git: 48398ec51f1b - main - mail/courier: Update to 1.1.11

From: Juraj Lutter <otis_at_FreeBSD.org>
Date: Mon, 11 Sep 2023 14:36:43 UTC
The branch main has been updated by otis:

URL: https://cgit.FreeBSD.org/ports/commit/?id=48398ec51f1bf338df18168ac520eb4729b88b09

commit 48398ec51f1bf338df18168ac520eb4729b88b09
Author:     Milan Obuch <bsd@dino.sk>
AuthorDate: 2023-09-11 14:35:09 +0000
Commit:     Juraj Lutter <otis@FreeBSD.org>
CommitDate: 2023-09-11 14:36:26 +0000

    mail/courier: Update to 1.1.11
    
    - Update to 1.1.11
    - Clean up Makefile a bit
    - Move chown/chmod into pkg-plist
    
    PR:             268008
---
 mail/courier/Makefile                              | 194 +++---
 mail/courier/Makefile.doc                          |  36 +-
 mail/courier/Makefile.own                          |  67 --
 mail/courier/distinfo                              |   5 +-
 mail/courier/files/courier.in                      |  20 +-
 mail/courier/files/extra-patch-maildrop__maildir.C |  33 -
 mail/courier/files/extra-patch-webmail__folder.c   |  82 +--
 .../extra-patch-webmail__images__sqwebmail.css     |  15 +-
 mail/courier/files/extra-patch-webmail__maildir.c  |   4 +-
 mail/courier/files/extra-patch-webmail__maildir.h  |   9 +-
 mail/courier/files/extra-patch-webmail__msg2html.c |   4 +-
 mail/courier/files/patch-courier__cmlmfetch.C      |  11 -
 mail/courier/files/patch-courier__configure        |  61 +-
 mail/courier/files/patch-courier__doc__Makefile.in |  71 --
 mail/courier/files/patch-courier__imapd-ssl.rc.in  |  11 +
 mail/courier/files/patch-courier__imapd.rc.in      |  11 +
 .../courier/files/patch-courier__libs__Makefile.in |  13 +
 .../files/patch-courier__module.esmtp__configure   |  44 ++
 .../patch-courier__module.esmtp__mkesmtpdcert.in   |  27 +-
 mail/courier/files/patch-courier__perms.sh.in      |  52 +-
 mail/courier/files/patch-courier__pop3d-ssl.in     |  11 +
 mail/courier/files/patch-courier__pop3d.in         |  11 +
 mail/courier/files/patch-courier__submit2.C        |  11 -
 mail/courier/files/patch-courier__webmlmd.H        |  11 -
 mail/courier/files/patch-courier__webmlmd.rc.in    |  13 +-
 mail/courier/files/patch-imap__mkimapdcert.in      |  11 -
 mail/courier/files/patch-imap__mkpop3dcert.in      |  11 -
 mail/courier/files/patch-liblock__locktest.c       |  81 ---
 mail/courier/files/patch-libs__imap__mkdhparams.in |  11 +
 .../courier/files/patch-libs__imap__mkimapdcert.in |  20 +
 .../courier/files/patch-libs__imap__mkpop3dcert.in |  20 +
 mail/courier/files/patch-tcpd__libcouriertls.c     |  18 -
 mail/courier/files/pkg-message.in                  |  27 +
 mail/courier/pkg-plist                             | 732 ++++++++++-----------
 34 files changed, 778 insertions(+), 980 deletions(-)

diff --git a/mail/courier/Makefile b/mail/courier/Makefile
index 273585a902b0..85742588b14b 100644
--- a/mail/courier/Makefile
+++ b/mail/courier/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	courier
-PORTVERSION=	0.65.3
-PORTREVISION=	6
+PORTVERSION=	1.1.11
 CATEGORIES=	mail
 MASTER_SITES=	SF
 
@@ -11,19 +10,19 @@ WWW=		https://www.Courier-MTA.org/
 LICENSE=	GPLv3
 LICENSE_FILE=	${WRKSRC}/COPYING.GPL
 
-BROKEN=	ld: error: duplicate symbol: sqwebmail_content_charset
-DEPRECATED=	Broken for more than a year and fails to build on supported RELEASE
-EXPIRATION_DATE=	2023-06-01
-
-BUILD_DEPENDS=	courierauthconfig:security/courier-authlib-base
+BUILD_DEPENDS=	courierauthconfig:security/courier-authlib-base \
+		wget:ftp/wget
 LIB_DEPENDS=	libidn.so:dns/libidn \
-		libpcre.so:devel/pcre
+		libpcre.so:devel/pcre \
+		libgdbm.so:databases/gdbm \
+		libcourier-unicode.so:devel/courier-unicode \
+		libpcre2-8.so:devel/pcre2
 RUN_DEPENDS=	courierauthconfig:security/courier-authlib-base \
 		${LOCALBASE}/share/sysconftool/sysconftool:devel/sysconftool \
 		${LOCALBASE}/etc/mime.types:misc/mime-support \
 		p5-Net-CIDR>=0:net-mgmt/p5-Net-CIDR \
-		ca_root_nss>=3.*:security/ca_root_nss
-
+		ca_root_nss>=3.*:security/ca_root_nss \
+		${LOCALBASE}/bin/wget:ftp/wget
 CONFLICTS=	courier-imap-2.* couriermlm-0.* \
 		exim-4.* maildrop-1.* \
 		panda-imap-201* postfix-1.* postfix-2.* \
@@ -49,10 +48,10 @@ MAILDROPDEFAULT?=./Maildir
 
 # End of user-serviceable variables
 
-MAILOWN=	courier
-MAILGRP=	courier
-MAILUID=	465
-MAILGID=	465
+MAILOWN?=	courier
+MAILGRP?=	courier
+MAILUID?=	465
+MAILGID?=	465
 ETCDIR=		${PREFIX}/etc
 SYSCONFDIR=	${ETCDIR}/courier
 LIBEXECDIR=	${PREFIX}/libexec
@@ -62,13 +61,15 @@ CALENDIR=	/var/spool/calendar
 MIMETYPES=	${LOCALBASE}/etc/mime.types
 WITH_TRANSPORT=	local esmtp dsn
 
-USES=		fam gettext gmake libtool perl5 pkgconfig tar:bzip2 ssl
+USES=		fam gettext gmake libtool perl5 pkgconfig tar:bzip2 ssl shebangfix
 USE_SUBMAKE=	yes
 USE_RC_SUBR=	courier
+SHEBANG_FILES=	courier/filters/perlfilter/perlfilter-ratelimit.pl \
+		courier/filters/perlfilter/perlfilter-wrapper.pl
 
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--disable-root-check \
-		--with-db=db \
+		--with-db=gdbm \
 		--enable-syslog=1 --enable-use-flock \
 		--program-transform-name=s,^,, \
 		--enable-utf7-folder-encoding \
@@ -87,29 +88,30 @@ CONFIGURE_ARGS=	--disable-root-check \
 		--with-cachedir=${CACHEDIR} \
 		--with-cacheowner=${CACHEOWN} \
 		--with-calendardir=${CALENDIR} \
-		--with-certsdir=${SYSCONFDIR} \
+		--with-mydatadir=${SYSCONFDIR} \
 		--with-transport='${WITH_TRANSPORT}' \
 		--with-default-maildrop=${MAILDROPDEFAULT} \
 		--with-paranoid-smtpext \
