1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit flag-o-matic toolchain-funcs prefix
8 DESCRIPTION="Mail delivery agent/filter"
9 HOMEPAGE="http://www.procmail.org/"
10 SRC_URI="http://www.procmail.org/${P}.tar.gz"
12 LICENSE="|| ( Artistic GPL-2 )"
14 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x86-solaris"
18 RDEPEND="selinux? ( sec-policy/selinux-procmail )"
21 # disable flock, using both fcntl and flock style locking
22 # doesn't work with NFS with 2.6.17+ kernels, bug #156493
24 sed -e "s:/\*#define NO_flock_LOCK:#define NO_flock_LOCK:" \
25 -i config.h || die "sed failed"
28 echo "# Use maildir-style mailbox in user's home directory" > "${S}"/procmailrc || die
29 echo 'DEFAULT=$HOME/.maildir/' >> "${S}"/procmailrc || die
31 eapply "${FILESDIR}/gentoo-maildir3.diff"
33 echo '# Use mbox-style mailbox in /var/spool/mail' > "${S}"/procmailrc || die
34 echo 'DEFAULT=${EPREFIX}/var/spool/mail/$LOGNAME' >> "${S}"/procmailrc || die
37 # Do not use lazy bindings on lockfile and procmail
38 if [[ ${CHOST} != *-darwin* ]]; then
39 eapply -p0 "${FILESDIR}/${PN}-lazy-bindings.diff"
43 eapply -p0 "${FILESDIR}/${PN}-comsat-segfault.diff"
46 eapply -p0 "${FILESDIR}/${PN}-maxprocs-fix.diff"
49 eapply -p0 "${FILESDIR}"/${PN}-prefix.patch
50 eprefixify config.h Makefile src/autoconf src/recommend.c
53 eapply "${FILESDIR}/${PN}-pipealloc.diff"
56 eapply "${FILESDIR}/${PN}-3.22-glibc-2.10.patch"
58 # Fix security bugs #522114 and #638108
59 eapply "${FILESDIR}/${PN}-CVE-2014-3618-16844.patch"
65 # -finline-functions (implied by -O3) leaves strstr() in an infinite loop.
66 # To work around this, we append -fno-inline-functions to CFLAGS
67 # Since GCC 4.7 we also need -fno-ipa-cp-clone (bug #466552)
68 # If it's clang, ignore -fno-ipa-cp-clone, as clang doesn't support this
70 "clang") append-flags -fno-inline-functions ;;
71 "gcc"|*) append-flags -fno-inline-functions -fno-ipa-cp-clone ;;
74 sed -e "s:CFLAGS0 = -O:CFLAGS0 = ${CFLAGS}:" \
75 -e "s:LDFLAGS0= -s:LDFLAGS0 = ${LDFLAGS}:" \
76 -e "s:LOCKINGTEST=__defaults__:#LOCKINGTEST=__defaults__:" \
77 -e "s:#LOCKINGTEST=/tmp:LOCKINGTEST=/tmp:" \
78 -i Makefile || die "sed failed"
80 emake CC="$(tc-getCC)"
90 fowners root:mail /usr/bin/lockfile
91 fperms 2755 /usr/bin/lockfile
93 dobin formail mailstat
99 dodoc FAQ FEATURES HISTORY INSTALL KNOWN_BUGS README
110 elog "Starting with mail-filter/procmail-3.22-r9 you'll need to ensure"
111 elog "that you configure a mail storage location using DEFAULT in"
112 elog "/etc/procmailrc, for example:"
113 elog "\tDEFAULT=\$HOME/.maildir/"
115 if has sfperms ${FEATURES}; then
116 ewarn "FEATURES=sfperms removes the read-bit for others from"
117 ewarn " /usr/bin/procmail"
118 ewarn " /usr/bin/lockfile"
119 ewarn "If you use procmail from an MTA like Exim, you need to"
120 ewarn "re-add the read-bit or avoid the MTA checking the binary"