homebrew-core/Formula/gnupg.rb
2019-05-30 07:24:53 +08:00

66 lines
2 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.2.16.tar.bz2"
sha256 "6cbe8d454bf5dc204621eed3016d721b66298fa95363395bb8eeceb1d2fd14cb"
bottle do
sha256 "674772ba04716d9c3faa818cc30fb8b55810d6ce14f7663ec59c153215141141" => :mojave
sha256 "40d01ea1bf078644bbc69b31521ad2dcf563ec85d21f27e2e11d8a88478dc593" => :high_sierra
sha256 "331a1343e5069b204f0c10ae66afb1b5d294b5de9b0a0da79ad66c265e90b565" => :sierra
end
depends_on "pkg-config" => :build
depends_on "sqlite" => :build if MacOS.version == :mavericks
depends_on "adns"
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"
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