92 lines
2.9 KiB
Ruby
92 lines
2.9 KiB
Ruby
class Gnutls < Formula
|
|
desc "GNU Transport Layer Security (TLS) Library"
|
|
homepage "https://gnutls.org/"
|
|
url "https://gnupg.org/ftp/gcrypt/gnutls/v3.5/gnutls-3.5.15.tar.xz"
|
|
mirror "https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/gnutls/v3.5/gnutls-3.5.15.tar.xz"
|
|
sha256 "046081108b8b1fe455a13a4c5a4eaa0368e185b678f1670fe09a11a2d7ecfad5"
|
|
|
|
bottle do
|
|
sha256 "336d9723533f59a925181d1d78ac9ab1b7843677131f31cf47b06af8635740bb" => :high_sierra
|
|
sha256 "80b734325c3829c83067eee6d97adefb06480588be402e4e9f73109ea66f9d2e" => :sierra
|
|
sha256 "6a700e60e886a36fd4f1a10dab6dd0a400677a7ff2f42b967974cf262e28d0a7" => :el_capitan
|
|
sha256 "4a1b43d75b7a0d13ad5ab35429453bd31585170de79f9d9c945841382506d6d7" => :yosemite
|
|
end
|
|
|
|
devel do
|
|
url "https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.0.tar.xz"
|
|
mirror "https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/gnutls/v3.6/gnutls-3.6.0.tar.xz"
|
|
sha256 "2ab9e3c0131fcd9142382f37ba9c6d20022b76cba83560cbcaa8e4002d71fb72"
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "libtasn1"
|
|
depends_on "gmp"
|
|
depends_on "nettle"
|
|
depends_on "libunistring"
|
|
depends_on "p11-kit" => :recommended
|
|
depends_on "guile" => :optional
|
|
depends_on "unbound" => :optional
|
|
|
|
def install
|
|
# Fix "dyld: lazy symbol binding failed: Symbol not found: _getentropy"
|
|
# Reported 18 Oct 2016 https://gitlab.com/gnutls/gnutls/issues/142
|
|
if MacOS.version == "10.11" && MacOS::Xcode.installed? && MacOS::Xcode.version >= "8.0"
|
|
inreplace "configure", "getentropy(0, 0);", "undefinedgibberish(0, 0);"
|
|
end
|
|
|
|
args = %W[
|
|
--disable-dependency-tracking
|
|
--disable-silent-rules
|
|
--disable-static
|
|
--prefix=#{prefix}
|
|
--sysconfdir=#{etc}
|
|
--with-default-trust-store-file=#{etc}/openssl/cert.pem
|
|
--disable-heartbeat-support
|
|
]
|
|
|
|
if build.with? "p11-kit"
|
|
args << "--with-p11-kit"
|
|
else
|
|
args << "--without-p11-kit"
|
|
end
|
|
|
|
if build.with? "guile"
|
|
args << "--enable-guile" << "--with-guile-site-dir"
|
|
else
|
|
args << "--disable-guile"
|
|
end
|
|
|
|
system "./configure", *args
|
|
system "make", "install"
|
|
|
|
# certtool shadows the macOS certtool utility
|
|
mv bin/"certtool", bin/"gnutls-certtool"
|
|
mv man1/"certtool.1", man1/"gnutls-certtool.1"
|
|
end
|
|
|
|
def post_install
|
|
keychains = %w[
|
|
/System/Library/Keychains/SystemRootCertificates.keychain
|
|
]
|
|
|
|
certs_list = `security find-certificate -a -p #{keychains.join(" ")}`
|
|
certs = certs_list.scan(/-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----/m)
|
|
|
|
valid_certs = certs.select do |cert|
|
|
IO.popen("openssl x509 -inform pem -checkend 0 -noout", "w") do |openssl_io|
|
|
openssl_io.write(cert)
|
|
openssl_io.close_write
|
|
end
|
|
|
|
$CHILD_STATUS.success?
|
|
end
|
|
|
|
openssldir = etc/"openssl"
|
|
openssldir.mkpath
|
|
(openssldir/"cert.pem").atomic_write(valid_certs.join("\n"))
|
|
end
|
|
|
|
test do
|
|
system bin/"gnutls-cli", "--version"
|
|
end
|
|
end
|