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