class Gnupg < Formula desc "GNU Pretty Good Privacy (PGP) package" homepage "https://gnupg.org/" url "https://gnupg.org/ftp/gcrypt/gnupg/gnupg-2.2.15.tar.bz2" sha256 "cb8ce298d7b36558ffc48aec961b14c830ff1783eef7a623411188b5e0f5d454" bottle do sha256 "db012902d3a8dd1ea7a0413d5711919ffe8da8bfd9a458f87798462aac13057b" => :mojave sha256 "434bb3b7cf04153a373476cb6d4c40cd5ce81514202a16b0d5cb79327add4d4c" => :high_sierra sha256 "0732d982db2cf0c7d11695a7d6241a46e96e255d076f3e0d8280971cb1f3c6c0" => :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