misc/124115: Auto-Detect OpenLDAP version and modify knobs according to common names

Jens Rehsack rehsack at web.de
Thu May 29 22:50:02 UTC 2008


>Number:         124115
>Category:       misc
>Synopsis:       Auto-Detect OpenLDAP version and modify knobs according to common names
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 29 22:50:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Jens Rehsack
>Release:        6.3-STABLE, 7.0-STABLE
>Organization:
>Environment:
FreeBSD waldorf.muppets.liwing.de 6.3-STABLE FreeBSD 6.3-STABLE #0: Sat May 24 10:41:49 UTC 2008     root at waldorf.muppets.liwing.de:/usr/obj/usr/src/sys/WALDORF  amd64
FreeBSD statler.muppets.liwing.de 7.0-STABLE FreeBSD 7.0-STABLE #0: Tue May 13 00:57:06 CEST 2008     root at statler.muppets.liwing.de:/usr/obj/usr/src/sys/STATLER  i386
>Description:
It seems, bsd.port.mk have problems with USE_OPENLDAP=yes when openldap 2.4 is installed ;-)
Because of many USE_XXX auto-detect installed version and the associated port, USE_OPENLDAP with this patch is one of them ;)
>How-To-Repeat:
Install openldap-client-2.4
Install Samba or PHP with LDAP 
>Fix:


Patch attached with submission follows:

Index: Mk/bsd.port.mk
===================================================================
diff -u Mk/bsd.port.mk.orig Mk/bsd.port.mk
--- Mk/bsd.port.mk.orig	2008-05-24 13:06:07.000000000 +0000
+++ Mk/bsd.port.mk	2008-05-24 13:27:02.000000000 +0000
@@ -401,7 +401,7 @@
 # USE_OPENLDAP	- If set, this port uses the OpenLDAP libraries.
 #				  Implies: WANT_OPENLDAP_VER?=23
 # WANT_OPENLDAP_VER
-#				- Legal values are: 22, 23, 24
+#				- Legal values are: 23, 24
 #				  If set to an unkown value, the port is marked BROKEN.
 # WANT_OPENLDAP_SASL
 #				- If set, the system should use OpenLDAP libraries
@@ -1531,8 +1531,6 @@
 # Location of mounted CDROM(s) to search for files
 CD_MOUNTPTS?=	/cdrom ${CD_MOUNTPT}
 
-WANT_OPENLDAP_VER?=	23
-
 # Owner and group of the WWW user
 WWWOWN?=	www
 WWWGRP?=	www
@@ -1676,26 +1674,8 @@
 .include "${PORTSDIR}/Mk/bsd.gcc.mk"
 .endif
 
-.if defined(USE_OPENLDAP_VER)
-USE_OPENLDAP?=		yes
-WANT_OPENLDAP_VER=	${USE_OPENLDAP_VER}
-.endif
-
-.if defined(USE_OPENLDAP)
-.if defined(WANT_OPENLDAP_SASL)
-_OPENLDAP_FLAVOUR=	-sasl
-.else
-_OPENLDAP_FLAVOUR=
-.endif
-.if ${WANT_OPENLDAP_VER} == 22
-LIB_DEPENDS+=		ldap-2.2.7:${PORTSDIR}/net/openldap22${_OPENLDAP_FLAVOUR}-client
-.elif ${WANT_OPENLDAP_VER} == 23
-LIB_DEPENDS+=		ldap-2.3.2:${PORTSDIR}/net/openldap23${_OPENLDAP_FLAVOUR}-client
-.elif ${WANT_OPENLDAP_VER} == 24
-LIB_DEPENDS+=		ldap-2.4.2:${PORTSDIR}/net/openldap24${_OPENLDAP_FLAVOUR}-client
-.else
-IGNORE=				cannot be built with unknown OpenLDAP version: ${WANT_OPENLDAP_VER}
-.endif
+.if defined(USE_OPENLDAP) || defined(WANT_OPENLDAP_VER)
+.include "${PORTSDIR}/Mk/bsd.ldap.mk"
 .endif
 
 .if defined(USE_FAM)
