git: 307b943e636e - main - mail/maildrop: Fix INOTIFY option

From: Guido Falsi <madpilot_at_FreeBSD.org>
Date: Sun, 20 Sep 2026 16:00:21 UTC
The branch main has been updated by madpilot:

URL: https://cgit.FreeBSD.org/ports/commit/?id=307b943e636e53d0c11f408014d01754ae42adb9

commit 307b943e636e53d0c11f408014d01754ae42adb9
Author:     Guido Falsi <madpilot@FreeBSD.org>
AuthorDate: 2026-09-20 15:58:32 +0000
Commit:     Guido Falsi <madpilot@FreeBSD.org>
CommitDate: 2026-09-20 15:58:32 +0000

    mail/maildrop: Fix INOTIFY option
    
    - FreeBSD 14.5 and up include inotify implementation in libc, so update checks to not depend on the ports implementation ion this case
    - When using the ports provided libinotify link using the dynamic library
    - Also add one file that needs patching for a successful build
    
    While here, pet portclippy/portfmt.
    
    Reported by:    Ewout1 (Excite/BlueTie) <ewout1@bluetiehome.com> (via mailing list)
    MFH:            2026Q3
---
 mail/maildrop/Makefile | 62 ++++++++++++++++++++++++++++++++------------------
 1 file changed, 40 insertions(+), 22 deletions(-)

diff --git a/mail/maildrop/Makefile b/mail/maildrop/Makefile
index cd2c85c6ba49..077270e09cba 100644
--- a/mail/maildrop/Makefile
+++ b/mail/maildrop/Makefile
@@ -13,7 +13,8 @@
 # MAILDROP_MBOX_DIR=<dir>	Specify DEFAULT mailbox location
 
 PORTNAME=	maildrop
-PORTVERSION=	4.0.4
+DISTVERSION=	4.0.4
+PORTREVISION=	1
 CATEGORIES=	mail
 MASTER_SITES=	SF/courier/${PORTNAME}/${PORTVERSION}
 
@@ -31,23 +32,23 @@ USES=		compiler:c++11-lang cpe iconv localbase:ldflags perl5 pkgconfig \
 		tar:bzip2
 USE_PERL5=	build
 GNU_CONFIGURE=	yes
-CONFIGURE_ARGS=	--enable-syslog=1 \
-		--enable-use-flock=1 \
-		--with-etcdir="${PREFIX}/etc" \
-		--enable-maildirquota
 GNU_CONFIGURE_MANPREFIX=	${PREFIX}/share
+CONFIGURE_ARGS=	--enable-maildirquota \
+		--enable-syslog=1 \
+		--enable-use-flock=1 \
+		--with-etcdir="${PREFIX}/etc"
 INSTALL_TARGET=	install-strip
 
 CONFLICTS=	courier-0.65* libunicode
 
-MAILDROP_LOG_COLUMNS?=	72	# lenght of 'File:' line in log
+MAILDROP_LOG_COLUMNS?=	72 # lenght of 'File:' line in log
 
 FIXDOCPATH=	libs/maildir/deliverquota.8.in libs/maildir/maildir.5 \
 		libs/maildir/maildiracl.1.in libs/maildir/maildirkw.1 \
-		libs/maildir/maildirmake.1.in libs/maildir/maildirquota.7 \
+		libs/maildir/maildirmake.1.in libs/maildir/maildirquota.7
 
-DOCS=	AUTHORS INSTALL INSTALL.html README README.html README.postfix \
-	UPGRADE UPGRADE.html maildroptips.txt maildir/README.*
+DOCS=		AUTHORS INSTALL INSTALL.html README README.html README.postfix \
+		UPGRADE UPGRADE.html maildroptips.txt maildir/README.*
 
 .if exists(${.CURDIR}/../../security/courier-authlib/Makefile.opt)
 .include "${.CURDIR}/../../security/courier-authlib/Makefile.opt"
@@ -58,32 +59,42 @@ AUTHLIB_DESC=		Courier Auth Library support
 .endif
 
 OPTIONS_DEFINE+=	DOCS DOVECOTAUTH GDBM INOTIFY MAILWRAPPER
+OPTIONS_SUB=		yes
 
 DOVECOTAUTH_DESC=	Dovecot Authentication support
 INOTIFY_DESC=		Inotify support for IDLE command
 MAILWRAPPER_DESC=	Let configure guess which sendmail binary to use
 
-OPTIONS_SUB=		yes
 DOVECOTAUTH_CONFIGURE_ENABLE=	dovecotauth
-GDBM_CONFIGURE_OFF=	--with-db=db
-GDBM_CONFIGURE_ON=	--with-db=gdbm
+
 GDBM_LIB_DEPENDS=	libgdbm.so:databases/gdbm
