Gentoo Archives: gentoo-commits

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