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

name                procmail
version             3.22
revision            7
categories          mail
license             {Artistic-1 GPL-2+}
platforms           darwin
maintainers         nomaintainer

description         A local mail delivery agent

long_description    The procmail mail processing program can be used \
                    to create mail-servers, mailing lists, sort your \
                    incoming mail into separate folders/files (real \
                    convenient when subscribing to one or more \
                    mailing lists or for prioritising your mail), \
                    preprocess your mail, start any programs upon \
                    mail arrival (e.g. to generate different chimes \
                    on your workstation for different types of mail) \
                    or selectively forward certain incoming mail \
                    automatically to someone. \
                    Procmail can be used: \
                    - and installed by an unprivileged user (for \
                      himself only). \
                    - as a drop in replacement for the local \
                      delivery agent /bin/mail (with biff/comsat \
                      support). \
                    - as a general mailfilter for whole groups of \
                      messages (e.g. when called from within \
                      sendmail.cf rules). \
                    The accompanying formail program enables you to \
                    generate autoreplies, split up digests/mailboxes \
                    into the original messages, do some very simple \
                    header-munging/extraction, or force mail into \
                    mail-format (with leading From line).

homepage            http://www.procmail.org/

master_sites        ftp://ftp.procmail.org/pub/procmail/ \
                    ftp://ftp.psg.com/pub/unix/procmail/ \
                    ftp://ftp.ucsb.edu/pub/mirrors/procmail/ \
                    ftp://ftp.informatik.rwth-aachen.de/pub/packages/procmail/ \
                    ftp://ftp.fu-berlin.de/pub/unix/mail/procmail/ \
                    ftp://ftp.net.ohio-state.edu/pub/networking/mail/procmail/ \
                    ftp://ftp.fdt.net/pub/unix/packages/procmail/ \
                    ftp://ftp.tamu.edu/pub/mirrors/procmail/ \
                    ftp://ftp.kfki.hu/pub/packages/mail/procmail/ \
                    ftp://giswitch.sggw.waw.pl/pub/unix/procmail/ \
                    ftp://ftp.solarisguide.com/pub/procmail/ \
                    ftp://ftp.win.ne.jp/pub/network/mail/procmail/ \
                    http://www.ring.gr.jp/archives/net/mail/procmail/ \
                    ftp://ftp.ring.gr.jp/pub/net/mail/procmail/ \
                    ftp://ftp.ayamura.org/pub/procmail/ \
                    ftp://sunsite.cnlab-switch.ch/mirror/procmail/ \
                    ftp://ftp.gigabell.net/pub/procmail/ \
                    ftp://ftp.linja.net/pub/mirrors/procmail/ \
                    ftp://ftp.stealth.net/pub/mirrors/ftp.procmail.org/pub/procmail/ \
                    ftp://ftp.mirror.ac.uk/sites/ftp.procmail.org/pub/procmail/

checksums           md5     1678ea99b973eb77eda4ecf6acae53f1 \
                    sha1    cd4e44c15559816453fd60349e5a32289f6f2965 \
                    rmd160  e609ec94ea9ab3b93629c62b3e29add497806483

post-extract {
    move ${worksrcpath}/INSTALL ${worksrcpath}/INSTALL.README
}

patchfiles          getline.patch \
                    patch-CVE-2014-3618.diff \
                    patch-CVE-2017-16844.diff \
                    patch-security-fixes.diff \
                    patch-src-manconf.c.diff

post-patch {
    reinplace "s%^/\\*\\(#define\[ \t\]*DEF\[S\]*PATH\[ \t\]*\".*\\)\".*$%\\1:${prefix}/bin\"%" ${worksrcpath}/config.h
    reinplace "s%/etc/procmailrc%${prefix}/etc/procmailrc%" ${worksrcpath}/config.h
    reinplace "s%/usr/local%${prefix}%g" ${worksrcpath}/Makefile
    reinplace "s%(BASENAME)/man%(BASENAME)/share/man%" ${worksrcpath}/Makefile
}

use_configure       no

variant universal {}

build.env           "CC=${configure.cc} [get_canonical_archflags cc]"

build.args          BASENAME=${prefix} LOCKINGTEST=/tmp
destroot.args       BASENAME=${destroot}${prefix} LOCKINGTEST=/tmp install-suid

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