homebrew-core/Formula/gnutls.rb

96 lines
3.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.7/gnutls-3.7.8.tar.xz"
mirror "https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/gnutls/v3.7/gnutls-3.7.8.tar.xz"
sha256 "c58ad39af0670efe6a8aee5e3a8b2331a1200418b64b7c51977fb396d4617114"
license all_of: ["LGPL-2.1-or-later", "GPL-3.0-only"]
revision 1
livecheck do
url "https://www.gnutls.org/news.html"
regex(/>\s*GnuTLS\s*v?(\d+(?:\.\d+)+)\s*</i)
end
bottle do
sha256 arm64_ventura: "426984f462990e271967d344024ddd6cf5fd1a05c31f8e107f957d001f96cf33"
sha256 arm64_monterey: "8b3e1d40d8e47e87210227552d007cc49e9f1b8a7880c830f623bdbd0491a35e"
sha256 arm64_big_sur: "a80a61fca20831652d166b614a4ec8fa6ba98d37d46c116a1bb1aa00c5b7dbce"
sha256 ventura: "53d488f2329fccccab5a1184c116f2bdeff137cfd3c400ebb02ea6c5b9d12e25"
sha256 monterey: "655e8c46cd3d815b74975797cfc8fcee75b47bafdf437f981788203bc271b2c8"
sha256 big_sur: "8bfc8baea81e2bfdfd823beec39f4d1eed709b1becb1debb793850d323a2d66e"
sha256 x86_64_linux: "9fd1beca90332d31e86d5e36f4a19a522b632f4931d075c9af516d7ac81d4485"
end
depends_on "pkg-config" => :build
depends_on "ca-certificates"
depends_on "gmp"
depends_on "guile"
depends_on "libidn2"
depends_on "libtasn1"
depends_on "libunistring"
depends_on "nettle"
depends_on "p11-kit"
depends_on "unbound"
uses_from_macos "zlib"
def install
args = %W[
--disable-dependency-tracking
--disable-silent-rules
--disable-static
--prefix=#{prefix}
--sysconfdir=#{etc}
--with-default-trust-store-file=#{pkgetc}/cert.pem
--with-guile-site-dir=#{share}/guile/site/3.0
--with-guile-site-ccache-dir=#{lib}/guile/3.0/site-ccache
--with-guile-extension-dir=#{lib}/guile/3.0/extensions
--disable-heartbeat-support
--with-p11-kit
]
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
rm_f pkgetc/"cert.pem"
pkgetc.install_symlink Formula["ca-certificates"].pkgetc/"cert.pem"
# Touch gnutls.go to avoid Guile recompilation.
# See https://github.com/Homebrew/homebrew-core/pull/60307#discussion_r478917491
touch lib/"guile/3.0/site-ccache/gnutls.go"
end
def caveats
<<~EOS
If you are going to use the Guile bindings you will need to add the following
to your .bashrc or equivalent in order for Guile to find the TLS certificates
database:
export GUILE_TLS_CERTIFICATE_DIRECTORY=#{pkgetc}/
EOS
end
test do
system bin/"gnutls-cli", "--version"
gnutls = testpath/"gnutls.scm"
gnutls.write <<~EOS
(use-modules (gnutls))
(gnutls-version)
EOS
ENV["GUILE_AUTO_COMPILE"] = "0"
ENV["GUILE_LOAD_PATH"] = HOMEBREW_PREFIX/"share/guile/site/3.0"
ENV["GUILE_LOAD_COMPILED_PATH"] = HOMEBREW_PREFIX/"lib/guile/3.0/site-ccache"
ENV["GUILE_SYSTEM_EXTENSIONS_PATH"] = HOMEBREW_PREFIX/"lib/guile/3.0/extensions"
system "guile", gnutls
end
end