homebrew-core/Formula/gnupg.rb
2016-08-17 17:41:08 +01:00

77 lines
2.5 KiB
Ruby

class Gnupg < Formula
desc "GNU Pretty Good Privacy (PGP) package"
homepage "https://www.gnupg.org/"
url "https://gnupg.org/ftp/gcrypt/gnupg/gnupg-1.4.21.tar.bz2"
mirror "https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.21.tar.bz2"
sha256 "6b47a3100c857dcab3c60e6152e56a997f2c7862c1b8b2b25adf3884a1ae2276"
bottle do
sha256 "3f38d8eda8e95d2561d788e4a4823686d0bf7e0fe2a40d3a62150c68e121cf7c" => :el_capitan
sha256 "b78cbae927f7cb72c9af535d6477222a23fcf649436a221f7b4b4ab59400d471" => :yosemite
sha256 "c557e753568c5582e79249324261a0d695f91c032660dd2554d6e73953bac417" => :mavericks
end
depends_on "curl" if MacOS.version <= :mavericks
depends_on "libusb-compat" => :optional
def install
args = %W[
--disable-dependency-tracking
--disable-silent-rules
--prefix=#{prefix}
--disable-asm
--program-suffix=1
]
args << "--with-libusb=no" if build.without? "libusb-compat"
system "./configure", *args
system "make"
system "make", "check"
# we need to create these directories because the install target has the
# dependency order wrong
[bin, libexec/"gnupg"].each(&:mkpath)
system "make", "install"
# Although gpg2 support should be pretty universal these days
# keep vanilla `gpg` executables available, at least for now.
%w[gpg-zip1 gpg1 gpgsplit1 gpgv1].each do |cmd|
(libexec/"gpgbin").install_symlink bin/cmd => cmd.to_s.sub(/1/, "")
end
end
def caveats; <<-EOS.undent
This formula does not install either `gpg` or `gpgv` executables into
into the PATH.
If you simply require `gpg` and `gpgv` executables without explicitly
needing GnuPG 1.x we recommend:
brew install gnupg2
If you really need to use these tools without the "1" suffix you can
add a "gpgbin" directory to your PATH from your #{shell_profile} like:
PATH="#{opt_libexec}/gpgbin:$PATH"
Note that doing so may interfere with GPG-using formulae installed via
Homebrew.
EOS
end
test do
(testpath/"batchgpg").write <<-EOS.undent
Key-Type: RSA
Key-Length: 2048
Subkey-Type: RSA
Subkey-Length: 2048
Name-Real: Testing
Name-Email: testing@foo.bar
Expire-Date: 1d
%commit
EOS
system bin/"gpg1", "--batch", "--gen-key", "batchgpg"
(testpath/"test.txt").write "Hello World!"
system bin/"gpg1", "--armor", "--sign", "test.txt"
system bin/"gpg1", "--verify", "test.txt.asc"
end
end