git: 9bce8280df4b - main - mail/spamass-milter: Fix build

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Sat, 11 Feb 2023 12:32:56 UTC
The branch main has been updated by bofh:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9bce8280df4b4b9e107b3d643d87a2f89b3adae4

commit 9bce8280df4b4b9e107b3d643d87a2f89b3adae4
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2023-02-11 12:28:23 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-02-11 12:32:43 +0000

    mail/spamass-milter: Fix build
    
    - While converting USE_LDAP=yes to USES=ldap this port was missed. Fix
      this.
    - Utilize OPTIONS framework
    - Utilize USES=localbase
    - Refactor conditional PORTDOCS as by function this is conditional
    
    PR:             269485
    Reported by:    dinoex
    Approved by:    portmgr (just-fix-it)
    Fixes:  6e1233b Mk/**ldap.mk: Convert USE_LDAP to USES=ldap
---
 mail/spamass-milter/Makefile | 35 ++++++++++++++---------------------
 1 file changed, 14 insertions(+), 21 deletions(-)

diff --git a/mail/spamass-milter/Makefile b/mail/spamass-milter/Makefile
index 1148b1b1acc0..99d8db475e19 100644
--- a/mail/spamass-milter/Makefile
+++ b/mail/spamass-milter/Makefile
@@ -8,14 +8,24 @@ MAINTAINER=	bmah@FreeBSD.org
 COMMENT=	Sendmail Milter (mail filter) plugin for SpamAssassin
 WWW=		https://savannah.nongnu.org/projects/spamass-milt/
 
+LICENSE=	GPLv2
+
 BUILD_DEPENDS=	spamc:mail/spamassassin
 RUN_DEPENDS:=	${BUILD_DEPENDS}
 
-LICENSE=	GPLv2
+USE_RC_SUBR=	spamass-milter
+
+GNU_CONFIGURE=	yes
+
+SUB_FILES=	pkg-message
+
+PORTDOCS=	AUTHORS ChangeLog NEWS README TODO
 
 OPTIONS_DEFINE=	LDAP MILTER_PORT DOCS
 MILTER_PORT_DESC=	Build against libmilter port
 
+LDAP_USES=	ldap localbase:ldflags
+
 .include <bsd.port.pre.mk>
 
 .if exists(${LOCALBASE}/lib/libldap.so)
@@ -23,36 +33,19 @@ WITH_LDAP=yes
 .undef WITHOUT_LDAP
 .endif
 
-.if ${PORT_OPTIONS:MLDAP}
-USE+=	ldap
-CPPFLAGS+=	-I${LOCALBASE}/include
-LDFLAGS+=	-L${LOCALBASE}/lib
-.endif
-
-.if ${PORT_OPTIONS:MDOCS}
-PORTDOCS=	AUTHORS ChangeLog NEWS README TODO
-.endif
-
-USE_RC_SUBR=	spamass-milter
-GNU_CONFIGURE=	yes
-
-SUB_FILES=	pkg-message
-
 post-patch:
 	@${SED} -e's,%%PREFIX%%,${PREFIX},g' \
 		${FILESDIR}/activation.txt > ${WRKDIR}/activation.txt
-.if ${PORT_OPTIONS:MLDAP} && ${PORT_OPTIONS:MLDAP}
+
+post-patch-LDAP-on:
 	@${REINPLACE_CMD} -e 's|-lmilter|-lmilter -lldap|g' ${WRKSRC}/configure
-.endif
 
-post-install:
-.if ${PORT_OPTIONS:MDOCS}
+post-install-DOCS-on:
 	${MKDIR} ${STAGEDIR}${DOCSDIR}
 	${INSTALL_DATA} ${WRKDIR}/activation.txt ${STAGEDIR}${DOCSDIR}/activation.txt
 .for f in ${PORTDOCS}
 	${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${DOCSDIR}
 .endfor
-.endif
 
 .include "${PORTSDIR}/mail/sendmail/bsd.milter.mk"
 .include <bsd.port.post.mk>