# $Id: Portfile 87715 2011-12-02 07:31:05Z ryandesign@macports.org $

PortSystem 1.0

name                    gnupg12
version                 1.2.8
platforms               darwin linux
categories              mail
description             GNU Privacy Guard
long_description        GnuPG is a complete and free replacement for PGP. \
                        Because it does not use the patented IDEA algorithm, \
                        it can be used without any restrictions. GnuPG is a \
                        RFC2440 (OpenPGP) compliant application. PGP, on which \
                        OpenPGP is based, was originally developed by Philip \
                        Zimmermann in the early 1990s.
homepage                http://www.gnupg.org/
maintainers             freeshell.org:dms
master_sites            gnupg:gnupg:gnupg
distname                gnupg-${version}
use_bzip2               yes
distfiles               [suffix ${distname}]:gnupg
checksums               [suffix ${distname}] \
                        rmd160  eff26780bcf78a83931cee79a4e7e91e435f958e \
                        sha256  1151674ea2c14e9c1160a89fdf0d9433125738073e9324216af1a9c7aa4d7139

post-patch              { reinplace s/PACKAGE='gnupg/&12/ \
                            ${worksrcpath}/configure
                          file rename ${worksrcpath}/po/gnupg.pot \
                            ${worksrcpath}/po/gnupg12.pot }

configure.args          --infodir=${prefix}/share/info \
                        --mandir=${prefix}/share/man \
                        --program-transform-name='s/pg/&12/' \
                        --enable-static-rnd=linux \
                        --with-libiconv-prefix=${prefix} \
                        --with-libintl-prefix=${prefix} \
                        --with-zlib=${prefix} \
                        --with-bzip2=${prefix}

depends_lib             port:libiconv \
                        port:gettext \
                        port:zlib \
                        port:bzip2

test.run                yes
test.dir                ${worksrcpath}/checks
test.target             check
post-destroot           { file rename ${destroot}${prefix}/share/info/gpg.info \
                            ${destroot}${prefix}/share/info/gpg12.info
                          file rename \
                            ${destroot}${prefix}/share/info/gpgv.info \
                            ${destroot}${prefix}/share/info/gpg12v.info
                          file delete ${destroot}${prefix}/lib/charset.alias \
                            ${destroot}${prefix}/share/locale/locale.alias }

variant tiger {
  configure.args-append --enable-tiger
}
variant newtiger {
  configure.args-append --enable-new-tiger
}
variant sha512 {
  configure.args-append --enable-sha512
}
variant memoryguard {
  configure.args-append --enable-m-guard
}
variant idea {
  master_sites-append   http://www.gnupg.dk/contrib-dk/:idea
  distfiles-append      idea.c.gz:idea
  checksums-append      idea.c.gz md5  9dc3bc086824a8c7a331f35e09a3e57f \
                                  sha1 82fded4ec31b97b3b2dd22741880b67cfee40f84
  extract.only          [suffix ${distname}]
  post-extract          { system "gzip -cd ${distpath}/idea.c.gz \
                            > ${worksrcpath}/cipher/idea.c" }
}

livecheck.type  regex
livecheck.url   ftp://ftp.gnupg.org/gcrypt/gnupg/
livecheck.regex gnupg-(1\\.2\\.\\d+)
