111 lines
3.5 KiB
Ruby
111 lines
3.5 KiB
Ruby
class Gnupg < Formula
|
|
bottle do
|
|
root_url "https://homebrew.mirror.ygg/bottles"
|
|
sha256 cellar: "/opt/homebrew/Cellar", arm64_sequoia: "8583235dd83654392b878f06833405b8bac255fb5f96c942259b1efd206b0ae8"
|
|
sha256 cellar: "/opt/homebrew/Cellar", arm64_tahoe: "77a293d5ac76a99d7ca1fca4d57860bd76bb25b3c334b2504fc9b7fc145f1502"
|
|
sha256 cellar: "/home/linuxbrew/.linuxbrew/Cellar", x86_64_linux: "2dd827488b6c6b1927cf5be2eb70638e0e59ad34ba9db3e9aaaca866c4ed3c29"
|
|
end
|
|
desc "GNU Privacy Guard (OpenPGP)"
|
|
homepage "https://gnupg.org/"
|
|
url "https://gnupg.org/ftp/gcrypt/gnupg/gnupg-2.5.21.tar.bz2"
|
|
sha256 "e3af2c8caa46a66a9329fa7c6880af260451914d819595beabc2c26597b31352"
|
|
license "GPL-3.0-or-later"
|
|
compatibility_version 1
|
|
|
|
# GnuPG usually indicates stable releases with an even-numbered minor but
|
|
# can declare an odd-numbered minor stable. e.g. 2.5 was stable since 2.5.16,
|
|
# see https://lists.gnupg.org/pipermail/gnupg-announce/2025q4/000500.html.
|
|
# The livecheck scrapes the version from the templated homepage which is
|
|
# manually updated by upstream when a new release series is stable, e.g.
|
|
# https://dev.gnupg.org/rD18a889b403c7a5934d5080be140a4d79e1c83332
|
|
livecheck do
|
|
url :homepage
|
|
regex(/The current version of GnuPG is v?(\d+(?:\.\d+)+)\. /i)
|
|
end
|
|
|
|
|
|
|
|
depends_on "pkgconf" => :build
|
|
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"
|
|
depends_on "readline"
|
|
|
|
uses_from_macos "bzip2"
|
|
uses_from_macos "openldap"
|
|
uses_from_macos "sqlite"
|
|
|
|
on_macos do
|
|
depends_on "gettext"
|
|
end
|
|
|
|
on_linux do
|
|
depends_on "zlib-ng-compat"
|
|
end
|
|
|
|
conflicts_with cask: "gpg-suite"
|
|
conflicts_with cask: "gpg-suite-no-mail"
|
|
conflicts_with cask: "gpg-suite-pinentry"
|
|
conflicts_with cask: "gpg-suite@nightly"
|
|
|
|
def install
|
|
libusb = Formula["libusb"]
|
|
ENV.append "CPPFLAGS", "-I#{libusb.opt_include}/libusb-#{libusb.version.major_minor}"
|
|
|
|
mkdir "build" do
|
|
system "../configure", "--disable-silent-rules",
|
|
"--enable-all-tests",
|
|
"--sysconfdir=#{etc}",
|
|
"--with-pinentry-pgm=#{formula_opt_bin("pinentry")}/pinentry",
|
|
"--with-readline=#{formula_opt_prefix("readline")}",
|
|
*std_configure_args
|
|
system "make"
|
|
system "make", "check"
|
|
system "make", "install"
|
|
end
|
|
|
|
# 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 <<~CONF
|
|
disable-ccid
|
|
CONF
|
|
pkgetc.install "scdaemon.conf"
|
|
end
|
|
end
|
|
|
|
post_install_steps do
|
|
mkdir_p "run", base: :var
|
|
terminate_process "gpg-agent", must_succeed: false
|
|
end
|
|
|
|
test do
|
|
(testpath/"batch.gpg").write <<~GPG
|
|
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
|
|
GPG
|
|
|
|
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
|