-		--enable-workarounds-for-imap-client-bugs
+		--enable-workarounds-for-imap-client-bugs \
+		--with-notice=unicode
+
 CPPFLAGS+=	-I${LOCALBASE}/include
 LIBS+=		-L${LOCALBASE}/lib
 
 INSTALL_TARGET=	install-strip install-perms
 
 PLIST_SUB+=	BINOWN="${BINOWN}" BINGRP="${BINGRP}" \
+		CACHEOWN="${CACHEOWN}" CACHEDIR="${CACHEDIR}" \
+		CALENDIR="${CALENDIR}" LOCALSTATEDIR="${LOCALSTATEDIR}" \
 		MAILOWN="${MAILOWN}" MAILGRP="${MAILGRP}" \
 		MAILUID="${MAILUID}" MAILGID="${MAILGID}" \
-		CACHEOWN="${CACHEOWN}" CACHEDIR="${CACHEDIR}" \
-		CALENDIR="${CALENDIR}" LOCALSTATEDIR="${LOCALSTATEDIR}"
+		SHAREOWN="${SHAREOWN}" SHAREGRP="${SHAREGRP}"
+
 SUB_LIST:=	${PLIST_SUB}
 SUB_FILES+=	pkg-message crontab sharedindexupdate
-#SUB_FILES+=	pkg-install pkg-message crontab sharedindexupdate
 
-OPTIONS_DEFINE=	LDAP PROCMAIL SENDFAX UUCP IPV6 MAILDROPFLAGS DOCS
+OPTIONS_DEFINE=	LDAP PROCMAIL SENDFAX UUCP IPV6 DOCS CERTSDIR
 OPTIONS_GROUP=	WEBMAIL
-#OPTIONS_GROUP=	SYSTEM WEBMAIL
-#OPTIONS_GROUP_SYSTEM=	RCCONF MAILCONF PERIODIC
 OPTIONS_GROUP_WEBMAIL=	GNUPG WEBMAILRSENT WEBMAILFLAGS WEBMAILXFACE
 OPTIONS_RADIO=	ALIASES SPELL
 OPTIONS_RADIO_ALIASES=	SYSTEMALIASES EMPTYALIASES
@@ -123,7 +125,7 @@ ISPELL_DESC=	ISpell support for WebMail
 PROCMAIL_DESC=	Procmail local delivery support
 SENDFAX_DESC=	mgetty+sendfax support
 UUCP_DESC=	UUCP support
-MAILDROPFLAGS_DESC=	maildrop set flags patch
+CERTSDIR_DESC=	separate .pem directory for certificates
 WEBMAILRSENT_DESC=	enable Autorename Sent folder
 WEBMAILFLAGS_DESC=	webmail show flags patch
 WEBMAILXFACE_DESC=	experimental webmail X-Face patch
@@ -136,7 +138,6 @@ PERIODIC_DESC=	modify/create periodic.conf
 .include <bsd.port.options.mk>
 
 .include "${.CURDIR}/Makefile.doc"
-.include "${.CURDIR}/Makefile.own"
 
 .if ${PORT_OPTIONS:MLDAP}
 USES+=	ldap
@@ -174,6 +175,9 @@ SUB_LIST+=	WITHEMPTYALIASES="@comment "
 .if ${PORT_OPTIONS:MGNUPG}
 BUILD_DEPENDS+=	gpg:security/gnupg
 RUN_DEPENDS+=	gpg:security/gnupg
+.else
+# This is a hack! But works well (at least partially) for me...
+CONFIGURE_ENV+=	GPG="${WRKSRC}/fakegpg"
 .endif
 
 .if ${PORT_OPTIONS:MASPELL}
@@ -224,17 +228,13 @@ CONFIGURE_ARGS+=--with-ipv6
 CONFIGURE_ARGS+=--without-ipv6
 .endif
 
-.if ${PORT_OPTIONS:MMAILDROPFLAGS}
-EXTRA_PATCHES+=	${FILESDIR}/extra-patch-maildrop__maildir.C
-.endif
-
 .if ${PORT_OPTIONS:MWEBMAILXFACE}
-EXTRA_PATCHES+=	${FILESDIR}/extra-patch-webmail__msg2html.c
+EXTRA_PATCHES+=	${FILESDIR}/extra-patch-libs__sqwebmail__msg2html.c
 .endif
 
 .if ${PORT_OPTIONS:MWEBMAILFLAGS}
-EXTRA_PATCHES+=	${FILESDIR}/extra-patch-webmail__folder.c ${FILESDIR}/extra-patch-webmail__maildir.c
-EXTRA_PATCHES+=	${FILESDIR}/extra-patch-webmail__maildir.h ${FILESDIR}/extra-patch-webmail__images__sqwebmail.css
+EXTRA_PATCHES+=	${FILESDIR}/extra-patch-libs__sqwebmail__folder.c ${FILESDIR}/extra-patch-libs__sqwebmail__maildir.c
+EXTRA_PATCHES+=	${FILESDIR}/extra-patch-libs__sqwebmail__maildir.h ${FILESDIR}/extra-patch-libs__sqwebmail__images__sqwebmail.css
 .endif
 
 .if ${PORT_OPTIONS:MWEBMAILRSENT}
@@ -261,97 +261,131 @@ SUB_LIST+=	PERIODIC="y"
 SUB_LIST+=	PERIODIC="n"
 .endif
 
-.if ${SSL_DEFAULT} == base
-BROKEN_FreeBSD_12=	pkg-static: Unable to access file /wrkdirs/usr/ports/mail/courier/work/stage/usr/local/bin/couriertls
-BROKEN_FreeBSD_13=	pkg-static: Unable to access file /wrkdirs/usr/ports/mail/courier/work/stage/usr/local/bin/couriertls
+.if ${PORT_OPTIONS:MCERTSDIR}
+CONFIGURE_ARGS+=--with-certsdir=${SYSCONFDIR}/.pem
+PLIST_SUB+=	WITHCERTSDIR=""
+SUB_LIST+=	CERTSDIR="${SYSCONFDIR}/.pem"
+.else
+CONFIGURE_ARGS+=--with-certsdir=${SYSCONFDIR}
+PLIST_SUB+=	WITHCERTSDIR="@comment "
+SUB_LIST+=	CERTSDIR="${SYSCONFDIR}"
 .endif
 
+_CNFFILES=	esmtpd.cnf \
+		imapd.cnf \
+		pop3d.cnf
+
+_DISTEXFILES=	courierd.dist \
+		esmtpd-msa.dist \
+		esmtpd-ssl.dist \
+		esmtpd.dist \
+		faxcoverpage.tr.dist \
+		faxnotifyrc.dist \
+		faxrc.dist \
+		imapd-ssl.dist \
+		imapd.dist \
+		ldapaddressbook.dist \
+		ldapaliasrc.dist \
+		pop3d-ssl.dist \
+		pop3d.dist \
+		sqwebmaild.dist \
+		webmlmrc.dist
+
 pre-everything::
 	@${ECHO_MSG} "===> --------------------------------------------------------"
 	@${ECHO_MSG} "===>	Run 'make config' to (re)configure ${PKGNAME}"
 	@${ECHO_MSG} "===> --------------------------------------------------------"
 
 pre-patch:
-	@${CP} ${TEMPLATES}/config.guess ${TEMPLATES}/config.sub ${WRKSRC}
+	${CP} ${TEMPLATES}/config.guess ${TEMPLATES}/config.sub ${WRKSRC}
 
 post-patch:
