# -*- 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 120171 2014-05-18 12:37:30Z cal@macports.org $

PortSystem          1.0

name                signing-party
version             1.1.7
checksums           rmd160  2608c87010a273cce9cc52f217c4f6e362c33c64 \
                    sha256  5e183d840a5cd76269ca14772ee4039ef4b162bff00636f5054900e1f459bcc7

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.mkdir       yes
extract.suffix      .orig.tar.gz

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

use_configure       no

depends_build       port:automake17 \
                    port:autoconf

depends_lib         port:perl5.16 \
                    port:p5.16-class-methodmaker \
                    port:p5.16-mailtools \
                    port:p5.16-term-readkey \
                    port:p5.16-gnupg-interface \
                    port:p5.16-text-iconv \
                    port:p5.16-text-template \
                    port:p5.16-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.16|" \
        ${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 \
            ${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.\]+)
