aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/gnupg.rb
blob: 9acc88997e55368b57d743a5d96a6af2a55a2067 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
require 'formula'

class GnupgIdea < Formula
  head 'http://www.gnupg.dk/contrib-dk/idea.c.gz', :using  => :nounzip
  md5 '9dc3bc086824a8c7a331f35e09a3e57f'
end

class Gnupg < Formula
  homepage 'http://www.gnupg.org/'
  url 'ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.12.tar.bz2'
  sha1 '9b78e20328d35525af7b8a9c1cf081396910e937'

  option 'idea', 'Build with the patented IDEA cipher'
  option '8192', 'Build with support for private keys of up to 8192 bits'

  def install
    if ENV.compiler == :clang
      ENV.append 'CFLAGS', '-std=gnu89'
      ENV.append 'CFLAGS', '-fheinous-gnu-extensions'
    end

    if build.include? 'idea'
      GnupgIdea.new.brew { (buildpath/'cipher').install Dir['*'] }
      system 'gunzip', 'cipher/idea.c.gz'
    end

    inreplace 'g10/keygen.c', 'max=4096', 'max=8192' if build.include? '8192'

    system "./configure", "--disable-dependency-tracking",
                          "--prefix=#{prefix}",
                          "--disable-asm"
    system "make"
    system "make check"

    # we need to create these directories because the install target has the
    # dependency order wrong
    bin.mkpath
    (libexec+'gnupg').mkpath
    system "make install"
  end

  def caveats
    if build.include? 'idea' then <<-EOS.undent
      This build of GnuPG contains support for the patented IDEA cipher.
      Please read http://www.gnupg.org/faq/why-not-idea.en.html before using
      this software.

      You will then need to add the following line to your ~/.gnupg/gpg.conf or
        ~/.gnupg/options file:
          load-extension idea
      EOS
    end
  end
end