80 lines
2.3 KiB
Ruby
80 lines
2.3 KiB
Ruby
class Gnutls < Formula
|
|
desc "GNU Transport Layer Security (TLS) Library"
|
|
homepage "https://gnutls.org/"
|
|
url "ftp://ftp.gnutls.org/gcrypt/gnutls/v3.4/gnutls-3.4.13.tar.xz"
|
|
mirror "https://gnupg.org/ftp/gcrypt/gnutls/v3.4/gnutls-3.4.13.tar.xz"
|
|
mirror "https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/gnutls/v3.4/gnutls-3.4.13.tar.xz"
|
|
sha256 "fd3386e8e72725980bcd7f40949aa0121dcb7650b5147c6490e794555ed25859"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "bf41a79072514cb69400657934c241e98cedb61e0d015640186eb438c595f379" => :el_capitan
|
|
sha256 "c6896ebde30bb2edacf4401a0343bcaf5425a3f8bd80bfa67438d2fd0138438e" => :yosemite
|
|
sha256 "acd746a9b14c1deeec2625f4f24b48bb22fea17b73593e518d4b3449420dc5a9" => :mavericks
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "libtasn1"
|
|
depends_on "gmp"
|
|
depends_on "nettle"
|
|
depends_on "guile" => :optional
|
|
depends_on "unbound" => :optional
|
|
|
|
fails_with :llvm do
|
|
build 2326
|
|
cause "Undefined symbols when linking"
|
|
end
|
|
|
|
def install
|
|
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
|
|
--without-p11-kit
|
|
]
|
|
|
|
if build.with? "guile"
|
|
args << "--enable-guile"
|
|
args << "--with-guile-site-dir=no"
|
|
end
|
|
|
|
system "./configure", *args
|
|
system "make", "install"
|
|
|
|
# certtool shadows the OS X 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
|
|
|
|
$?.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
|