-INOTIFY_LIB_DEPENDS=	libinotify.so:devel/libinotify
+GDBM_CONFIGURE_ON=	--with-db=gdbm
+GDBM_CONFIGURE_OFF=	--with-db=db
+
 MAILWRAPPER_CONFIGURE_OFF=	--enable-sendmail=/usr/sbin/sendmail
 
 .include <bsd.port.options.mk>
 
 .if defined(MAILDROP_SUID) && defined(MAILDROP_SGID)
-CONFIGURE_ARGS+=	--enable-maildrop-uid="${MAILDROP_SUID}" --enable-maildrop-gid="${MAILDROP_SGID}"
-PLIST_SUB+=		MMODE='6755' MUID='${MAILDROP_SUID}' MGID='${MAILDROP_SGID}'
+CONFIGURE_ARGS+=	--enable-maildrop-gid="${MAILDROP_SGID}" \
+			--enable-maildrop-uid="${MAILDROP_SUID}"
+PLIST_SUB+=		MGID='${MAILDROP_SGID}' \
+			MMODE='6755' \
+			MUID='${MAILDROP_SUID}'
 .elif defined(MAILDROP_SUID)
 CONFIGURE_ARGS+=	--enable-maildrop-uid="${MAILDROP_SUID}"
-PLIST_SUB+=		MMODE='4755' MUID='${MAILDROP_SUID}' MGID='mail'
+PLIST_SUB+=		MGID='mail' \
+			MMODE='4755' \
+			MUID='${MAILDROP_SUID}'
 .elif defined(MAILDROP_SGID)
 CONFIGURE_ARGS+=	--enable-maildrop-gid="${MAILDROP_SGID}"
-PLIST_SUB+=		MMODE='2755' MGID='${MAILDROP_SGID}' MUID='root'
+PLIST_SUB+=		MGID='${MAILDROP_SGID}' \
+			MMODE='2755' \
+			MUID='root'
 .else
-PLIST_SUB+=		MMODE='' MUID='root' MGID='mail'
+PLIST_SUB+=		MGID='mail' \
+			MMODE='' \
+			MUID='root'
 .endif
 
 .if defined(MAILDROP_MBOX_DIR)
@@ -94,6 +105,10 @@ CONFIGURE_ARGS+=	--with-default-maildrop='${MAILDROP_MBOX_DIR}'
 CONFIGURE_ARGS+=	--enable-trusted-users="${MAILDROP_TRUSTED_USERS}"
 .endif
 
+.if ${PORT_OPTIONS:MINOTIFY} && (${OSVERSION} < 1405000 || (${OSVERSION} > 1500000 && ${OSVERSION} < 1500500))
+LIB_DEPENDS+=	libinotify.so:devel/libinotify
+.endif
+
 post-patch:
 	@${REINPLACE_CMD} -e "s/l= 72 - szbuf.Length();/l= ${MAILDROP_LOG_COLUMNS} - szbuf.Length();/" \
 		${WRKSRC}/libs/maildrop/log.C
@@ -108,16 +123,19 @@ post-patch:
 .if exists(${.CURDIR}/../../security/courier-authlib/Makefile.dep)
 .include "${.CURDIR}/../../security/courier-authlib/Makefile.dep"
 .endif
-BUILD_DEPENDS+=	courierauthconfig:security/courier-authlib-base
-RUN_DEPENDS+=	courierauthconfig:security/courier-authlib-base
+BUILD_DEPENDS+=		courierauthconfig:security/courier-authlib-base
+RUN_DEPENDS+=		courierauthconfig:security/courier-authlib-base
 CONFIGURE_ARGS+=	--enable-authlib
 .else
 CONFIGURE_ARGS+=	--disable-authlib
 .endif
 
 post-patch-INOTIFY-on:
-	@${REINPLACE_CMD} -e 's|LIBS = @LIBS@|& ${LOCALBASE}/lib/libinotify.a -lpthread|' \
-		${WRKSRC}/libs/maildir/Makefile.in
+.if ${OSVERSION} < 1405000 || (${OSVERSION} > 1500000 && ${OSVERSION} < 1500500)
+	@${REINPLACE_CMD} -e 's|LIBS = @LIBS@|& -L${LOCALBASE}/lib -linotify -lpthread|' \
+		${WRKSRC}/libs/maildir/Makefile.in \
+		${WRKSRC}/libs/maildrop/Makefile.in
+.endif
 
 post-configure-INOTIFY-on:
 	@${ECHO_CMD} '#define HAVE_INOTIFY_INIT 1' >>${WRKSRC}/libs/maildir/config.h