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" revision 1 bottle do sha256 "2b0472114407f0b8d9e87addc5365593a003e87730538b7830a867d55d7656d9" => :mojave sha256 "fb1bdbc7295dbd7595cd0c15edbd8813428f319c79fa40dcd674c67a02972731" => :high_sierra sha256 "06c9fd498dddb5b88366e1d7cbd0624964d662705d520ddd7490db7ce8ac02f6" => :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