# $Id: Portfile 54266 2009-07-24 03:40:14Z toby@macports.org $

PortSystem      1.0

name            gnupg2
version         2.0.12
revision        1
categories      mail security
maintainers     waqar boeyms
description     GNU pretty-good-privacy package
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.
homepage        http://www.gnupg.org
platforms       darwin freebsd sunos
use_bzip2   yes
distname    gnupg-${version}
master_sites    gnupg:gnupg

use_bzip2       yes
checksums   md5     4718d8a8cd3eac100951d8b162cf537b \
            sha1    91856f917c13a1a12622ef39995eaf59c46f7502 \
            rmd160  17edbd6bac5210933ef0cc2ce70820d38ce970ef

post-patch {
    reinplace "s|/var|${prefix}/var|" \
        ${worksrcpath}/sm/call-dirmngr.c
}

# gpg-agent is built separately from the rest of gnupg2 to enable gnupg 1.x
# users to use gpg-agent as well.  gnupg2, however, requires gpg-agent to run,
# and so gnupg2 depends on gpg-agent.

configure.args  --disable-agent

depends_lib     port:libiconv           \
                port:gettext            \
                port:zlib               \
                port:bzip2              \
                port:bison              \
                port:gpg-agent          \
                port:libassuan          \
                port:libksba            \
                port:libgcrypt          \
                port:libgpg-error       \
                port:pth                \
                port:libusb-compat

patchfiles      patch-configure.diff

test.run        yes
test.dir        ${worksrcpath}/tests
test.target     check

platform darwin {
        configure.env-append    MACOSX_DEPLOYMENT_TARGET=10.3
        build.env-append        MACOSX_DEPLOYMENT_TARGET=10.3
}

platform darwin 7 {
        configure.ldflags-append        "-framework IOKit"
}

# See also the post-patch above.
# Apparently we have no way of forcing gnupg2 to build without DirMngr support,
# so we have to just hope we don't run into any problems.
variant dirmngr description {Enable the use of DirMngr by gpgsm} {
        depends_lib-append  port:dirmngr
}

livecheck.check regex
livecheck.url   http://mirrors.rootmode.com/ftp.gnupg.org/gnupg/?O=D
livecheck.regex gnupg-(\\d+\\.\\d+\\.\\d+)
