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

perl5.require_variant   yes
perl5.conflict_variants yes
perl5.branches          5.28 5.30 5.32 5.34
perl5.default_branch    5.34

name                t-prot
version             3.4
revision            3
categories          mail
license             BSD-old
maintainers         nomaintainer
supported_archs     noarch
platforms           {darwin any}

description         TOFU protection script (MUA display filter)
long_description    You know these misformatted mail or news messages, with \
                    full quotes, too long signatures, and lots of \
                    exclamation marks? They get on your nerves day by day? \
                    That is what this script is for.

homepage            http://www.escape.de/~tolot/mutt/
master_sites        ${homepage}t-prot/downloads/

checksums           rmd160  7947e1306bb49a092185a6f6dda6ec758b85e609 \
                    sha256  39b7a5f0fefdea87885f3b6ab041e7148c600fb50017c3a283231f6dde5eca2b \
                    size    46066

depends_run         port:p${perl5.major}-getopt-mixed \
                    port:p${perl5.major}-locale-gettext

use_configure       no

build {
    reinplace -locale C "s|#!/usr/bin/perl|#!${perl5.bin}|g" ${worksrcpath}/t-prot
    reinplace -locale C "s|/usr|${prefix}|g"                 ${worksrcpath}/t-prot
}

destroot {
    # install t-prot and its man page:
    xinstall -m 755 ${worksrcpath}/t-prot ${destroot}${prefix}/bin
    xinstall -m 644 ${worksrcpath}/t-prot.1 ${destroot}${prefix}/share/man/man1

    # install additional files:
    xinstall -d ${destroot}${prefix}/share/${name}
    foreach file [glob ${worksrcpath}/contrib/*] {
        xinstall -m 644 $file ${destroot}${prefix}/share/${name}
    }
}

platform darwin {
    patchfiles-append patch-t-prot.diff
}

notes \
"To use t-prot with mutt, add this to your ~/.muttrc:
source ${prefix}/share/${name}/muttrc.t-prot

You can switch it off and on with Esc-0 and Esc-1.

If you use muttrc.t-prot you have to make sure the\
following directories exist (they can be empty):
~/.mutt/mlfooters
~/.mutt/adfooters"
