# -*- 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                mailqfmt
version             0.6
revision            6
categories          mail
license             GPL-2
maintainers         nomaintainer
# homepage is gone since 2014 or so
# use archived copy from web.archive.org 
homepage            https://web.archive.org/web/20130627035045/http://www.dt.e-technik.uni-dortmund.de/~ma/postfix/
description         Postfix mailq file reformatter
long_description    mailqfmt reformats postfix mail queue with single \
                    line entries that are easier to parse
master_sites        macports_distfiles
distfiles           ${name}.pl

checksums           rmd160  d5e24479642537db03f3ab82eee380fefce1bdf9 \
                    sha256  11e6410cdc811cebc8212b73eeaad2386cb15569b526d73376d35a69bda54b95 \
                    size    2010

perl5.require_variant   yes
perl5.conflict_variants yes
perl5.branches          5.28 5.30 5.32 5.34
perl5.default_branch    5.34
perl5.create_variants   ${perl5.branches}

depends_lib-append  port:postfix \
                    port:p${perl5.major}-http-date

extract {
      file copy ${distpath}/mailqfmt.pl ${workpath}/mailqfmt
}

post-patch {
    reinplace "s|/usr/bin/perl|${prefix}/bin/perl${perl5.major}|g" ${workpath}/mailqfmt

    if {![variant_isset apple_postfix]} {
        reinplace "s|/usr/bin/mailq|${prefix}/bin/mailq|g" ${workpath}/mailqfmt
    }
}

use_configure       no
build               {}

destroot {
    xinstall -m 755 -d ${destroot}${prefix}/bin
    xinstall -m 755 ${workpath}/mailqfmt ${destroot}${prefix}/bin/mailqfmt
}

variant apple_postfix description {uses the mail queues of macosx postfix} {
    depends_lib-delete  port:postfix
}

livecheck.type      none