Index: Mk/bsd.ldap.mk
===================================================================
diff -u Mk/bsd.ldap.mk.orig Mk/bsd.ldap.mk
--- Mk/bsd.ldap.mk.orig	2008-05-24 13:25:18.000000000 +0000
+++ Mk/bsd.ldap.mk	2008-05-24 16:03:20.000000000 +0000
@@ -0,0 +1,93 @@
+# -*- mode: Makefile; tab-width: 4; -*-
+# ex: ts=4
+#
+# $FreeBSD$
+#
+
+.if defined(_POSTMKINCLUDED) && !defined(Ldap_Post_Include)
+
+Ldap_Post_Include=		 		bsd.ldap.mk
+Database_Include_MAINTAINER=	ports at FreeBSD.org
+
+# This file contains some routines to interact with different databases, such
+# as mysql, postgresql and berkley DB. For including this file define macro
+# USE_[LDAP], for example USE_OPENLDAP. Defining macro like USE_[LDAP]_VER or
+# WANT_[LDAP]_VER will include this file too.
+#
+##
+# USE_OPENLDAP	- Add OpenLDAP client dependency.
+#				  If no version is given (by the maintainer via the port or
+#				  by the user via defined variable), try to find the
+#				  currently installed version.  Fall back to default if
+#				  necessary (OpenLDAP 2.3 = 23).
+# DEFAULT_OPENLDAP_VER
+#				- OpenLDAP default version. Can be overriden within a port.
+#				  Default: 23.
+# WANT_OPENLDAP_VER
+#				- Maintainer can set an arbitrary version of OpenLDAP by using it.
+# IGNORE_OPENLDAP_OPENLDAP
+#				- This variable can be defined if the ports doesn't support
+#				  one or more version of OpenLDAP.
+# WITH_OPENLDAP_VER
+#				- User defined variable to set OpenLDAP version.
+# OPENLDAP_VER
+#				- Detected OpenLDAP version.
+
+.if defined(USE_OPENLDAP)
+DEFAULT_OPENLDPAP_VER?=	23
+# OpenLDAP client versions currently supported
+OPENLDAP23_LIBVER=	2.3.2
+OPENLDAP24_LIBVER=	2.4.2
+
+.if exists(${LOCALBASE}/bin/ldapwhoami)
+_OPENLDAP_VER!=	${LOCALBASE}/bin/ldapwhoami -VV 2>&1 | ${GREP} ldapwhoami | ${SED} -E 's/.*OpenLDAP: ldapwhoami (2)\.(3|4).*/\1\2/'
+.endif
+
+.if defined(WANT_OPENLDAP_VER)
+.if defined(WITH_OPENLDAP_VER) && ${WITH_OPENLDAP_VER} != ${WANT_OPENLDAP_VER}
+IGNORE=		cannot install: the port wants openldap${WANT_OPENLDAP_VER}-client and you try to install openldap${WITH_OPENLDAP_VER}-client.
+.endif
+OPENLDAP_VER=	${WANT_OPENLDAP_VER}
+.elif defined(WITH_OPENLDAP_VER)
+OPENLDAP_VER=	${WITH_OPENLDAP_VER}
+.else
+.if defined(_OPENLDAP_VER)
+OPENLDAP_VER=	${_OPENLDAP_VER}
+.else
+OPENLDAP_VER=	${DEFAULT_OPENLDAP_VER}
+.endif
+.endif # WANT_OPENLDAP_VER
+
+.if defined(_OPENLDAP_VER)
+.if ${_OPENLDAP_VER} != ${OPENLDAP_VER}
+IGNORE=	cannot install: OpenLDAP versions mismatch: openldap${_OPENLDAP_VER}-client is installed and wanted version is openldap${OPENLDAP_VER}-client
+.endif
+.endif
+
+.if defined(WANT_OPENLDAP_SASL)
+_OPENLDAP_FLAVOUR=	-sasl
+.else
+_OPENLDAP_FLAVOUR=
+.endif
+
+# And now we are checking if we can use it
+.if defined(OPENLDAP${OPENLDAP_VER}_LIBVER)
+# compatability shim
+.if defined(BROKEN_WITH_OPENLDAP)
+IGNORE_WITH_OPENLDAP=${BROKEN_WITH_OPENLDAP}
+.endif
+.if defined(IGNORE_WITH_OPENLDAP)
+.	for VER in ${IGNORE_WITH_OPENLDAP}
+.		if (${OPENLDAP_VER} == "${VER}")
+IGNORE=		cannot install: doesn't work with OpenLDAP version: ${OPENLDAP_VER} (Doesn't support OpenLDAP ${IGNORE_WITH_OPENLDAP})
+.		endif
+.	endfor
+.endif # IGNORE_WITH_OPENLDAP
+LIB_DEPENDS+=	ldap-${OPENLDAP${OPENLDAP_VER}_LIBVER}:${PORTSDIR}/net/openldap${OPENLDAP_VER}${_OPENLDAP_FLAVOUR}-client
+.else
+IGNORE=		cannot install: unknown OpenLDAP version: ${OPENLDAP_VER}
+.endif # Check for correct libs
+
+.endif # defined(USE_OPENLDAP)
+
+.endif # defined(_POSTMKINCLUDED) && !defined(Ldap_Post_Include)
Index: mail/postfix1/Makefile
===================================================================
diff -u mail/postfix1/Makefile.orig mail/postfix1/Makefile
--- mail/postfix1/Makefile.orig	2008-05-24 13:38:05.000000000 +0000
+++ mail/postfix1/Makefile	2008-05-24 13:38:49.000000000 +0000
@@ -116,9 +116,6 @@
 .if defined(WITH_OPENLDAP)
 BROKEN=			does not support OPENLDAP
 USE_OPENLDAP=		yes
-.if defined(WITH_OPENLDAP_VER)
-USE_OPENLDAP_VER=	${WITH_OPENLDAP_VER}
-.endif
 POSTFIX_CCARGS+=	-DHAS_LDAP -I${LOCALBASE}/include
 POSTFIX_AUXLIBS+=	-L${LOCALBASE}/lib -lldap -llber
 _REQUIRE+=		slapd
Index: dns/bind9-dlz/Makefile
===================================================================
diff -u dns/bind9-dlz/Makefile.orig dns/bind9-dlz/Makefile
--- dns/bind9-dlz/Makefile.orig	2008-05-24 13:39:08.000000000 +0000
+++ dns/bind9-dlz/Makefile	2008-05-24 13:40:01.000000000 +0000
@@ -87,7 +87,7 @@
 
 .if defined(WITH_LDAP)
 LDAP_SUFFIX=	+ldap
-USE_OPENLDAP_VER?=	23
+WITH_OPENLDAP_VER?=	23
 CONFIGURE_ARGS+=	--with-dlz-ldap
 .endif
 


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list