# GnuTLS has previous, current, and next stable branches, we use current. # From 3.4.0 GnuTLS will be permanently disabling SSLv3. Every brew uses will need a revision with that. # http://nmav.gnutls.org/2014/10/what-about-poodle.html class Gnutls < Formula desc "GNU Transport Layer Security (TLS) Library" homepage "http://gnutls.org" url "ftp://ftp.gnutls.org/gcrypt/gnutls/v3.3/gnutls-3.3.17.1.tar.xz" mirror "https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/gnutls/v3.3/gnutls-3.3.17.1.tar.xz" sha256 "b40f158030a92f450a07b20300a3996710ca19800848d9f6fd62493170c5bbb4" bottle do cellar :any sha256 "4cdb3be227283ce8f939f5b36b952d85af26150986c465c980c9df4356b1e3f4" => :yosemite sha256 "163f2ba093399402f690d722d49023109360f9a8f0412d3d50ba7385988cc248" => :mavericks sha256 "c45005f683e63962edd3c5caf71834d3c82647167653b5f9dc617dbf97fab624" => :mountain_lion end depends_on "pkg-config" => :build depends_on "libtasn1" depends_on "gmp" depends_on "nettle" depends_on "guile" => :optional depends_on "p11-kit" => :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 ] 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[ /Library/Keychains/System.keychain /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