# -*- 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

PortSystem          1.0
PortGroup           perl5 1.0

name                lbdb
version             0.56
revision            0
categories          mail
maintainers         nomaintainer
platforms           darwin freebsd
license             GPL-2+

description         The little brother's database for the mutt mail reader.

long_description    This package consists of a set of small tools, which \
                    collect mail addresses from several sources and offer \
                    these addresses to the mutt external query feature. \
                    It can use Emacs bbdb, abook, ldap and even Mac OS X \
                    address book for query.

homepage            https://www.spinnaker.de/lbdb
master_sites        ${homepage}/download

checksums           rmd160  8c5ec2ac52374a78a34d9efa94a6b8e865cce5d8 \
                    sha256  baa6a23b61394d792b7b221e1961d9ba5710614c9324e8f59b35c126c2b4e74e \
                    size    204971

perl5.branches      5.34

depends_lib         port:libiconv \
                    port:perl${perl5.major}

depends_run         port:gsed

post-patch  {
    reinplace "s|sed|gsed|g" ${worksrcpath}/m_muttalias.sh.in
}

configure.args      --libdir=${prefix}/lib/lbdb/ \
                    --without-gpg \
                    ac_cv_path_PERL=${perl5.bin}

destroot.destdir    install_prefix=${destroot}

post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/emacs/site-lisp
    file copy ${configure.dir}/lbdb.el ${destroot}${prefix}/share/emacs/site-lisp
}

variant gpg conflicts gpg2 description {Add support for GnuPG version 1} {
    depends_lib-append      port:gnupg1
    configure.args-replace  --without-gpg --with-gpg=${prefix}/bin/gpg1
}

variant gpg2 conflicts gpg description {Add support for GnuPG version 2} {
    depends_lib-append      path:bin/gpg2:gnupg2
    configure.args-replace  --without-gpg --with-gpg=${prefix}/bin/gpg2
}

variant ldap description {Also install necessary dependencies for use with LDAP} {
    depends_lib-append      port:p${perl5.major}-perl-ldap
}

livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     ${name}_(\[0-9.\]+)${extract.suffix}
