Bug 85795

Summary: [PATCH] Fix mail/milter-greylist with sendmail from ports and add option to bild it with libspf2
Product: Ports & Packages Reporter: Oleg Sharoiko <os>
Component: Individual Port(s)Assignee: Pav Lucistnik <pav>
Status: Closed FIXED    
Severity: Affects Only Me CC: aragorn+ports
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Oleg Sharoiko 2005-09-06 14:40:19 UTC
	When sendmail has been installed from ports but not from the base
	system mail/milter-greylist can not find libmilter.

	Attached patch fixes this by adding WITH_SENDMAIL_BASE and
	WITH_SENDMAIL_PORT options. The default is to use base sendmail
	in case it has milter support and mail/sendmail otherwise.

	Pathc also adds optional support for building with libspf2

How-To-Repeat: 	Install base system without sendmail
	Install sendmail from mail/sendmail
	Try to build mail/milter-greylist
Comment 1 Pav Lucistnik freebsd_committer freebsd_triage 2005-09-10 17:56:32 UTC
Dear maintainer of FreeBSD port mail/milter-greylist, please take a look
at

http://www.freebsd.org/cgi/query-pr.cgi?q=85795

Do you approve this patch?

-- 
Pav Lucistnik <pav@oook.cz>
              <pav@FreeBSD.org>

And now something completely different.
Comment 2 Pav Lucistnik freebsd_committer freebsd_triage 2005-09-10 17:56:34 UTC
State Changed
From-To: open->feedback

Asked maintainer for approval 


Comment 3 Pav Lucistnik freebsd_committer freebsd_triage 2005-09-10 17:56:34 UTC
Responsible Changed
From-To: freebsd-ports-bugs->pav

Track
Comment 4 aragorn 2005-09-18 08:49:17 UTC
Pav Lucistnik <pav@FreeBSD.org> writes:

> Dear maintainer of FreeBSD port mail/milter-greylist, please take a look
> at
>
> http://www.freebsd.org/cgi/query-pr.cgi?q=85795
>
> Do you approve this patch?

I think OSVERSION must be tested in order to prevent linking with non
reentrant versions of the resolver (ie. 4.X and earlier 5.X).

I will try to figure out which version number has to be considered for
this purpose during the next coming days and will come back soon.

Thanks.
Comment 5 aragorn 2005-09-25 13:33:43 UTC
Here is the patch providing OSVERSION test.


--- Makefile.orig	Wed Sep 14 04:58:24 2005
+++ Makefile	Sun Sep 25 14:23:04 2005
@@ -7,32 +7,75 @@
 
 PORTNAME=	milter-greylist
 PORTVERSION=	2.0
+PORTREVISION=	1
 CATEGORIES=	mail
 MASTER_SITES=	ftp://ftp.espci.fr/pub/milter-greylist/
 DISTNAME=	milter-greylist-${PORTVERSION}
 EXTRACT_SUFX=	.tgz
 
-MAINTAINER=	aragorn+ports@teaser.fr
+MAINTAINER=	aragorn+ports@babasse.net
 COMMENT=	Easy-to-use greylist milter for sendmail
 
+CONFLICTS=	milter-greylist-devel-[1-9]*.*
+
+##
+# Use the following quirks to choose which sendmail to use (ports or system):
+#
+#   WITH_SENDMAIL_BASE=yes
+# or
+#   WITH_SENDMAIL_PORT=yes
+#
+# If unspecified, check for an up-to-date system version but give an
+# installed port preference over it.
+##
+
 MAN5=		greylist.conf.5
 MAN8=		milter-greylist.8
 
+.include <bsd.port.pre.mk>
+
+.if !defined(WITH_SENDMAIL_BASE) && \
+    !defined(WITH_SENDMAIL_PORT) && \
+    !exists(${LOCALBASE}/lib/libmilter.a)
+WITH_SENDMAIL_BASE=yes
+.endif
+
+.if defined(WITH_SENDMAIL_BASE)
+.if exists(/usr/lib/libmilter.a)
+MILTERBASE=	/usr
+.else
+BROKEN= "Base system sendmail not found or too old, rebuild with WITH_SENDMAIL_PORT=yes"
+.endif
+.else
+BUILD_DEPENDS+=	${LOCALBASE}/lib/libmilter.a:${PORTSDIR}/mail/sendmail
+MILTERBASE?=	${LOCALBASE}
+.endif
+
+##
+# If you have a reentrant resolver (starting with RELENG_5_2) you can use SPF
+##
+.if defined(WITH_LIBSPF2)
+.if ${OSVERSION} < 502102
+IGNORE= "Using libspf2 requires a thread safe resolver"
+.else
+BUILD_DEPENDS+=	${LOCALBASE}/lib/libspf2.so:${PORTSDIR}/mail/libspf2
+CONFIGURE_ARGS+=	--with-libspf2=${LOCALBASE}
+.endif
+.endif
+
 CFLAGS+=	${PTHREAD_CFLAGS}
 LIBS+=		${PTHREAD_LIBS}
 
 GNU_CONFIGURE=	yes
 CONFIGURE_TARGET=	--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
-CONFIGURE_ARGS+=	--with-user=smmsp
-CONFIGURE_ENV+=	CFLAGS="${CFLAGS}" LIBS="${LIBS}"
+CONFIGURE_ARGS+=	--with-user=smmsp --with-libmilter=${MILTERBASE}
+CONFIGURE_ENV+=	CFLAGS="${CFLAGS}" LIBS="${LIBS} "
 
 ALL_TARGET=	milter-greylist
 
 USE_RC_SUBR=	yes
 RC_SCRIPTS_SUB=	PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}
 
-CONFLICTS=	milter-greylist-devel-[1-9]*.*
-
 post-extract:
 	@${SED}	${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
 		${FILESDIR}/milter-greylist.sh > ${WRKSRC}/milter-greylist.sh
@@ -73,4 +116,4 @@
 
 	@${CAT} ${PKGMESSAGE}
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
Comment 6 Pav Lucistnik freebsd_committer freebsd_triage 2005-09-25 19:09:05 UTC
State Changed
From-To: feedback->closed

Maintainer's patch committed.