git: 3038d6005b36 - main - mail/procmail-bgrb: New port

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Sun, 17 Apr 2022 19:01:54 UTC
The branch main has been updated by cy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3038d6005b36437c5815f4b0ced200f1712526ad

commit 3038d6005b36437c5815f4b0ced200f1712526ad
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-04-17 18:41:00 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-04-17 18:41:00 +0000

    mail/procmail-bgrb: New port
    
    mail/procmail-bgrb is a new port tracking the BuGlessRB fork of
    procmail (which hasn't been updated for over 20 years).
    The commits to BuGlessRB/procmail appear be by the original author
    of procmail. Wikipedia documents that the upstream for this port is
    its repo.
    
    As this upstream is in active development and the original procmail on
    sourceforge is defunct, we may wish to consider merging or replacing
    mail/procmail with this port at some point.
    
    Reported by:    Lucas Holt at midnightbsd.org (on Twitter)
---
 mail/Makefile                                      |  1 +
 mail/procmail-bgrb/Makefile                        | 45 +++++++++++++++++
 mail/procmail-bgrb/distinfo                        |  3 ++
 mail/procmail-bgrb/files/patch-Makefile            | 50 +++++++++++++++++++
 mail/procmail-bgrb/files/patch-Makefile.1          | 15 ++++++
 mail/procmail-bgrb/files/patch-config.h            | 37 ++++++++++++++
 mail/procmail-bgrb/files/patch-initmake            | 13 +++++
 mail/procmail-bgrb/files/patch-man-procmail.man    | 14 ++++++
 mail/procmail-bgrb/files/patch-src-autoconf        | 32 +++++++++++++
 mail/procmail-bgrb/files/patch-src-manconf.c       | 11 +++++
 mail/procmail-bgrb/files/patch-src-recommend.c     | 12 +++++
 .../files/procmail-3.22-getline.patch              | 56 ++++++++++++++++++++++
 mail/procmail-bgrb/pkg-descr                       | 24 ++++++++++
 mail/procmail-bgrb/pkg-plist                       | 11 +++++
 14 files changed, 324 insertions(+)

diff --git a/mail/Makefile b/mail/Makefile
index cf4cb4ba1e1a..0eb121b47157 100644
--- a/mail/Makefile
+++ b/mail/Makefile
@@ -481,6 +481,7 @@
     SUBDIR += postsrsd
     SUBDIR += prepflog
     SUBDIR += procmail
+    SUBDIR += procmail-bgrb
     SUBDIR += proxsmtp
     SUBDIR += py-Products.SecureMailHost
     SUBDIR += py-afew
diff --git a/mail/procmail-bgrb/Makefile b/mail/procmail-bgrb/Makefile
new file mode 100644
index 000000000000..fab7990b5b2a
--- /dev/null
+++ b/mail/procmail-bgrb/Makefile
@@ -0,0 +1,45 @@
+# Created by: Adam David <adam@FreeBSD.org>
+
+PORTNAME=	procmail
+DISTVERSIONPREFIX=	v
+DISTVERSION=	3.24
+CATEGORIES=	mail
+PKGNAMESUFFIX=	-bgrb
+
+MAINTAINER=	cy@FreeBSD.org
+COMMENT=	BuGlessRB fork of the procmail local mail delivery agent
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	BuGlessRB
+
+CONFLICTS_INSTALL=	procmail
+
+LICENSE=	GPLv2
+
+LIB_DEPENDS=	libnet.so:net/libnet
+
+.if defined(QEMU_EMULATING) && "${QEMU_EMULATING}" == "1"
+BROKEN=		fails to build under qemu: killing runaway build after 21600 seconds with no output
+.endif
+
+OPTIONS_DEFINE=	DOCS EXAMPLES
+
+INSTALL_TARGET=	install.bin install.man
+USES=		cpe
+# EXTRA_PATCHES=	${FILESDIR}/procmail-3.22-getline.patch:-p1
+
+PORTDOCS=	FAQ FEATURES HISTORY KNOWN_BUGS README
+PORTEXAMPLES=	1procmailrc 1rmail 2procmailrc 2rmail 3procmailrc 3rmail \
+		advanced dirname forward local_procmail_lmtp.m4 mailstat
+
+post-patch:
+	@${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|g' ${WRKSRC}/config.h ${WRKSRC}/src/autoconf
+# Allow parallel builds (-jX) to work
+	@${FIND} ${WRKSRC} -name 'Makefile*' | ${XARGS} ${REINPLACE_CMD} -E 's|cd (.+); (\$$\(MAKE\))|\2 -C \1|'
+
+post-install:
+	${MKDIR} ${STAGEDIR}${DOCSDIR}/ ${STAGEDIR}${EXAMPLESDIR}/
+	cd ${WRKSRC}/ && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR}/
+	cd ${WRKSRC}/examples/ && ${INSTALL_DATA} ${PORTEXAMPLES} ${STAGEDIR}${EXAMPLESDIR}/
+
+.include <bsd.port.mk>
diff --git a/mail/procmail-bgrb/distinfo b/mail/procmail-bgrb/distinfo
new file mode 100644
index 000000000000..a327e7b0b147
--- /dev/null
+++ b/mail/procmail-bgrb/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1650219171
+SHA256 (BuGlessRB-procmail-v3.24_GH0.tar.gz) = 514ea433339783e95df9321e794771e4887b9823ac55fdb2469702cf69bd3989
+SIZE (BuGlessRB-procmail-v3.24_GH0.tar.gz) = 299704
diff --git a/mail/procmail-bgrb/files/patch-Makefile b/mail/procmail-bgrb/files/patch-Makefile
new file mode 100644
index 000000000000..91a38924c475
--- /dev/null
+++ b/mail/procmail-bgrb/files/patch-Makefile
@@ -0,0 +1,50 @@
+*** Makefile.orig	Mon Apr 28 04:27:40 1997
+--- Makefile	Wed May 14 18:16:50 1997
+***************
+*** 2,8 ****
+  
+  # BASENAME should point to where the whole lot will be installed
+  # change BASENAME to your home directory if need be
+! BASENAME	= /usr
+  # For display in the man pages
+  VISIBLE_BASENAME= $(BASENAME)
+  
+--- 2,8 ----
+  
+  # BASENAME should point to where the whole lot will be installed
+  # change BASENAME to your home directory if need be
+! BASENAME      = $(DESTDIR)$(PREFIX)
+  # For display in the man pages
+  VISIBLE_BASENAME= $(BASENAME)
+  
+***************
+*** 53,59 ****
+--- 53,63 ----
+  
+  # Makefile.0 - mark, don't (re)move this, a sed script needs it
+  
++ .if defined(BATCH)
++ LOCKINGTEST=/tmp .
++ .else
+  LOCKINGTEST=__defaults__
++ .endif
+  
+  #LOCKINGTEST=/tmp .	# Uncomment and add any directories you see fit.
+  #			If LOCKINGTEST is defined, autoconf will NOT
+***************
+*** 86,92 ****
+   #-Wimplicit -Wshadow -Wid-clash-6 #-Wuninitialized
+  
+  # The place to put your favourite extra cc flag
+! CFLAGS0 = -O #$(GCC_WARNINGS)
+  LDFLAGS0= -s
+  # Read my libs :-)
+  LIBS=
+--- 90,96 ----
+   #-Wimplicit -Wshadow -Wid-clash-6 #-Wuninitialized
+  
+  # The place to put your favourite extra cc flag
+! CFLAGS0 = #-O #$(GCC_WARNINGS)
+  LDFLAGS0= -s
+  # Read my libs :-)
+  LIBS=
diff --git a/mail/procmail-bgrb/files/patch-Makefile.1 b/mail/procmail-bgrb/files/patch-Makefile.1
new file mode 100644
index 000000000000..d314a6af2685
--- /dev/null
+++ b/mail/procmail-bgrb/files/patch-Makefile.1
@@ -0,0 +1,15 @@
+--- Makefile.1.orig	Tue Dec 28 10:33:26 1999
++++ Makefile.1	Tue Dec 28 10:33:55 1999
+@@ -60,12 +60,7 @@
+  sed -n 's/.*\(Mlocal.*procmail.*F=[a-zA-Z]*\)u/\1/p' `if test -f \
+  /etc/sendmail.cf; then echo /etc/sendmail.cf; else \
+  echo /usr/lib/sendmail.cf; fi`; fi
+-	@echo
+-	@echo \
+- "Also, HIGHLY RECOMMENDED (type 'make install-suid' to execute it):"
+-	@echo
+ 	@src/$@ $(BINDIR)/procmail $(BINDIR)/lockfile >suid.sh
+-	@src/$@ $(BINDIR)/procmail $(BINDIR)/lockfile
+ 	@echo ================================================================\
+ ===============
+ 
diff --git a/mail/procmail-bgrb/files/patch-config.h b/mail/procmail-bgrb/files/patch-config.h
new file mode 100644
index 000000000000..7c54253b1c1b
--- /dev/null
+++ b/mail/procmail-bgrb/files/patch-config.h
@@ -0,0 +1,37 @@
+--- config.h.orig	Tue Sep 11 08:53:50 2001
++++ config.h	Sun Mar 30 20:23:47 2003
+@@ -52,7 +52,7 @@
+ 	is group writable or contained in a group writable home directory
+ 	if the group involved is the user's default group. */
+ 
+-/*#define LMTP					/* uncomment this if you
++#define LMTP                                  /* uncomment this if you
+ 						   want to use procmail
+ 	as an LMTP (rfc2033) server, presumably for invocation by an MTA.
+ 	The file examples/local_procmail_lmtp.m4 contains info on how to
+@@ -75,9 +75,9 @@
+    >From_ field will be added in the header */
+ 
+ #define TRUSTED_IDS	{"root","daemon","uucp","mail","x400","network",\
+-			 "list","slist","lists","news",0}
++			 "list","slist","lists","news","mailnull","majordom","majordomo",0}
+ 
+-/*#define NO_fcntl_LOCK		/* uncomment any of these three if you	     */
++#define NO_fcntl_LOCK         /* uncomment any of these three if you       */
+ /*#define NO_lockf_LOCK		/* definitely do not want procmail to make   */
+ /*#define NO_flock_LOCK		/* use of those kernel-locking methods	     */
+ 				/* If you set LOCKINGTEST to a binary number
+@@ -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   "/usr/local/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  "/usr/local/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
diff --git a/mail/procmail-bgrb/files/patch-initmake b/mail/procmail-bgrb/files/patch-initmake
new file mode 100644
index 000000000000..e363e3ac83e7
--- /dev/null
+++ b/mail/procmail-bgrb/files/patch-initmake
@@ -0,0 +1,13 @@
+--- initmake.orig	Sat Jan 29 09:52:13 2000
++++ initmake	Sun Aug 27 13:06:14 2000
+@@ -433,8 +433,8 @@
+ test -z "$MAKE" && echo "MAKE	= make"			>>_Makefile
+ test a"$cc" != a"$CC" && echo "CC	= $cc"		>>_Makefile
+ 
+-echo "CFLAGS	= \$(CFLAGS1)$CFLAGS"			>>_Makefile
+-echo "LDFLAGS	= $LDFLAGS"				>>_Makefile
++echo "CFLAGS    += \$(CFLAGS1)$CFLAGS"                   >>_Makefile
++echo "LDFLAGS   += $LDFLAGS"                             >>_Makefile
+ echo							>>_Makefile
+ 
+ MANSS=""
diff --git a/mail/procmail-bgrb/files/patch-man-procmail.man b/mail/procmail-bgrb/files/patch-man-procmail.man
new file mode 100644
index 000000000000..c3a84f47d61f
--- /dev/null
+++ b/mail/procmail-bgrb/files/patch-man-procmail.man
@@ -0,0 +1,14 @@
+--- man/procmail.man.orig	Fri Aug 25 11:04:32 2000
++++ man/procmail.man	Sun Aug 27 13:21:23 2000
+@@ -690,9 +690,8 @@
+ .RE
+ .PP
+ @CF_procmail@
+-In this case your $HOME/@DOT_FORWARD@ (beware, it
+-.B has
+-to be world readable) file should contain the line below.  Be sure to include
++In this case your $HOME/@DOT_FORWARD@
++file should contain the line below.  Be sure to include
+ the single and double quotes, and unless you know your site to be running
+ smrsh (the SendMail Restricted SHell), it must be an
+ .I absolute
diff --git a/mail/procmail-bgrb/files/patch-src-autoconf b/mail/procmail-bgrb/files/patch-src-autoconf
new file mode 100644
index 000000000000..41ab653bd40b
--- /dev/null
+++ b/mail/procmail-bgrb/files/patch-src-autoconf
@@ -0,0 +1,32 @@
+--- src/autoconf.orig	2001-09-10 21:55:46.000000000 -0700
++++ src/autoconf	2010-12-23 11:53:07.000000000 -0800
+@@ -230,7 +230,8 @@
+   echo ""
+   if test -z "$LOCKINGTEST"
+   then
+-     read b
++     #read b
++     b=""
+   elif test dummy = "$LOCKINGTEST"
+   then
+      b=""
+@@ -977,6 +978,7 @@
+ 
+ echo 'Checking realloc implementation'
+ 
++$RM -f _autotst
+ if $MAKE _autotst >$DEVNULL 2>&1
+  test -f _autotst
+ then
+@@ -1491,6 +1493,11 @@
+   fi
+ done
+ 
++case ":$lpath:" in
++    *:/usr/local/bin:*) ;;
++    *) lpath="$lpath:/usr/local/bin" ;;
++esac
++
+ echo "#define defPATH \"PATH=\$HOME/bin:$lpath\"" >>$ACONF
+ echo "#define defSPATH \"PATH=$lpath\"" >>$ACONF
+ 
diff --git a/mail/procmail-bgrb/files/patch-src-manconf.c b/mail/procmail-bgrb/files/patch-src-manconf.c
new file mode 100644
index 000000000000..1ec12acc25bd
--- /dev/null
+++ b/mail/procmail-bgrb/files/patch-src-manconf.c
@@ -0,0 +1,11 @@
+--- src/manconf.c.orig	Fri Aug 25 11:04:33 2000
++++ src/manconf.c	Sun Aug 27 13:12:55 2000
+@@ -140,7 +140,7 @@
+ sh before procmail ever sees it; it is however a necessary kludge against\1\
+ overoptimising sendmail programs:\1");
+ #else
+-  ps("FW_content","\"|exec @BINDIR@/procmail\"");
++  ps("FW_content","\"|exec @BINDIR@/procmail || exit 75\"");
+   ps("FW_comment","");
+ #endif
+ #else
diff --git a/mail/procmail-bgrb/files/patch-src-recommend.c b/mail/procmail-bgrb/files/patch-src-recommend.c
new file mode 100644
index 000000000000..c73f9f9373cf
--- /dev/null
+++ b/mail/procmail-bgrb/files/patch-src-recommend.c
@@ -0,0 +1,12 @@
+*** src/recommend.c.bak	Wed Apr  2 07:15:45 1997
+--- src/recommend.c	Tue Jun 17 21:48:49 1997
+***************
+*** 23,29 ****
+     { fprintf(stderr,"Please run this program via 'make recommend'\n");
+       return EX_USAGE;
+     }
+-   strchr(mailspooldir,'\0')[-1]='\0';		     /* strip last character */
+    for(p=checkf;*p;p++)
+       if(!stat(*p,&stbuf)&&stbuf.st_mode&S_ISGID)
+        { if(stbuf.st_mode&S_ISGID)
+--- 23,28 ----
diff --git a/mail/procmail-bgrb/files/procmail-3.22-getline.patch b/mail/procmail-bgrb/files/procmail-3.22-getline.patch
new file mode 100644
index 000000000000..fb9a4ec6efb5
--- /dev/null
+++ b/mail/procmail-bgrb/files/procmail-3.22-getline.patch
@@ -0,0 +1,56 @@
+diff -up procmail-3.22/src/fields.c.getline procmail-3.22/src/fields.c
+--- procmail-3.22/src/fields.c.getline	2001-09-11 06:57:08.000000000 +0200
++++ procmail-3.22/src/fields.c	2009-06-30 16:10:36.000000000 +0200
+@@ -110,16 +110,16 @@ void dispfield(p)register const struct f
+ 		    /* try and append one valid field to rdheader from stdin */
+ int readhead P((void))
+ { int idlen;
+-  getline();
++  get_line();
+   if((idlen=breakfield(buf,buffilled))<=0) /* not the start of a valid field */
+      return 0;
+   if(idlen==STRLEN(FROM)&&eqFrom_(buf))			/* it's a From_ line */
+    { if(rdheader)
+ 	return 0;			       /* the From_ line was a fake! */
+-     for(;buflast=='>';getline());	    /* gather continued >From_ lines */
++     for(;buflast=='>';get_line());	    /* gather continued >From_ lines */
+    }
+   else
+-     for(;;getline())		      /* get the rest of the continued field */
++     for(;;get_line())		      /* get the rest of the continued field */
+       { switch(buflast)			     /* will this line be continued? */
+ 	 { case ' ':case '\t':				  /* yep, it sure is */
+ 	      continue;
+diff -up procmail-3.22/src/formail.c.getline procmail-3.22/src/formail.c
+--- procmail-3.22/src/formail.c.getline	2009-06-30 16:00:40.000000000 +0200
++++ procmail-3.22/src/formail.c	2009-06-30 16:10:49.000000000 +0200
+@@ -819,7 +819,7 @@ splitit:       { if(!lnl)   /* did the p
+       { if(split)		       /* gobble up the next start separator */
+ 	 { buffilled=0;
+ #ifdef sMAILBOX_SEPARATOR
+-	   getline();buffilled=0;		 /* but only if it's defined */
++	   get_line();buffilled=0;		 /* but only if it's defined */
+ #endif
+ 	   if(buflast!=EOF)					   /* if any */
+ 	      goto splitit;
+diff -up procmail-3.22/src/formisc.c.getline procmail-3.22/src/formisc.c
+--- procmail-3.22/src/formisc.c.getline	2001-06-29 04:20:45.000000000 +0200
++++ procmail-3.22/src/formisc.c	2009-06-30 16:12:20.000000000 +0200
+@@ -115,7 +115,7 @@ void loadchar(c)const int c;		      /* a
+   buf[buffilled++]=c;
+ }
+ 
+-int getline P((void))			   /* read a newline-terminated line */
++int get_line P((void))			   /* read a newline-terminated line */
+ { if(buflast==EOF)			 /* at the end of our Latin already? */
+    { loadchar('\n');					  /* fake empty line */
+      return EOF;					  /* spread the word */
+diff -up procmail-3.22/src/formisc.h.getline procmail-3.22/src/formisc.h
+--- procmail-3.22/src/formisc.h.getline	1999-04-19 08:42:15.000000000 +0200
++++ procmail-3.22/src/formisc.h	2009-06-30 16:10:02.000000000 +0200
+@@ -17,4 +17,4 @@ void
+ char*
+  skipwords P((char*start));
+ int
+- getline P((void));
++ get_line P((void));
diff --git a/mail/procmail-bgrb/pkg-descr b/mail/procmail-bgrb/pkg-descr
new file mode 100644
index 000000000000..1c886f02c1a5
--- /dev/null
+++ b/mail/procmail-bgrb/pkg-descr
@@ -0,0 +1,24 @@
+This is the BuGlessRB version of procmail, a fork of the original procmail
+at procmail.org.
+
+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).
+
+WWW: https://github.com/BuGlessRB/procmail
diff --git a/mail/procmail-bgrb/pkg-plist b/mail/procmail-bgrb/pkg-plist
new file mode 100644
index 000000000000..5716a194572d
--- /dev/null
+++ b/mail/procmail-bgrb/pkg-plist
@@ -0,0 +1,11 @@
+bin/formail
+@(,mail,2755) bin/lockfile
+bin/mailstat
+@(,mail,6755) bin/procmail
+man/man1/formail.1.gz
+man/man1/lockfile.1.gz
+man/man1/mailstat.1.gz
+man/man1/procmail.1.gz
+man/man5/procmailex.5.gz
+man/man5/procmailrc.5.gz
+man/man5/procmailsc.5.gz