Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-nds/openldap/
Date: Thu, 03 Mar 2016 21:08:50
Message-Id: 1457039314.74cd88d668dd203fc840427c7d3b643b8a88a41d.zmedico@gentoo
1 commit: 74cd88d668dd203fc840427c7d3b643b8a88a41d
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Thu Mar 3 21:07:59 2016 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Thu Mar 3 21:08:34 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=74cd88d6
7
8 net-nds/openldap: version bump to 2.4.44
9
10 Package-Manager: portage-2.2.27
11
12 net-nds/openldap/Manifest | 1 +
13 net-nds/openldap/openldap-2.4.44.ebuild | 821 ++++++++++++++++++++++++++++++++
14 2 files changed, 822 insertions(+)
15
16 diff --git a/net-nds/openldap/Manifest b/net-nds/openldap/Manifest
17 index 786b161..d299ef0 100644
18 --- a/net-nds/openldap/Manifest
19 +++ b/net-nds/openldap/Manifest
20 @@ -4,4 +4,5 @@ DIST openldap-2.4.39.tgz 5509060 SHA256 8267c87347103fef56b783b24877c0feda1063d3
21 DIST openldap-2.4.40.tgz 5641865 SHA256 d12611a5c25b6499293c2bb7b435dc2b174db73e83f5a8cb7e34f2ce5fa6dadb SHA512 c803c4a82878891d60414d64dcb54a7c3f08675106ba13f50cba06034a97b3eee1c238761dd5ddad97d8c3f6675d9bbbec176d0340eb4a3bcd808f940baabab5 WHIRLPOOL 82cb6033798ac69faf4a0d1f5d7716316f5fbfc67e0f3a013b5bae461a01e3029aa6fb7d510bc14eed4f40ef83632561a3fa39aebf2be2785e3d0e0038db048c
22 DIST openldap-2.4.42.tgz 5645925 SHA256 eeb7b0e2c5852bfd2650e83909bb6152835c0b862fab10b63954dc1bcbba8e63 SHA512 52d6af7610c4fdc8f965ebea04d09c38f73773a02c2e484dc111100f3d472f8b2f766ca32d9c80f5815a57745095cc7c33ad62d9165eec5b9e252ae172e7782c WHIRLPOOL e151c63bfd10f5e96c60f216925315ed788d426ba2c15ee2793a4de4bb25d01717e7bb5144814a0e6a053a5d5a0aab75213a495aa47aa13f7c3e70716c01633e
23 DIST openldap-2.4.43.tgz 5654057 SHA256 34d78e5598a2b0360d26a9050fcdbbe198c65493b013bb607839d5598b6978c8 SHA512 1306206bf22fcec2ccf4b91fd7eadf0207e7015f20d761a4055b0e0213fe1f4c275eec933d86220b03b558650439e74cdca07db05e8debb54d38be4e983b3631 WHIRLPOOL 0d4dc1c1f36f85c4711d0ec1d11107dac242f1d69b4f183e7762cc3ed3d7221c45bd44777e7441afe10156abc487da18f9bdf748244123dd62a241aefe7bca3f
24 +DIST openldap-2.4.44.tgz 5658830 SHA256 d7de6bf3c67009c95525dde3a0212cc110d0a70b92af2af8e3ee800e81b88400 SHA512 132eb81798f59a364c9246d08697e1c7ebb6c2c3b983f786b14ec0233df09696cbad33a1f35f3076348b5efb77665a076ab854a24122c31e8b58310b7c7fd136 WHIRLPOOL 37399793d681a6489c369d663772970c62a4e1e370d4dc306bcb6fa3b9cb680139c9d940d9218aaac4618f50a63bc391b10f2aec0a134f84094ce4f7378c88ff
25 DIST rfc2307bis.schema-20140524 12262 SHA256 6cd8154ad86be1d6bb88a79c303dc10a49bce4ce7d21bb417a951d6496df30b1 SHA512 83b89a1deeefc8566b97e7e865b9b6d04541099cbdf719e24538a7d27d61b6209e87ab9003a9f140bd9afd018ec569e71721e3a24090e1902c8b6659d2ba103e WHIRLPOOL 40cef24529fb4bfc1661d03088eccdb17d9056d696b2bf0e698fa248d03f508ba776784bf8abbaffb5f4c2c59b59b29525b4be2babc978fed681e5e3c88073de
26
27 diff --git a/net-nds/openldap/openldap-2.4.44.ebuild b/net-nds/openldap/openldap-2.4.44.ebuild
28 new file mode 100644
29 index 0000000..4e463cf
30 --- /dev/null
31 +++ b/net-nds/openldap/openldap-2.4.44.ebuild
32 @@ -0,0 +1,821 @@
33 +# Copyright 1999-2016 Gentoo Foundation
34 +# Distributed under the terms of the GNU General Public License v2
35 +# $Id$
36 +
37 +EAPI="5"
38 +
39 +inherit db-use eutils flag-o-matic multilib multilib-minimal ssl-cert versionator toolchain-funcs autotools user systemd
40 +
41 +BIS_PN=rfc2307bis.schema
42 +BIS_PV=20140524
43 +BIS_P="${BIS_PN}-${BIS_PV}"
44 +
45 +DESCRIPTION="LDAP suite of application and development tools"
46 +HOMEPAGE="http://www.OpenLDAP.org/"
47 +
48 +# mirrors are mostly not working, using canonical URI
49 +SRC_URI="ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${P}.tgz
50 + mirror://gentoo/${BIS_P}"
51 +
52 +LICENSE="OPENLDAP GPL-2"
53 +SLOT="0"
54 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
55 +
56 +IUSE_DAEMON="crypt icu samba slp tcpd experimental minimal"
57 +IUSE_BACKEND="+berkdb"
58 +IUSE_OVERLAY="overlays perl"
59 +IUSE_OPTIONAL="gnutls iodbc sasl ssl odbc debug ipv6 libressl +syslog selinux static-libs"
60 +IUSE_CONTRIB="smbkrb5passwd kerberos kinit"
61 +IUSE_CONTRIB="${IUSE_CONTRIB} -cxx"
62 +IUSE="${IUSE_DAEMON} ${IUSE_BACKEND} ${IUSE_OVERLAY} ${IUSE_OPTIONAL} ${IUSE_CONTRIB}"
63 +
64 +REQUIRED_USE="cxx? ( sasl )
65 + ?? ( gnutls libressl )"
66 +
67 +# always list newer first
68 +# Do not add any AGPL-3 BDB here!
69 +# See bug 525110, comment 15.
70 +BDB_SLOTS='5.3 5.1 4.8 4.7 4.6 4.5 4.4'
71 +BDB_PKGS=''
72 +for _slot in $BDB_SLOTS; do BDB_PKGS="${BDB_PKGS} sys-libs/db:${_slot}" ; done
73 +
74 +# openssl is needed to generate lanman-passwords required by samba
75 +CDEPEND="icu? ( dev-libs/icu:= )
76 + ssl? (
77 + !gnutls? (
78 + !libressl? ( >=dev-libs/openssl-1.0.1h-r2:0[${MULTILIB_USEDEP}] )
79 + )
80 + gnutls? ( >=net-libs/gnutls-2.12.23-r6[${MULTILIB_USEDEP}]
81 + libressl? ( dev-libs/libressl[${MULTILIB_USEDEP}] )
82 + >=dev-libs/libgcrypt-1.5.3:0[${MULTILIB_USEDEP}] ) )
83 + sasl? ( dev-libs/cyrus-sasl:= )
84 + !minimal? (
85 + sys-devel/libtool
86 + sys-libs/e2fsprogs-libs
87 + >=dev-db/lmdb-0.9.14:=
88 + tcpd? ( sys-apps/tcp-wrappers )
89 + odbc? ( !iodbc? ( dev-db/unixODBC )
90 + iodbc? ( dev-db/libiodbc ) )
91 + slp? ( net-libs/openslp )
92 + perl? ( dev-lang/perl[-build(-)] )
93 + samba? (
94 + !libressl? ( dev-libs/openssl:0 )
95 + libressl? ( dev-libs/libressl )
96 + )
97 + berkdb? (
98 + <sys-libs/db-6.0:=
99 + || ( ${BDB_PKGS} )
100 + )
101 + smbkrb5passwd? (
102 + !libressl? ( dev-libs/openssl:0 )
103 + libressl? ( dev-libs/libressl )
104 + kerberos? ( app-crypt/heimdal )
105 + )
106 + kerberos? (
107 + virtual/krb5
108 + kinit? ( !app-crypt/heimdal )
109 + )
110 + cxx? ( dev-libs/cyrus-sasl:= )
111 + )
112 + abi_x86_32? (
113 + !<=app-emulation/emul-linux-x86-baselibs-20140508-r3
114 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)]
115 + )"
116 +DEPEND="${CDEPEND}
117 + sys-apps/groff"
118 +RDEPEND="${CDEPEND}
119 + selinux? ( sec-policy/selinux-ldap )
120 +"
121 +# for tracking versions
122 +OPENLDAP_VERSIONTAG=".version-tag"
123 +OPENLDAP_DEFAULTDIR_VERSIONTAG="/var/lib/openldap-data"
124 +
125 +MULTILIB_WRAPPED_HEADERS=(
126 + # USE=cxx
127 + /usr/include/LDAPAsynConnection.h
128 + /usr/include/LDAPAttrType.h
129 + /usr/include/LDAPAttribute.h
130 + /usr/include/LDAPAttributeList.h
131 + /usr/include/LDAPConnection.h
132 + /usr/include/LDAPConstraints.h
133 + /usr/include/LDAPControl.h
134 + /usr/include/LDAPControlSet.h
135 + /usr/include/LDAPEntry.h
136 + /usr/include/LDAPEntryList.h
137 + /usr/include/LDAPException.h
138 + /usr/include/LDAPExtResult.h
139 + /usr/include/LDAPMessage.h
140 + /usr/include/LDAPMessageQueue.h
141 + /usr/include/LDAPModList.h
142 + /usr/include/LDAPModification.h
143 + /usr/include/LDAPObjClass.h
144 + /usr/include/LDAPRebind.h
145 + /usr/include/LDAPRebindAuth.h
146 + /usr/include/LDAPReferenceList.h
147 + /usr/include/LDAPResult.h
148 + /usr/include/LDAPSaslBindResult.h
149 + /usr/include/LDAPSchema.h
150 + /usr/include/LDAPSearchReference.h
151 + /usr/include/LDAPSearchResult.h
152 + /usr/include/LDAPSearchResults.h
153 + /usr/include/LDAPUrl.h
154 + /usr/include/LDAPUrlList.h
155 + /usr/include/LdifReader.h
156 + /usr/include/LdifWriter.h
157 + /usr/include/SaslInteraction.h
158 + /usr/include/SaslInteractionHandler.h
159 + /usr/include/StringList.h
160 + /usr/include/TlsOptions.h
161 +)
162 +
163 +openldap_filecount() {
164 + local dir="$1"
165 + find "${dir}" -type f ! -name '.*' ! -name 'DB_CONFIG*' | wc -l
166 +}
167 +
168 +openldap_find_versiontags() {
169 + # scan for all datadirs
170 + openldap_datadirs=""
171 + if [ -f "${EROOT}"/etc/openldap/slapd.conf ]; then
172 + openldap_datadirs="$(awk '{if($1 == "directory") print $2 }' ${EROOT}/etc/openldap/slapd.conf)"
173 + fi
174 + openldap_datadirs="${openldap_datadirs} ${OPENLDAP_DEFAULTDIR_VERSIONTAG}"
175 +
176 + einfo
177 + einfo "Scanning datadir(s) from slapd.conf and"
178 + einfo "the default installdir for Versiontags"
179 + einfo "(${OPENLDAP_DEFAULTDIR_VERSIONTAG} may appear twice)"
180 + einfo
181 +
182 + # scan datadirs if we have a version tag
183 + openldap_found_tag=0
184 + have_files=0
185 + for each in ${openldap_datadirs}; do
186 + CURRENT_TAGDIR=${ROOT}`echo ${each} | sed "s:\/::"`
187 + CURRENT_TAG=${CURRENT_TAGDIR}/${OPENLDAP_VERSIONTAG}
188 + if [ -d ${CURRENT_TAGDIR} ] && [ ${openldap_found_tag} == 0 ] ; then
189 + einfo "- Checking ${each}..."
190 + if [ -r ${CURRENT_TAG} ] ; then
191 + # yey, we have one :)
192 + einfo " Found Versiontag in ${each}"
193 + source ${CURRENT_TAG}
194 + if [ "${OLDPF}" == "" ] ; then
195 + eerror "Invalid Versiontag found in ${CURRENT_TAGDIR}"
196 + eerror "Please delete it"
197 + eerror
198 + die "Please kill the invalid versiontag in ${CURRENT_TAGDIR}"
199 + fi
200 +
201 + OLD_MAJOR=`get_version_component_range 2-3 ${OLDPF}`
202 +
203 + [ $(openldap_filecount ${CURRENT_TAGDIR}) -gt 0 ] && have_files=1
204 +
205 + # are we on the same branch?
206 + if [ "${OLD_MAJOR}" != "${PV:0:3}" ] ; then
207 + ewarn " Versiontag doesn't match current major release!"
208 + if [[ "${have_files}" == "1" ]] ; then
209 + eerror " Versiontag says other major and you (probably) have datafiles!"
210 + echo
211 + openldap_upgrade_howto
212 + else
213 + einfo " No real problem, seems there's no database."
214 + fi
215 + else
216 + einfo " Versiontag is fine here :)"
217 + fi
218 + else
219 + einfo " Non-tagged dir ${each}"
220 + [ $(openldap_filecount ${each}) -gt 0 ] && have_files=1
221 + if [[ "${have_files}" == "1" ]] ; then
222 + einfo " EEK! Non-empty non-tagged datadir, counting `ls -a ${each} | wc -l` files"
223 + echo
224 +
225 + eerror
226 + eerror "Your OpenLDAP Installation has a non tagged datadir that"
227 + eerror "possibly contains a database at ${CURRENT_TAGDIR}"
228 + eerror
229 + eerror "Please export data if any entered and empty or remove"
230 + eerror "the directory, installation has been stopped so you"
231 + eerror "can take required action"
232 + eerror
233 + eerror "For a HOWTO on exporting the data, see instructions in the ebuild"
234 + eerror
235 + openldap_upgrade_howto
236 + die "Please move the datadir ${CURRENT_TAGDIR} away"
237 + fi
238 + fi
239 + einfo
240 + fi
241 + done
242 + [ "${have_files}" == "1" ] && einfo "DB files present" || einfo "No DB files present"
243 +
244 + # Now we must check for the major version of sys-libs/db linked against.
245 + SLAPD_PATH=${EROOT}/usr/$(get_libdir)/openldap/slapd
246 + if [ "${have_files}" == "1" -a -f "${SLAPD_PATH}" ]; then
247 + OLDVER="$(/usr/bin/ldd ${SLAPD_PATH} \
248 + | awk '/libdb-/{gsub("^libdb-","",$1);gsub(".so$","",$1);print $1}')"
249 + if use berkdb; then
250 + # find which one would be used
251 + for bdb_slot in $BDB_SLOTS ; do
252 + NEWVER="$(db_findver "=sys-libs/db-${bdb_slot}*")"
253 + [[ -n "$NEWVER" ]] && break
254 + done
255 + fi
256 + local fail=0
257 + if [ -z "${OLDVER}" -a -z "${NEWVER}" ]; then
258 + :
259 + # Nothing wrong here.
260 + elif [ -z "${OLDVER}" -a -n "${NEWVER}" ]; then
261 + eerror " Your existing version of OpenLDAP was not built against"
262 + eerror " any version of sys-libs/db, but the new one will build"
263 + eerror " against ${NEWVER} and your database may be inaccessible."
264 + echo
265 + fail=1
266 + elif [ -n "${OLDVER}" -a -z "${NEWVER}" ]; then
267 + eerror " Your existing version of OpenLDAP was built against"
268 + eerror " sys-libs/db:${OLDVER}, but the new one will not be"
269 + eerror " built against any version and your database may be"
270 + eerror " inaccessible."
271 + echo
272 + fail=1
273 + elif [ "${OLDVER}" != "${NEWVER}" ]; then
274 + eerror " Your existing version of OpenLDAP was built against"
275 + eerror " sys-libs/db:${OLDVER}, but the new one will build against"
276 + eerror " ${NEWVER} and your database would be inaccessible."
277 + echo
278 + fail=1
279 + fi
280 + [ "${fail}" == "1" ] && openldap_upgrade_howto
281 + fi
282 +
283 + echo
284 + einfo
285 + einfo "All datadirs are fine, proceeding with merge now..."
286 + einfo
287 +}
288 +
289 +openldap_upgrade_howto() {
290 + eerror
291 + eerror "A (possible old) installation of OpenLDAP was detected,"
292 + eerror "installation will not proceed for now."
293 + eerror
294 + eerror "As major version upgrades can corrupt your database,"
295 + eerror "you need to dump your database and re-create it afterwards."
296 + eerror
297 + eerror "Additionally, rebuilding against different major versions of the"
298 + eerror "sys-libs/db libraries will cause your database to be inaccessible."
299 + eerror ""
300 + d="$(date -u +%s)"
301 + l="/root/ldapdump.${d}"
302 + i="${l}.raw"
303 + eerror " 1. /etc/init.d/slurpd stop ; /etc/init.d/slapd stop"
304 + eerror " 2. slapcat -l ${i}"
305 + eerror " 3. egrep -v '^(entry|context)CSN:' <${i} >${l}"
306 + eerror " 4. mv /var/lib/openldap-data/ /var/lib/openldap-data-backup/"
307 + eerror " 5. emerge --update \=net-nds/${PF}"
308 + eerror " 6. etc-update, and ensure that you apply the changes"
309 + eerror " 7. slapadd -l ${l}"
310 + eerror " 8. chown ldap:ldap /var/lib/openldap-data/*"
311 + eerror " 9. /etc/init.d/slapd start"
312 + eerror "10. check that your data is intact."
313 + eerror "11. set up the new replication system."
314 + eerror
315 + if [ "${FORCE_UPGRADE}" != "1" ]; then
316 + die "You need to upgrade your database first"
317 + else
318 + eerror "You have the magical FORCE_UPGRADE=1 in place."
319 + eerror "Don't say you weren't warned about data loss."
320 + fi
321 +}
322 +
323 +pkg_setup() {
324 + if ! use sasl && use cxx ; then
325 + die "To build the ldapc++ library you must emerge openldap with sasl support"
326 + fi
327 + # Bug #322787
328 + if use minimal && ! has_version "net-nds/openldap" ; then
329 + einfo "No datadir scan needed, openldap not installed"
330 + elif use minimal && has_version "net-nds/openldap" && built_with_use net-nds/openldap minimal ; then
331 + einfo "Skipping scan for previous datadirs as requested by minimal useflag"
332 + else
333 + openldap_find_versiontags
334 + fi
335 +
336 + enewgroup ldap 439
337 + enewuser ldap 439 -1 /usr/$(get_libdir)/openldap ldap
338 +}
339 +
340 +src_prepare() {
341 + # ensure correct SLAPI path by default
342 + sed -i -e 's,\(#define LDAPI_SOCK\).*,\1 "'"${EPREFIX}"'/var/run/openldap/slapd.sock",' \
343 + "${S}"/include/ldap_defaults.h
344 +
345 + epatch "${FILESDIR}"/${PN}-2.4.17-gcc44.patch
346 +
347 + epatch \
348 + "${FILESDIR}"/${PN}-2.2.14-perlthreadsfix.patch \
349 + "${FILESDIR}"/${PN}-2.4.15-ppolicy.patch
350 +
351 + # bug #116045 - still present in 2.4.28
352 + epatch "${FILESDIR}"/${PN}-2.4.35-contrib-smbk5pwd.patch
353 + # bug #408077 - samba4
354 + epatch "${FILESDIR}"/${PN}-2.4.35-contrib-samba4.patch
355 +
356 + # bug #189817
357 + epatch "${FILESDIR}"/${PN}-2.4.11-libldap_r.patch
358 +
359 + # bug #233633
360 + epatch "${FILESDIR}"/${PN}-2.4.17-fix-lmpasswd-gnutls-symbols.patch
361 +
362 + # bug #281495
363 + epatch "${FILESDIR}"/${PN}-2.4.28-gnutls-gcrypt.patch
364 +
365 + # bug #294350
366 + epatch "${FILESDIR}"/${PN}-2.4.6-evolution-ntlm.patch
367 +
368 + # unbreak /bin/sh -> dash
369 + epatch "${FILESDIR}"/${PN}-2.4.28-fix-dash.patch
370 +
371 + # bug #420959
372 + epatch "${FILESDIR}"/${PN}-2.4.31-gcc47.patch
373 +
374 + # unbundle lmdb
375 + epatch "${FILESDIR}"/${PN}-2.4.42-mdb-unbundle.patch
376 + rm -rf "${S}"/libraries/liblmdb
377 +
378 + cd "${S}"/build || die
379 + einfo "Making sure upstream build strip does not do stripping too early"
380 + sed -i.orig \
381 + -e '/^STRIP/s,-s,,g' \
382 + top.mk || die "Failed to block stripping"
383 +
384 + # wrong assumption that /bin/sh is /bin/bash
385 + sed -i \
386 + -e 's|/bin/sh|/bin/bash|g' \
387 + "${S}"/tests/scripts/* || die "sed failed"
388 +
389 + cd "${S}" || die
390 +
391 + AT_NOEAUTOMAKE=yes eautoreconf
392 +}
393 +
394 +build_contrib_module() {
395 + # <dir> <sources> <outputname>
396 + cd "${S}/contrib/slapd-modules/$1" || die
397 + einfo "Compiling contrib-module: $3"
398 + # Make sure it's uppercase
399 + local define_name="$(echo "SLAPD_OVER_${1}" | LC_ALL=C tr '[:lower:]' '[:upper:]')"
400 + "${lt}" --mode=compile --tag=CC \
401 + "${CC}" \
402 + -D${define_name}=SLAPD_MOD_DYNAMIC \
403 + -I"${BUILD_DIR}"/include \
404 + -I../../../include -I../../../servers/slapd ${CFLAGS} \
405 + -o ${2%.c}.lo -c $2 || die "compiling $3 failed"
406 + einfo "Linking contrib-module: $3"
407 + "${lt}" --mode=link --tag=CC \
408 + "${CC}" -module \
409 + ${CFLAGS} \
410 + ${LDFLAGS} \
411 + -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
412 + -o $3.la ${2%.c}.lo || die "linking $3 failed"
413 +}
414 +
415 +src_configure() {
416 + # Bug 408001
417 + use elibc_FreeBSD && append-cppflags -DMDB_DSYNC=O_SYNC -DMDB_FDATASYNC=fsync
418 +
419 + # connectionless ldap per bug #342439
420 + append-cppflags -DLDAP_CONNECTIONLESS
421 +
422 + multilib-minimal_src_configure
423 +}
424 +
425 +multilib_src_configure() {
426 + local myconf=()
427 +
428 + use debug && myconf+=( $(use_enable debug) )
429 +
430 + # ICU usage is not configurable
431 + export ac_cv_header_unicode_utypes_h="$(multilib_is_native_abi && use icu && echo yes || echo no)"
432 +
433 + if ! use minimal && multilib_is_native_abi; then
434 + local CPPFLAGS=${CPPFLAGS}
435 +
436 + # re-enable serverside overlay chains per bug #296567
437 + # see ldap docs chaper 12.3.1 for details
438 + myconf+=( --enable-ldap )
439 +
440 + # backends
441 + myconf+=( --enable-slapd )
442 + if use berkdb ; then
443 + einfo "Using Berkeley DB for local backend"
444 + myconf+=( --enable-bdb --enable-hdb )
445 + DBINCLUDE=$(db_includedir $BDB_SLOTS)
446 + einfo "Using $DBINCLUDE for sys-libs/db version"
447 + # We need to include the slotted db.h dir for FreeBSD
448 + append-cppflags -I${DBINCLUDE}
449 + else
450 + myconf+=( --disable-bdb --disable-hdb )
451 + fi
452 + for backend in dnssrv ldap mdb meta monitor null passwd relay shell sock; do
453 + myconf+=( --enable-${backend}=mod )
454 + done
455 +
456 + myconf+=( $(use_enable perl perl mod) )
457 +
458 + myconf+=( $(use_enable odbc sql mod) )
459 + if use odbc ; then
460 + local odbc_lib="unixodbc"
461 + if use iodbc ; then
462 + odbc_lib="iodbc"
463 + append-cppflags -I"${EPREFIX}"/usr/include/iodbc
464 + fi
465 + myconf+=( --with-odbc=${odbc_lib} )
466 + fi
467 +
468 + # slapd options
469 + myconf+=(
470 + $(use_enable crypt)
471 + $(use_enable slp)
472 + $(use_enable samba lmpasswd)
473 + $(use_enable syslog)
474 + )
475 + if use experimental ; then
476 + myconf+=(
477 + --enable-dynacl
478 + --enable-aci=mod
479 + )
480 + fi
481 + for option in aci cleartext modules rewrite rlookups slapi; do
482 + myconf+=( --enable-${option} )
483 + done
484 +
485 + # slapd overlay options
486 + # Compile-in the syncprov, the others as module
487 + myconf+=( --enable-syncprov=yes )
488 + use overlays && myconf+=( --enable-overlays=mod )
489 +
490 + else
491 + myconf+=(
492 + --disable-backends
493 + --disable-slapd
494 + --disable-bdb
495 + --disable-hdb
496 + --disable-mdb
497 + --disable-overlays
498 + --disable-syslog
499 + )
500 + fi
501 +
502 + # basic functionality stuff
503 + myconf+=(
504 + $(use_enable ipv6)
505 + $(multilib_native_use_with sasl cyrus-sasl)
506 + $(multilib_native_use_enable sasl spasswd)
507 + $(use_enable tcpd wrappers)
508 + )
509 +
510 + local ssl_lib="no"
511 + if use ssl || ( ! use minimal && use samba ) ; then
512 + ssl_lib="openssl"
513 + use gnutls && ssl_lib="gnutls"
514 + fi
515 +
516 + myconf+=( --with-tls=${ssl_lib} )
517 +
518 + for basicflag in dynamic local proctitle shared; do
519 + myconf+=( --enable-${basicflag} )
520 + done
521 +
522 + tc-export AR CC CXX
523 + ECONF_SOURCE=${S} \
524 + STRIP=/bin/true \
525 + econf \
526 + --libexecdir="${EPREFIX}"/usr/$(get_libdir)/openldap \
527 + $(use_enable static-libs static) \
528 + "${myconf[@]}"
529 + emake depend
530 +}
531 +
532 +src_configure_cxx() {
533 + # This needs the libraries built by the first build run.
534 + # So we have to run it AFTER the main build, not just after the main
535 + # configure.
536 + local myconf_ldapcpp=(
537 + --with-ldap-includes="${S}"/include
538 + )
539 +
540 + mkdir -p "${BUILD_DIR}"/contrib/ldapc++ || die
541 + cd "${BUILD_DIR}/contrib/ldapc++" || die
542 +
543 + local LDFLAGS=${LDFLAGS} CPPFLAGS=${CPPFLAGS}
544 + append-ldflags -L"${BUILD_DIR}"/libraries/liblber/.libs \
545 + -L"${BUILD_DIR}"/libraries/libldap/.libs
546 + append-cppflags -I"${BUILD_DIR}"/include
547 + ECONF_SOURCE=${S}/contrib/ldapc++ \
548 + econf "${myconf_ldapcpp[@]}" \
549 + CC="${CC}" \
550 + CXX="${CXX}"
551 +}
552 +
553 +multilib_src_compile() {
554 + tc-export AR CC CXX
555 + emake CC="${CC}" AR="${AR}" SHELL="${EPREFIX}"/bin/bash
556 + local lt="${BUILD_DIR}/libtool"
557 + export echo="echo"
558 +
559 + if ! use minimal && multilib_is_native_abi ; then
560 + if use cxx ; then
561 + einfo "Building contrib library: ldapc++"
562 + src_configure_cxx
563 + cd "${BUILD_DIR}/contrib/ldapc++" || die
564 + emake \
565 + CC="${CC}" CXX="${CXX}"
566 + fi
567 +
568 + if use smbkrb5passwd ; then
569 + einfo "Building contrib-module: smbk5pwd"
570 + cd "${S}/contrib/slapd-modules/smbk5pwd" || die
571 +
572 + MY_DEFS="-DDO_SHADOW"
573 + if use samba ; then
574 + MY_DEFS="${MY_DEFS} -DDO_SAMBA"
575 + MY_KRB5_INC=""
576 + fi
577 + if use kerberos ; then
578 + MY_DEFS="${MY_DEFS} -DDO_KRB5"
579 + MY_KRB5_INC="$(krb5-config --cflags)"
580 + fi
581 +
582 + emake \
583 + DEFS="${MY_DEFS}" \
584 + KRB5_INC="${MY_KRB5_INC}" \
585 + LDAP_BUILD="${BUILD_DIR}" \
586 + CC="${CC}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap"
587 + fi
588 +
589 + if use overlays ; then
590 + einfo "Building contrib-module: samba4"
591 + cd "${S}/contrib/slapd-modules/samba4" || die
592 +
593 + emake \
594 + LDAP_BUILD="${BUILD_DIR}" \
595 + CC="${CC}" libexecdir="/usr/$(get_libdir)/openldap"
596 + fi
597 +
598 + if use kerberos ; then
599 + if use kinit ; then
600 + build_contrib_module "kinit" "kinit.c" "kinit"
601 + fi
602 + cd "${S}/contrib/slapd-modules/passwd" || die
603 + einfo "Compiling contrib-module: pw-kerberos"
604 + "${lt}" --mode=compile --tag=CC \
605 + "${CC}" \
606 + -I"${BUILD_DIR}"/include \
607 + -I../../../include \
608 + ${CFLAGS} \
609 + $(krb5-config --cflags) \
610 + -DHAVE_KRB5 \
611 + -o kerberos.lo \
612 + -c kerberos.c || die "compiling pw-kerberos failed"
613 + einfo "Linking contrib-module: pw-kerberos"
614 + "${lt}" --mode=link --tag=CC \
615 + "${CC}" -module \
616 + ${CFLAGS} \
617 + ${LDFLAGS} \
618 + -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
619 + -o pw-kerberos.la \
620 + kerberos.lo || die "linking pw-kerberos failed"
621 + fi
622 + # We could build pw-radius if GNURadius would install radlib.h
623 + cd "${S}/contrib/slapd-modules/passwd" || die
624 + einfo "Compiling contrib-module: pw-netscape"
625 + "${lt}" --mode=compile --tag=CC \
626 + "${CC}" \
627 + -I"${BUILD_DIR}"/include \
628 + -I../../../include \
629 + ${CFLAGS} \
630 + -o netscape.lo \
631 + -c netscape.c || die "compiling pw-netscape failed"
632 + einfo "Linking contrib-module: pw-netscape"
633 + "${lt}" --mode=link --tag=CC \
634 + "${CC}" -module \
635 + ${CFLAGS} \
636 + ${LDFLAGS} \
637 + -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
638 + -o pw-netscape.la \
639 + netscape.lo || die "linking pw-netscape failed"
640 +
641 + #build_contrib_module "acl" "posixgroup.c" "posixGroup" # example code only
642 + #build_contrib_module "acl" "gssacl.c" "gss" # example code only, also needs kerberos
643 + build_contrib_module "addpartial" "addpartial-overlay.c" "addpartial-overlay"
644 + build_contrib_module "allop" "allop.c" "overlay-allop"
645 + build_contrib_module "allowed" "allowed.c" "allowed"
646 + build_contrib_module "autogroup" "autogroup.c" "autogroup"
647 + build_contrib_module "cloak" "cloak.c" "cloak"
648 + # build_contrib_module "comp_match" "comp_match.c" "comp_match" # really complex, adds new external deps, questionable demand
649 + build_contrib_module "denyop" "denyop.c" "denyop-overlay"
650 + build_contrib_module "dsaschema" "dsaschema.c" "dsaschema-plugin"
651 + build_contrib_module "dupent" "dupent.c" "dupent"
652 + build_contrib_module "lastbind" "lastbind.c" "lastbind"
653 + # lastmod may not play well with other overlays
654 + build_contrib_module "lastmod" "lastmod.c" "lastmod"
655 + build_contrib_module "noopsrch" "noopsrch.c" "noopsrch"
656 + build_contrib_module "nops" "nops.c" "nops-overlay"
657 + #build_contrib_module "nssov" "nssov.c" "nssov-overlay" RESO:LATER
658 + build_contrib_module "trace" "trace.c" "trace"
659 + # build slapi-plugins
660 + cd "${S}/contrib/slapi-plugins/addrdnvalues" || die
661 + einfo "Building contrib-module: addrdnvalues plugin"
662 + "${CC}" -shared \
663 + -I"${BUILD_DIR}"/include \
664 + -I../../../include \
665 + ${CFLAGS} \
666 + -fPIC \
667 + ${LDFLAGS} \
668 + -o libaddrdnvalues-plugin.so \
669 + addrdnvalues.c || die "Building libaddrdnvalues-plugin.so failed"
670 +
671 + fi
672 +}
673 +
674 +multilib_src_test() {
675 + if multilib_is_native_abi; then
676 + cd tests || die
677 + emake tests || die "make tests failed"
678 + fi
679 +}
680 +
681 +multilib_src_install() {
682 + local lt="${BUILD_DIR}/libtool"
683 + emake DESTDIR="${D}" SHELL="${EPREFIX}"/bin/bash install
684 + use static-libs || prune_libtool_files --all
685 +
686 + if ! use minimal && multilib_is_native_abi; then
687 + # openldap modules go here
688 + # TODO: write some code to populate slapd.conf with moduleload statements
689 + keepdir /usr/$(get_libdir)/openldap/openldap/
690 +
691 + # initial data storage dir
692 + keepdir /var/lib/openldap-data
693 + use prefix || fowners ldap:ldap /var/lib/openldap-data
694 + fperms 0700 /var/lib/openldap-data
695 +
696 + echo "OLDPF='${PF}'" > "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
697 + echo "# do NOT delete this. it is used" >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
698 + echo "# to track versions for upgrading." >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
699 +
700 + # use our config
701 + rm "${ED}"etc/openldap/slapd.conf
702 + insinto /etc/openldap
703 + newins "${FILESDIR}"/${PN}-2.4.40-slapd-conf slapd.conf
704 + configfile="${ED}"etc/openldap/slapd.conf
705 +
706 + # populate with built backends
707 + ebegin "populate config with built backends"
708 + for x in "${ED}"usr/$(get_libdir)/openldap/openldap/back_*.so; do
709 + einfo "Adding $(basename ${x})"
710 + sed -e "/###INSERTDYNAMICMODULESHERE###$/a# moduleload\t$(basename ${x})" -i "${configfile}"
711 + done
712 + sed -e "s:###INSERTDYNAMICMODULESHERE###$:# modulepath\t${EPREFIX}/usr/$(get_libdir)/openldap/openldap:" -i "${configfile}"
713 + use prefix || fowners root:ldap /etc/openldap/slapd.conf
714 + fperms 0640 /etc/openldap/slapd.conf
715 + cp "${configfile}" "${configfile}".default
716 + eend
717 +
718 + # install our own init scripts and systemd unit files
719 + einfo "Install init scripts"
720 + newinitd "${FILESDIR}"/slapd-initd-2.4.40-r2 slapd
721 + newconfd "${FILESDIR}"/slapd-confd-2.4.28-r1 slapd
722 + einfo "Install systemd service"
723 + systemd_dounit "${FILESDIR}"/slapd.service
724 + systemd_install_serviced "${FILESDIR}"/slapd.service.conf
725 + systemd_newtmpfilesd "${FILESDIR}"/slapd.tmpfilesd slapd.conf
726 +
727 + if [[ $(get_libdir) != lib ]]; then
728 + sed -e "s,/usr/lib/,/usr/$(get_libdir)/," -i \
729 + "${ED}"/etc/init.d/slapd \
730 + "${ED}"/usr/lib/systemd/system/slapd.service || die
731 + fi
732 + # If built without SLP, we don't need to be before avahi
733 + use slp \
734 + || sed -i \
735 + -e '/before/{s/avahi-daemon//g}' \
736 + "${ED}"etc/init.d/slapd
737 +
738 + if use cxx ; then
739 + einfo "Install the ldapc++ library"
740 + cd "${BUILD_DIR}/contrib/ldapc++" || die
741 + emake DESTDIR="${D}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
742 + cd "${S}"/contrib/ldapc++ || die
743 + newdoc README ldapc++-README
744 + fi
745 +
746 + if use smbkrb5passwd ; then
747 + einfo "Install the smbk5pwd module"
748 + cd "${S}/contrib/slapd-modules/smbk5pwd" || die
749 + emake DESTDIR="${D}" \
750 + LDAP_BUILD="${BUILD_DIR}" \
751 + libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
752 + newdoc README smbk5pwd-README
753 + fi
754 +
755 + if use overlays ; then
756 + einfo "Install the samba4 module"
757 + cd "${S}/contrib/slapd-modules/samba4" || die
758 + emake DESTDIR="${D}" \
759 + LDAP_BUILD="${BUILD_DIR}" \
760 + libexecdir="/usr/$(get_libdir)/openldap" install
761 + newdoc README samba4-README
762 + fi
763 +
764 + einfo "Installing contrib modules"
765 + cd "${S}/contrib/slapd-modules" || die
766 + for l in */*.la; do
767 + "${lt}" --mode=install cp ${l} \
768 + "${ED}"usr/$(get_libdir)/openldap/openldap || \
769 + die "installing ${l} failed"
770 + done
771 +
772 + dodoc "${FILESDIR}"/DB_CONFIG.fast.example
773 + docinto contrib
774 + doman */*.5
775 + #newdoc acl/README*
776 + newdoc addpartial/README addpartial-README
777 + newdoc allop/README allop-README
778 + newdoc allowed/README allowed-README
779 + newdoc autogroup/README autogroup-README
780 + newdoc dsaschema/README dsaschema-README
781 + newdoc passwd/README passwd-README
782 + cd "${S}/contrib/slapi-plugins" || die
783 + insinto /usr/$(get_libdir)/openldap/openldap
784 + doins */*.so
785 + docinto contrib
786 + newdoc addrdnvalues/README addrdnvalues-README
787 +
788 + insinto /etc/openldap/schema
789 + newins "${DISTDIR}"/${BIS_P} ${BIS_PN}
790 +
791 + docinto back-sock ; dodoc "${S}"/servers/slapd/back-sock/searchexample*
792 + docinto back-shell ; dodoc "${S}"/servers/slapd/back-shell/searchexample*
793 + docinto back-perl ; dodoc "${S}"/servers/slapd/back-perl/SampleLDAP.pm
794 +
795 + dosbin "${S}"/contrib/slapd-tools/statslog
796 + newdoc "${S}"/contrib/slapd-tools/README README.statslog
797 + fi
798 +}
799 +
800 +multilib_src_install_all() {
801 + dodoc ANNOUNCEMENT CHANGES COPYRIGHT README
802 + docinto rfc ; dodoc doc/rfc/*.txt
803 +}
804 +
805 +pkg_preinst() {
806 + # keep old libs if any
807 + preserve_old_lib /usr/$(get_libdir)/{liblber,libldap_r,liblber}-2.3$(get_libname 0)
808 + # bug 440470, only display the getting started help there was no openldap before,
809 + # or we are going to a non-minimal build
810 + ! has_version net-nds/openldap || has_version 'net-nds/openldap[minimal]'
811 + OPENLDAP_PRINT_MESSAGES=$((! $?))
812 +}
813 +
814 +pkg_postinst() {
815 + if ! use minimal ; then
816 + # You cannot build SSL certificates during src_install that will make
817 + # binary packages containing your SSL key, which is both a security risk
818 + # and a misconfiguration if multiple machines use the same key and cert.
819 + if use ssl; then
820 + install_cert /etc/openldap/ssl/ldap
821 + use prefix || chown ldap:ldap "${EROOT}"etc/openldap/ssl/ldap.*
822 + ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
823 + ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
824 + ewarn "add 'TLS_REQCERT allow' if you want to use them."
825 + fi
826 +
827 + if use prefix; then
828 + # Warn about prefix issues with slapd
829 + eerror "slapd might NOT be usable on Prefix systems as it requires root privileges"
830 + eerror "to start up, and requires that certain files directories be owned by"
831 + eerror "ldap:ldap. As Prefix does not support changing ownership of files and"
832 + eerror "directories, you will have to manually fix this yourself."
833 + fi
834 +
835 + # These lines force the permissions of various content to be correct
836 + use prefix || chown ldap:ldap "${EROOT}"var/run/openldap
837 + chmod 0755 "${EROOT}"var/run/openldap
838 + use prefix || chown root:ldap "${EROOT}"etc/openldap/slapd.conf{,.default}
839 + chmod 0640 "${EROOT}"etc/openldap/slapd.conf{,.default}
840 + use prefix || chown ldap:ldap "${EROOT}"var/lib/openldap-data
841 + fi
842 +
843 + if has_version 'net-nds/openldap[-minimal]' && ((${OPENLDAP_PRINT_MESSAGES})); then
844 + elog "Getting started using OpenLDAP? There is some documentation available:"
845 + elog "Gentoo Guide to OpenLDAP Authentication"
846 + elog "(https://www.gentoo.org/doc/en/ldap-howto.xml)"
847 + elog "---"
848 + elog "An example file for tuning BDB backends with openldap is"
849 + elog "DB_CONFIG.fast.example in /usr/share/doc/${PF}/"
850 + fi
851 +
852 + preserve_old_lib_notify /usr/$(get_libdir)/{liblber,libldap,libldap_r}-2.3$(get_libname 0)
853 +}