# -*- 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 101431 2013-01-10 23:39:02Z blair@macports.org $

PortSystem  1.0

name            gnupg
version         1.4.13
revision        1
categories      mail security
license         GPL-3+
installs_libs   no
maintainers     nomaintainer
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     c74249db5803f76f17fee9a201c0189f \
                                                sha1    17a75c54d292bd0923f0a1817a1b02ded37d1de1 \
                                                rmd160  a3d6f2ca2dd46d8b97e1790d0b1738dc4a1cedd6

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} \
                --with-libcurl=${prefix}

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

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+)
