# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 92275 2012-04-23 18:28:58Z ryandesign@macports.org $

PortSystem  1.0

name            gnupg
version         1.4.12
categories      mail security
license         GPL-3+
installs_libs   no
maintainers     waqar openmaintainer
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
master_sites    gnupg

use_bzip2       yes
checksums       ${distname}${extract.suffix}    md5     ce3742e5c7912559cab7894ad8ba7f6b \
                                                sha1    9b78e20328d35525af7b8a9c1cf081396910e937 \
                                                rmd160  d5f4367c9a636d778b6ccb2711bfba6597c27fa0

configure.args  --mandir=${prefix}/share/man \
                --infodir=${prefix}/share/info \
                --disable-asm \
                --with-libiconv-prefix=${prefix} \
                --with-libintl-prefix=${prefix} \
                --with-zlib=${prefix} \
                --with-bzip2=${prefix} \
                --with-libusb=${prefix} \
                --with-ldap=${prefix}

depends_lib     port:libiconv \
                port:gettext \
                port:readline \
                port:zlib \
                port:bzip2 \
                port:libusb-compat \
                port:openldap

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

# clang defaults to c99, and gnupg doesn't play nicely
if {${configure.compiler} == "clang"} {
    configure.cflags-append -std=gnu89
}

variant idea description {Add support for the patented IDEA algorithm} {
    patch_sites-append  http://www.gnupg.dk/contrib-dk
    patchfiles          idea.c.gz
    checksums-append \
        idea.c.gz md5    9dc3bc086824a8c7a331f35e09a3e57f \
                  sha1   82fded4ec31b97b3b2dd22741880b67cfee40f84 \
                  rmd160 e35be5a031d10d52341ac5f029d28f811edd908d
    patch.dir           ${worksrcpath}/cipher
    patch.cmd           cat
    patch.pre_args      > idea.c
}

platform sunos {
    configure.args-delete --disable-asm
}

livecheck.type  regex
livecheck.url   ftp://ftp.gnupg.org/GnuPG/${name}/
livecheck.regex ${name}-(1\\.\\d+\\.\\d+)