-	@${REINPLACE_CMD} -i '' -e 's|#! perl|#!${PERL}|g' \
+	${REINPLACE_CMD} -i '' -e 's|#! perl|#!${PERL}|g' \
 		${WRKSRC}/webadmin/*.pl \
 		${WRKSRC}/webadmin/*.pl.in \
 		${WRKSRC}/courier/webadmin/*.pl \
 		${WRKSRC}/courier/webadmin/*.pl.in
-	@${REINPLACE_CMD} -e 's|^PROG=\./|PROG=exec ./|g' \
+	${REINPLACE_CMD} -e 's|^PROG=\./|PROG=exec ./|g' \
 		${WRKSRC}/courier/module.*/courier.config
-	@${REINPLACE_CMD} -e 's|@mydatadir@|@sysconfdir@|g' \
-		${WRKSRC}/*/mk*cert.* \
+	${REINPLACE_CMD} -e 's|@mydatadir@|@sysconfdir@|g' \
 		${WRKSRC}/*/*/mk*cert.*
-	@${REINPLACE_CMD} -e 's|^\(TLS_CERTFILE=\)@mydatadir@|\1@sysconfdir@|g' \
+	${REINPLACE_CMD} -e 's|^\(TLS_CERTFILE=\)@mydatadir@|\1@sysconfdir@|g' \
+		${WRKSRC}/*/*.dist.in \
+		${WRKSRC}/*/*/*.dist.in
+	${REINPLACE_CMD} -e 's|^\(TLS_DHPARAMS=\)@mydatadir@|\1@sysconfdir@|g' \
 		${WRKSRC}/*/*.dist.in \
 		${WRKSRC}/*/*/*.dist.in
-	@${REINPLACE_CMD} -e 's|^\(RANDFILE[[:space:]]*=[[:space:]]*\)@mydatadir@|\1@sysconfdir@|g' \
-		${WRKSRC}/*/*.cnf.openssl.in \
+	${REINPLACE_CMD} -e 's|^\(RANDFILE[[:space:]]*=[[:space:]]*\)@mydatadir@|\1@sysconfdir@|g' \
 		${WRKSRC}/*/*/*.cnf.openssl.in
-	@${REINPLACE_CMD} -e 's|$$(INSTALL_DATA) \(.$$$$file.\)|${INSTALL_MAN} \1|' \
+	${REINPLACE_CMD} -e 's|$$(INSTALL_DATA) \(.$$$$file.\)|${INSTALL_MAN} \1|' \
 		${WRKSRC}/Makefile.in \
 		${WRKSRC}/*/Makefile.in \
 		${WRKSRC}/*/*/Makefile.in \
 		${WRKSRC}/*/*/*/Makefile.in
-	@${REINPLACE_CMD} -e 's|^\(INSTALL_STRIP_PROGRAM=\).*$$|\1"${INSTALL_PROGRAM} -s"|' \
+	${REINPLACE_CMD} -e 's|^\(INSTALL_STRIP_PROGRAM=\).*$$|\1"${INSTALL_PROGRAM} -s"|' \
 			-e 's|; ldapaliasd="yes"||' \
 		${WRKSRC}/configure \
 		${WRKSRC}/*/configure \
 		${WRKSRC}/*/*/configure \
 		${WRKSRC}/*/*/*/configure
-	@${REINPLACE_CMD} -E -e 's/(root|bin)[[:space:]]*bin/root	wheel/g' \
+	${REINPLACE_CMD} -E -e 's/(root|bin)[[:space:]]*bin/root	wheel/g' \
 		${WRKSRC}/courier/perms.sh.in
-	@${REINPLACE_CMD} '/^courieresmtp_LDADD =/s/$$/ -lcourierauth/' \
+	${REINPLACE_CMD} '/^courieresmtp_LDADD =/s/$$/ -lcourierauth/' \
 		${WRKSRC}/courier/module.esmtp/Makefile.in
 # Avoid conflict with C++20 <version> by adding .txt suffix
-	@${REINPLACE_CMD} -i .c++20 's/>version$$/&.txt/' ${WRKSRC}/configure
-	@${FIND} ${WRKSRC} -name configure -exec ${REINPLACE_CMD} \
+	${REINPLACE_CMD} -i .c++20 's/>version$$/&.txt/' ${WRKSRC}/configure
+	${FIND} ${WRKSRC} -name configure -exec ${REINPLACE_CMD} \
 		-i .c++20 '/^version.*cat/s,/version,&.txt,' {} +
 
+pre-configure:
+# This is a hack! But works well (at least partially) for me...
+	touch ${WRKSRC}/fakegpg
+	chmod +x ${WRKSRC}/fakegpg
+
 post-build:
