homebrew-core/Formula/gnutls.rb
2019-10-03 11:49:33 -04:00

74 lines
2.2 KiB
Ruby

class Gnutls < Formula
desc "GNU Transport Layer Security (TLS) Library"
homepage "https://gnutls.org/"
url "https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.10.tar.xz"
mirror "https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/gnutls/v3.6/gnutls-3.6.10.tar.xz"
sha256 "b1f3ca67673b05b746a961acf2243eaae0ffe658b6a6494265c648e7c7812293"
bottle do
sha256 "89d7940566541751bad9e2a553d8a739e2b39c905986e47bebab4a46c740f6e4" => :catalina
sha256 "28482998c647f8def5e6b0311dd80ea030ab6c49145f39cde573da49beed8b63" => :mojave
sha256 "cf5dd54bf707bb65e8782564fb4c11ea38c4d0c0750586d679f5e53c7f742128" => :high_sierra
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "pkg-config" => :build
depends_on "gmp"
depends_on "libidn2"
depends_on "libtasn1"
depends_on "libunistring"
depends_on "nettle"
depends_on "p11-kit"
depends_on "unbound"
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-guile
--disable-heartbeat-support
--with-p11-kit
]
# Work around a gnulib issue with macOS Catalina
args << "gl_cv_func_ftello_works=yes"
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