summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mail-filter')
-rw-r--r--mail-filter/procmail/Manifest1
-rw-r--r--mail-filter/procmail/files/procmail-3.24-gentoo-prefix.patch168
-rw-r--r--mail-filter/procmail/files/procmail-3.24-lazy-bindings.patch18
-rw-r--r--mail-filter/procmail/files/procmail-3.24-maildir.patch16
-rw-r--r--mail-filter/procmail/procmail-3.24.ebuild117
5 files changed, 320 insertions, 0 deletions
diff --git a/mail-filter/procmail/Manifest b/mail-filter/procmail/Manifest
index bf817c923214..e05644b06225 100644
--- a/mail-filter/procmail/Manifest
+++ b/mail-filter/procmail/Manifest
@@ -1 +1,2 @@
DIST procmail-3.22.tar.gz 226817 BLAKE2B 4fd4641abcd3a897ea19bd8f76446f88806d22649d5221f8cef6f9efc29f7fcc02c9707cbf00c32fe247f16579d28fd887d3c18c4d3a2f8877c351bf92e85866 SHA512 3d0658329a55957a8d5741e03b0853b030c4524acef30641663213aa9eefc8264f8cc2b68a00a89e5f9f0f7c916c41a42e1b6c8df562c545ba97d8ab9049a936
+DIST procmail-3.24.gh.tar.gz 299704 BLAKE2B 3223e9551a48329da88545bc8b90a346dea1182ba5ec6221acbe7a76cf01485b7115194087104bd042eeec3660de9f6146c5b9d984763fee1e2174f1edd59c11 SHA512 ce3763205d7e34c8a096c411487de296ecfb190ba817ad07926d44811222e689faedb97a3d4e85989db70e5a2298b26fff70c9d0cb0324a447ddc8988d7fe8ea
diff --git a/mail-filter/procmail/files/procmail-3.24-gentoo-prefix.patch b/mail-filter/procmail/files/procmail-3.24-gentoo-prefix.patch
new file mode 100644
index 000000000000..8426a53d8f59
--- /dev/null
+++ b/mail-filter/procmail/files/procmail-3.24-gentoo-prefix.patch
@@ -0,0 +1,168 @@
+diff --git a/Makefile b/Makefile
+index 0be77b1..42bb241 100644
+--- a/Makefile
++++ b/Makefile
+@@ -2,7 +2,7 @@
+
+ # BASENAME should point to where the whole lot will be installed
+ # change BASENAME to your home directory if need be
+-BASENAME = /usr
++BASENAME = @GENTOO_PORTAGE_EPREFIX@/usr
+ # For display in the man pages
+ VISIBLE_BASENAME= $(BASENAME)
+
+@@ -79,7 +79,7 @@ SEARCHLIBS = -lm -ldir -lx -lsocket -lnet -linet -lnsl_s -lnsl_i -lnsl -lsun \
+ # -lresolv # not really needed, is it?
+
+ # Informal list of directories where we look for the libraries in SEARCHLIBS
+-LIBPATHS=/lib /usr/lib /usr/local/lib
++LIBPATHS=@GENTOO_PORTAGE_EPREFIX@/lib @GENTOO_PORTAGE_EPREFIX@/usr/lib
+
+ GCC_WARNINGS = -O2 -pedantic -Wreturn-type -Wunused -Wformat -Wtraditional \
+ -Wpointer-arith -Wconversion -Waggregate-return \
+@@ -97,10 +97,10 @@ LDFLAGS1= $(LDFLAGS0) $(LIBS) #-lcposix
+ ####CC = cc # gcc
+ # object file extension
+ O = o
+-RM = /bin/rm -f
++RM = @GENTOO_PORTAGE_EPREFIX@/bin/rm -f
+ MV = mv -f
+ LN = ln
+-BSHELL = /bin/sh
++BSHELL = @GENTOO_PORTAGE_EPREFIX@/bin/sh
+ INSTALL = cp
+ DEVNULL = /dev/null
+ STRIP = strip
+@@ -112,7 +112,7 @@ MANS1S = procmail formail lockfile mailstat
+ MANS5S = procmailrc procmailsc procmailex
+
+ # Possible locations for the sendmail.cf file
+-SENDMAILCFS = /etc/mail/sendmail.cf /etc/sendmail.cf /usr/lib/sendmail.cf
++SENDMAILCFS = @GENTOO_PORTAGE_EPREFIX@/etc/mail/sendmail.cf @GENTOO_PORTAGE_EPREFIX@/etc/sendmail.cf @GENTOO_PORTAGE_EPREFIX@/usr/lib/sendmail.cf
+
+ # Makefile - mark, don't (re)move this, a sed script needs it
+
+diff --git a/config.h b/config.h
+index 4f6b57e..ef69e0b 100644
+--- a/config.h
++++ b/config.h
+@@ -116,11 +116,11 @@
+ is not found, maildelivery will proceed as normal to the default
+ system mailbox. This also must be an absolute path */
+
+-#define ETCRC "/etc/procmailrc" /* optional global procmailrc startup
++#define ETCRC "@GENTOO_PORTAGE_EPREFIX@/etc/procmailrc" /* optional global procmailrc startup
+ file (will only be read if procmail
+ is started with no rcfile on the command line). */
+
+-#define ETCRCS "/etc/procmailrcs/" /* optional trusted path prefix for
++#define ETCRCS "@GENTOO_PORTAGE_EPREFIX@/etc/procmailrcs/" /* optional trusted path prefix for
+ rcfiles which will be executed with
+ the uid of the owner of the rcfile (this only happens if procmail is
+ called with the -m option, without variable assignments on the command
+@@ -175,7 +175,7 @@
+ #define INEFFICIENTrealloc /* don't pussy-foot around */
+ #endif
+ #define MAXinMEM (1024*1024) /* when to switch to mmap() */
+-#define MMAP_DIR "/var/spool/procmail/" /* where to put */
++#define MMAP_DIR "@GENTOO_PORTAGE_EPREFIX@/var/spool/procmail/" /* where to put */
+ #endif /* the files */
+ #define MINlogbuf 81 /* fit an entire line */
+ #define MAXlogbuf 1000 /* in case someone abuses LOG */
+@@ -227,8 +227,8 @@ MMGR)\
+ #define DEFcomsat offvalue /* when an rcfile has been specified */
+ /* set to either "offvalue" or "empty" */
+
+-#define BinSh "/bin/sh"
+-#define ROOT_DIR "/"
++#define BinSh "@GENTOO_PORTAGE_EPREFIX@/bin/sh"
++#define ROOT_DIR "@GENTOO_PORTAGE_EPREFIX@"
+ #define DEAD_LETTER "/tmp/dead.letter" /* $ORGMAIL if no passwd entry */
+ #define DevNull "/dev/null"
+ #define NICE_RANGE 39 /* maximal nice difference */
+diff --git a/src/autoconf b/src/autoconf
+index 7c46487..094e4f0 100755
+--- a/src/autoconf
++++ b/src/autoconf
+@@ -1,4 +1,4 @@
+-#! /bin/sh
++#! @GENTOO_PORTAGE_EPREFIX@/bin/sh
+ :
+ # Copyright (c) 1990-1997, S.R. van den Berg, The Netherlands
+ #$Id$
+@@ -1416,22 +1416,12 @@ _autotst >>$ACONF
+
+ found=no
+
+-for a in /var/spool/mail /usr/spool/mail /var/mail /usr/mail /spool/mail
+-do
+- test -d $a -a $found = no && found=$a
+-done
+-if test $found = no
+-then
+- found=/var/spool/mail
+- echo Could not find the system-mailbox directory, supplied default.
+-fi
+ echo '#ifndef MAILSPOOLDIR' >>$ACONF
+-echo '#define MAILSPOOLDIR "'$found'/"' >>$ACONF
++echo '#define MAILSPOOLDIR "@GENTOO_PORTAGE_EPREFIX@/var/spool/mail/"' >>$ACONF
+ echo '#endif' >>$ACONF
+
+ cat >lookfor <<HERE
+-for a in /usr/sbin /usr/lib /lib /usr/etc /etc /usr/bin /bin /usr/local/bin \
+- /usr/lbin /usr/local/lib /usr/local /usr/.lib /local/bin /sbin
++for a in @GENTOO_PORTAGE_EPREFIX@/usr/sbin
+ do
+ if test -f "\$a/\$1"
+ then
+@@ -1460,7 +1450,7 @@ fi
+ grep '^#define SENDMAIL ".*/sendmail"' $ACONF >$DEVNULL ||
+ echo "#define DEFflagsendmail \"\"" >>$ACONF
+
+-a=/tmp/_chowntst.$$
++a=@GENTOO_PORTAGE_EPREFIX@/tmp/_chowntst.$$
+ $RM -r $a
+ OLDTESTDIRS="$a $OLDTESTDIRS"
+ mkdir $a
+@@ -1468,19 +1458,18 @@ mkdir $a/__
+
+ _autotst $a/__ $a/__/__ 4 >>$ACONF
+
+-cat /usr/lib/sendmail.cf /etc/sendmail.cf /etc/mail/sendmail.cf 2>$DEVNULL |
++cat @GENTOO_PORTAGE_EPREFIX@/usr/lib/sendmail.cf @GENTOO_PORTAGE_EPREFIX@/etc/sendmail.cf @GENTOO_PORTAGE_EPREFIX@/etc/mail/sendmail.cf 2>$DEVNULL |
+ grep 'Mlocal.*procmail' >$DEVNULL ||
+ echo '#define CF_no_procmail_yet' >>$ACONF
+
+-cat /usr/lib/sendmail.cf /etc/sendmail.cf /etc/mail/sendmail.cf 2>$DEVNULL |
++cat @GENTOO_PORTAGE_EPREFIX@/usr/lib/sendmail.cf @GENTOO_PORTAGE_EPREFIX@/etc/sendmail.cf @GENTOO_PORTAGE_EPREFIX@/etc/mail/sendmail.cf 2>$DEVNULL |
+ grep '^V' >$DEVNULL ||
+ echo '#define buggy_SENDMAIL' >>$ACONF
+
+-lpath='/usr/local/bin:/bin'
+-bins="/bin"
++lpath='@GENTOO_PORTAGE_EPREFIX@/bin'
++bins='@GENTOO_PORTAGE_EPREFIX@/bin'
+
+-for newd in /usr/bin /usr/ucb /usr/5bin $BINDIR /local/bin \
+- /global/bin /usr/bin/X11 /usr/X*/bin
++for newd in @GENTOO_PORTAGE_EPREFIX@/usr/bin
+ do
+ if test -d $newd
+ then
+diff --git a/src/recommend.c b/src/recommend.c
+index 980098f..f4b7095 100644
+--- a/src/recommend.c
++++ b/src/recommend.c
+@@ -9,8 +9,7 @@
+
+ char mailspooldir[]=MAILSPOOLDIR;
+ const char dirsep[]=DIRSEP,
+- *const checkf[]={"/bin/mail","/bin/lmail","/usr/lib/sendmail",
+- "/usr/lib/smail",0};
++ *const checkf[]={"@GENTOO_PORTAGE_EPREFIX@/usr/bin/sendmail",0};
+
+ int main(argc,argv)const int argc;const char*const argv[];
+ { struct group*grp;struct stat stbuf;gid_t gid=(gid_t)-1;
+--
+2.42.0
+
diff --git a/mail-filter/procmail/files/procmail-3.24-lazy-bindings.patch b/mail-filter/procmail/files/procmail-3.24-lazy-bindings.patch
new file mode 100644
index 000000000000..850b29e59777
--- /dev/null
+++ b/mail-filter/procmail/files/procmail-3.24-lazy-bindings.patch
@@ -0,0 +1,18 @@
+diff --git a/src/Makefile.0 b/src/Makefile.0
+index 35b6180..4fcba2c 100644
+--- a/src/Makefile.0
++++ b/src/Makefile.0
+@@ -18,11 +18,11 @@ make: # fake target
+ .PRECIOUS: Makefile
+
+ procmail: procmail.$(O) $(PM_OBJ) setid
+- $(CC) $(CFLAGS) $@.$(O) $(PM_OBJ) -o $@ $(LDFLAGS)
++ $(CC) $(CFLAGS) $@.$(O) $(PM_OBJ) -o $@ -Wl,-z,now $(LDFLAGS)
+ @test -z "$(STRIP)" || ( echo $(STRIP) $@; $(STRIP) $@ )
+
+ lockfile: lockfile.$(O) $(LF_OBJ)
+- $(CC) $(CFLAGS) $@.$(O) $(LF_OBJ) -o $@ $(LDFLAGS)
++ $(CC) $(CFLAGS) $@.$(O) $(LF_OBJ) -o $@ -Wl,-z,now $(LDFLAGS)
+ @test -z "$(STRIP)" || ( echo $(STRIP) $@; $(STRIP) $@ )
+
+ formail: formail.$(O) $(FM_OBJ)
diff --git a/mail-filter/procmail/files/procmail-3.24-maildir.patch b/mail-filter/procmail/files/procmail-3.24-maildir.patch
new file mode 100644
index 000000000000..b71661134438
--- /dev/null
+++ b/mail-filter/procmail/files/procmail-3.24-maildir.patch
@@ -0,0 +1,16 @@
+diff --git a/src/authenticate.c b/src/authenticate.c
+index 1f6cd6f..d92b6de 100644
+--- a/src/authenticate.c
++++ b/src/authenticate.c
+@@ -39,7 +39,7 @@ static /*const*/char rcsid[]=
+ #include "authenticate.h"
+
+ #ifndef MAILSPOOLDIR
+-#define MAILSPOOLDIR "/var/mail/" /* watch the trailing / */
++#define MAILSPOOLDIR "" /* watch the trailing / */
+ #endif
+ #ifndef MAILSPOOLSUFFIX
+ #define MAILSPOOLSUFFIX "" /* suffix to force maildir or MH style */
+--
+2.42.0
+
diff --git a/mail-filter/procmail/procmail-3.24.ebuild b/mail-filter/procmail/procmail-3.24.ebuild
new file mode 100644
index 000000000000..fda6f283d5a6
--- /dev/null
+++ b/mail-filter/procmail/procmail-3.24.ebuild
@@ -0,0 +1,117 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic toolchain-funcs prefix
+
+DESCRIPTION="Mail delivery agent/filter"
+HOMEPAGE="https://www.procmail.org/"
+SRC_URI="https://github.com/BuGlessRB/procmail/archive/refs/tags/v${PV}.tar.gz -> ${P}.gh.tar.gz"
+
+LICENSE="|| ( Artistic GPL-2 )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
+IUSE="mbox selinux"
+
+DEPEND="
+ acct-group/mail
+ virtual/mta
+"
+RDEPEND="
+ ${DEPEND}
+ selinux? ( sec-policy/selinux-procmail )
+"
+
+src_prepare() {
+ # disable flock, using both fcntl and flock style locking
+ # doesn't work with NFS with 2.6.17+ kernels, bug #156493
+
+ sed -e "s|/\*#define NO_flock_LOCK|#define NO_flock_LOCK|" \
+ -i config.h || die "sed failed"
+
+ if ! use mbox ; then
+ echo "# Use maildir-style mailbox in user's home directory" > "${S}"/procmailrc || die
+ echo 'DEFAULT=$HOME/.maildir/' >> "${S}"/procmailrc || die
+ cd "${S}" || die
+ eapply "${FILESDIR}/${P}-maildir.patch"
+ else
+ echo '# Use mbox-style mailbox in /var/spool/mail' > "${S}"/procmailrc || die
+ echo 'DEFAULT=${EPREFIX}/var/spool/mail/$LOGNAME' >> "${S}"/procmailrc || die
+ fi
+
+ # Do not use lazy bindings on lockfile and procmail
+ if [[ ${CHOST} != *-darwin* ]]; then
+ eapply "${FILESDIR}/${P}-lazy-bindings.patch"
+ fi
+
+ # Prefixify config.h
+ eapply "${FILESDIR}/${P}-gentoo-prefix.patch"
+ eprefixify config.h Makefile src/autoconf src/recommend.c
+
+ default
+}
+
+src_compile() {
+ # bug #875251, bug #896052
+ append-flags -std=gnu89
+ # bug #859517
+ filter-lto
+
+ # -finline-functions (implied by -O3) leaves strstr() in an infinite loop.
+ # To work around this, we append -fno-inline-functions to CFLAGS
+ # Since GCC 4.7 we also need -fno-ipa-cp-clone (bug #466552)
+ # If it's clang, ignore -fno-ipa-cp-clone, as clang doesn't support this
+ append-flags -fno-inline-functions
+ tc-is-clang || append-flags -fno-ipa-cp-clone
+
+ sed -e "s|CFLAGS0 = -O|CFLAGS0 = ${CFLAGS}|" \
+ -e "s|LDFLAGS0= -s|LDFLAGS0 = ${LDFLAGS}|" \
+ -e "s|LOCKINGTEST=__defaults__|#LOCKINGTEST=__defaults__|" \
+ -e "s|#LOCKINGTEST=/tmp|LOCKINGTEST=/tmp|" \
+ -i Makefile || die "sed failed"
+
+ emake CC="$(tc-getCC)"
+}
+
+src_install() {
+ cd "${S}"/new || die
+ insinto /usr/bin
+ insopts -m 6755
+ doins procmail
+
+ doins lockfile
+ fowners root:mail /usr/bin/lockfile
+ fperms 2755 /usr/bin/lockfile
+
+ dobin formail mailstat
+ insopts -m 0644
+
+ doman *.1 *.5
+
+ cd "${S}" || die
+ dodoc FAQ FEATURES HISTORY INSTALL KNOWN_BUGS README
+
+ insinto /etc
+ doins procmailrc
+
+ docinto examples
+ dodoc examples/*
+}
+
+pkg_postinst() {
+ if ! use mbox ; then
+ elog "Starting with mail-filter/procmail-3.22-r9 you'll need to ensure"
+ elog "that you configure a mail storage location using DEFAULT in"
+ elog "/etc/procmailrc, for example:"
+ elog "\tDEFAULT=\$HOME/.maildir/"
+ fi
+ if has sfperms ${FEATURES}; then
+ ewarn "FEATURES=sfperms removes the read-bit for others from"
+ ewarn " /usr/bin/procmail"
+ ewarn " /usr/bin/lockfile"
+ ewarn "If you use procmail from an MTA like Exim, you need to"
+ ewarn "re-add the read-bit or avoid the MTA checking the binary"
+ ewarn "exists."
+ fi
+}