-	@${PERL} -pi -e 's|^(auth)\s+(required).*|$$1\t\t$$2\tpam_unix.so\ttry_first_pass|g;' \
-		     -e 's|^(account)\s+(required).*|$$1 \t$$2\tpam_unix.so|g;' \
-		     -e 's|^(session)\s+(required).*|$$1 \t$$2\tpam_permit.so|g;' \
+	${PERL} -pi -e 's|^(auth)\s+(required).*|$$1\t\t$$2\tpam_unix.so\ttry_first_pass|g;' \
+		    -e 's|^(account)\s+(required).*|$$1 \t$$2\tpam_unix.so|g;' \
+		    -e 's|^(session)\s+(required).*|$$1 \t$$2\tpam_permit.so|g;' \
 		${WRKSRC}/*/*.authpam* \
 		${WRKSRC}/*/*/*.authpam*
-	@${LN} -f ${WRKSRC}/gpglib/README.html		${WRKSRC}/gpglib/README.gpglib.html
-	@${LN} -f ${WRKSRC}/imap/BUGS			${WRKSRC}/imap/BUGS.imap
-	@${LN} -f ${WRKSRC}/imap/BUGS.html		${WRKSRC}/imap/BUGS.imap.html
-	@${LN} -f ${WRKSRC}/imap/README			${WRKSRC}/imap/README.imap
-	@${LN} -f ${WRKSRC}/imap/README.html		${WRKSRC}/imap/README.imap.html
-	@${LN} -f ${WRKSRC}/maildrop/README.html	${WRKSRC}/maildrop/README.maildrop.html
-	@${LN} -f ${WRKSRC}/pcp/README.html		${WRKSRC}/pcp/README.pcp.html
-	@${LN} -f ${WRKSRC}/webmail/BUGS		${WRKSRC}/webmail/BUGS.webmail
-	@${LN} -f ${WRKSRC}/webmail/BUGS.html		${WRKSRC}/webmail/BUGS.webmail.html
-	@${LN} -f ${WRKSRC}/webmail/SECURITY		${WRKSRC}/webmail/SECURITY.webmail
-	@${LN} -f ${WRKSRC}/webmail/SECURITY.html	${WRKSRC}/webmail/SECURITY.webmail.html
+	${INSTALL} -lrs ${WRKSRC}/libs/gpglib/README.html	${WRKSRC}/libs/gpglib/README.gpglib.html
+	${INSTALL} -lrs ${WRKSRC}/libs/imap/BUGS		${WRKSRC}/libs/imap/BUGS.imap
+	${INSTALL} -lrs ${WRKSRC}/libs/imap/BUGS.html		${WRKSRC}/libs/imap/BUGS.imap.html
+	${INSTALL} -lrs ${WRKSRC}/libs/maildrop/README.html	${WRKSRC}/libs/maildrop/README.maildrop.html
+	${INSTALL} -lrs ${WRKSRC}/libs/pcp/README.html		${WRKSRC}/libs/pcp/README.pcp.html
+	${INSTALL} -lrs ${WRKSRC}/libs/sqwebmail/BUGS		${WRKSRC}/libs/sqwebmail/BUGS.sqwebmail
+	${INSTALL} -lrs ${WRKSRC}/libs/sqwebmail/BUGS.html	${WRKSRC}/libs/sqwebmail/BUGS.sqwebmail.html
+	${INSTALL} -lrs ${WRKSRC}/libs/sqwebmail/SECURITY	${WRKSRC}/libs/sqwebmail/SECURITY.sqwebmail
+	${INSTALL} -lrs ${WRKSRC}/libs/sqwebmail/SECURITY.html	${WRKSRC}/libs/sqwebmail/SECURITY.sqwebmail.html
 
 post-install:
-	@${LN} -f ${STAGEDIR}${SYSCONFDIR}/maildrop ${STAGEDIR}${SYSCONFDIR}/maildropfilter
-	@${INSTALL_DATA} /dev/null ${STAGEDIR}${SYSCONFDIR}/locallowercase
-	@${INSTALL_DATA} ${WRKDIR}/crontab ${STAGEDIR}${SYSCONFDIR}/
-	@${INSTALL_SCRIPT} ${WRKDIR}/sharedindexupdate ${STAGEDIR}${DATADIR}/
-.for file in ${OWNER0}
-	@-${CHOWN} -Rh ${BINOWN}:${BINGRP} ${STAGEDIR}${PREFIX}/${file}
+.for _cfgfile in ${_CNFFILES}
+	-${MV} ${STAGEDIR}${SYSCONFDIR}/${_cfgfile} ${STAGEDIR}${SYSCONFDIR}/${_cfgfile:S/.cnf/.cnf.sample/g}
 .endfor
+.for _cfgfile in ${_DISTEXFILES}
+	-${MV} ${STAGEDIR}${SYSCONFDIR}/${_cfgfile} ${STAGEDIR}${SYSCONFDIR}/${_cfgfile:S/.dist/.sample/g}
+.endfor
+	${INSTALL} -lrs ${STAGEDIR}${SYSCONFDIR}/maildrop ${STAGEDIR}${SYSCONFDIR}/maildropfilter
+	${INSTALL_DATA} /dev/null ${STAGEDIR}${SYSCONFDIR}/locallowercase
+	${INSTALL_DATA} ${WRKDIR}/crontab ${STAGEDIR}${SYSCONFDIR}/
+	${INSTALL_SCRIPT} ${WRKDIR}/sharedindexupdate ${STAGEDIR}${DATADIR}/
 .if ${PORT_OPTIONS:MDOCS}
-	@${MKDIR} ${STAGEDIR}${DOCSDIR}
-	@${MKDIR} ${STAGEDIR}${DOCSDIR}/html
+	${MKDIR} ${STAGEDIR}${DOCSDIR}
+	${MKDIR} ${STAGEDIR}${DOCSDIR}/html
 .for f in ${DOCS}
-	@${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${DOCSDIR}
+	${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${DOCSDIR}
 .endfor
 .for f in ${HTMLDOCS}
-	@${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${DOCSDIR}/html
+	${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${DOCSDIR}/html
 .endfor
-	@${INSTALL_DATA} ${STAGEDIR}${DATADIR}/htmldoc/* ${STAGEDIR}${DOCSDIR}/html
+	${INSTALL_DATA} ${STAGEDIR}${DATADIR}/htmldoc/* ${STAGEDIR}${DOCSDIR}/html
+.endif
+.if ${PORT_OPTIONS:MCERTSDIR}
+	${MKDIR} ${STAGEDIR}${SYSCONFDIR}/.pem
 .endif
-	@${RM} -r ${STAGEDIR}${DATADIR}/htmldoc
-	@-${CHOWN} -Rh ${SHAREOWN}:${SHAREGRP} ${STAGEDIR}${DATADIR}
-	@${CHMOD} -R a+r ${STAGEDIR}${DATADIR}/courierwebadmin
-	@${CHMOD} -R a-w ${STAGEDIR}${DATADIR} ${STAGEDIR}${LIBEXECDIR}/courier
-	@${CHMOD} 550 ${STAGEDIR}${LIBEXECDIR}/courier/modules/esmtp/courieresmtp*
+	${RM} -r ${STAGEDIR}${DATADIR}/htmldoc
+	${CHMOD} -R a+r ${STAGEDIR}${DATADIR}/courierwebadmin
+	${CHMOD} -R a-w ${STAGEDIR}${DATADIR} ${STAGEDIR}${LIBEXECDIR}/courier
+	${CHMOD} 550 ${STAGEDIR}${LIBEXECDIR}/courier/modules/esmtp/courieresmtp*
 
 .include <bsd.port.mk>
diff --git a/mail/courier/Makefile.doc b/mail/courier/Makefile.doc
index a0e0cfcc166e..d93cdb4798c9 100644
--- a/mail/courier/Makefile.doc
+++ b/mail/courier/Makefile.doc
@@ -8,24 +8,22 @@ DOCS=	AUTHORS \
 	NEWS \
 	README \
 	TODO \
-	imap/BUGS.imap \
-	imap/README.imap \
-	imap/README.proxy \
-	maildir/README.maildirquota.txt \
-	maildir/README.sharedfolders.txt \
-	tcpd/README.couriertls \
-	webmail/BUGS.webmail \
-	webmail/SECURITY.webmail
+	libs/imap/BUGS.imap \
+	libs/imap/README.imap.proxy \
+	libs/maildir/README.maildirquota.txt \
+	libs/maildir/README.sharedfolders.txt \
+	libs/tcpd/README.couriertls \
+	libs/sqwebmail/BUGS.webmail \
+	libs/sqwebmail/SECURITY.webmail
 
 HTMLDOCS=NEWS.html \
-	gpglib/README.gpglib.html \
-	imap/BUGS.imap.html \
-	imap/README.imap.html \
-	imap/README.proxy.html \
-	maildir/README.maildirfilter.html \
-	maildir/README.maildirquota.html \
-	maildir/README.sharedfolders.html \
-	maildrop/README.maildrop.html \
-	pcp/README.pcp.html \
-	webmail/BUGS.webmail.html \
-	webmail/SECURITY.webmail.html
+	libs/gpglib/README.gpglib.html \
+	libs/imap/BUGS.imap.html \
+	libs/imap/README.imap.proxy.html \
+	libs/maildir/README.maildirfilter.html \
+	libs/maildir/README.maildirquota.html \
+	libs/maildir/README.sharedfolders.html \
+	libs/maildrop/README.maildrop.html \
+	libs/pcp/README.pcp.html \
+	libs/sqwebmail/BUGS.webmail.html \
+	libs/sqwebmail/SECURITY.webmail.html
diff --git a/mail/courier/Makefile.own b/mail/courier/Makefile.own
deleted file mode 100644
index 3d1b346df0ba..000000000000
--- a/mail/courier/Makefile.own
+++ /dev/null
@@ -1,67 +0,0 @@
-OWNER0=	bin/courier-config \
-	bin/couriermlm \
-	bin/couriertls \
-	bin/deliverquota \
-	bin/dotforward \
-	bin/imapd \
-	bin/lockmail \
-	bin/mailbot \
-	bin/maildirmake \
-	bin/maildiracl \
-	bin/maildirkw \
-	bin/makemime \
-	bin/mimegpg \
-	bin/preline \
-	bin/reformail \
-	bin/reformime \
-	bin/sendmail \
-	bin/testmxlookup \
-	bin/webmlmd \
-	bin/webmlmd.rc \
-	etc/courier/courierd.dist \
-	etc/courier/enablefiltering \
-	etc/courier/esmtp.authpam \
-	etc/courier/esmtpd-msa.dist \
-	etc/courier/esmtpd-ssl.dist \
-	etc/courier/esmtpd.cnf \
-	etc/courier/esmtpd.dist \
-	etc/courier/imapd-ssl.dist \
-	etc/courier/imapd.authpam \
-	etc/courier/imapd.cnf \
-	etc/courier/imapd.dist \
-	etc/courier/ldapaddressbook.dist \
-	etc/courier/locallowercase \
-	etc/courier/maildrop \
-	etc/courier/maildropfilter \
-	etc/courier/pop3d-ssl.dist \
-	etc/courier/pop3d.authpam \
-	etc/courier/pop3d.cnf \
-	etc/courier/pop3d.dist \
-	etc/courier/quotawarnmsg.example \
-	etc/courier/rfcerr2045.txt \
-	etc/courier/rfcerr2046.txt \
-	etc/courier/rfcerr2047.txt \
-	etc/courier/rfcerrheader.txt \
-	etc/courier/smtpaccess/default \
-	etc/courier/webmail.authpam \
-	etc/courier/webmlmrc.dist \
-	libexec/courier/courierpop3d \
-	libexec/courier/courierpop3login \
-	libexec/courier/imaplogin \
-	libexec/courier/makedatprog \
-	libexec/courier/modules \
-	libexec/courier/pcpd \
-	libexec/courier/sqwebmaild \
-	libexec/courier/webmail/webadmin \
-	libexec/courier/webmail/webmail \
-	libexec/courier/webmail/webmlm \
-	libexec/filters/dupfilter \
-	libexec/filters/perlfilter \
-	sbin/courier \
-	sbin/couriertcpd \
-	sbin/showconfig \
-	sbin/webmaild
-
-.if defined(WITH_LDAP) && !defined(WITHOUT_LDAP)
-OWNER0+=sbin/courierldapaliasd
-.endif
diff --git a/mail/courier/distinfo b/mail/courier/distinfo
index 0d76693c1c49..af6d59963b10 100644
--- a/mail/courier/distinfo
+++ b/mail/courier/distinfo
@@ -1,2 +1,3 @@
-SHA256 (courier-0.65.3.tar.bz2) = a743ba01137230165b00d726cf0faef3998d43edc0bfb00d8358eeefd96c7d60
-SIZE (courier-0.65.3.tar.bz2) = 7152828
+TIMESTAMP = 1686226592
+SHA256 (courier-1.1.11.tar.bz2) = 4fe3b73e7da159351ab973b52044996aa0006076f2effdcc4c004be087c5f777
+SIZE (courier-1.1.11.tar.bz2) = 7895772
diff --git a/mail/courier/files/courier.in b/mail/courier/files/courier.in
index 2dcecaa786e6..45a3e5a54bf5 100644
--- a/mail/courier/files/courier.in
+++ b/mail/courier/files/courier.in
@@ -13,6 +13,7 @@
 prefix="%%PREFIX%%"
 exec_prefix="${prefix}"
 sysconfdir="${prefix}/etc/courier"
+certsdir="%%CERTSDIR%%"
 sbindir="${exec_prefix}/sbin"
 bindir="${exec_prefix}/bin"
 libexecdir="${prefix}/libexec"
@@ -127,7 +128,7 @@ courier_start()
 
 	if [ "$esmtpdcert" = 1 ]; then
 		# If we do not have a certificate, make one up.
-		if [ ! -f ${sysconfdir}/esmtpd.pem \
+		if [ ! -f ${certsdir}/esmtpd.pem \
 		  -a -x "$COURIERTLS" \
 		  -a -x ${sbindir}/mkesmtpdcert ]; then
 			echo -n " generating-ESMTP-SSL-certificate..."
@@ -194,10 +195,12 @@ courier_start()
 		case "$IMAPDSSLSTART" in
 		[Yy]*)	# If we do not have a certificate, make one up.
 			if [ -x "$COURIERTLS" ]; then
-				if [ ! -f ${sysconfdir}/imapd.pem \
+				if [ ! -f ${certsdir}/imapd.pem \
 				  -a -x ${sbindir}/mkimapdcert ]; then
 					echo -n " generating-IMAP-SSL-certificate..."
 					${sbindir}/mkimapdcert >/dev/null 2>&1
+					# double usage - DH params need to exist
+					esmtpdcert=1
 				fi
 				if [ -x ${sbindir}/imapd-ssl ]; then
 					echo -n " imapd-ssl"
@@ -227,10 +230,12 @@ courier_start()
 		case "$POP3DSSLSTART" in
 		[Yy]*)	# If we do not have a certificate, make one up.
 			if [ -x "$COURIERTLS" ]; then
-				if [ ! -f ${sysconfdir}/pop3d.pem \
+				if [ ! -f ${certsdir}/pop3d.pem \
 				  -a -x ${sbindir}/mkpop3dcert ]; then 
 					echo -n " generating-POP3-SSL-certificate..."
 					${sbindir}/mkpop3dcert >/dev/null 2>&1
+					# double usage - DH params need to exist
+					esmtpdcert=1
 				fi
 				if [ -x ${sbindir}/pop3d-ssl ]; then
 					echo -n " pop3d-ssl"
@@ -241,6 +246,15 @@ courier_start()
 		esac
 	fi
 
+	if [ "$esmtpdcert" = 1 ]; then
+		# If we do not have DH params, make them up.
+		if [ ! -f ${certsdir}/dhparams.pem \
+		  -a -x ${sbindir}/mkdhparams ]; then
+			echo -n " generating-DH-params..."
+			${sbindir}/mkdhparams >/dev/null 2>&1
+		fi
+	fi
+
 	LISTS=""
 	if [ -f ${sysconfdir}/webmlmrc ]; then 
 		. ${sysconfdir}/webmlmrc
diff --git a/mail/courier/files/extra-patch-maildrop__maildir.C b/mail/courier/files/extra-patch-maildrop__maildir.C
deleted file mode 100644
index ba1d64c18051..000000000000
--- a/mail/courier/files/extra-patch-maildrop__maildir.C
+++ /dev/null
@@ -1,33 +0,0 @@
---- maildrop/maildir.C.orig	Thu Jan 15 04:12:13 2004
-+++ maildrop/maildir.C	Thu Jul  5 00:09:38 2007
-@@ -137,7 +137,6 @@
- 			tmpname=createInfo.tmpname;
- 			newname=createInfo.newname;
- 			tmpname += '\0';
--			newname += '\0';
- 			maildir_tmpcreate_free(&createInfo);
- 
- 			file.fd(f);
-@@ -181,6 +180,22 @@
- {
- 	if (is_open)
- 	{
-+		Buffer b;
-+
-+		b="MFLAGS";
-+
-+		const char *f=GetVarStr(b);
-+
-+		if (f && strlen(f) > 0)
-+		{
-+			newname += ':';
-+			newname += '2';
-+			newname += ',';
-+			newname += f;
-+		}
-+
-+		newname += '\0';
-+
- 		Buffer keywords;
- 
- 		keywords="KEYWORDS";
diff --git a/mail/courier/files/extra-patch-webmail__folder.c b/mail/courier/files/extra-patch-webmail__folder.c
index d1a6139cbcd3..d62fbc5703e3 100644
--- a/mail/courier/files/extra-patch-webmail__folder.c
+++ b/mail/courier/files/extra-patch-webmail__folder.c
@@ -1,7 +1,7 @@
---- webmail/folder.c.orig	2008-07-20 19:00:33.000000000 +0200
-+++ webmail/folder.c	2009-06-04 08:32:54.000000000 +0200
-@@ -247,6 +247,18 @@
- 	return (maildir_msgmovefile(folder, file, cgi("moveto"), pos));
+--- libs/sqwebmail/folder.c.orig	2008-07-20 19:00:33.000000000 +0200
++++ libs/sqwebmail/folder.c	2009-06-04 08:32:54.000000000 +0200
+@@ -331,6 +331,18 @@
+ 	return rc ? "quota":"";
  }
  
 +static int groupmark(const char *folder, const char *file, size_t pos)
@@ -18,10 +18,10 @@
 +
  void folder_delmsgs(const char *dir, size_t pos)
  {
- 	int	rc=0;
-@@ -317,6 +329,16 @@
- 		rc=group_movedel( dir, &groupmove );
- 		maildir_savefoldermsgs(dir);
+ 	const char *status=do_folder_delmsgs(dir, pos);
+@@ -392,6 +404,16 @@
+ 		}
+ 		fclose(fp);
  	}
 +	else if (*cgi("cmdmark"))
 +	{
@@ -34,42 +34,18 @@
 +		maildir_savefoldermsgs(dir);
 +	} 
  
- 	maildir_cleanup();
- 
-@@ -441,7 +463,7 @@
- 
- 	folder_navigate(dir, pos, highend, morebefore, moreafter);
+ 	fprintf(ofp, "%s\n%s\n", maildir, path);
+ 	fclose(ofp);
+@@ -510,7 +532,7 @@
+ 	folder_navigate(dir, pos, highend, morebefore, moreafter,
+ 			last_message_searched_ptr);
  
 -	printf("<table width=\"100%%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\"><tr class=\"folder-index-header\"><th align=\"center\">%s</th><th>&nbsp;</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>\n",
 +	printf("<table width=\"100%%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\"><tr class=\"folder-index-header\"><th align=\"center\">%s</th><th>&nbsp;</th><th>&nbsp;</th><th>&nbsp;</th><th>%s</th><th>%s</th><th>%s</th><th>%s</th></tr>\n",
  		getarg("NUM"),
  		getarg("DATE"),
  		(strncmp(dir, INBOX "." SENT, sizeof(INBOX)+sizeof(SENT)-1) &&
-@@ -486,12 +508,13 @@
- 		if ((q=strrchr(p, '/')) != 0)
- 			p=q+1;
- 
--		printf("<tr class=\"folder-index-bg-%d\" id=\"row%d\"><td align=\"right\" class=\"message-number\">%s%ld.%s</td><td class=\"message-status\"><input type=\"checkbox\" name=\"MOVE-%ld\" id=\"MOVE-%ld",
-+		printf("<tr class=\"folder-index-bg-%d\" id=\"row%d\"><td align=\"right\" class=\"message-number\">%s%ld.%s</td><td class=\"message-flag\">%s</td><td class=\"message-select\"><input type=\"checkbox\" name=\"MOVE-%ld\" id=\"MOVE-%ld",
- 		       (i & 1)+1,
- 		       i,
- 		       folder_index_entry_start,
- 		       (long)(i+pos+1),
- 		       folder_index_entry_end,
-+		       maildirfile_flag(MSGINFO_FILENAME(contents[i])) ? "<font color=\"red\">!</font>" : "",
- 		       (long) (pos+i),
- 		       (long) (pos+i));
- 		printf("\" onchange=\"setsel('MOVE-%ld', 'row%d', 'folder-index-bg-%d');\"%s /><input type=\"hidden\" name=\"MOVEFILE-%ld\" value=\"",
-@@ -499,7 +522,7 @@
- 			(type[0] == MSGTYPE_DELETED ? " disabled=\"disabled\"":""),
- 			(long)(pos+i));
- 		output_attrencoded(p);
--		printf("\" />&nbsp;%s%s%s</td><td class=\"message-date\">%s",
-+		printf("\" /></td><td class=\"message-status\">%s%s%s</td><td class=\"message-date\">%s",
- 		       folder_index_entry_start,
- 		       type,
- 		       folder_index_entry_end,
-@@ -545,9 +568,9 @@
+@@ -531,9 +553,9 @@
  
  	if (found)
  	{
@@ -82,7 +58,7 @@
  
  		puts("<script type=\"text/javascript\">");
  		puts("/* <![CDATA[ */");
