homebrew-core/Formula/gnupg.rb
2016-08-13 16:21:05 +01:00

73 lines
2.3 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.20.tar.bz2"
mirror "https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.20.tar.bz2"
sha256 "04988b1030fa28ddf961ca8ff6f0f8984e0cddcb1eb02859d5d8fe0fe237edcc"
revision 2
bottle do
sha256 "9becdec079dcfbae99917b30cf676c772b28e91c1a3fe6ea129b4071b25a26d4" => :el_capitan
sha256 "a5a80017b1d7f37ee88cd2d16b7b004d286259b48336f2073330ea42f8d2cc61" => :yosemite
sha256 "6f5ed43c01c4dbbd3b8b5787da018d4b3f4a66e7d39cfb39719e124d228e5760" => :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
All commands have been installed with the suffix '1'.
If you really need to use these commands with their normal names, 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