# -*- 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 89605 2012-02-03 22:53:05Z cal@macports.org $

PortSystem          1.0

name                signing-party
version             1.1.4
categories          mail security
maintainers         cal openmaintainer
platforms           darwin
description         Various OpenPGP related tools
long_description    signing-party is a collection for all kinds of PGP/GnuPG \
                    related things, including signing scripts, party \
                    preparation scripts, etc.

homepage            http://pgp-tools.alioth.debian.org/
license             BSD GPL-2 GPL-2+
master_sites        debian:s/signing-party/
distname            ${name}_${version}
worksrcdir          ${name}-${version}
extract.suffix      .orig.tar.gz
checksums           md5     675f8f1edd01baa8b58a743927d13750 \
                    sha1    092b7d644b7a8a8d2e82fd6ddb453ca58020ed31 \
                    rmd160  fb7024f00b2c9f192004a8fa649d6122551f2471

patchfiles          gpgwrap-makefile-usingtherightcompiler.patch \
                    keyanalyze-makefile-usingtherightcompiler.patch

use_configure       no

depends_lib         port:perl5.12 \
                    port:p5.12-class-methodmaker \
                    port:p5.12-mailtools \
                    port:p5.12-term-readkey \
                    port:p5.12-gnupg-interface \
                    port:p5.12-text-iconv \
                    port:p5.12-text-template \
                    port:p5.12-mime-tools \
                    port:qprint
depends_run         bin:gpg:gnupg \
                    port:dialog

variant universal   {}

build.env-append    CC=${configure.cc} \
                    CFLAGS="${configure.cflags} [get_canonical_archflags]"

pre-build {
    reinplace "s|/usr/bin/perl|${prefix}/bin/perl5.12|" \
        ${worksrcpath}/caff/caff \
        ${worksrcpath}/caff/pgp-clean \
        ${worksrcpath}/caff/pgp-fixkey \
        ${worksrcpath}/gpg-key2ps/gpg-key2ps \
        ${worksrcpath}/gpgdir/bump_version.pl \
        ${worksrcpath}/gpgdir/gpgdir \
        ${worksrcpath}/gpgdir/install.pl \
        ${worksrcpath}/gpglist/gpglist \
        ${worksrcpath}/gpgsigs/gpgsigs \
        ${worksrcpath}/keylookup/keylookup \
        ${worksrcpath}/sig2dot/sig2dot \
        ${worksrcpath}/springgraph/springgraph
}

platform macosx {
    post-patch {
        reinplace "s!getent.*$!dscl . -read /Users/\$USER \| awk \'\{print \$2\}\'\`!" ${worksrcpath}/gpg-mailkeys/gpg-mailkeys
    }
}

destroot {
        # install executables
        xinstall -m 0755 \
            ${worksrcpath}/caff/caff \
            ${worksrcpath}/caff/pgp-clean \
            ${worksrcpath}/caff/pgp-fixkey \
            ${worksrcpath}/gpg-key2ps/gpg-key2ps \
            ${worksrcpath}/gpg-mailkeys/gpg-mailkeys \
            ${worksrcpath}/gpglist/gpglist \
            ${worksrcpath}/gpgparticipants/gpgparticipants \
            ${worksrcpath}/gpgsigs/gpgsigs \
            ${worksrcpath}/gpgwrap/bin/gpgwrap \
            ${worksrcpath}/keyanalyze/keyanalyze \
            ${worksrcpath}/keyanalyze/process_keys \
            ${worksrcpath}/keylookup/keylookup \
            ${worksrcpath}/sig2dot/sig2dot \
            ${worksrcpath}/springgraph/springgraph \
            ${destroot}${prefix}/bin
        # install manpages
        xinstall -m 0644 \
            ${worksrcpath}/caff/caff.1 \
            ${worksrcpath}/caff/pgp-clean.1 \
            ${worksrcpath}/caff/pgp-fixkey.1 \
            ${worksrcpath}/gpg-key2ps/gpg-key2ps.1 \
            ${worksrcpath}/gpg-mailkeys/gpg-mailkeys.1 \
            ${worksrcpath}/gpglist/gpglist.1 \
            ${worksrcpath}/gpgparticipants/gpgparticipants.1 \
            ${worksrcpath}/gpgwrap/doc/gpgwrap.1 \
            ${worksrcpath}/sig2dot/sig2dot.1 \
            ${worksrcpath}/springgraph/springgraph.1 \
            ${worksrcpath}/gpgsigs/gpgsigs.1 \
            ${worksrcpath}/keyanalyze/keyanalyze.1 \
            ${worksrcpath}/keylookup/keylookup.1 \
            ${destroot}${prefix}/share/man/man1
        # install example configurations in share/doc
        xinstall -d \
            ${destroot}${prefix}/share/doc/signing-party
        xinstall -m 0644 \
            ${worksrcpath}/caff/caffrc.sample \
            ${worksrcpath}/gpg-mailkeys/example.gpg-mailkeysrc \
            ${worksrcpath}/gpgsigs/gpgsigs-eps-helper \
            ${destroot}${prefix}/share/doc/signing-party
}

notes               "Some example configuration files have been installed to ${prefix}/share/doc/signing-party."

livecheck.type      regex
livecheck.url       http://packages.debian.org/unstable/misc/${name}
livecheck.regex     ${name} .(\[0-9.\]+)

