# $Id: Portfile,v 1.7 2006/08/08 07:07:53 yeled Exp $

PortSystem 1.0
name        t-prot
version     2.1.1
categories  mail
maintainers yeled@opendarwin.org
description TOFU protection script (MUA display filter)
homepage    http://www.escape.de/users/tolot/mutt/
platforms   darwin

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's what this script is for.

master_sites    http://www.escape.de/users/tolot/mutt/t-prot/downloads/

checksums      md5 79d2223e03257ab7627f7fcbcde2cfac 

use_configure no
depends_lib port:p5-getopt-mixed port:p5-locale-gettext

build {
        cd ${worksrcpath}
        reinplace "s|/usr|${prefix}|g" t-prot
}

destroot    {
    xinstall -m 755 ${worksrcpath}/t-prot ${destroot}${prefix}/bin
    xinstall -m 644 ${worksrcpath}/t-prot.1 \
        ${destroot}${prefix}/share/man/man1
    xinstall -m 755 -d ${destroot}${prefix}/share/${name}
    xinstall -m 644 -W ${worksrcpath}/contrib README.examples \
    t-prot-r1.238-gpg126.diff README.patches t-prot-r1.246-mutt1511.diff \
    filter_innd.pl t-prot.sl muttrc.t-prot ${destroot}${prefix}/share/${name}/
}

post-install {
        ui_msg ""
        ui_msg "to start TOFU protection, add this to your ~/.muttrc:"
        ui_msg "source ${prefix}/share/t-prot/muttrc.t-prot"
        ui_msg ""
        ui_msg "..and switch it off and on with Esc-0, Esc-1"
        ui_msg ""
}

variant darwin {
        patch { reinplace "s|use strict;|use strict; use Locale\:\:gettext;|g" ${worksrcpath}/t-prot }
}
