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: Fri, 01 Nov 2019 08:45:01
Message-Id: 1572597879.10961eb90668f1925e3be5552c86aee72560043a.zlogene@gentoo
1 commit: 10961eb90668f1925e3be5552c86aee72560043a
2 Author: Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
3 AuthorDate: Fri Nov 1 08:41:00 2019 +0000
4 Commit: Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
5 CommitDate: Fri Nov 1 08:44:39 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=10961eb9
7
8 net-nds/openldap: Drop old
9
10 Package-Manager: Portage-2.3.76, Repoman-2.3.16
11 Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>
12
13 net-nds/openldap/Manifest | 1 -
14 net-nds/openldap/openldap-2.4.45-r1.ebuild | 882 ----------------------------
15 net-nds/openldap/openldap-2.4.47-r1.ebuild | 901 -----------------------------
16 3 files changed, 1784 deletions(-)
17
18 diff --git a/net-nds/openldap/Manifest b/net-nds/openldap/Manifest
19 index 068956c4799..0aba7c48052 100644
20 --- a/net-nds/openldap/Manifest
21 +++ b/net-nds/openldap/Manifest
22 @@ -1,4 +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 openldap-2.4.48.tgz 5704883 BLAKE2B ef856ff0b22c9187e68e9c09583a176fe4c2ee1f5bfe6b169f03bc0058294170ec4d1aa1b164e28eecd2ef6bafab539c1b942b0bd74e93852205beeaff39aeef SHA512 cf694a415be0bd55cc7f606099da2ed461748efd276561944cd29d7f5a8252a9be799d8778fac2d4fa9f382731eb4ca48c6b85630cb58a3b8249843561ae8feb
26 DIST rfc2307bis.schema-20140524 12262 BLAKE2B 98031f49e9bde1e4821e637af3382364d8344ed7017649686a088070d96a632dffa6c661552352656b1b159c0fd962965580069a64c7f3d5bb6a3ed75f60fd99 SHA512 83b89a1deeefc8566b97e7e865b9b6d04541099cbdf719e24538a7d27d61b6209e87ab9003a9f140bd9afd018ec569e71721e3a24090e1902c8b6659d2ba103e
27
28 diff --git a/net-nds/openldap/openldap-2.4.45-r1.ebuild b/net-nds/openldap/openldap-2.4.45-r1.ebuild
29 deleted file mode 100644
30 index 8cb3e58f1d4..00000000000
31 --- a/net-nds/openldap/openldap-2.4.45-r1.ebuild
32 +++ /dev/null
33 @@ -1,882 +0,0 @@
34 -# Copyright 1999-2019 Gentoo Authors
35 -# Distributed under the terms of the GNU General Public License v2
36 -
37 -EAPI="5"
38 -
39 -inherit db-use eutils flag-o-matic multilib multilib-minimal ssl-cert versionator toolchain-funcs autotools user systemd
40 -
41 -BIS_PN=rfc2307bis.schema
42 -BIS_PV=20140524
43 -BIS_P="${BIS_PN}-${BIS_PV}"
44 -
45 -DESCRIPTION="LDAP suite of application and development tools"
46 -HOMEPAGE="http://www.OpenLDAP.org/"
47 -
48 -# mirrors are mostly not working, using canonical URI
49 -SRC_URI="ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${P}.tgz
50 - mirror://gentoo/${BIS_P}"
51 -
52 -LICENSE="OPENLDAP GPL-2"
53 -SLOT="0"
54 -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-linux ~x86-linux ~x86-solaris"
55 -
56 -IUSE_DAEMON="crypt samba slp tcpd experimental minimal"
57 -IUSE_BACKEND="+berkdb"
58 -IUSE_OVERLAY="overlays perl"
59 -IUSE_OPTIONAL="gnutls iodbc sasl ssl odbc debug ipv6 libressl +syslog selinux static-libs"
60 -IUSE_CONTRIB="smbkrb5passwd kerberos kinit pbkdf2 sha2"
61 -IUSE_CONTRIB="${IUSE_CONTRIB} -cxx"
62 -IUSE="${IUSE_DAEMON} ${IUSE_BACKEND} ${IUSE_OVERLAY} ${IUSE_OPTIONAL} ${IUSE_CONTRIB}"
63 -
64 -REQUIRED_USE="cxx? ( sasl )
65 - pbkdf2? ( ssl )"
66 -
67 -# always list newer first
68 -# Do not add any AGPL-3 BDB here!
69 -# See bug 525110, comment 15.
70 -# Advanced usage: OPENLDAP_BDB_SLOTS in the environment can be used to force a slot during build.
71 -BDB_SLOTS="${OPENLDAP_BDB_SLOTS:=5.3 5.1 4.8 4.7 4.6 4.5 4.4}"
72 -BDB_PKGS=''
73 -for _slot in $BDB_SLOTS; do BDB_PKGS="${BDB_PKGS} sys-libs/db:${_slot}" ; done
74 -
75 -# openssl is needed to generate lanman-passwords required by samba
76 -CDEPEND="
77 - ssl? (
78 - !gnutls? (
79 - !libressl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
80 - libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP}] )
81 - )
82 - gnutls? (
83 - >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}]
84 - >=dev-libs/libgcrypt-1.5.3:0=[${MULTILIB_USEDEP}]
85 - )
86 - )
87 - sasl? ( dev-libs/cyrus-sasl:= )
88 - !minimal? (
89 - sys-devel/libtool
90 - sys-libs/e2fsprogs-libs
91 - >=dev-db/lmdb-0.9.18:=
92 - tcpd? ( sys-apps/tcp-wrappers )
93 - odbc? ( !iodbc? ( dev-db/unixODBC )
94 - iodbc? ( dev-db/libiodbc ) )
95 - slp? ( net-libs/openslp )
96 - perl? ( dev-lang/perl:=[-build(-)] )
97 - samba? (
98 - !libressl? ( dev-libs/openssl:0= )
99 - libressl? ( dev-libs/libressl:0= )
100 - )
101 - berkdb? (
102 - <sys-libs/db-6.0:=
103 - || ( ${BDB_PKGS} )
104 - )
105 - smbkrb5passwd? (
106 - !libressl? ( dev-libs/openssl:0= )
107 - libressl? ( dev-libs/libressl:0= )
108 - kerberos? ( app-crypt/heimdal )
109 - )
110 - kerberos? (
111 - virtual/krb5
112 - kinit? ( !app-crypt/heimdal )
113 - )
114 - cxx? ( dev-libs/cyrus-sasl:= )
115 - )"
116 -DEPEND="${CDEPEND}
117 - sys-apps/groff"
118 -RDEPEND="${CDEPEND}
119 - selinux? ( sec-policy/selinux-ldap )
120 -"
121 -# for tracking versions
122 -OPENLDAP_VERSIONTAG=".version-tag"
123 -OPENLDAP_DEFAULTDIR_VERSIONTAG="/var/lib/openldap-data"
124 -
125 -MULTILIB_WRAPPED_HEADERS=(
126 - # USE=cxx
127 - /usr/include/LDAPAsynConnection.h
128 - /usr/include/LDAPAttrType.h
129 - /usr/include/LDAPAttribute.h
130 - /usr/include/LDAPAttributeList.h
131 - /usr/include/LDAPConnection.h
132 - /usr/include/LDAPConstraints.h
133 - /usr/include/LDAPControl.h
134 - /usr/include/LDAPControlSet.h
135 - /usr/include/LDAPEntry.h
136 - /usr/include/LDAPEntryList.h
137 - /usr/include/LDAPException.h
138 - /usr/include/LDAPExtResult.h
139 - /usr/include/LDAPMessage.h
140 - /usr/include/LDAPMessageQueue.h
141 - /usr/include/LDAPModList.h
142 - /usr/include/LDAPModification.h
143 - /usr/include/LDAPObjClass.h
144 - /usr/include/LDAPRebind.h
145 - /usr/include/LDAPRebindAuth.h
146 - /usr/include/LDAPReferenceList.h
147 - /usr/include/LDAPResult.h
148 - /usr/include/LDAPSaslBindResult.h
149 - /usr/include/LDAPSchema.h
150 - /usr/include/LDAPSearchReference.h
151 - /usr/include/LDAPSearchResult.h
152 - /usr/include/LDAPSearchResults.h
153 - /usr/include/LDAPUrl.h
154 - /usr/include/LDAPUrlList.h
155 - /usr/include/LdifReader.h
156 - /usr/include/LdifWriter.h
157 - /usr/include/SaslInteraction.h
158 - /usr/include/SaslInteractionHandler.h
159 - /usr/include/StringList.h
160 - /usr/include/TlsOptions.h
161 -)
162 -
163 -openldap_filecount() {
164 - local dir="$1"
165 - find "${dir}" -type f ! -name '.*' ! -name 'DB_CONFIG*' | wc -l
166 -}
167 -
168 -openldap_find_versiontags() {
169 - # scan for all datadirs
170 - openldap_datadirs=""
171 - if [ -f "${EROOT}"/etc/openldap/slapd.conf ]; then
172 - openldap_datadirs="$(awk '{if($1 == "directory") print $2 }' ${EROOT}/etc/openldap/slapd.conf)"
173 - fi
174 - openldap_datadirs="${openldap_datadirs} ${OPENLDAP_DEFAULTDIR_VERSIONTAG}"
175 -
176 - einfo
177 - einfo "Scanning datadir(s) from slapd.conf and"
178 - einfo "the default installdir for Versiontags"
179 - einfo "(${OPENLDAP_DEFAULTDIR_VERSIONTAG} may appear twice)"
180 - einfo
181 -
182 - # scan datadirs if we have a version tag
183 - openldap_found_tag=0
184 - have_files=0
185 - for each in ${openldap_datadirs}; do
186 - CURRENT_TAGDIR=${ROOT}`echo ${each} | sed "s:\/::"`
187 - CURRENT_TAG=${CURRENT_TAGDIR}/${OPENLDAP_VERSIONTAG}
188 - if [ -d ${CURRENT_TAGDIR} ] && [ ${openldap_found_tag} == 0 ] ; then
189 - einfo "- Checking ${each}..."
190 - if [ -r ${CURRENT_TAG} ] ; then
191 - # yey, we have one :)
192 - einfo " Found Versiontag in ${each}"
193 - source ${CURRENT_TAG}
194 - if [ "${OLDPF}" == "" ] ; then
195 - eerror "Invalid Versiontag found in ${CURRENT_TAGDIR}"
196 - eerror "Please delete it"
197 - eerror
198 - die "Please kill the invalid versiontag in ${CURRENT_TAGDIR}"
199 - fi
200 -
201 - OLD_MAJOR=`get_version_component_range 2-3 ${OLDPF}`
202 -
203 - [ $(openldap_filecount ${CURRENT_TAGDIR}) -gt 0 ] && have_files=1
204 -
205 - # are we on the same branch?
206 - if [ "${OLD_MAJOR}" != "${PV:0:3}" ] ; then
207 - ewarn " Versiontag doesn't match current major release!"
208 - if [[ "${have_files}" == "1" ]] ; then
209 - eerror " Versiontag says other major and you (probably) have datafiles!"
210 - echo
211 - openldap_upgrade_howto
212 - else
213 - einfo " No real problem, seems there's no database."
214 - fi
215 - else
216 - einfo " Versiontag is fine here :)"
217 - fi
218 - else
219 - einfo " Non-tagged dir ${each}"
220 - [ $(openldap_filecount ${each}) -gt 0 ] && have_files=1
221 - if [[ "${have_files}" == "1" ]] ; then
222 - einfo " EEK! Non-empty non-tagged datadir, counting `ls -a ${each} | wc -l` files"
223 - echo
224 -
225 - eerror
226 - eerror "Your OpenLDAP Installation has a non tagged datadir that"
227 - eerror "possibly contains a database at ${CURRENT_TAGDIR}"
228 - eerror
229 - eerror "Please export data if any entered and empty or remove"
230 - eerror "the directory, installation has been stopped so you"
231 - eerror "can take required action"
232 - eerror
233 - eerror "For a HOWTO on exporting the data, see instructions in the ebuild"
234 - eerror
235 - openldap_upgrade_howto
236 - die "Please move the datadir ${CURRENT_TAGDIR} away"
237 - fi
238 - fi
239 - einfo
240 - fi
241 - done
242 - [ "${have_files}" == "1" ] && einfo "DB files present" || einfo "No DB files present"
243 -
244 - # Now we must check for the major version of sys-libs/db linked against.
245 - SLAPD_PATH=${EROOT}/usr/$(get_libdir)/openldap/slapd
246 - if [ "${have_files}" == "1" -a -f "${SLAPD_PATH}" ]; then
247 - OLDVER="$(/usr/bin/ldd ${SLAPD_PATH} \
248 - | awk '/libdb-/{gsub("^libdb-","",$1);gsub(".so$","",$1);print $1}')"
249 - if use berkdb; then
250 - # find which one would be used
251 - for bdb_slot in $BDB_SLOTS ; do
252 - NEWVER="$(db_findver "=sys-libs/db-${bdb_slot}*")"
253 - [[ -n "$NEWVER" ]] && break
254 - done
255 - fi
256 - local fail=0
257 - if [ -z "${OLDVER}" -a -z "${NEWVER}" ]; then
258 - :
259 - # Nothing wrong here.
260 - elif [ -z "${OLDVER}" -a -n "${NEWVER}" ]; then
261 - eerror " Your existing version of OpenLDAP was not built against"
262 - eerror " any version of sys-libs/db, but the new one will build"
263 - eerror " against ${NEWVER} and your database may be inaccessible."
264 - echo
265 - fail=1
266 - elif [ -n "${OLDVER}" -a -z "${NEWVER}" ]; then
267 - eerror " Your existing version of OpenLDAP was built against"
268 - eerror " sys-libs/db:${OLDVER}, but the new one will not be"
269 - eerror " built against any version and your database may be"
270 - eerror " inaccessible."
271 - echo
272 - fail=1
273 - elif [ "${OLDVER}" != "${NEWVER}" ]; then
274 - eerror " Your existing version of OpenLDAP was built against"
275 - eerror " sys-libs/db:${OLDVER}, but the new one will build against"
276 - eerror " ${NEWVER} and your database would be inaccessible."
277 - echo
278 - fail=1
279 - fi
280 - [ "${fail}" == "1" ] && openldap_upgrade_howto
281 - fi
282 -
283 - echo
284 - einfo
285 - einfo "All datadirs are fine, proceeding with merge now..."
286 - einfo
287 -}
288 -
289 -openldap_upgrade_howto() {
290 - eerror
291 - eerror "A (possible old) installation of OpenLDAP was detected,"
292 - eerror "installation will not proceed for now."
293 - eerror
294 - eerror "As major version upgrades can corrupt your database,"
295 - eerror "you need to dump your database and re-create it afterwards."
296 - eerror
297 - eerror "Additionally, rebuilding against different major versions of the"
298 - eerror "sys-libs/db libraries will cause your database to be inaccessible."
299 - eerror ""
300 - d="$(date -u +%s)"
301 - l="/root/ldapdump.${d}"
302 - i="${l}.raw"
303 - eerror " 1. /etc/init.d/slapd stop"
304 - eerror " 2. slapcat -l ${i}"
305 - eerror " 3. egrep -v '^(entry|context)CSN:' <${i} >${l}"
306 - eerror " 4. mv /var/lib/openldap-data/ /var/lib/openldap-data-backup/"
307 - eerror " 5. emerge --update \=net-nds/${PF}"
308 - eerror " 6. etc-update, and ensure that you apply the changes"
309 - eerror " 7. slapadd -l ${l}"
310 - eerror " 8. chown ldap:ldap /var/lib/openldap-data/*"
311 - eerror " 9. /etc/init.d/slapd start"
312 - eerror "10. check that your data is intact."
313 - eerror "11. set up the new replication system."
314 - eerror
315 - if [ "${FORCE_UPGRADE}" != "1" ]; then
316 - die "You need to upgrade your database first"
317 - else
318 - eerror "You have the magical FORCE_UPGRADE=1 in place."
319 - eerror "Don't say you weren't warned about data loss."
320 - fi
321 -}
322 -
323 -pkg_setup() {
324 - if ! use sasl && use cxx ; then
325 - die "To build the ldapc++ library you must emerge openldap with sasl support"
326 - fi
327 - # Bug #322787
328 - if use minimal && ! has_version "net-nds/openldap" ; then
329 - einfo "No datadir scan needed, openldap not installed"
330 - elif use minimal && has_version 'net-nds/openldap[minimal]' ; then
331 - einfo "Skipping scan for previous datadirs as requested by minimal useflag"
332 - else
333 - openldap_find_versiontags
334 - fi
335 -
336 - # The user/group are only used for running daemons which are
337 - # disabled in minimal builds, so elide the accounts too.
338 - if ! use minimal ; then
339 - enewgroup ldap 439
340 - enewuser ldap 439 -1 /usr/$(get_libdir)/openldap ldap
341 - fi
342 -}
343 -
344 -src_prepare() {
345 - # ensure correct SLAPI path by default
346 - sed -i -e 's,\(#define LDAPI_SOCK\).*,\1 "'"${EPREFIX}"'/var/run/openldap/slapd.sock",' \
347 - "${S}"/include/ldap_defaults.h
348 -
349 - epatch "${FILESDIR}"/${PN}-2.4.17-gcc44.patch
350 -
351 - epatch \
352 - "${FILESDIR}"/${PN}-2.2.14-perlthreadsfix.patch \
353 - "${FILESDIR}"/${PN}-2.4.15-ppolicy.patch
354 -
355 - # bug #116045 - still present in 2.4.28
356 - epatch "${FILESDIR}"/${PN}-2.4.35-contrib-smbk5pwd.patch
357 - # bug #408077 - samba4
358 - epatch "${FILESDIR}"/${PN}-2.4.35-contrib-samba4.patch
359 -
360 - # bug #189817
361 - epatch "${FILESDIR}"/${PN}-2.4.11-libldap_r.patch
362 -
363 - # bug #233633
364 - epatch "${FILESDIR}"/${PN}-2.4.45-fix-lmpasswd-gnutls-symbols.patch
365 -
366 - # bug #281495
367 - epatch "${FILESDIR}"/${PN}-2.4.28-gnutls-gcrypt.patch
368 -
369 - # bug #294350
370 - epatch "${FILESDIR}"/${PN}-2.4.6-evolution-ntlm.patch
371 -
372 - # unbreak /bin/sh -> dash
373 - epatch "${FILESDIR}"/${PN}-2.4.28-fix-dash.patch
374 -
375 - # bug #420959
376 - epatch "${FILESDIR}"/${PN}-2.4.31-gcc47.patch
377 -
378 - # bug #622464
379 - epatch "${FILESDIR}"/${PN}-2.4.45-libressl.patch
380 -
381 - # unbundle lmdb
382 - epatch "${FILESDIR}"/${PN}-2.4.42-mdb-unbundle.patch
383 - rm -rf "${S}"/libraries/liblmdb
384 -
385 - epatch_user
386 -
387 - cd "${S}"/build || die
388 - einfo "Making sure upstream build strip does not do stripping too early"
389 - sed -i.orig \
390 - -e '/^STRIP/s,-s,,g' \
391 - top.mk || die "Failed to block stripping"
392 -
393 - # wrong assumption that /bin/sh is /bin/bash
394 - sed -i \
395 - -e 's|/bin/sh|/bin/bash|g' \
396 - "${S}"/tests/scripts/* || die "sed failed"
397 -
398 - cd "${S}" || die
399 -
400 - AT_NOEAUTOMAKE=yes eautoreconf
401 -}
402 -
403 -build_contrib_module() {
404 - # <dir> <sources> <outputname>
405 - cd "${S}/contrib/slapd-modules/$1" || die
406 - einfo "Compiling contrib-module: $3"
407 - # Make sure it's uppercase
408 - local define_name="$(echo "SLAPD_OVER_${1}" | LC_ALL=C tr '[:lower:]' '[:upper:]')"
409 - "${lt}" --mode=compile --tag=CC \
410 - "${CC}" \
411 - -D${define_name}=SLAPD_MOD_DYNAMIC \
412 - -I"${BUILD_DIR}"/include \
413 - -I../../../include -I../../../servers/slapd ${CFLAGS} \
414 - -o ${2%.c}.lo -c $2 || die "compiling $3 failed"
415 - einfo "Linking contrib-module: $3"
416 - "${lt}" --mode=link --tag=CC \
417 - "${CC}" -module \
418 - ${CFLAGS} \
419 - ${LDFLAGS} \
420 - -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
421 - -o $3.la ${2%.c}.lo || die "linking $3 failed"
422 -}
423 -
424 -src_configure() {
425 - # Bug 408001
426 - use elibc_FreeBSD && append-cppflags -DMDB_DSYNC=O_SYNC -DMDB_FDATASYNC=fsync
427 -
428 - # connectionless ldap per bug #342439
429 - append-cppflags -DLDAP_CONNECTIONLESS
430 -
431 - multilib-minimal_src_configure
432 -}
433 -
434 -multilib_src_configure() {
435 - local myconf=()
436 -
437 - use debug && myconf+=( $(use_enable debug) )
438 -
439 - # ICU exists only in the configure, nowhere in the codebase, bug #510858
440 - export ac_cv_header_unicode_utypes_h=no ol_cv_lib_icu=no
441 -
442 - if ! use minimal && multilib_is_native_abi; then
443 - local CPPFLAGS=${CPPFLAGS}
444 -
445 - # re-enable serverside overlay chains per bug #296567
446 - # see ldap docs chaper 12.3.1 for details
447 - myconf+=( --enable-ldap )
448 -
449 - # backends
450 - myconf+=( --enable-slapd )
451 - if use berkdb ; then
452 - einfo "Using Berkeley DB for local backend"
453 - myconf+=( --enable-bdb --enable-hdb )
454 - DBINCLUDE=$(db_includedir $BDB_SLOTS)
455 - einfo "Using $DBINCLUDE for sys-libs/db version"
456 - # We need to include the slotted db.h dir for FreeBSD
457 - append-cppflags -I${DBINCLUDE}
458 - else
459 - myconf+=( --disable-bdb --disable-hdb )
460 - fi
461 - for backend in dnssrv ldap mdb meta monitor null passwd relay shell sock; do
462 - myconf+=( --enable-${backend}=mod )
463 - done
464 -
465 - myconf+=( $(use_enable perl perl mod) )
466 -
467 - myconf+=( $(use_enable odbc sql mod) )
468 - if use odbc ; then
469 - local odbc_lib="unixodbc"
470 - if use iodbc ; then
471 - odbc_lib="iodbc"
472 - append-cppflags -I"${EPREFIX}"/usr/include/iodbc
473 - fi
474 - myconf+=( --with-odbc=${odbc_lib} )
475 - fi
476 -
477 - # slapd options
478 - myconf+=(
479 - $(use_enable crypt)
480 - $(use_enable slp)
481 - $(use_enable samba lmpasswd)
482 - $(use_enable syslog)
483 - )
484 - if use experimental ; then
485 - myconf+=(
486 - --enable-dynacl
487 - --enable-aci=mod
488 - )
489 - fi
490 - for option in aci cleartext modules rewrite rlookups slapi; do
491 - myconf+=( --enable-${option} )
492 - done
493 -
494 - # slapd overlay options
495 - # Compile-in the syncprov, the others as module
496 - myconf+=( --enable-syncprov=yes )
497 - use overlays && myconf+=( --enable-overlays=mod )
498 -
499 - else
500 - myconf+=(
501 - --disable-backends
502 - --disable-slapd
503 - --disable-bdb
504 - --disable-hdb
505 - --disable-mdb
506 - --disable-overlays
507 - --disable-syslog
508 - )
509 - fi
510 -
511 - # basic functionality stuff
512 - myconf+=(
513 - $(use_enable ipv6)
514 - $(multilib_native_use_with sasl cyrus-sasl)
515 - $(multilib_native_use_enable sasl spasswd)
516 - $(use_enable tcpd wrappers)
517 - )
518 -
519 - # Some cross-compiling tests don't pan out well.
520 - tc-is-cross-compiler && myconf+=(
521 - --with-yielding-select=yes
522 - )
523 -
524 - local ssl_lib="no"
525 - if use ssl || ( ! use minimal && use samba ) ; then
526 - ssl_lib="openssl"
527 - use gnutls && ssl_lib="gnutls"
528 - fi
529 -
530 - myconf+=( --with-tls=${ssl_lib} )
531 -
532 - for basicflag in dynamic local proctitle shared; do
533 - myconf+=( --enable-${basicflag} )
534 - done
535 -
536 - tc-export AR CC CXX
537 - ECONF_SOURCE=${S} \
538 - STRIP=/bin/true \
539 - econf \
540 - --libexecdir="${EPREFIX}"/usr/$(get_libdir)/openldap \
541 - $(use_enable static-libs static) \
542 - "${myconf[@]}"
543 - emake depend
544 -}
545 -
546 -src_configure_cxx() {
547 - # This needs the libraries built by the first build run.
548 - # So we have to run it AFTER the main build, not just after the main
549 - # configure.
550 - local myconf_ldapcpp=(
551 - --with-ldap-includes="${S}"/include
552 - )
553 -
554 - mkdir -p "${BUILD_DIR}"/contrib/ldapc++ || die
555 - cd "${BUILD_DIR}/contrib/ldapc++" || die
556 -
557 - local LDFLAGS=${LDFLAGS} CPPFLAGS=${CPPFLAGS}
558 - append-ldflags -L"${BUILD_DIR}"/libraries/liblber/.libs \
559 - -L"${BUILD_DIR}"/libraries/libldap/.libs
560 - append-cppflags -I"${BUILD_DIR}"/include
561 - ECONF_SOURCE=${S}/contrib/ldapc++ \
562 - econf "${myconf_ldapcpp[@]}" \
563 - CC="${CC}" \
564 - CXX="${CXX}"
565 -}
566 -
567 -multilib_src_compile() {
568 - tc-export AR CC CXX
569 - emake CC="${CC}" AR="${AR}" SHELL="${EPREFIX}"/bin/bash
570 - local lt="${BUILD_DIR}/libtool"
571 - export echo="echo"
572 -
573 - if ! use minimal && multilib_is_native_abi ; then
574 - if use cxx ; then
575 - einfo "Building contrib library: ldapc++"
576 - src_configure_cxx
577 - cd "${BUILD_DIR}/contrib/ldapc++" || die
578 - emake \
579 - CC="${CC}" CXX="${CXX}"
580 - fi
581 -
582 - if use smbkrb5passwd ; then
583 - einfo "Building contrib-module: smbk5pwd"
584 - cd "${S}/contrib/slapd-modules/smbk5pwd" || die
585 -
586 - MY_DEFS="-DDO_SHADOW"
587 - if use samba ; then
588 - MY_DEFS="${MY_DEFS} -DDO_SAMBA"
589 - MY_KRB5_INC=""
590 - fi
591 - if use kerberos ; then
592 - MY_DEFS="${MY_DEFS} -DDO_KRB5"
593 - MY_KRB5_INC="$(krb5-config --cflags)"
594 - fi
595 -
596 - emake \
597 - DEFS="${MY_DEFS}" \
598 - KRB5_INC="${MY_KRB5_INC}" \
599 - LDAP_BUILD="${BUILD_DIR}" \
600 - CC="${CC}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap"
601 - fi
602 -
603 - if use overlays ; then
604 - einfo "Building contrib-module: samba4"
605 - cd "${S}/contrib/slapd-modules/samba4" || die
606 -
607 - emake \
608 - LDAP_BUILD="${BUILD_DIR}" \
609 - CC="${CC}" libexecdir="/usr/$(get_libdir)/openldap"
610 - fi
611 -
612 - if use kerberos ; then
613 - if use kinit ; then
614 - build_contrib_module "kinit" "kinit.c" "kinit"
615 - fi
616 - cd "${S}/contrib/slapd-modules/passwd" || die
617 - einfo "Compiling contrib-module: pw-kerberos"
618 - "${lt}" --mode=compile --tag=CC \
619 - "${CC}" \
620 - -I"${BUILD_DIR}"/include \
621 - -I../../../include \
622 - ${CFLAGS} \
623 - $(krb5-config --cflags) \
624 - -DHAVE_KRB5 \
625 - -o kerberos.lo \
626 - -c kerberos.c || die "compiling pw-kerberos failed"
627 - einfo "Linking contrib-module: pw-kerberos"
628 - "${lt}" --mode=link --tag=CC \
629 - "${CC}" -module \
630 - ${CFLAGS} \
631 - ${LDFLAGS} \
632 - -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
633 - -o pw-kerberos.la \
634 - kerberos.lo || die "linking pw-kerberos failed"
635 - fi
636 -
637 - if use pbkdf2; then
638 - cd "${S}/contrib/slapd-modules/passwd/pbkdf2" || die
639 - einfo "Compiling contrib-module: pw-pbkdf2"
640 - "${lt}" --mode=compile --tag=CC \
641 - "${CC}" \
642 - -I"${BUILD_DIR}"/include \
643 - -I../../../../include \
644 - ${CFLAGS} \
645 - -o pbkdf2.lo \
646 - -c pw-pbkdf2.c || die "compiling pw-pbkdf2 failed"
647 - einfo "Linking contrib-module: pw-pbkdf2"
648 - "${lt}" --mode=link --tag=CC \
649 - "${CC}" -module \
650 - ${CFLAGS} \
651 - ${LDFLAGS} \
652 - -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
653 - -o pw-pbkdf2.la \
654 - pbkdf2.lo || die "linking pw-pbkdf2 failed"
655 - fi
656 -
657 - if use sha2 ; then
658 - cd "${S}/contrib/slapd-modules/passwd/sha2" || die
659 - einfo "Compiling contrib-module: pw-sha2"
660 - "${lt}" --mode=compile --tag=CC \
661 - "${CC}" \
662 - -I"${BUILD_DIR}"/include \
663 - -I../../../../include \
664 - ${CFLAGS} \
665 - -o sha2.lo \
666 - -c sha2.c || die "compiling pw-sha2 failed"
667 - "${lt}" --mode=compile --tag=CC \
668 - "${CC}" \
669 - -I"${BUILD_DIR}"/include \
670 - -I../../../../include \
671 - ${CFLAGS} \
672 - -o slapd-sha2.lo \
673 - -c slapd-sha2.c || die "compiling pw-sha2 failed"
674 - einfo "Linking contrib-module: pw-sha2"
675 - "${lt}" --mode=link --tag=CC \
676 - "${CC}" -module \
677 - ${CFLAGS} \
678 - ${LDFLAGS} \
679 - -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
680 - -o pw-sha2.la \
681 - sha2.lo slapd-sha2.lo || die "linking pw-sha2 failed"
682 - fi
683 -
684 - # We could build pw-radius if GNURadius would install radlib.h
685 - cd "${S}/contrib/slapd-modules/passwd" || die
686 - einfo "Compiling contrib-module: pw-netscape"
687 - "${lt}" --mode=compile --tag=CC \
688 - "${CC}" \
689 - -I"${BUILD_DIR}"/include \
690 - -I../../../include \
691 - ${CFLAGS} \
692 - -o netscape.lo \
693 - -c netscape.c || die "compiling pw-netscape failed"
694 - einfo "Linking contrib-module: pw-netscape"
695 - "${lt}" --mode=link --tag=CC \
696 - "${CC}" -module \
697 - ${CFLAGS} \
698 - ${LDFLAGS} \
699 - -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
700 - -o pw-netscape.la \
701 - netscape.lo || die "linking pw-netscape failed"
702 -
703 - #build_contrib_module "acl" "posixgroup.c" "posixGroup" # example code only
704 - #build_contrib_module "acl" "gssacl.c" "gss" # example code only, also needs kerberos
705 - build_contrib_module "addpartial" "addpartial-overlay.c" "addpartial-overlay"
706 - build_contrib_module "allop" "allop.c" "overlay-allop"
707 - build_contrib_module "allowed" "allowed.c" "allowed"
708 - build_contrib_module "autogroup" "autogroup.c" "autogroup"
709 - build_contrib_module "cloak" "cloak.c" "cloak"
710 - # build_contrib_module "comp_match" "comp_match.c" "comp_match" # really complex, adds new external deps, questionable demand
711 - build_contrib_module "denyop" "denyop.c" "denyop-overlay"
712 - build_contrib_module "dsaschema" "dsaschema.c" "dsaschema-plugin"
713 - build_contrib_module "dupent" "dupent.c" "dupent"
714 - build_contrib_module "lastbind" "lastbind.c" "lastbind"
715 - # lastmod may not play well with other overlays
716 - build_contrib_module "lastmod" "lastmod.c" "lastmod"
717 - build_contrib_module "noopsrch" "noopsrch.c" "noopsrch"
718 - build_contrib_module "nops" "nops.c" "nops-overlay"
719 - #build_contrib_module "nssov" "nssov.c" "nssov-overlay" RESO:LATER
720 - build_contrib_module "trace" "trace.c" "trace"
721 - # build slapi-plugins
722 - cd "${S}/contrib/slapi-plugins/addrdnvalues" || die
723 - einfo "Building contrib-module: addrdnvalues plugin"
724 - "${CC}" -shared \
725 - -I"${BUILD_DIR}"/include \
726 - -I../../../include \
727 - ${CFLAGS} \
728 - -fPIC \
729 - ${LDFLAGS} \
730 - -o libaddrdnvalues-plugin.so \
731 - addrdnvalues.c || die "Building libaddrdnvalues-plugin.so failed"
732 -
733 - fi
734 -}
735 -
736 -multilib_src_test() {
737 - if multilib_is_native_abi; then
738 - cd tests || die
739 - emake tests || die "make tests failed"
740 - fi
741 -}
742 -
743 -multilib_src_install() {
744 - local lt="${BUILD_DIR}/libtool"
745 - emake DESTDIR="${D}" SHELL="${EPREFIX}"/bin/bash install
746 -
747 - if ! use minimal && multilib_is_native_abi; then
748 - # openldap modules go here
749 - # TODO: write some code to populate slapd.conf with moduleload statements
750 - keepdir /usr/$(get_libdir)/openldap/openldap/
751 -
752 - # initial data storage dir
753 - keepdir /var/lib/openldap-data
754 - use prefix || fowners ldap:ldap /var/lib/openldap-data
755 - fperms 0700 /var/lib/openldap-data
756 -
757 - echo "OLDPF='${PF}'" > "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
758 - echo "# do NOT delete this. it is used" >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
759 - echo "# to track versions for upgrading." >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
760 -
761 - # use our config
762 - rm "${ED}"etc/openldap/slapd.conf
763 - insinto /etc/openldap
764 - newins "${FILESDIR}"/${PN}-2.4.40-slapd-conf slapd.conf
765 - configfile="${ED}"etc/openldap/slapd.conf
766 -
767 - # populate with built backends
768 - ebegin "populate config with built backends"
769 - for x in "${ED}"usr/$(get_libdir)/openldap/openldap/back_*.so; do
770 - einfo "Adding $(basename ${x})"
771 - sed -e "/###INSERTDYNAMICMODULESHERE###$/a# moduleload\t$(basename ${x})" -i "${configfile}"
772 - done
773 - sed -e "s:###INSERTDYNAMICMODULESHERE###$:# modulepath\t${EPREFIX}/usr/$(get_libdir)/openldap/openldap:" -i "${configfile}"
774 - use prefix || fowners root:ldap /etc/openldap/slapd.conf
775 - fperms 0640 /etc/openldap/slapd.conf
776 - cp "${configfile}" "${configfile}".default
777 - eend
778 -
779 - # install our own init scripts and systemd unit files
780 - einfo "Install init scripts"
781 - sed -e "s,/usr/lib/,/usr/$(get_libdir)/," "${FILESDIR}"/slapd-initd-2.4.40-r2 > "${T}"/slapd || die
782 - doinitd "${T}"/slapd
783 - newconfd "${FILESDIR}"/slapd-confd-2.4.28-r1 slapd
784 -
785 - einfo "Install systemd service"
786 - sed -e "s,/usr/lib/,/usr/$(get_libdir)/," "${FILESDIR}"/slapd.service > "${T}"/slapd.service || die
787 - systemd_dounit "${T}"/slapd.service
788 - systemd_install_serviced "${FILESDIR}"/slapd.service.conf
789 - systemd_newtmpfilesd "${FILESDIR}"/slapd.tmpfilesd slapd.conf
790 -
791 - # If built without SLP, we don't need to be before avahi
792 - use slp \
793 - || sed -i \
794 - -e '/before/{s/avahi-daemon//g}' \
795 - "${ED}"etc/init.d/slapd
796 -
797 - if use cxx ; then
798 - einfo "Install the ldapc++ library"
799 - cd "${BUILD_DIR}/contrib/ldapc++" || die
800 - emake DESTDIR="${D}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
801 - cd "${S}"/contrib/ldapc++ || die
802 - newdoc README ldapc++-README
803 - fi
804 -
805 - if use smbkrb5passwd ; then
806 - einfo "Install the smbk5pwd module"
807 - cd "${S}/contrib/slapd-modules/smbk5pwd" || die
808 - emake DESTDIR="${D}" \
809 - LDAP_BUILD="${BUILD_DIR}" \
810 - libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
811 - newdoc README smbk5pwd-README
812 - fi
813 -
814 - if use overlays ; then
815 - einfo "Install the samba4 module"
816 - cd "${S}/contrib/slapd-modules/samba4" || die
817 - emake DESTDIR="${D}" \
818 - LDAP_BUILD="${BUILD_DIR}" \
819 - libexecdir="/usr/$(get_libdir)/openldap" install
820 - newdoc README samba4-README
821 - fi
822 -
823 - einfo "Installing contrib modules"
824 - cd "${S}/contrib/slapd-modules" || die
825 - for l in */*.la */*/*.la; do
826 - [[ -e ${l} ]] || continue
827 - "${lt}" --mode=install cp ${l} \
828 - "${ED}"usr/$(get_libdir)/openldap/openldap || \
829 - die "installing ${l} failed"
830 - done
831 -
832 - dodoc "${FILESDIR}"/DB_CONFIG.fast.example
833 - docinto contrib
834 - doman */*.5
835 - #newdoc acl/README*
836 - newdoc addpartial/README addpartial-README
837 - newdoc allop/README allop-README
838 - newdoc allowed/README allowed-README
839 - newdoc autogroup/README autogroup-README
840 - newdoc dsaschema/README dsaschema-README
841 - newdoc passwd/README passwd-README
842 - cd "${S}/contrib/slapi-plugins" || die
843 - insinto /usr/$(get_libdir)/openldap/openldap
844 - doins */*.so
845 - docinto contrib
846 - newdoc addrdnvalues/README addrdnvalues-README
847 -
848 - insinto /etc/openldap/schema
849 - newins "${DISTDIR}"/${BIS_P} ${BIS_PN}
850 -
851 - docinto back-sock ; dodoc "${S}"/servers/slapd/back-sock/searchexample*
852 - docinto back-shell ; dodoc "${S}"/servers/slapd/back-shell/searchexample*
853 - docinto back-perl ; dodoc "${S}"/servers/slapd/back-perl/SampleLDAP.pm
854 -
855 - dosbin "${S}"/contrib/slapd-tools/statslog
856 - newdoc "${S}"/contrib/slapd-tools/README README.statslog
857 - fi
858 -
859 - use static-libs || prune_libtool_files --all
860 -}
861 -
862 -multilib_src_install_all() {
863 - dodoc ANNOUNCEMENT CHANGES COPYRIGHT README
864 - docinto rfc ; dodoc doc/rfc/*.txt
865 -}
866 -
867 -pkg_preinst() {
868 - # keep old libs if any
869 - preserve_old_lib /usr/$(get_libdir)/{liblber,libldap_r,liblber}-2.3$(get_libname 0)
870 - # bug 440470, only display the getting started help there was no openldap before,
871 - # or we are going to a non-minimal build
872 - ! has_version net-nds/openldap || has_version 'net-nds/openldap[minimal]'
873 - OPENLDAP_PRINT_MESSAGES=$((! $?))
874 -}
875 -
876 -pkg_postinst() {
877 - if ! use minimal ; then
878 - # You cannot build SSL certificates during src_install that will make
879 - # binary packages containing your SSL key, which is both a security risk
880 - # and a misconfiguration if multiple machines use the same key and cert.
881 - if use ssl; then
882 - install_cert /etc/openldap/ssl/ldap
883 - use prefix || chown ldap:ldap "${EROOT}"etc/openldap/ssl/ldap.*
884 - ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
885 - ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
886 - ewarn "add 'TLS_REQCERT allow' if you want to use them."
887 - fi
888 -
889 - if use prefix; then
890 - # Warn about prefix issues with slapd
891 - eerror "slapd might NOT be usable on Prefix systems as it requires root privileges"
892 - eerror "to start up, and requires that certain files directories be owned by"
893 - eerror "ldap:ldap. As Prefix does not support changing ownership of files and"
894 - eerror "directories, you will have to manually fix this yourself."
895 - fi
896 -
897 - # These lines force the permissions of various content to be correct
898 - use prefix || chown ldap:ldap "${EROOT}"var/run/openldap
899 - chmod 0755 "${EROOT}"var/run/openldap
900 - use prefix || chown root:ldap "${EROOT}"etc/openldap/slapd.conf{,.default}
901 - chmod 0640 "${EROOT}"etc/openldap/slapd.conf{,.default}
902 - use prefix || chown ldap:ldap "${EROOT}"var/lib/openldap-data
903 - fi
904 -
905 - if has_version 'net-nds/openldap[-minimal]' && ((${OPENLDAP_PRINT_MESSAGES})); then
906 - elog "Getting started using OpenLDAP? There is some documentation available:"
907 - elog "Gentoo Guide to OpenLDAP Authentication"
908 - elog "(https://wiki.gentoo.org/wiki/Centralized_authentication_using_OpenLDAP)"
909 - elog "---"
910 - elog "An example file for tuning BDB backends with openldap is"
911 - elog "DB_CONFIG.fast.example in /usr/share/doc/${PF}/"
912 - fi
913 -
914 - preserve_old_lib_notify /usr/$(get_libdir)/{liblber,libldap,libldap_r}-2.3$(get_libname 0)
915 -}
916
917 diff --git a/net-nds/openldap/openldap-2.4.47-r1.ebuild b/net-nds/openldap/openldap-2.4.47-r1.ebuild
918 deleted file mode 100644
919 index 8023c2ebaf9..00000000000
920 --- a/net-nds/openldap/openldap-2.4.47-r1.ebuild
921 +++ /dev/null
922 @@ -1,901 +0,0 @@
923 -# Copyright 1999-2019 Gentoo Authors
924 -# Distributed under the terms of the GNU General Public License v2
925 -
926 -EAPI=6
927 -
928 -inherit db-use flag-o-matic multilib multilib-minimal ssl-cert eapi7-ver toolchain-funcs autotools user systemd
929 -
930 -BIS_PN=rfc2307bis.schema
931 -BIS_PV=20140524
932 -BIS_P="${BIS_PN}-${BIS_PV}"
933 -
934 -DESCRIPTION="LDAP suite of application and development tools"
935 -HOMEPAGE="http://www.OpenLDAP.org/"
936 -
937 -# mirrors are mostly not working, using canonical URI
938 -SRC_URI="ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${P}.tgz
939 - mirror://gentoo/${BIS_P}"
940 -
941 -LICENSE="OPENLDAP GPL-2"
942 -SLOT="0"
943 -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-linux ~x86-linux ~x86-solaris"
944 -
945 -IUSE_DAEMON="crypt samba slp tcpd experimental minimal"
946 -IUSE_BACKEND="+berkdb"
947 -IUSE_OVERLAY="overlays perl"
948 -IUSE_OPTIONAL="gnutls iodbc sasl ssl odbc debug ipv6 libressl +syslog selinux static-libs test"
949 -IUSE_CONTRIB="smbkrb5passwd kerberos kinit pbkdf2 sha2"
950 -IUSE_CONTRIB="${IUSE_CONTRIB} -cxx"
951 -IUSE="${IUSE_DAEMON} ${IUSE_BACKEND} ${IUSE_OVERLAY} ${IUSE_OPTIONAL} ${IUSE_CONTRIB}"
952 -
953 -REQUIRED_USE="cxx? ( sasl )
954 - pbkdf2? ( ssl )
955 - test? ( berkdb )
956 - ?? ( test minimal )"
957 -
958 -# always list newer first
959 -# Do not add any AGPL-3 BDB here!
960 -# See bug 525110, comment 15.
961 -# Advanced usage: OPENLDAP_BDB_SLOTS in the environment can be used to force a slot during build.
962 -BDB_SLOTS="${OPENLDAP_BDB_SLOTS:=5.3 5.1 4.8 4.7 4.6 4.5 4.4}"
963 -BDB_PKGS=''
964 -for _slot in $BDB_SLOTS; do BDB_PKGS="${BDB_PKGS} sys-libs/db:${_slot}" ; done
965 -
966 -# openssl is needed to generate lanman-passwords required by samba
967 -CDEPEND="
968 - ssl? (
969 - !gnutls? (
970 - !libressl? ( >=dev-libs/openssl-1.0.1h-r2:0=[${MULTILIB_USEDEP}] )
971 - libressl? ( dev-libs/libressl:0=[${MULTILIB_USEDEP}] )
972 - )
973 - gnutls? (
974 - >=net-libs/gnutls-2.12.23-r6:=[${MULTILIB_USEDEP}]
975 - >=dev-libs/libgcrypt-1.5.3:0=[${MULTILIB_USEDEP}]
976 - )
977 - )
978 - sasl? ( dev-libs/cyrus-sasl:= )
979 - !minimal? (
980 - sys-devel/libtool
981 - sys-libs/e2fsprogs-libs
982 - >=dev-db/lmdb-0.9.18:=
983 - tcpd? ( sys-apps/tcp-wrappers )
984 - odbc? ( !iodbc? ( dev-db/unixODBC )
985 - iodbc? ( dev-db/libiodbc ) )
986 - slp? ( net-libs/openslp )
987 - perl? ( dev-lang/perl:=[-build(-)] )
988 - samba? (
989 - !libressl? ( dev-libs/openssl:0= )
990 - libressl? ( dev-libs/libressl:0= )
991 - )
992 - berkdb? (
993 - <sys-libs/db-6.0:=
994 - || ( ${BDB_PKGS} )
995 - )
996 - smbkrb5passwd? (
997 - !libressl? ( dev-libs/openssl:0= )
998 - libressl? ( dev-libs/libressl:0= )
999 - kerberos? ( app-crypt/heimdal )
1000 - )
1001 - kerberos? (
1002 - virtual/krb5
1003 - kinit? ( !app-crypt/heimdal )
1004 - )
1005 - cxx? ( dev-libs/cyrus-sasl:= )
1006 - )
1007 -"
1008 -DEPEND="${CDEPEND}
1009 - sys-apps/groff"
1010 -RDEPEND="${CDEPEND}
1011 - selinux? ( sec-policy/selinux-ldap )
1012 -"
1013 -# for tracking versions
1014 -OPENLDAP_VERSIONTAG=".version-tag"
1015 -OPENLDAP_DEFAULTDIR_VERSIONTAG="/var/lib/openldap-data"
1016 -
1017 -MULTILIB_WRAPPED_HEADERS=(
1018 - # USE=cxx
1019 - /usr/include/LDAPAsynConnection.h
1020 - /usr/include/LDAPAttrType.h
1021 - /usr/include/LDAPAttribute.h
1022 - /usr/include/LDAPAttributeList.h
1023 - /usr/include/LDAPConnection.h
1024 - /usr/include/LDAPConstraints.h
1025 - /usr/include/LDAPControl.h
1026 - /usr/include/LDAPControlSet.h
1027 - /usr/include/LDAPEntry.h
1028 - /usr/include/LDAPEntryList.h
1029 - /usr/include/LDAPException.h
1030 - /usr/include/LDAPExtResult.h
1031 - /usr/include/LDAPMessage.h
1032 - /usr/include/LDAPMessageQueue.h
1033 - /usr/include/LDAPModList.h
1034 - /usr/include/LDAPModification.h
1035 - /usr/include/LDAPObjClass.h
1036 - /usr/include/LDAPRebind.h
1037 - /usr/include/LDAPRebindAuth.h
1038 - /usr/include/LDAPReferenceList.h
1039 - /usr/include/LDAPResult.h
1040 - /usr/include/LDAPSaslBindResult.h
1041 - /usr/include/LDAPSchema.h
1042 - /usr/include/LDAPSearchReference.h
1043 - /usr/include/LDAPSearchResult.h
1044 - /usr/include/LDAPSearchResults.h
1045 - /usr/include/LDAPUrl.h
1046 - /usr/include/LDAPUrlList.h
1047 - /usr/include/LdifReader.h
1048 - /usr/include/LdifWriter.h
1049 - /usr/include/SaslInteraction.h
1050 - /usr/include/SaslInteractionHandler.h
1051 - /usr/include/StringList.h
1052 - /usr/include/TlsOptions.h
1053 -)
1054 -
1055 -PATCHES=(
1056 - "${FILESDIR}"/${PN}-2.4.17-gcc44.patch
1057 -
1058 - "${FILESDIR}"/${PN}-2.2.14-perlthreadsfix.patch
1059 - "${FILESDIR}"/${PN}-2.4.15-ppolicy.patch
1060 -
1061 - # bug #116045 - still present in 2.4.28
1062 - "${FILESDIR}"/${PN}-2.4.35-contrib-smbk5pwd.patch
1063 - # bug #408077 - samba4
1064 - "${FILESDIR}"/${PN}-2.4.35-contrib-samba4.patch
1065 -
1066 - # bug #189817
1067 - "${FILESDIR}"/${PN}-2.4.11-libldap_r.patch
1068 -
1069 - # bug #233633
1070 - "${FILESDIR}"/${PN}-2.4.45-fix-lmpasswd-gnutls-symbols.patch
1071 -
1072 - # bug #281495
1073 - "${FILESDIR}"/${PN}-2.4.28-gnutls-gcrypt.patch
1074 -
1075 - # bug #294350
1076 - "${FILESDIR}"/${PN}-2.4.6-evolution-ntlm.patch
1077 -
1078 - # unbreak /bin/sh -> dash
1079 - "${FILESDIR}"/${PN}-2.4.28-fix-dash.patch
1080 -
1081 - # bug #420959
1082 - "${FILESDIR}"/${PN}-2.4.31-gcc47.patch
1083 -
1084 - # unbundle lmdb
1085 - "${FILESDIR}"/${PN}-2.4.42-mdb-unbundle.patch
1086 -
1087 - # bug #622464
1088 - "${FILESDIR}"/${PN}-2.4.47-libressl.patch
1089 -
1090 - # fix some compiler warnings
1091 - "${FILESDIR}"/${PN}-2.4.47-warnings.patch
1092 -)
1093 -
1094 -openldap_filecount() {
1095 - local dir="$1"
1096 - find "${dir}" -type f ! -name '.*' ! -name 'DB_CONFIG*' | wc -l
1097 -}
1098 -
1099 -openldap_find_versiontags() {
1100 - # scan for all datadirs
1101 - local openldap_datadirs=()
1102 - if [[ -f "${EROOT}"/etc/openldap/slapd.conf ]]; then
1103 - openldap_datadirs=( $(awk '{if($1 == "directory") print $2 }' "${EROOT}"/etc/openldap/slapd.conf) )
1104 - fi
1105 - openldap_datadirs+=( ${OPENLDAP_DEFAULTDIR_VERSIONTAG} )
1106 -
1107 - einfo
1108 - einfo "Scanning datadir(s) from slapd.conf and"
1109 - einfo "the default installdir for Versiontags"
1110 - einfo "(${OPENLDAP_DEFAULTDIR_VERSIONTAG} may appear twice)"
1111 - einfo
1112 -
1113 - # scan datadirs if we have a version tag
1114 - openldap_found_tag=0
1115 - have_files=0
1116 - for each in ${openldap_datadirs[@]} ; do
1117 - CURRENT_TAGDIR="${ROOT}$(sed "s:\/::" <<< ${each})"
1118 - CURRENT_TAG="${CURRENT_TAGDIR}/${OPENLDAP_VERSIONTAG}"
1119 - if [[ -d "${CURRENT_TAGDIR}" ]] && [[ "${openldap_found_tag}" == 0 ]] ; then
1120 - einfo "- Checking ${each}..."
1121 - if [[ -r "${CURRENT_TAG}" ]] ; then
1122 - # yey, we have one :)
1123 - einfo " Found Versiontag in ${each}"
1124 - source "${CURRENT_TAG}"
1125 - if [[ "${OLDPF}" == "" ]] ; then
1126 - eerror "Invalid Versiontag found in ${CURRENT_TAGDIR}"
1127 - eerror "Please delete it"
1128 - eerror
1129 - die "Please kill the invalid versiontag in ${CURRENT_TAGDIR}"
1130 - fi
1131 -
1132 - OLD_MAJOR=$(ver_cut 2-3 ${OLDPF})
1133 -
1134 - [[ "$(openldap_filecount ${CURRENT_TAGDIR})" -gt 0 ]] && have_files=1
1135 -
1136 - # are we on the same branch?
1137 - if [[ "${OLD_MAJOR}" != "${PV:0:3}" ]] ; then
1138 - ewarn " Versiontag doesn't match current major release!"
1139 - if [[ "${have_files}" == "1" ]] ; then
1140 - eerror " Versiontag says other major and you (probably) have datafiles!"
1141 - echo
1142 - openldap_upgrade_howto
1143 - else
1144 - einfo " No real problem, seems there's no database."
1145 - fi
1146 - else
1147 - einfo " Versiontag is fine here :)"
1148 - fi
1149 - else
1150 - einfo " Non-tagged dir ${each}"
1151 - [[ "$(openldap_filecount ${each})" -gt 0 ]] && have_files=1
1152 - if [[ "${have_files}" == "1" ]] ; then
1153 - einfo " EEK! Non-empty non-tagged datadir, counting `ls -a ${each} | wc -l` files"
1154 - echo
1155 -
1156 - eerror
1157 - eerror "Your OpenLDAP Installation has a non tagged datadir that"
1158 - eerror "possibly contains a database at ${CURRENT_TAGDIR}"
1159 - eerror
1160 - eerror "Please export data if any entered and empty or remove"
1161 - eerror "the directory, installation has been stopped so you"
1162 - eerror "can take required action"
1163 - eerror
1164 - eerror "For a HOWTO on exporting the data, see instructions in the ebuild"
1165 - eerror
1166 - openldap_upgrade_howto
1167 - die "Please move the datadir ${CURRENT_TAGDIR} away"
1168 - fi
1169 - fi
1170 - einfo
1171 - fi
1172 - done
1173 - [[ "${have_files}" == "1" ]] && einfo "DB files present" || einfo "No DB files present"
1174 -
1175 - # Now we must check for the major version of sys-libs/db linked against.
1176 - SLAPD_PATH="${EROOT}/usr/$(get_libdir)/openldap/slapd"
1177 - if [[ "${have_files}" == "1" ]] && [[ -f "${SLAPD_PATH}" ]]; then
1178 - OLDVER="$(/usr/bin/ldd ${SLAPD_PATH} \
1179 - | awk '/libdb-/{gsub("^libdb-","",$1);gsub(".so$","",$1);print $1}')"
1180 - if use berkdb; then
1181 - # find which one would be used
1182 - for bdb_slot in ${BDB_SLOTS} ; do
1183 - NEWVER="$(db_findver "=sys-libs/db-${bdb_slot}*")"
1184 - [[ -n "${NEWVER}" ]] && break
1185 - done
1186 - fi
1187 - local fail=0
1188 - if [[ -z "${OLDVER}" ]] && [[ -z "${NEWVER}" ]]; then
1189 - :
1190 - # Nothing wrong here.
1191 - elif [[ -z "${OLDVER}" ]] && [[ -n "${NEWVER}" ]]; then
1192 - eerror " Your existing version of OpenLDAP was not built against"
1193 - eerror " any version of sys-libs/db, but the new one will build"
1194 - eerror " against ${NEWVER} and your database may be inaccessible."
1195 - echo
1196 - fail=1
1197 - elif [[ -n "${OLDVER}" ]] && [[ -z "${NEWVER}" ]]; then
1198 - eerror " Your existing version of OpenLDAP was built against"
1199 - eerror " sys-libs/db:${OLDVER}, but the new one will not be"
1200 - eerror " built against any version and your database may be"
1201 - eerror " inaccessible."
1202 - echo
1203 - fail=1
1204 - elif [[ "${OLDVER}" != "${NEWVER}" ]]; then
1205 - eerror " Your existing version of OpenLDAP was built against"
1206 - eerror " sys-libs/db:${OLDVER}, but the new one will build against"
1207 - eerror " ${NEWVER} and your database would be inaccessible."
1208 - echo
1209 - fail=1
1210 - fi
1211 - [[ "${fail}" == "1" ]] && openldap_upgrade_howto
1212 - fi
1213 -
1214 - echo
1215 - einfo
1216 - einfo "All datadirs are fine, proceeding with merge now..."
1217 - einfo
1218 -}
1219 -
1220 -openldap_upgrade_howto() {
1221 - local d l i
1222 - eerror
1223 - eerror "A (possible old) installation of OpenLDAP was detected,"
1224 - eerror "installation will not proceed for now."
1225 - eerror
1226 - eerror "As major version upgrades can corrupt your database,"
1227 - eerror "you need to dump your database and re-create it afterwards."
1228 - eerror
1229 - eerror "Additionally, rebuilding against different major versions of the"
1230 - eerror "sys-libs/db libraries will cause your database to be inaccessible."
1231 - eerror ""
1232 - d="$(date -u +%s)"
1233 - l="/root/ldapdump.${d}"
1234 - i="${l}.raw"
1235 - eerror " 1. /etc/init.d/slapd stop"
1236 - eerror " 2. slapcat -l ${i}"
1237 - eerror " 3. egrep -v '^(entry|context)CSN:' <${i} >${l}"
1238 - eerror " 4. mv /var/lib/openldap-data/ /var/lib/openldap-data-backup/"
1239 - eerror " 5. emerge --update \=net-nds/${PF}"
1240 - eerror " 6. etc-update, and ensure that you apply the changes"
1241 - eerror " 7. slapadd -l ${l}"
1242 - eerror " 8. chown ldap:ldap /var/lib/openldap-data/*"
1243 - eerror " 9. /etc/init.d/slapd start"
1244 - eerror "10. check that your data is intact."
1245 - eerror "11. set up the new replication system."
1246 - eerror
1247 - if [[ "${FORCE_UPGRADE}" != "1" ]]; then
1248 - die "You need to upgrade your database first"
1249 - else
1250 - eerror "You have the magical FORCE_UPGRADE=1 in place."
1251 - eerror "Don't say you weren't warned about data loss."
1252 - fi
1253 -}
1254 -
1255 -pkg_setup() {
1256 - if ! use sasl && use cxx ; then
1257 - die "To build the ldapc++ library you must emerge openldap with sasl support"
1258 - fi
1259 - # Bug #322787
1260 - if use minimal && ! has_version "net-nds/openldap" ; then
1261 - einfo "No datadir scan needed, openldap not installed"
1262 - elif use minimal && has_version 'net-nds/openldap[minimal]' ; then
1263 - einfo "Skipping scan for previous datadirs as requested by minimal useflag"
1264 - else
1265 - openldap_find_versiontags
1266 - fi
1267 -
1268 - # The user/group are only used for running daemons which are
1269 - # disabled in minimal builds, so elide the accounts too.
1270 - if ! use minimal ; then
1271 - enewgroup ldap 439
1272 - enewuser ldap 439 -1 /usr/$(get_libdir)/openldap ldap
1273 - fi
1274 -}
1275 -
1276 -src_prepare() {
1277 - # ensure correct SLAPI path by default
1278 - sed -e 's,\(#define LDAPI_SOCK\).*,\1 "'"${EPREFIX}"'/var/run/openldap/slapd.sock",' \
1279 - -i include/ldap_defaults.h || die
1280 -
1281 - default
1282 - rm -r libraries/liblmdb || die
1283 -
1284 - pushd build &>/dev/null || die "pushd build"
1285 - einfo "Making sure upstream build strip does not do stripping too early"
1286 - sed -i.orig \
1287 - -e '/^STRIP/s,-s,,g' \
1288 - top.mk || die "Failed to block stripping"
1289 - popd &>/dev/null || die
1290 -
1291 - # wrong assumption that /bin/sh is /bin/bash
1292 - sed \
1293 - -e 's|/bin/sh|/bin/bash|g' \
1294 - -i tests/scripts/* || die "sed failed"
1295 -
1296 - AT_NOEAUTOMAKE=yes eautoreconf
1297 -}
1298 -
1299 -build_contrib_module() {
1300 - # <dir> <sources> <outputname>
1301 - pushd "${S}/contrib/slapd-modules/$1" &>/dev/null || die "pushd contrib/slapd-modules/$1"
1302 - einfo "Compiling contrib-module: $3"
1303 - # Make sure it's uppercase
1304 - local define_name="$(LC_ALL=C tr '[:lower:]' '[:upper:]' <<< "SLAPD_OVER_${1}")"
1305 - "${lt}" --mode=compile --tag=CC \
1306 - "${CC}" \
1307 - -D${define_name}=SLAPD_MOD_DYNAMIC \
1308 - -I"${BUILD_DIR}"/include \
1309 - -I../../../include -I../../../servers/slapd ${CFLAGS} \
1310 - -o ${2%.c}.lo -c $2 || die "compiling $3 failed"
1311 - einfo "Linking contrib-module: $3"
1312 - "${lt}" --mode=link --tag=CC \
1313 - "${CC}" -module \
1314 - ${CFLAGS} \
1315 - ${LDFLAGS} \
1316 - -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
1317 - -o $3.la ${2%.c}.lo || die "linking $3 failed"
1318 - popd &>/dev/null || die
1319 -}
1320 -
1321 -src_configure() {
1322 - # Bug 408001
1323 - use elibc_FreeBSD && append-cppflags -DMDB_DSYNC=O_SYNC -DMDB_FDATASYNC=fsync
1324 -
1325 - # connectionless ldap per bug #342439
1326 - append-cppflags -DLDAP_CONNECTIONLESS
1327 -
1328 - multilib-minimal_src_configure
1329 -}
1330 -
1331 -multilib_src_configure() {
1332 - local myconf=()
1333 -
1334 - use debug && myconf+=( $(use_enable debug) )
1335 -
1336 - # ICU exists only in the configure, nowhere in the codebase, bug #510858
1337 - export ac_cv_header_unicode_utypes_h=no ol_cv_lib_icu=no
1338 -
1339 - if ! use minimal && multilib_is_native_abi; then
1340 - local CPPFLAGS=${CPPFLAGS}
1341 -
1342 - # re-enable serverside overlay chains per bug #296567
1343 - # see ldap docs chaper 12.3.1 for details
1344 - myconf+=( --enable-ldap )
1345 -
1346 - # backends
1347 - myconf+=( --enable-slapd )
1348 - if use berkdb ; then
1349 - einfo "Using Berkeley DB for local backend"
1350 - myconf+=( --enable-bdb --enable-hdb )
1351 - DBINCLUDE=$(db_includedir ${BDB_SLOTS})
1352 - einfo "Using ${DBINCLUDE} for sys-libs/db version"
1353 - # We need to include the slotted db.h dir for FreeBSD
1354 - append-cppflags -I${DBINCLUDE}
1355 - else
1356 - myconf+=( --disable-bdb --disable-hdb )
1357 - fi
1358 - for backend in dnssrv ldap mdb meta monitor null passwd relay shell sock; do
1359 - myconf+=( --enable-${backend}=mod )
1360 - done
1361 -
1362 - myconf+=( $(use_enable perl perl mod) )
1363 -
1364 - myconf+=( $(use_enable odbc sql mod) )
1365 - if use odbc ; then
1366 - local odbc_lib="unixodbc"
1367 - if use iodbc ; then
1368 - odbc_lib="iodbc"
1369 - append-cppflags -I"${EPREFIX}"/usr/include/iodbc
1370 - fi
1371 - myconf+=( --with-odbc=${odbc_lib} )
1372 - fi
1373 -
1374 - # slapd options
1375 - myconf+=(
1376 - $(use_enable crypt)
1377 - $(use_enable slp)
1378 - $(use_enable samba lmpasswd)
1379 - $(use_enable syslog)
1380 - )
1381 - if use experimental ; then
1382 - myconf+=(
1383 - --enable-dynacl
1384 - --enable-aci=mod
1385 - )
1386 - fi
1387 - for option in aci cleartext modules rewrite rlookups slapi; do
1388 - myconf+=( --enable-${option} )
1389 - done
1390 -
1391 - # slapd overlay options
1392 - # Compile-in the syncprov, the others as module
1393 - myconf+=( --enable-syncprov=yes )
1394 - use overlays && myconf+=( --enable-overlays=mod )
1395 -
1396 - else
1397 - myconf+=(
1398 - --disable-backends
1399 - --disable-slapd
1400 - --disable-bdb
1401 - --disable-hdb
1402 - --disable-mdb
1403 - --disable-overlays
1404 - --disable-syslog
1405 - )
1406 - fi
1407 -
1408 - # basic functionality stuff
1409 - myconf+=(
1410 - $(use_enable ipv6)
1411 - $(multilib_native_use_with sasl cyrus-sasl)
1412 - $(multilib_native_use_enable sasl spasswd)
1413 - $(use_enable tcpd wrappers)
1414 - )
1415 -
1416 - # Some cross-compiling tests don't pan out well.
1417 - tc-is-cross-compiler && myconf+=(
1418 - --with-yielding-select=yes
1419 - )
1420 -
1421 - local ssl_lib="no"
1422 - if use ssl || ( ! use minimal && use samba ) ; then
1423 - ssl_lib="openssl"
1424 - use gnutls && ssl_lib="gnutls"
1425 - fi
1426 -
1427 - myconf+=( --with-tls=${ssl_lib} )
1428 -
1429 - for basicflag in dynamic local proctitle shared; do
1430 - myconf+=( --enable-${basicflag} )
1431 - done
1432 -
1433 - tc-export AR CC CXX
1434 - ECONF_SOURCE="${S}" \
1435 - STRIP=/bin/true \
1436 - econf \
1437 - --libexecdir="${EPREFIX}"/usr/$(get_libdir)/openldap \
1438 - $(use_enable static-libs static) \
1439 - "${myconf[@]}"
1440 - emake depend
1441 -}
1442 -
1443 -src_configure_cxx() {
1444 - # This needs the libraries built by the first build run.
1445 - # So we have to run it AFTER the main build, not just after the main
1446 - # configure.
1447 - local myconf_ldapcpp=(
1448 - --with-ldap-includes="${S}"/include
1449 - )
1450 -
1451 - mkdir -p "${BUILD_DIR}"/contrib/ldapc++ || die
1452 - pushd "${BUILD_DIR}/contrib/ldapc++" &>/dev/null || die "pushd contrib/ldapc++"
1453 -
1454 - local LDFLAGS=${LDFLAGS} CPPFLAGS=${CPPFLAGS}
1455 - append-ldflags -L"${BUILD_DIR}"/libraries/liblber/.libs \
1456 - -L"${BUILD_DIR}"/libraries/libldap/.libs
1457 - append-cppflags -I"${BUILD_DIR}"/include
1458 - ECONF_SOURCE=${S}/contrib/ldapc++ \
1459 - econf "${myconf_ldapcpp[@]}" \
1460 - CC="${CC}" \
1461 - CXX="${CXX}"
1462 - popd &>/dev/null || die
1463 -}
1464 -
1465 -multilib_src_compile() {
1466 - tc-export AR CC CXX
1467 - emake CC="${CC}" AR="${AR}" SHELL="${EPREFIX}"/bin/bash
1468 - local lt="${BUILD_DIR}/libtool"
1469 - export echo="echo"
1470 -
1471 - if ! use minimal && multilib_is_native_abi ; then
1472 - if use cxx ; then
1473 - einfo "Building contrib library: ldapc++"
1474 - src_configure_cxx
1475 - pushd "${BUILD_DIR}/contrib/ldapc++" &>/dev/null || die "pushd contrib/ldapc++"
1476 - emake CC="${CC}" CXX="${CXX}"
1477 - popd &>/dev/null || die
1478 - fi
1479 -
1480 - if use smbkrb5passwd ; then
1481 - einfo "Building contrib-module: smbk5pwd"
1482 - pushd "${S}/contrib/slapd-modules/smbk5pwd" &>/dev/null || die "pushd contrib/slapd-modules/smbk5pwd"
1483 -
1484 - MY_DEFS="-DDO_SHADOW"
1485 - if use samba ; then
1486 - MY_DEFS="${MY_DEFS} -DDO_SAMBA"
1487 - MY_KRB5_INC=""
1488 - fi
1489 - if use kerberos ; then
1490 - MY_DEFS="${MY_DEFS} -DDO_KRB5"
1491 - MY_KRB5_INC="$(krb5-config --cflags)"
1492 - fi
1493 -
1494 - emake \
1495 - DEFS="${MY_DEFS}" \
1496 - KRB5_INC="${MY_KRB5_INC}" \
1497 - LDAP_BUILD="${BUILD_DIR}" \
1498 - CC="${CC}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap"
1499 - popd &>/dev/null || die
1500 - fi
1501 -
1502 - if use overlays ; then
1503 - einfo "Building contrib-module: samba4"
1504 - pushd "${S}/contrib/slapd-modules/samba4" &>/dev/null || die "pushd contrib/slapd-modules/samba4"
1505 -
1506 - emake \
1507 - LDAP_BUILD="${BUILD_DIR}" \
1508 - CC="${CC}" libexecdir="/usr/$(get_libdir)/openldap"
1509 - popd &>/dev/null || die
1510 - fi
1511 -
1512 - if use kerberos ; then
1513 - if use kinit ; then
1514 - build_contrib_module "kinit" "kinit.c" "kinit"
1515 - fi
1516 - pushd "${S}/contrib/slapd-modules/passwd" &>/dev/null || die "pushd contrib/slapd-modules/passwd"
1517 - einfo "Compiling contrib-module: pw-kerberos"
1518 - "${lt}" --mode=compile --tag=CC \
1519 - "${CC}" \
1520 - -I"${BUILD_DIR}"/include \
1521 - -I../../../include \
1522 - ${CFLAGS} \
1523 - $(krb5-config --cflags) \
1524 - -DHAVE_KRB5 \
1525 - -o kerberos.lo \
1526 - -c kerberos.c || die "compiling pw-kerberos failed"
1527 - einfo "Linking contrib-module: pw-kerberos"
1528 - "${lt}" --mode=link --tag=CC \
1529 - "${CC}" -module \
1530 - ${CFLAGS} \
1531 - ${LDFLAGS} \
1532 - -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
1533 - -o pw-kerberos.la \
1534 - kerberos.lo || die "linking pw-kerberos failed"
1535 - popd &>/dev/null || die
1536 - fi
1537 -
1538 - if use pbkdf2; then
1539 - pushd "${S}/contrib/slapd-modules/passwd/pbkdf2" &>/dev/null || die "pushd contrib/slapd-modules/passwd/pbkdf2"
1540 - einfo "Compiling contrib-module: pw-pbkdf2"
1541 - "${lt}" --mode=compile --tag=CC \
1542 - "${CC}" \
1543 - -I"${BUILD_DIR}"/include \
1544 - -I../../../../include \
1545 - ${CFLAGS} \
1546 - -o pbkdf2.lo \
1547 - -c pw-pbkdf2.c || die "compiling pw-pbkdf2 failed"
1548 - einfo "Linking contrib-module: pw-pbkdf2"
1549 - "${lt}" --mode=link --tag=CC \
1550 - "${CC}" -module \
1551 - ${CFLAGS} \
1552 - ${LDFLAGS} \
1553 - -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
1554 - -o pw-pbkdf2.la \
1555 - pbkdf2.lo || die "linking pw-pbkdf2 failed"
1556 - popd &>/dev/null || die
1557 - fi
1558 -
1559 - if use sha2 ; then
1560 - pushd "${S}/contrib/slapd-modules/passwd/sha2" &>/dev/null || die "pushd contrib/slapd-modules/passwd/sha2"
1561 - einfo "Compiling contrib-module: pw-sha2"
1562 - "${lt}" --mode=compile --tag=CC \
1563 - "${CC}" \
1564 - -I"${BUILD_DIR}"/include \
1565 - -I../../../../include \
1566 - ${CFLAGS} \
1567 - -o sha2.lo \
1568 - -c sha2.c || die "compiling pw-sha2 failed"
1569 - "${lt}" --mode=compile --tag=CC \
1570 - "${CC}" \
1571 - -I"${BUILD_DIR}"/include \
1572 - -I../../../../include \
1573 - ${CFLAGS} \
1574 - -o slapd-sha2.lo \
1575 - -c slapd-sha2.c || die "compiling pw-sha2 failed"
1576 - einfo "Linking contrib-module: pw-sha2"
1577 - "${lt}" --mode=link --tag=CC \
1578 - "${CC}" -module \
1579 - ${CFLAGS} \
1580 - ${LDFLAGS} \
1581 - -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
1582 - -o pw-sha2.la \
1583 - sha2.lo slapd-sha2.lo || die "linking pw-sha2 failed"
1584 - popd &>/dev/null || die
1585 - fi
1586 -
1587 - # We could build pw-radius if GNURadius would install radlib.h
1588 - pushd "${S}/contrib/slapd-modules/passwd" &>/dev/null || die "pushd contrib/slapd-modules/passwd"
1589 - einfo "Compiling contrib-module: pw-netscape"
1590 - "${lt}" --mode=compile --tag=CC \
1591 - "${CC}" \
1592 - -I"${BUILD_DIR}"/include \
1593 - -I../../../include \
1594 - ${CFLAGS} \
1595 - -o netscape.lo \
1596 - -c netscape.c || die "compiling pw-netscape failed"
1597 - einfo "Linking contrib-module: pw-netscape"
1598 - "${lt}" --mode=link --tag=CC \
1599 - "${CC}" -module \
1600 - ${CFLAGS} \
1601 - ${LDFLAGS} \
1602 - -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
1603 - -o pw-netscape.la \
1604 - netscape.lo || die "linking pw-netscape failed"
1605 -
1606 - #build_contrib_module "acl" "posixgroup.c" "posixGroup" # example code only
1607 - #build_contrib_module "acl" "gssacl.c" "gss" # example code only, also needs kerberos
1608 - build_contrib_module "addpartial" "addpartial-overlay.c" "addpartial-overlay"
1609 - build_contrib_module "allop" "allop.c" "overlay-allop"
1610 - build_contrib_module "allowed" "allowed.c" "allowed"
1611 - build_contrib_module "autogroup" "autogroup.c" "autogroup"
1612 - build_contrib_module "cloak" "cloak.c" "cloak"
1613 - # build_contrib_module "comp_match" "comp_match.c" "comp_match" # really complex, adds new external deps, questionable demand
1614 - build_contrib_module "denyop" "denyop.c" "denyop-overlay"
1615 - build_contrib_module "dsaschema" "dsaschema.c" "dsaschema-plugin"
1616 - build_contrib_module "dupent" "dupent.c" "dupent"
1617 - build_contrib_module "lastbind" "lastbind.c" "lastbind"
1618 - # lastmod may not play well with other overlays
1619 - build_contrib_module "lastmod" "lastmod.c" "lastmod"
1620 - build_contrib_module "noopsrch" "noopsrch.c" "noopsrch"
1621 - build_contrib_module "nops" "nops.c" "nops-overlay"
1622 - #build_contrib_module "nssov" "nssov.c" "nssov-overlay" RESO:LATER
1623 - build_contrib_module "trace" "trace.c" "trace"
1624 - popd &>/dev/null || die
1625 - # build slapi-plugins
1626 - pushd "${S}/contrib/slapi-plugins/addrdnvalues" &>/dev/null || die "pushd contrib/slapi-plugins/addrdnvalues"
1627 - einfo "Building contrib-module: addrdnvalues plugin"
1628 - "${CC}" -shared \
1629 - -I"${BUILD_DIR}"/include \
1630 - -I../../../include \
1631 - ${CFLAGS} \
1632 - -fPIC \
1633 - ${LDFLAGS} \
1634 - -o libaddrdnvalues-plugin.so \
1635 - addrdnvalues.c || die "Building libaddrdnvalues-plugin.so failed"
1636 - popd &>/dev/null || die
1637 - fi
1638 -}
1639 -
1640 -multilib_src_test() {
1641 - if multilib_is_native_abi; then
1642 - cd tests || die
1643 - emake tests || die "make tests failed"
1644 - fi
1645 -}
1646 -
1647 -multilib_src_install() {
1648 - local lt="${BUILD_DIR}/libtool"
1649 - emake DESTDIR="${D}" SHELL="${EPREFIX}"/bin/bash install
1650 -
1651 - if ! use minimal && multilib_is_native_abi; then
1652 - # openldap modules go here
1653 - # TODO: write some code to populate slapd.conf with moduleload statements
1654 - keepdir /usr/$(get_libdir)/openldap/openldap/
1655 -
1656 - # initial data storage dir
1657 - keepdir /var/lib/openldap-data
1658 - use prefix || fowners ldap:ldap /var/lib/openldap-data
1659 - fperms 0700 /var/lib/openldap-data
1660 -
1661 - echo "OLDPF='${PF}'" > "${ED%/}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
1662 - echo "# do NOT delete this. it is used" >> "${ED%/}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
1663 - echo "# to track versions for upgrading." >> "${ED%/}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
1664 -
1665 - # use our config
1666 - rm "${ED%/}"/etc/openldap/slapd.conf
1667 - insinto /etc/openldap
1668 - newins "${FILESDIR}"/${PN}-2.4.40-slapd-conf slapd.conf
1669 - configfile="${ED%/}"/etc/openldap/slapd.conf
1670 -
1671 - # populate with built backends
1672 - ebegin "populate config with built backends"
1673 - for x in "${ED%/}"/usr/$(get_libdir)/openldap/openldap/back_*.so; do
1674 - einfo "Adding $(basename ${x})"
1675 - sed -e "/###INSERTDYNAMICMODULESHERE###$/a# moduleload\t$(basename ${x})" -i "${configfile}" || die
1676 - done
1677 - sed -e "s:###INSERTDYNAMICMODULESHERE###$:# modulepath\t${EPREFIX}/usr/$(get_libdir)/openldap/openldap:" -i "${configfile}"
1678 - use prefix || fowners root:ldap /etc/openldap/slapd.conf
1679 - fperms 0640 /etc/openldap/slapd.conf
1680 - cp "${configfile}" "${configfile}".default || die
1681 - eend
1682 -
1683 - # install our own init scripts and systemd unit files
1684 - einfo "Install init scripts"
1685 - sed -e "s,/usr/lib/,/usr/$(get_libdir)/," "${FILESDIR}"/slapd-initd-2.4.40-r2 > "${T}"/slapd || die
1686 - doinitd "${T}"/slapd
1687 - newconfd "${FILESDIR}"/slapd-confd-2.4.28-r1 slapd
1688 -
1689 - einfo "Install systemd service"
1690 - sed -e "s,/usr/lib/,/usr/$(get_libdir)/," "${FILESDIR}"/slapd.service > "${T}"/slapd.service || die
1691 - systemd_dounit "${T}"/slapd.service
1692 - systemd_install_serviced "${FILESDIR}"/slapd.service.conf
1693 - systemd_newtmpfilesd "${FILESDIR}"/slapd.tmpfilesd slapd.conf
1694 -
1695 - # If built without SLP, we don't need to be before avahi
1696 - if ! use slp ; then
1697 - sed -i \
1698 - -e '/before/{s/avahi-daemon//g}' \
1699 - "${ED%/}"/etc/init.d/slapd \
1700 - || die
1701 - fi
1702 -
1703 - if use cxx ; then
1704 - einfo "Install the ldapc++ library"
1705 - cd "${BUILD_DIR}/contrib/ldapc++" || die
1706 - emake DESTDIR="${D}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
1707 - cd "${S}"/contrib/ldapc++ || die
1708 - newdoc README ldapc++-README
1709 - fi
1710 -
1711 - if use smbkrb5passwd ; then
1712 - einfo "Install the smbk5pwd module"
1713 - cd "${S}/contrib/slapd-modules/smbk5pwd" || die
1714 - emake DESTDIR="${D}" \
1715 - LDAP_BUILD="${BUILD_DIR}" \
1716 - libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install
1717 - newdoc README smbk5pwd-README
1718 - fi
1719 -
1720 - if use overlays ; then
1721 - einfo "Install the samba4 module"
1722 - cd "${S}/contrib/slapd-modules/samba4" || die
1723 - emake DESTDIR="${D}" \
1724 - LDAP_BUILD="${BUILD_DIR}" \
1725 - libexecdir="/usr/$(get_libdir)/openldap" install
1726 - newdoc README samba4-README
1727 - fi
1728 -
1729 - einfo "Installing contrib modules"
1730 - cd "${S}/contrib/slapd-modules" || die
1731 - for l in */*.la */*/*.la; do
1732 - [[ -e ${l} ]] || continue
1733 - "${lt}" --mode=install cp ${l} \
1734 - "${ED%/}"/usr/$(get_libdir)/openldap/openldap || \
1735 - die "installing ${l} failed"
1736 - done
1737 -
1738 - dodoc "${FILESDIR}"/DB_CONFIG.fast.example
1739 - docinto contrib
1740 - doman */*.5
1741 - #newdoc acl/README*
1742 - newdoc addpartial/README addpartial-README
1743 - newdoc allop/README allop-README
1744 - newdoc allowed/README allowed-README
1745 - newdoc autogroup/README autogroup-README
1746 - newdoc dsaschema/README dsaschema-README
1747 - newdoc passwd/README passwd-README
1748 - cd "${S}/contrib/slapi-plugins" || die
1749 - insinto /usr/$(get_libdir)/openldap/openldap
1750 - doins */*.so
1751 - docinto contrib
1752 - newdoc addrdnvalues/README addrdnvalues-README
1753 -
1754 - insinto /etc/openldap/schema
1755 - newins "${DISTDIR}"/${BIS_P} ${BIS_PN}
1756 -
1757 - docinto back-sock ; dodoc "${S}"/servers/slapd/back-sock/searchexample*
1758 - docinto back-shell ; dodoc "${S}"/servers/slapd/back-shell/searchexample*
1759 - docinto back-perl ; dodoc "${S}"/servers/slapd/back-perl/SampleLDAP.pm
1760 -
1761 - dosbin "${S}"/contrib/slapd-tools/statslog
1762 - newdoc "${S}"/contrib/slapd-tools/README README.statslog
1763 - fi
1764 -
1765 - if ! use static-libs ; then
1766 - find "${ED}" \( -name '*.a' -o -name '*.la' \) -delete || die
1767 - fi
1768 -}
1769 -
1770 -multilib_src_install_all() {
1771 - dodoc ANNOUNCEMENT CHANGES COPYRIGHT README
1772 - docinto rfc ; dodoc doc/rfc/*.txt
1773 -}
1774 -
1775 -pkg_preinst() {
1776 - # keep old libs if any
1777 - preserve_old_lib /usr/$(get_libdir)/{liblber,libldap_r,liblber}-2.3$(get_libname 0)
1778 - # bug 440470, only display the getting started help there was no openldap before,
1779 - # or we are going to a non-minimal build
1780 - ! has_version net-nds/openldap || has_version 'net-nds/openldap[minimal]'
1781 - OPENLDAP_PRINT_MESSAGES=$((! $?))
1782 -}
1783 -
1784 -pkg_postinst() {
1785 - if ! use minimal ; then
1786 - # You cannot build SSL certificates during src_install that will make
1787 - # binary packages containing your SSL key, which is both a security risk
1788 - # and a misconfiguration if multiple machines use the same key and cert.
1789 - if use ssl; then
1790 - install_cert /etc/openldap/ssl/ldap
1791 - use prefix || chown ldap:ldap "${EROOT}"etc/openldap/ssl/ldap.*
1792 - ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
1793 - ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
1794 - ewarn "add 'TLS_REQCERT allow' if you want to use them."
1795 - fi
1796 -
1797 - if use prefix; then
1798 - # Warn about prefix issues with slapd
1799 - eerror "slapd might NOT be usable on Prefix systems as it requires root privileges"
1800 - eerror "to start up, and requires that certain files directories be owned by"
1801 - eerror "ldap:ldap. As Prefix does not support changing ownership of files and"
1802 - eerror "directories, you will have to manually fix this yourself."
1803 - fi
1804 -
1805 - # These lines force the permissions of various content to be correct
1806 - use prefix || chown ldap:ldap "${EROOT}"var/run/openldap
1807 - chmod 0755 "${EROOT}"var/run/openldap
1808 - use prefix || chown root:ldap "${EROOT}"etc/openldap/slapd.conf{,.default}
1809 - chmod 0640 "${EROOT}"etc/openldap/slapd.conf{,.default}
1810 - use prefix || chown ldap:ldap "${EROOT}"var/lib/openldap-data
1811 - fi
1812 -
1813 - if has_version 'net-nds/openldap[-minimal]' && ((${OPENLDAP_PRINT_MESSAGES})); then
1814 - elog "Getting started using OpenLDAP? There is some documentation available:"
1815 - elog "Gentoo Guide to OpenLDAP Authentication"
1816 - elog "(https://wiki.gentoo.org/wiki/Centralized_authentication_using_OpenLDAP)"
1817 - elog "---"
1818 - elog "An example file for tuning BDB backends with openldap is"
1819 - elog "DB_CONFIG.fast.example in /usr/share/doc/${PF}/"
1820 - fi
1821 -
1822 - preserve_old_lib_notify /usr/$(get_libdir)/{liblber,libldap,libldap_r}-2.3$(get_libname 0)
1823 -}