homebrew-core/Formula/gnupg.rb

88 lines
2.6 KiB
Ruby

class Gnupg < Formula
desc "GNU Pretty Good Privacy (PGP) package"
homepage "https://gnupg.org/"
url "https://gnupg.org/ftp/gcrypt/gnupg/gnupg-2.3.2.tar.bz2"
sha256 "e1d953e0e296072fca284215103ef168885eaac596c4660c5039a36a83e3041b"
license "GPL-3.0-or-later"
livecheck do
url "https://gnupg.org/ftp/gcrypt/gnupg/"
regex(/href=.*?gnupg[._-]v?(\d+(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_big_sur: "941069d6ef19f59b24dfe2f8851fea635f679eb740a595ff0a74ac007181bc99"
sha256 big_sur: "ca228c2800845d8d0e020c3e3359201edc0bac8554cfc3a2e985617eb09b629a"
sha256 catalina: "9d0e847588e735e9f1137b7ccfa73a9439a8653a6949d284e3192e6fb2fdf5a5"
sha256 mojave: "a483dd421a3156007c163969705a617676c78e2780ed7bf9279cbcefc903b904"
sha256 x86_64_linux: "cb12c6aab9f508b977047bf4053047b3f48d010988760c53d4c728d78ba7dae9"
end
depends_on "pkg-config" => :build
depends_on "gettext"
depends_on "gnutls"
depends_on "libassuan"
depends_on "libgcrypt"
depends_on "libgpg-error"
depends_on "libksba"
depends_on "libusb"
depends_on "npth"
depends_on "pinentry"
uses_from_macos "sqlite", since: :catalina
on_linux do
depends_on "libidn"
end
def install
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}",
"--sbindir=#{bin}",
"--sysconfdir=#{etc}",
"--enable-all-tests",
"--with-pinentry-pgm=#{Formula["pinentry"].opt_bin}/pinentry"
system "make"
system "make", "check"
system "make", "install"
# Configure scdaemon as recommended by upstream developers
# https://dev.gnupg.org/T5415#145864
if OS.mac?
# write to buildpath then install to ensure existing files are not clobbered
(buildpath/"scdaemon.conf").write <<~EOS
disable-ccid
EOS
pkgetc.install "scdaemon.conf"
end
end
def post_install
(var/"run").mkpath
quiet_system "gpgconf", "--reload", "all"
end
test do
(testpath/"batch.gpg").write <<~EOS
Key-Type: RSA
Key-Length: 2048
Subkey-Type: RSA
Subkey-Length: 2048
Name-Real: Testing
Name-Email: testing@foo.bar
Expire-Date: 1d
%no-protection
%commit
EOS
begin
system bin/"gpg", "--batch", "--gen-key", "batch.gpg"
(testpath/"test.txt").write "Hello World!"
system bin/"gpg", "--detach-sign", "test.txt"
system bin/"gpg", "--verify", "test.txt.sig"
ensure
system bin/"gpgconf", "--kill", "gpg-agent"
end
end
end