homebrew-core/Formula/gnupg@2.2.rb

80 lines
2.3 KiB
Ruby

class GnupgAT22 < Formula
desc "GNU Pretty Good Privacy (PGP) package"
homepage "https://gnupg.org/"
url "https://gnupg.org/ftp/gcrypt/gnupg/gnupg-2.2.27.tar.bz2"
sha256 "34e60009014ea16402069136e0a5f63d9b65f90096244975db5cea74b3d02399"
license "GPL-3.0-or-later"
livecheck do
url "https://gnupg.org/ftp/gcrypt/gnupg/"
regex(/href=.*?gnupg[._-]v?(2\.2(?:\.\d+)+)\.t/i)
end
bottle do
sha256 arm64_big_sur: "6e52afe96b7c4acf7e83ffcc3904c62b5dee9948f6e18a664285e9b6ed24804f"
sha256 big_sur: "9885e75474b25f2a7d2d1f66fb0ab305c98a8daa3848e41473f60a2f2ff34d3d"
sha256 catalina: "aa2c9d472c019a2ad71a94cbc17753ec051685ace6a7d386fd76efa30c97ada0"
sha256 mojave: "42ef4c3b4758a11c1dbfea5fe5bf47ba150b30f19468ba67882d5ccaf786a5ef"
end
keg_only :versioned_formula
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" => :build
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",
"--enable-symcryptrun",
"--with-pinentry-pgm=#{Formula["pinentry"].opt_bin}/pinentry"
system "make"
system "make", "check"
system "make", "install"
end
def post_install
(var/"run").mkpath
quiet_system "killall", "gpg-agent"
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