Gentoo Archives: gentoo-commits

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