# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4

PortSystem          1.0

name                opendkim
version             2.10.3
revision            4
categories          mail
license             {BSD restrictive/distributable}
maintainers         nomaintainer

description         OpenDKIM is an implementation of the DKIM (Domain Keys Identified Mail)
long_description    {*}${description}

homepage            http://www.opendkim.org/
master_sites        sourceforge

depends_lib-append  path:lib/libssl.dylib:openssl \
                    path:lib/libmilter.dylib:libmilter \
                    port:unbound

# https://lists.gnu.org/archive/html/autoconf/2005-08/msg00089.html
depends_build-append \
                    path:bin/pkg-config:pkgconfig

checksums           rmd160  c6553757ae9675434e647f3cc1e6357bc60c7d2a \
                    sha256  43a0ba57bf942095fe159d0748d8933c6b1dd1117caf0273fa9a0003215e681b \
                    size    1210224

# https://sources.debian.org/data/main/o/opendkim/2.11.0~alpha-12/debian/patches/openssl_1.1.0_compat.patch
patchfiles          openssl_1.1.0_compat.patch

# patch above modifies configure.ac
use_autoreconf      yes

post-patch {
    reinplace "s|/var/|${prefix}/var/|g" \
        ${worksrcpath}/opendkim/opendkim.conf.sample \
        ${worksrcpath}/opendkim/opendkim.conf.simple.in \
        ${worksrcpath}/opendkim/opendkim.conf.simple-verify.in
}

configure.args      --with-openssl=${prefix} \
                    --with-unbound=${prefix} \
                    --with-milter=${prefix}

destroot.keepdirs    ${destroot}${prefix}/var/db/${name} \
                     ${destroot}${prefix}/var/run/${name}

livecheck.url       http://sourceforge.net/projects/opendkim/files/
livecheck.type      regex
livecheck.regex     "${name}-(\\d+\\.\\d+(\[0-9rc.\]+)?)${extract.suffix}"

# https://trac.macports.org/ticket/49648
startupitem.create      yes
startupitem.executable  ${prefix}/sbin/${name} -f