-@@ -578,7 +601,7 @@
+@@ -565,7 +587,7 @@
  	}
  	if (!found && nomsg)
  	{
@@ -91,9 +67,33 @@
  		puts(nomsg);
  		puts("<br /></p></td></tr>");
  		printf("</table>\n");
-@@ -3364,7 +3387,7 @@
+@@ -630,12 +652,13 @@
+ 	if ((q=strrchr(p, '/')) != 0)
+ 		p=q+1;
+ 
+-	printf("<tr class=\"folder-index-bg-%d\" id=\"row%d\"><td align=\"right\" class=\"message-number\">%s%ld.%s</td><td class=\"message-status\"><input type=\"checkbox\" name=\"MOVE-%ld\" id=\"MOVE-%ld",
++	printf("<tr class=\"folder-index-bg-%d\" id=\"row%d\"><td align=\"right\" class=\"message-number\">%s%ld.%s</td><td class=\"message-flag\">%s</td><td class=\"message-select\"><input type=\"checkbox\" name=\"MOVE-%ld\" id=\"MOVE-%ld",
+ 	       (row & 1)+1,
+ 	       row,
+ 	       folder_index_entry_start,
+ 	       (long)(msgnum+1),
+ 	       folder_index_entry_end,
++	       maildirfile_flag(MSGINFO_FILENAME(contents[i])) ? "<font color=\"red\">!</font>" : "",
+ 	       (long) (msgnum),
+ 	       (long) (msgnum));
+ 	printf("\" onchange=\"setsel('MOVE-%ld', 'row%d', 'folder-index-bg-%d');\"%s /><input type=\"hidden\" name=\"MOVEFILE-%ld\" value=\"",
+@@ -643,7 +666,7 @@
+ 	       (type[0] == MSGTYPE_DELETED ? " disabled=\"disabled\"":""),
+ 	       (long)(msgnum));
+ 	output_attrencoded(p);
+-	printf("\" />&nbsp;%s%s%s</td><td class=\"message-date\">%s",
++	printf("\" /></td><td class=\"message-status\">%s%s%s</td><td class=\"message-date\">%s",
+ 	       folder_index_entry_start,
+ 	       type,
+ 	       folder_index_entry_end,
+@@ -3645,7 +3668,7 @@
  	if ((strcmp(sqwebmail_folder, INBOX "." TRASH) == 0) && (strlen(getarg("PURGEALL"))))
- 	    printf("<input type=\"submit\" name=\"cmdpurgeall\" value=\"%s\" onclick=\"javascript: return deleteAll();\" />", 
+ 	    printf("<input type=\"submit\" name=\"cmdpurgeall\" value=\"%s\" onclick=\"javascript: return deleteAll();\" />",
  		getarg("PURGEALL"));
 -	printf("<input type=\"submit\" name=\"cmddel\" value=\"%s\" />%s<select name=\"moveto\">",
 +	printf("<input type=\"submit\" name=\"cmddel\" value=\"%s\" />, <input type=\"submit\" name=\"cmdmark\" value=\"Mark\" />, <input type=\"submit\" name=\"cmdunmark\" value=\"Unmark\" />%s<select name=\"moveto\">",
diff --git a/mail/courier/files/extra-patch-webmail__images__sqwebmail.css b/mail/courier/files/extra-patch-webmail__images__sqwebmail.css
index adedc27b6ec5..de75c1143f8f 100644
--- a/mail/courier/files/extra-patch-webmail__images__sqwebmail.css
+++ b/mail/courier/files/extra-patch-webmail__images__sqwebmail.css
@@ -1,6 +1,6 @@
---- webmail/images/sqwebmail.css.orig	2009-06-04 08:27:30.000000000 +0200
-+++ webmail/images/sqwebmail.css	2009-06-04 08:33:54.000000000 +0200
-@@ -142,6 +142,9 @@
+--- libs/sqwebmail/images/sqwebmail.css.orig	2009-06-04 08:27:30.000000000 +0200
++++ libs/sqwebmail/images/sqwebmail.css	2009-06-04 08:33:54.000000000 +0200
+@@ -169,6 +169,9 @@
  .folder-index-bg-1:hover { background-color: #bbbbbb }
  .folder-index-bg-2 { background-color: #ddddbb }
  .folder-index-bg-2:hover { background-color: #bbbbbb }
@@ -8,9 +8,9 @@
 +.folder-index-bg-3 { background-color: #ffffff }
 +.folder-index-bg-4 { background-color: #eeeecc }
  
- 	/* Selected message */
+ .folder-index-bg-1, .folder-index-bg-2 { white-space: nowrap }
  
-@@ -159,11 +162,13 @@
+@@ -188,7 +191,9 @@
  */
  
  .message-number { }
@@ -21,8 +21,3 @@
  .message-date { }
  .message-from { }
  .message-subject { }
--.message-size { font-family: monospace}
-+.message-size { font-family: monospace }
- 
- /***************************** Folder permissions ***********************/
- 
diff --git a/mail/courier/files/extra-patch-webmail__maildir.c b/mail/courier/files/extra-patch-webmail__maildir.c
index dfd1f2a1e132..a6b96b375296 100644
--- a/mail/courier/files/extra-patch-webmail__maildir.c
+++ b/mail/courier/files/extra-patch-webmail__maildir.c
@@ -1,5 +1,5 @@
---- webmail/maildir.c.orig	2008-07-20 05:15:08.000000000 +0200
-+++ webmail/maildir.c	2009-06-03 22:41:49.000000000 +0200
+--- libs/sqwebmail/maildir.c.orig	2008-07-20 05:15:08.000000000 +0200
++++ libs/sqwebmail/maildir.c	2009-06-03 22:41:49.000000000 +0200
 @@ -1091,6 +1091,42 @@
  	return (rc);
  }
diff --git a/mail/courier/files/extra-patch-webmail__maildir.h b/mail/courier/files/extra-patch-webmail__maildir.h
index 71d4700415cc..6dff5f0ff87d 100644
--- a/mail/courier/files/extra-patch-webmail__maildir.h
+++ b/mail/courier/files/extra-patch-webmail__maildir.h
@@ -1,6 +1,6 @@
---- webmail/maildir.h.orig	2004-02-17 01:58:24.000000000 +0100
-+++ webmail/maildir.h	2009-06-04 08:40:43.000000000 +0200
-@@ -35,12 +35,15 @@
+--- libs/sqwebmail/maildir.h.orig	2004-02-17 01:58:24.000000000 +0100
++++ libs/sqwebmail/maildir.h	2009-06-04 08:40:43.000000000 +0200
+@@ -49,6 +49,7 @@
  extern int maildir_name2pos(const char *, const char *, size_t *);
  
  extern char maildirfile_type(const char *);
@@ -8,9 +8,10 @@
  extern void maildir_markread(const char *, size_t);
  extern void maildir_markreplied(const char *, const char *);
  extern void maildir_msgdeletefile(const char *, const char *, size_t);
- extern void maildir_msgpurge(const char *, size_t);
+@@ -56,6 +57,8 @@
  extern void maildir_msgpurgefile(const char *, const char *);
  extern void maildir_purgemimegpg();
+ extern void maildir_purgesearch();
 +extern void maildir_msgmarkfile(const char *, const char *, size_t);
 +extern void maildir_msgunmarkfile(const char *, const char *, size_t);
  
diff --git a/mail/courier/files/extra-patch-webmail__msg2html.c b/mail/courier/files/extra-patch-webmail__msg2html.c
index 00b5445f55f6..5e310aad1bad 100644
--- a/mail/courier/files/extra-patch-webmail__msg2html.c
+++ b/mail/courier/files/extra-patch-webmail__msg2html.c
@@ -1,5 +1,5 @@
---- webmail/msg2html.c.orig	2007-07-11 03:36:04.000000000 +0200
-+++ webmail/msg2html.c	2007-12-21 08:42:02.000000000 +0100
+--- libs/sqwebmail/msg2html.c.orig	2007-07-11 03:36:04.000000000 +0200
++++ libs/sqwebmail/msg2html.c	2007-12-21 08:42:02.000000000 +0100
 @@ -451,6 +451,7 @@
  char	*header, *value;
  char	*save_subject=0;
diff --git a/mail/courier/files/patch-courier__cmlmfetch.C b/mail/courier/files/patch-courier__cmlmfetch.C
deleted file mode 100644
index 80a27c2f0156..000000000000
--- a/mail/courier/files/patch-courier__cmlmfetch.C
+++ /dev/null
@@ -1,11 +0,0 @@
---- courier/cmlmfetch.C.orig	2009-11-08 18:14:47 UTC
-+++ courier/cmlmfetch.C
-@@ -334,7 +334,7 @@ int doindex(const char *n)
- 			ack << std::setiosflags(std::ios::right)
- 			    << std::setw(10)
- 			    << msgs[i]
--			    << resetiosflags(std::ios::right) << " "
-+			    << std::resetiosflags(std::ios::right) << " "
- 			    << std::setw(0) << msginfo[i].msgsubj << std::endl;
- 			ack << std::setiosflags(std::ios::right)
- 			    << std::setw(10)
diff --git a/mail/courier/files/patch-courier__configure b/mail/courier/files/patch-courier__configure
index db86e5bf09ce..304d1ca004a2 100644
--- a/mail/courier/files/patch-courier__configure
+++ b/mail/courier/files/patch-courier__configure
@@ -1,41 +1,33 @@
---- courier/configure.orig	2009-09-05 13:59:59.000000000 +0200
-+++ courier/configure	2010-02-15 20:05:20.000000000 +0100
-@@ -819,6 +819,7 @@
+--- courier/configure.orig	2019-11-16 22:02:20.000000000 +0100
++++ courier/configure	2020-04-20 23:15:06.000000000 +0200
+@@ -667,6 +667,7 @@
+ distdirlist
  dirlist
  transport
- MODE
 +piddir
- COPYRIGHT
- testmode
- COURIERAUTHCONFIG
-@@ -954,6 +955,7 @@
+ LIBIDN_LIBS
+ LIBIDN_CFLAGS
+ PKG_CONFIG_LIBDIR
+@@ -818,6 +819,7 @@
+ with_sysroot
  enable_libtool_lock
  with_softlinkdir
- with_testmode
 +with_piddir
  with_transport
  with_db
  with_courierlogger
-@@ -1629,6 +1631,7 @@
-   --with-softlinks=dir:link,dir:link...   specify soft links for
-                                           installation subdirectories.
-  -- This space intentionally left blank --
-+  --with-piddir         Directory where webmlm.pid is created
-   --with-transport='local esmtp ...'
-                           Specify list of modules to install
- 
-@@ -2553,7 +2556,7 @@
+@@ -2927,7 +2929,7 @@
  fi
  
  fi
 -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
 +INSTALL_STRIP_PROGRAM="install  -s -o root -g wheel -m 555 -s"
  
- { $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
  $as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
-@@ -15882,6 +15885,14 @@
- esac
- 
+@@ -16512,6 +16514,13 @@
+   ac_configure_args="$ac_configure_args --with-softlinkdir=$prefix"
+ fi
  
 +# Check whether --with-piddir was given.
 +if test "${with_piddir+set}" = set; then
@@ -44,20 +36,19 @@
 +    piddir=$localstatedir/run
 +fi
 +
-+
+ 
  version=`cat ../version`
  
- COPYRIGHT="Courier $version Copyright 1999-2008 Double Precision, Inc."
-@@ -18397,9 +18408,9 @@
- 
- if test "$testmode" = "0"
- then
--	INSTALL_PROGRAM='${INSTALL} -m 700'
--	INSTALL_SCRIPT='${INSTALL} -m 700'
--	INSTALL_DATA='${INSTALL} -m 600'
-+	INSTALL_PROGRAM='${BSD_INSTALL_PROGRAM}'
-+	INSTALL_SCRIPT='${BSD_INSTALL_SCRIPT}'
-+	INSTALL_DATA='${BSD_INSTALL_DATA}'
- fi
+@@ -18135,9 +18144,9 @@
+ 
+ # Automake stupidity
+ 
+-INSTALL_PROGRAM='${INSTALL} -m 700'
+-INSTALL_SCRIPT='${INSTALL} -m 700'
+-INSTALL_DATA='${INSTALL} -m 600'
++INSTALL_PROGRAM='${BSD_INSTALL_PROGRAM}'
++INSTALL_SCRIPT='${BSD_INSTALL_SCRIPT}'
++INSTALL_DATA='${BSD_INSTALL_DATA}'
  
  ac_ext=cpp
+ ac_cpp='$CXXCPP $CPPFLAGS'
diff --git a/mail/courier/files/patch-courier__doc__Makefile.in b/mail/courier/files/patch-courier__doc__Makefile.in
deleted file mode 100644
index 1d70f7f64cf6..000000000000
--- a/mail/courier/files/patch-courier__doc__Makefile.in
+++ /dev/null
@@ -1,71 +0,0 @@
---- courier/doc/Makefile.in.orig	Sun Jul  3 00:15:30 2005
-+++ courier/doc/Makefile.in	Sun Jul  3 00:15:30 2005
-@@ -1136,18 +1136,18 @@
- 	$(MAKE) do-man-install
- 
- do-man-install:
--	for f in $(mandir) $(man1dir) $(man7dir) $(man8dir) ; do test -d $(DESTDIR)$$f && chmod 755 $(DESTDIR)$$f ; done ; exit 0
-+#	for f in $(mandir) $(man1dir) $(man7dir) $(man8dir) ; do test -d $(DESTDIR)$$f && chmod 755 $(DESTDIR)$$f ; done ; exit 0
- 	for f in $(man1) ; do test -f $(DESTDIR)$(man1dir)/$$f && chmod 644 $(DESTDIR)$(man1dir)/$$f ; done ; exit 0
- 	for f in $(man5) ; do test -f $(DESTDIR)$(man5dir)/$$f && chmod 644 $(DESTDIR)$(man5dir)/$$f ; done ; exit 0
- 	for f in $(man7) ; do test -f $(DESTDIR)$(man7dir)/$$f && chmod 644 $(DESTDIR)$(man7dir)/$$f ; done ; exit 0
- 	for f in $(man8) ; do test -f $(DESTDIR)$(man8dir)/$$f && chmod 644 $(DESTDIR)$(man8dir)/$$f ; done ; exit 0
--	test -w /etc || exit 0 ; for f in $(mandir) $(man1dir) $(man5dir) $(man7dir) $(man8dir) ; do test -d $(DESTDIR)$$f && chown bin $(DESTDIR)$$f && chgrp bin $(DESTDIR)$$f ; done ; exit 0
--	test -w /etc || exit 0 ; for f in $(man1) ; do test -f $(DESTDIR)$(man1dir)/$$f && chown bin $(DESTDIR)$(man1dir)/$$f && chgrp bin $(DESTDIR)$(man1dir)/$$f ; done ; exit 0
--	test -w /etc || exit 0 ; for f in $(man5) ; do test -f $(DESTDIR)$(man5dir)/$$f && chown bin $(DESTDIR)$(man5dir)/$$f && chgrp bin $(DESTDIR)$(man5dir)/$$f ; done ; exit 0
--	test -w /etc || exit 0 ; for f in $(man7) ; do test -f $(DESTDIR)$(man7dir)/$$f && chown bin $(DESTDIR)$(man7dir)/$$f && chgrp bin $(DESTDIR)$(man7dir)/$$f ; done ; exit 0
--	test -w /etc || exit 0 ; for f in $(man8) ; do test -f $(DESTDIR)$(man8dir)/$$f && chown bin $(DESTDIR)$(man8dir)/$$f && chgrp bin $(DESTDIR)$(man8dir)/$$f ; done ; exit 0
-+#	test -w /etc || exit 0 ; for f in $(mandir) $(man1dir) $(man5dir) $(man7dir) $(man8dir) ; do test -d $(DESTDIR)$$f && chown bin $(DESTDIR)$$f && chgrp bin $(DESTDIR)$$f ; done ; exit 0
-+#	test -w /etc || exit 0 ; for f in $(man1) ; do test -f $(DESTDIR)$(man1dir)/$$f && chown bin $(DESTDIR)$(man1dir)/$$f && chgrp bin $(DESTDIR)$(man1dir)/$$f ; done ; exit 0
-+#	test -w /etc || exit 0 ; for f in $(man5) ; do test -f $(DESTDIR)$(man5dir)/$$f && chown bin $(DESTDIR)$(man5dir)/$$f && chgrp bin $(DESTDIR)$(man5dir)/$$f ; done ; exit 0
-+#	test -w /etc || exit 0 ; for f in $(man7) ; do test -f $(DESTDIR)$(man7dir)/$$f && chown bin $(DESTDIR)$(man7dir)/$$f && chgrp bin $(DESTDIR)$(man7dir)/$$f ; done ; exit 0
-+#	test -w /etc || exit 0 ; for f in $(man8) ; do test -f $(DESTDIR)$(man8dir)/$$f && chown bin $(DESTDIR)$(man8dir)/$$f && chgrp bin $(DESTDIR)$(man8dir)/$$f ; done ; exit 0
- 	for f in $(htmldoc_DATA) ; do chmod 444 $(DESTDIR)$(htmldocdir)/$$f ; done
--	test -w /etc || exit 0; for f in $(htmldoc_DATA) ; do chown bin $(DESTDIR)$(htmldocdir)/$$f ; chgrp bin $(DESTDIR)$(htmldocdir)/$$f ; done
-+#	test -w /etc || exit 0; for f in $(htmldoc_DATA) ; do chown bin $(DESTDIR)$(htmldocdir)/$$f ; chgrp bin $(DESTDIR)$(htmldocdir)/$$f ; done
- 
- status.html: config.status
- 
-@@ -1160,24 +1160,24 @@
- 	@SUBDIRS="$(SUBDIRS)" ; for f in $$SUBDIRS ; do ( cd $$f && $(MAKE) $(AM_MAKEFLAGS) install-perms ) ; cat /dev/null >>$$f/permissions.dat ; cat $$f/permissions.dat >>permissions.dat ; done
- 
- install-perms-local:
--	@echo @mandir@ 755 bin bin >>permissions.dat
--	@echo $(man1dir) 755 bin bin >>permissions.dat
--	@echo $(man5dir) 755 bin bin >>permissions.dat
*** 1524 LINES SKIPPED ***