homebrew-core/Formula/curl.rb
2019-01-17 15:24:28 +08:00

81 lines
2.8 KiB
Ruby

class Curl < Formula
desc "Get a file from an HTTP, HTTPS or FTP server"
homepage "https://curl.haxx.se/"
url "https://curl.haxx.se/download/curl-7.63.0.tar.bz2"
mirror "http://curl.mirror.anstey.ca/curl-7.63.0.tar.bz2"
sha256 "9bab7ed4ecff77020a312d84cc5fb7eb02d58419d218f267477a724a17fd8dd8"
bottle do
cellar :any
rebuild 1
sha256 "1adf29db170609663c8579d04c8993cfbd86e90d5fdb75430143fd262de3247d" => :mojave
sha256 "9ac454c6e3cada54d75285a7285b6157e0e3f943488e6fc43d992dd22edc4fb1" => :high_sierra
sha256 "511bc0c21227330895bc0c2f18e6bfbf75d8aeb07b78d4daeb4a48cfb9d088a2" => :sierra
end
head do
url "https://github.com/curl/curl.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
keg_only :provided_by_macos
# HTTP/2 support requires OpenSSL 1.0.2+ or LibreSSL 2.1.3+ for ALPN Support
# which is currently not supported by Secure Transport (DarwinSSL).
if MacOS.version < :mountain_lion
depends_on "openssl"
else
option "with-openssl", "Build with OpenSSL instead of Secure Transport"
depends_on "openssl" => :optional
end
depends_on "pkg-config" => :build
def install
system "./buildconf" if build.head?
# Allow to build on Lion, lowering from the upstream setting of 10.8
ENV.append_to_cflags "-mmacosx-version-min=10.7" if MacOS.version <= :lion
args = %W[
--disable-debug
--disable-dependency-tracking
--disable-silent-rules
--prefix=#{prefix}
]
# cURL has a new firm desire to find ssl with PKG_CONFIG_PATH instead of using
# "--with-ssl" any more. "when possible, set the PKG_CONFIG_PATH environment
# variable instead of using this option". Multi-SSL choice breaks w/o using it.
if MacOS.version < :mountain_lion || build.with?("openssl")
ENV.prepend_path "PKG_CONFIG_PATH", "#{Formula["openssl"].opt_lib}/pkgconfig"
args << "--with-ssl=#{Formula["openssl"].opt_prefix}"
args << "--with-ca-bundle=#{etc}/openssl/cert.pem"
args << "--with-ca-path=#{etc}/openssl/certs"
else
args << "--with-darwinssl"
args << "--without-ca-bundle"
args << "--without-ca-path"
end
system "./configure", *args
system "make", "install"
system "make", "install", "-C", "scripts"
libexec.install "lib/mk-ca-bundle.pl"
end
test do
# Fetch the curl tarball and see that the checksum matches.
# This requires a network connection, but so does Homebrew in general.
filename = (testpath/"test.tar.gz")
system "#{bin}/curl", "-L", stable.url, "-o", filename
filename.verify_checksum stable.checksum
system libexec/"mk-ca-bundle.pl", "test.pem"
assert_predicate testpath/"test.pem", :exist?
assert_predicate testpath/"certdata.txt", :exist?
end
end