92 lines
2.8 KiB
Ruby
92 lines
2.8 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.6.tar.bz2"
|
|
sha256 "21f7fe2fc5c2f214184ab050977ec7a8e304e58bfae2ab098fec69f8fabda9c1"
|
|
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_monterey: "d961dff294b7bfd45a14f8f6f8d92de6acd5c384f6c04e5db445c9b4698d1aa5"
|
|
sha256 arm64_big_sur: "2ac2e09be47bca4d64ffb243c3cc37dec0824315ba04627e2d183b2bafaf8855"
|
|
sha256 monterey: "fc2af0aa23bcf8f7a9c5d4685f3744e6ed4f115a0d4fde0669285389ff7b679c"
|
|
sha256 big_sur: "a80cd7d926b0b82a15fb956f1e2fc137fb024f318807d666dd64133538b2f977"
|
|
sha256 catalina: "429ee6d3cc907fe696d8b5a6d3ba831d8e840ef2381f5d433b21e6d462276f2f"
|
|
sha256 x86_64_linux: "b501ef3afcfbeb8626d438446609d5c65f8d36749cda7f6c04d183e0017fa822"
|
|
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
|
|
libusb = Formula["libusb"]
|
|
ENV.append "CPPFLAGS", "-I#{libusb.opt_include}/libusb-#{libusb.version.major_minor}"
|
|
|
|
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 "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
|