Gentoo Archives: gentoo-commits

From: "Diego Petteno (flameeyes)" <flameeyes@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-nds/openldap: openldap-2.4.33-r1.ebuild ChangeLog
Date: Sat, 01 Dec 2012 23:04:48
Message-Id: 20121201230438.379B321712@flycatcher.gentoo.org
1 flameeyes 12/12/01 23:04:38
2
3 Modified: ChangeLog
4 Added: openldap-2.4.33-r1.ebuild
5 Log:
6 Improve USE=minimal, dropping dependencies on tcpd and libtool in that configuration (they are used by the server), and only installing files/directories for the server if it's going to be built. Drop dependency over ncurses (not used anywhere in the code) and stop using keepdir on /var/run (the init script will do that properly and support tmpfs configurations).
7
8 (Portage version: 2.2.0_alpha143/cvs/Linux x86_64, signed Manifest commit with key 1CD13C8AD4301342)
9
10 Revision Changes Path
11 1.424 net-nds/openldap/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-nds/openldap/ChangeLog?rev=1.424&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-nds/openldap/ChangeLog?rev=1.424&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-nds/openldap/ChangeLog?r1=1.423&r2=1.424
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/net-nds/openldap/ChangeLog,v
20 retrieving revision 1.423
21 retrieving revision 1.424
22 diff -u -r1.423 -r1.424
23 --- ChangeLog 22 Oct 2012 08:25:27 -0000 1.423
24 +++ ChangeLog 1 Dec 2012 23:04:38 -0000 1.424
25 @@ -1,6 +1,17 @@
26 # ChangeLog for net-nds/openldap
27 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/net-nds/openldap/ChangeLog,v 1.423 2012/10/22 08:25:27 robbat2 Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/net-nds/openldap/ChangeLog,v 1.424 2012/12/01 23:04:38 flameeyes Exp $
30 +
31 +*openldap-2.4.33-r1 (01 Dec 2012)
32 +
33 + 01 Dec 2012; Diego E. Pettenò <flameeyes@g.o>
34 + +openldap-2.4.33-r1.ebuild:
35 + Improve USE=minimal, dropping dependencies on tcpd and libtool in that
36 + configuration (they are used by the server), and only installing
37 + files/directories for the server if it's going to be built. Drop dependency
38 + over ncurses (not used anywhere in the code) and stop using keepdir on
39 + /var/run (the init script will do that properly and support tmpfs
40 + configurations).
41
42 22 Oct 2012; Robin H. Johnson <robbat2@g.o> openldap-2.4.30.ebuild:
43 Fix missing dep per bug #420887.
44
45
46
47 1.1 net-nds/openldap/openldap-2.4.33-r1.ebuild
48
49 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-nds/openldap/openldap-2.4.33-r1.ebuild?rev=1.1&view=markup
50 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/net-nds/openldap/openldap-2.4.33-r1.ebuild?rev=1.1&content-type=text/plain
51
52 Index: openldap-2.4.33-r1.ebuild
53 ===================================================================
54 # Copyright 1999-2012 Gentoo Foundation
55 # Distributed under the terms of the GNU General Public License v2
56 # $Header: /var/cvsroot/gentoo-x86/net-nds/openldap/openldap-2.4.33-r1.ebuild,v 1.1 2012/12/01 23:04:38 flameeyes Exp $
57
58 EAPI="4"
59
60 inherit db-use eutils flag-o-matic multilib ssl-cert versionator toolchain-funcs autotools
61
62 BIS_PN=rfc2307bis.schema
63 BIS_PV=20120525
64 BIS_P="${BIS_PN}-${BIS_PV}"
65
66 DESCRIPTION="LDAP suite of application and development tools"
67 HOMEPAGE="http://www.OpenLDAP.org/"
68 SRC_URI="mirror://openldap/openldap-release/${P}.tgz
69 mirror://gentoo/${BIS_P}"
70
71 LICENSE="OPENLDAP"
72 SLOT="0"
73 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~x86-linux ~x86-solaris"
74
75 IUSE_DAEMON="crypt icu samba slp tcpd experimental minimal"
76 IUSE_BACKEND="+berkdb"
77 IUSE_OVERLAY="overlays perl"
78 IUSE_OPTIONAL="gnutls iodbc sasl ssl odbc debug ipv6 +syslog selinux"
79 IUSE_CONTRIB="smbkrb5passwd kerberos"
80 IUSE_CONTRIB="${IUSE_CONTRIB} -cxx"
81 IUSE="${IUSE_DAEMON} ${IUSE_BACKEND} ${IUSE_OVERLAY} ${IUSE_OPTIONAL} ${IUSE_CONTRIB}"
82
83 REQUIRED_USE="cxx? ( sasl )"
84
85 # openssl is needed to generate lanman-passwords required by samba
86 RDEPEND="icu? ( dev-libs/icu )
87 ssl? ( !gnutls? ( dev-libs/openssl )
88 gnutls? ( net-libs/gnutls dev-libs/libgcrypt ) )
89 sasl? ( dev-libs/cyrus-sasl )
90 !minimal? (
91 sys-devel/libtool
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? ( dev-libs/openssl )
98 berkdb? ( sys-libs/db )
99 smbkrb5passwd? (
100 dev-libs/openssl
101 app-crypt/heimdal )
102 kerberos? ( virtual/krb5 )
103 cxx? ( dev-libs/cyrus-sasl )
104 )
105 selinux? ( sec-policy/selinux-ldap )"
106 DEPEND="${RDEPEND}
107 sys-apps/groff"
108
109 # for tracking versions
110 OPENLDAP_VERSIONTAG=".version-tag"
111 OPENLDAP_DEFAULTDIR_VERSIONTAG="/var/lib/openldap-data"
112
113 openldap_filecount() {
114 local dir="$1"
115 find "${dir}" -type f ! -name '.*' ! -name 'DB_CONFIG.example' | wc -l
116 }
117
118 openldap_find_versiontags() {
119 # scan for all datadirs
120 openldap_datadirs=""
121 if [ -f "${EROOT}"/etc/openldap/slapd.conf ]; then
122 openldap_datadirs="$(awk '{if($1 == "directory") print $2 }' ${EROOT}/etc/openldap/slapd.conf)"
123 fi
124 openldap_datadirs="${openldap_datadirs} ${OPENLDAP_DEFAULTDIR_VERSIONTAG}"
125
126 einfo
127 einfo "Scanning datadir(s) from slapd.conf and"
128 einfo "the default installdir for Versiontags"
129 einfo "(${OPENLDAP_DEFAULTDIR_VERSIONTAG} may appear twice)"
130 einfo
131
132 # scan datadirs if we have a version tag
133 openldap_found_tag=0
134 have_files=0
135 for each in ${openldap_datadirs}; do
136 CURRENT_TAGDIR=${ROOT}`echo ${each} | sed "s:\/::"`
137 CURRENT_TAG=${CURRENT_TAGDIR}/${OPENLDAP_VERSIONTAG}
138 if [ -d ${CURRENT_TAGDIR} ] && [ ${openldap_found_tag} == 0 ] ; then
139 einfo "- Checking ${each}..."
140 if [ -r ${CURRENT_TAG} ] ; then
141 # yey, we have one :)
142 einfo " Found Versiontag in ${each}"
143 source ${CURRENT_TAG}
144 if [ "${OLDPF}" == "" ] ; then
145 eerror "Invalid Versiontag found in ${CURRENT_TAGDIR}"
146 eerror "Please delete it"
147 eerror
148 die "Please kill the invalid versiontag in ${CURRENT_TAGDIR}"
149 fi
150
151 OLD_MAJOR=`get_version_component_range 2-3 ${OLDPF}`
152
153 [ $(openldap_filecount ${CURRENT_TAGDIR}) -gt 0 ] && have_files=1
154
155 # are we on the same branch?
156 if [ "${OLD_MAJOR}" != "${PV:0:3}" ] ; then
157 ewarn " Versiontag doesn't match current major release!"
158 if [[ "${have_files}" == "1" ]] ; then
159 eerror " Versiontag says other major and you (probably) have datafiles!"
160 echo
161 openldap_upgrade_howto
162 else
163 einfo " No real problem, seems there's no database."
164 fi
165 else
166 einfo " Versiontag is fine here :)"
167 fi
168 else
169 einfo " Non-tagged dir ${each}"
170 [ $(openldap_filecount ${each}) -gt 0 ] && have_files=1
171 if [[ "${have_files}" == "1" ]] ; then
172 einfo " EEK! Non-empty non-tagged datadir, counting `ls -a ${each} | wc -l` files"
173 echo
174
175 eerror
176 eerror "Your OpenLDAP Installation has a non tagged datadir that"
177 eerror "possibly contains a database at ${CURRENT_TAGDIR}"
178 eerror
179 eerror "Please export data if any entered and empty or remove"
180 eerror "the directory, installation has been stopped so you"
181 eerror "can take required action"
182 eerror
183 eerror "For a HOWTO on exporting the data, see instructions in the ebuild"
184 eerror
185 openldap_upgrade_howto
186 die "Please move the datadir ${CURRENT_TAGDIR} away"
187 fi
188 fi
189 einfo
190 fi
191 done
192 [ "${have_files}" == "1" ] && einfo "DB files present" || einfo "No DB files present"
193
194 # Now we must check for the major version of sys-libs/db linked against.
195 SLAPD_PATH=${EROOT}/usr/$(get_libdir)/openldap/slapd
196 if [ "${have_files}" == "1" -a -f "${SLAPD_PATH}" ]; then
197 OLDVER="$(/usr/bin/ldd ${SLAPD_PATH} \
198 | awk '/libdb-/{gsub("^libdb-","",$1);gsub(".so$","",$1);print $1}')"
199 NEWVER="$(use berkdb && db_findver sys-libs/db)"
200 local fail=0
201 if [ -z "${OLDVER}" -a -z "${NEWVER}" ]; then
202 :
203 # Nothing wrong here.
204 elif [ -z "${OLDVER}" -a -n "${NEWVER}" ]; then
205 eerror " Your existing version of OpenLDAP was not built against"
206 eerror " any version of sys-libs/db, but the new one will build"
207 eerror " against ${NEWVER} and your database may be inaccessible."
208 echo
209 fail=1
210 elif [ -n "${OLDVER}" -a -z "${NEWVER}" ]; then
211 eerror " Your existing version of OpenLDAP was built against"
212 eerror " sys-libs/db:${OLDVER}, but the new one will not be"
213 eerror " built against any version and your database may be"
214 eerror " inaccessible."
215 echo
216 fail=1
217 elif [ "${OLDVER}" != "${NEWVER}" ]; then
218 eerror " Your existing version of OpenLDAP was built against"
219 eerror " sys-libs/db:${OLDVER}, but the new one will build against"
220 eerror " ${NEWVER} and your database would be inaccessible."
221 echo
222 fail=1
223 fi
224 [ "${fail}" == "1" ] && openldap_upgrade_howto
225 fi
226
227 echo
228 einfo
229 einfo "All datadirs are fine, proceeding with merge now..."
230 einfo
231 }
232
233 openldap_upgrade_howto() {
234 eerror
235 eerror "A (possible old) installation of OpenLDAP was detected,"
236 eerror "installation will not proceed for now."
237 eerror
238 eerror "As major version upgrades can corrupt your database,"
239 eerror "you need to dump your database and re-create it afterwards."
240 eerror
241 eerror "Additionally, rebuilding against different major versions of the"
242 eerror "sys-libs/db libraries will cause your database to be inaccessible."
243 eerror ""
244 d="$(date -u +%s)"
245 l="/root/ldapdump.${d}"
246 i="${l}.raw"
247 eerror " 1. /etc/init.d/slurpd stop ; /etc/init.d/slapd stop"
248 eerror " 2. slapcat -l ${i}"
249 eerror " 3. egrep -v '^(entry|context)CSN:' <${i} >${l}"
250 eerror " 4. mv /var/lib/openldap-data/ /var/lib/openldap-data-backup/"
251 eerror " 5. emerge --update \=net-nds/${PF}"
252 eerror " 6. etc-update, and ensure that you apply the changes"
253 eerror " 7. slapadd -l ${l}"
254 eerror " 8. chown ldap:ldap /var/lib/openldap-data/*"
255 eerror " 9. /etc/init.d/slapd start"
256 eerror "10. check that your data is intact."
257 eerror "11. set up the new replication system."
258 eerror
259 if [ "${FORCE_UPGRADE}" != "1" ]; then
260 die "You need to upgrade your database first"
261 else
262 eerror "You have the magical FORCE_UPGRADE=1 in place."
263 eerror "Don't say you weren't warned about data loss."
264 fi
265 }
266
267 pkg_setup() {
268 if ! use sasl && use cxx ; then
269 die "To build the ldapc++ library you must emerge openldap with sasl support"
270 fi
271 # Bug #322787
272 if use minimal && ! has_version "net-nds/openldap" ; then
273 einfo "No datadir scan needed, openldap not installed"
274 elif use minimal && has_version "net-nds/openldap" && built_with_use net-nds/openldap minimal ; then
275 einfo "Skipping scan for previous datadirs as requested by minimal useflag"
276 else
277 openldap_find_versiontags
278 fi
279
280 enewgroup ldap 439
281 enewuser ldap 439 -1 /usr/$(get_libdir)/openldap ldap
282 }
283
284 src_prepare() {
285 # ensure correct SLAPI path by default
286 sed -i -e 's,\(#define LDAPI_SOCK\).*,\1 "'"${EPREFIX}"'/var/run/openldap/slapd.sock",' \
287 "${S}"/include/ldap_defaults.h
288
289 epatch "${FILESDIR}"/${PN}-2.4.17-gcc44.patch
290
291 epatch \
292 "${FILESDIR}"/${PN}-2.2.14-perlthreadsfix.patch \
293 "${FILESDIR}"/${PN}-2.4.15-ppolicy.patch
294
295 # bug #116045 - still present in 2.4.28
296 epatch "${FILESDIR}"/${PN}-2.4.28-contrib-smbk5pwd.patch
297 # bug #408077 - samba4
298 epatch "${FILESDIR}"/${PN}-2.4.30-contrib-samba4.patch
299
300 # bug #189817
301 epatch "${FILESDIR}"/${PN}-2.4.11-libldap_r.patch
302
303 # bug #233633
304 epatch "${FILESDIR}"/${PN}-2.4.17-fix-lmpasswd-gnutls-symbols.patch
305
306 # bug #281495
307 epatch "${FILESDIR}"/${PN}-2.4.28-gnutls-gcrypt.patch
308
309 # bug #294350
310 epatch "${FILESDIR}"/${PN}-2.4.6-evolution-ntlm.patch
311
312 # unbreak /bin/sh -> dash
313 epatch "${FILESDIR}"/${PN}-2.4.28-fix-dash.patch
314
315 # bug #420959
316 epatch "${FILESDIR}"/${PN}-2.4.31-gcc47.patch
317
318 cd "${S}"/build
319 einfo "Making sure upstream build strip does not do stripping too early"
320 sed -i.orig \
321 -e '/^STRIP/s,-s,,g' \
322 top.mk || die "Failed to block stripping"
323
324 # wrong assumption that /bin/sh is /bin/bash
325 sed -i \
326 -e 's|/bin/sh|/bin/bash|g' \
327 "${S}"/tests/scripts/* || die "sed failed"
328
329 cd "${S}"
330 AT_NOEAUTOMAKE=yes eautoreconf
331 }
332
333 build_contrib_module() {
334 lt="${S}/libtool"
335 # <dir> <sources> <outputname>
336 cd "${S}/contrib/slapd-modules/$1"
337 einfo "Compiling contrib-module: $3"
338 # Make sure it's uppercase
339 local define_name="$(echo "SLAPD_OVER_${1}" | LC_ALL=C tr '[:lower:]' '[:upper:]')"
340 "${lt}" --mode=compile --tag=CC \
341 "${CC}" \
342 -D${define_name}=SLAPD_MOD_DYNAMIC \
343 -I../../../include -I../../../servers/slapd ${CFLAGS} \
344 -o ${2%.c}.lo -c $2 || die "compiling $3 failed"
345 einfo "Linking contrib-module: $3"
346 "${lt}" --mode=link --tag=CC \
347 "${CC}" -module \
348 ${CFLAGS} \
349 ${LDFLAGS} \
350 -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
351 -o $3.la ${2%.c}.lo || die "linking $3 failed"
352 }
353
354 src_configure() {
355 local myconf
356
357 #Fix for glibc-2.8 and ucred. Bug 228457.
358 append-flags -D_GNU_SOURCE
359
360 # Bug 408001
361 use elibc_FreeBSD && append-flags -DMDB_DSYNC=O_SYNC -DMDB_FDATASYNC=fsync
362
363 use debug && myconf="${myconf} $(use_enable debug)"
364
365 # ICU usage is not configurable
366 export ac_cv_header_unicode_utypes_h="$(use icu && echo yes || echo no)"
367
368 if ! use minimal ; then
369 # re-enable serverside overlay chains per bug #296567
370 # see ldap docs chaper 12.3.1 for details
371 myconf="${myconf} --enable-ldap"
372
373 # backends
374 myconf="${myconf} --enable-slapd"
375 if use berkdb ; then
376 einfo "Using Berkeley DB for local backend"
377 myconf="${myconf} --enable-bdb --enable-hdb"
378 # We need to include the slotted db.h dir for FreeBSD
379 append-cppflags -I$(db_includedir)
380 else
381 ewarn
382 ewarn "Note: if you disable berkdb, you can only use remote-backends!"
383 ewarn
384 ebeep 5
385 myconf="${myconf} --disable-bdb --disable-hdb"
386 fi
387 for backend in dnssrv ldap meta monitor null passwd relay shell sock; do
388 myconf="${myconf} --enable-${backend}=mod"
389 done
390
391 myconf="${myconf} $(use_enable perl perl mod)"
392
393 myconf="${myconf} $(use_enable odbc sql mod)"
394 if use odbc ; then
395 local odbc_lib="unixodbc"
396 if use iodbc ; then
397 odbc_lib="iodbc"
398 append-cppflags -I"${EPREFIX}"/usr/include/iodbc
399 fi
400 myconf="${myconf} --with-odbc=${odbc_lib}"
401 fi
402
403 # slapd options
404 myconf="${myconf} $(use_enable crypt) $(use_enable slp)"
405 myconf="${myconf} $(use_enable samba lmpasswd) $(use_enable syslog)"
406 if use experimental ; then
407 myconf="${myconf} --enable-dynacl"
408 myconf="${myconf} --enable-aci=mod"
409 fi
410 for option in aci cleartext modules rewrite rlookups slapi; do
411 myconf="${myconf} --enable-${option}"
412 done
413
414 # slapd overlay options
415 # Compile-in the syncprov, the others as module
416 myconf="${myconf} --enable-syncprov=yes"
417 use overlays && myconf="${myconf} --enable-overlays=mod"
418
419 else
420 myconf="${myconf} --disable-slapd --disable-bdb --disable-hdb"
421 myconf="${myconf} --disable-overlays --disable-syslog"
422 fi
423
424 # basic functionality stuff
425 myconf="${myconf} $(use_enable ipv6)"
426 myconf="${myconf} $(use_with sasl cyrus-sasl) $(use_enable sasl spasswd)"
427 myconf="${myconf} $(use_enable tcpd wrappers)"
428
429 local ssl_lib="no"
430 if use ssl || ( use ! minimal && use samba ) ; then
431 ssl_lib="openssl"
432 use gnutls && ssl_lib="gnutls"
433 fi
434
435 myconf="${myconf} --with-tls=${ssl_lib}"
436
437 for basicflag in dynamic local proctitle shared static; do
438 myconf="${myconf} --enable-${basicflag}"
439 done
440
441 # connectionless ldap per bug #342439
442 append-cppflags -DLDAP_CONNECTIONLESS
443
444 tc-export CC AR CXX
445 STRIP=/bin/true \
446 econf \
447 --libexecdir="${EPREFIX}"/usr/$(get_libdir)/openldap \
448 ${myconf} || die "econf failed"
449 }
450
451 src_configure_cxx() {
452 # This needs the libraries built by the first build run.
453 # So we have to run it AFTER the main build, not just after the main
454 # configure.
455 if ! use minimal ; then
456 if use cxx ; then
457 local myconf_ldapcpp
458 myconf_ldapcpp="${myconf_ldapcpp} --with-ldap-includes=../../include"
459 cd "${S}/contrib/ldapc++"
460 OLD_LDFLAGS="$LDFLAGS"
461 OLD_CPPFLAGS="$CPPFLAGS"
462 append-ldflags -L../../libraries/liblber/.libs -L../../libraries/libldap/.libs
463 append-ldflags -L../../../libraries/liblber/.libs -L../../../libraries/libldap/.libs
464 append-cppflags -I../../../include
465 econf ${myconf_ldapcpp} \
466 CC="${CC}" \
467 CXX="${CXX}" \
468 || die "econf ldapc++ failed"
469 CPPFLAGS="$OLD_CPPFLAGS"
470 LDFLAGS="${OLD_LDFLAGS}"
471 fi
472 fi
473 }
474
475 src_compile() {
476 emake depend || die "emake depend failed"
477 emake CC="${CC}" AR="${AR}" SHELL="${EPREFIX}"/bin/bash || die "emake failed"
478 lt="${S}/libtool"
479 export echo="echo"
480
481 if ! use minimal ; then
482 if use cxx ; then
483 einfo "Building contrib library: ldapc++"
484 src_configure_cxx
485 cd "${S}/contrib/ldapc++"
486 emake \
487 CC="${CC}" CXX="${CXX}" \
488 || die "emake ldapc++ failed"
489 fi
490
491 if use smbkrb5passwd ; then
492 einfo "Building contrib-module: smbk5pwd"
493 cd "${S}/contrib/slapd-modules/smbk5pwd"
494
495 emake \
496 DEFS="-DDO_SAMBA -DDO_KRB5 -DDO_SHADOW" \
497 KRB5_INC="$(krb5-config --cflags)" \
498 CC="${CC}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" \
499 || die "emake smbk5pwd failed"
500 fi
501
502 if use overlays ; then
503 einfo "Building contrib-module: samba4"
504 cd "${S}/contrib/slapd-modules/samba4"
505
506 emake \
507 CC="${CC}" libexecdir="/usr/$(get_libdir)/openldap" \
508 || die "emake samba4 failed"
509 fi
510
511 if use kerberos ; then
512 cd "${S}/contrib/slapd-modules/passwd"
513 einfo "Compiling contrib-module: pw-kerberos"
514 "${lt}" --mode=compile --tag=CC \
515 "${CC}" \
516 -I../../../include \
517 ${CFLAGS} \
518 $(krb5-config --cflags) \
519 -DHAVE_KRB5 \
520 -o kerberos.lo \
521 -c kerberos.c || die "compiling pw-kerberos failed"
522 einfo "Linking contrib-module: pw-kerberos"
523 "${lt}" --mode=link --tag=CC \
524 "${CC}" -module \
525 ${CFLAGS} \
526 ${LDFLAGS} \
527 -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
528 -o pw-kerberos.la \
529 kerberos.lo || die "linking pw-kerberos failed"
530 fi
531 # We could build pw-radius if GNURadius would install radlib.h
532 cd "${S}/contrib/slapd-modules/passwd"
533 einfo "Compiling contrib-module: pw-netscape"
534 "${lt}" --mode=compile --tag=CC \
535 "${CC}" \
536 -I../../../include \
537 ${CFLAGS} \
538 -o netscape.lo \
539 -c netscape.c || die "compiling pw-netscape failed"
540 einfo "Linking contrib-module: pw-netscape"
541 "${lt}" --mode=link --tag=CC \
542 "${CC}" -module \
543 ${CFLAGS} \
544 ${LDFLAGS} \
545 -rpath "${EPREFIX}"/usr/$(get_libdir)/openldap/openldap \
546 -o pw-netscape.la \
547 netscape.lo || die "linking pw-netscape failed"
548
549 build_contrib_module "addpartial" "addpartial-overlay.c" "addpartial-overlay"
550 build_contrib_module "allop" "allop.c" "overlay-allop"
551 build_contrib_module "allowed" "allowed.c" "allowed"
552 build_contrib_module "autogroup" "autogroup.c" "autogroup"
553 build_contrib_module "denyop" "denyop.c" "denyop-overlay"
554 build_contrib_module "dsaschema" "dsaschema.c" "dsaschema-plugin"
555 # lastmod may not play well with other overlays
556 build_contrib_module "lastmod" "lastmod.c" "lastmod"
557 build_contrib_module "nops" "nops.c" "nops-overlay"
558 build_contrib_module "trace" "trace.c" "trace"
559 # build slapi-plugins
560 cd "${S}/contrib/slapi-plugins/addrdnvalues"
561 einfo "Building contrib-module: addrdnvalues plugin"
562 "${CC}" -shared \
563 -I../../../include \
564 ${CFLAGS} \
565 -fPIC \
566 ${LDFLAGS} \
567 -o libaddrdnvalues-plugin.so \
568 addrdnvalues.c || die "Building libaddrdnvalues-plugin.so failed"
569
570 fi
571 }
572
573 src_test() {
574 cd tests ; make tests || die "make tests failed"
575 }
576
577 src_install() {
578 lt="${S}/libtool"
579 emake DESTDIR="${D}" SHELL="${EPREFIX}"/bin/bash install || die "make install failed"
580
581 dodoc ANNOUNCEMENT CHANGES COPYRIGHT README "${FILESDIR}"/DB_CONFIG.fast.example
582 docinto rfc ; dodoc doc/rfc/*.txt
583
584 if ! use minimal; then
585 # openldap modules go here
586 # TODO: write some code to populate slapd.conf with moduleload statements
587 keepdir /usr/$(get_libdir)/openldap/openldap/
588
589 # initial data storage dir
590 keepdir /var/lib/openldap-data
591 use prefix || fowners ldap:ldap /var/lib/openldap-data
592 fperms 0700 /var/lib/openldap-data
593
594 echo "OLDPF='${PF}'" > "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
595 echo "# do NOT delete this. it is used" >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
596 echo "# to track versions for upgrading." >> "${ED}${OPENLDAP_DEFAULTDIR_VERSIONTAG}/${OPENLDAP_VERSIONTAG}"
597
598 # use our config
599 rm "${ED}"etc/openldap/slapd.conf
600 insinto /etc/openldap
601 newins "${FILESDIR}"/${PN}-2.3.34-slapd-conf slapd.conf
602 configfile="${ED}"etc/openldap/slapd.conf
603
604 # populate with built backends
605 ebegin "populate config with built backends"
606 for x in "${ED}"usr/$(get_libdir)/openldap/openldap/back_*.so; do
607 elog "Adding $(basename ${x})"
608 sed -e "/###INSERTDYNAMICMODULESHERE###$/a# moduleload\t$(basename ${x})" -i "${configfile}"
609 done
610 sed -e "s:###INSERTDYNAMICMODULESHERE###$:# modulepath\t${EPREFIX}/usr/$(get_libdir)/openldap/openldap:" -i "${configfile}"
611 use prefix || fowners root:ldap /etc/openldap/slapd.conf
612 fperms 0640 /etc/openldap/slapd.conf
613 cp "${configfile}" "${configfile}".default
614 eend
615
616 # install our own init scripts
617 newinitd "${FILESDIR}"/slapd-initd-2.4.28-r1 slapd
618 newconfd "${FILESDIR}"/slapd-confd-2.4.28-r1 slapd
619 if [ $(get_libdir) != lib ]; then
620 sed -e "s,/usr/lib/,/usr/$(get_libdir)/," -i "${ED}"etc/init.d/slapd
621 fi
622 # If built without SLP, we don't need to be before avahi
623 use slp \
624 || sed -i \
625 -e '/before/{s/avahi-daemon//g}' \
626 "${ED}"etc/init.d/slapd
627
628 if use cxx ; then
629 einfo "Install the ldapc++ library"
630 cd "${S}/contrib/ldapc++"
631 emake DESTDIR="${D}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install || die "emake install ldapc++ failed"
632 newdoc README ldapc++-README
633 fi
634
635 if use smbkrb5passwd ; then
636 einfo "Install the smbk5pwd module"
637 cd "${S}/contrib/slapd-modules/smbk5pwd"
638 emake DESTDIR="${D}" libexecdir="${EPREFIX}/usr/$(get_libdir)/openldap" install || die "emake install smbk5pwd failed"
639 newdoc README smbk5pwd-README
640 fi
641
642 if use overlays ; then
643 einfo "Install the samba4 module"
644 cd "${S}/contrib/slapd-modules/samba4"
645 emake DESTDIR="${D}" libexecdir="/usr/$(get_libdir)/openldap" install || die "emake install samba4 failed"
646 newdoc README samba4-README
647 fi
648
649 einfo "Installing contrib modules"
650 cd "${S}/contrib/slapd-modules"
651 for l in */*.la; do
652 "${lt}" --mode=install cp ${l} \
653 "${ED}"usr/$(get_libdir)/openldap/openldap || \
654 die "installing ${l} failed"
655 done
656 docinto contrib
657 newdoc addpartial/README addpartial-README
658 newdoc allop/README allop-README
659 doman allop/slapo-allop.5
660 newdoc autogroup/README autogroup-README
661 newdoc denyop/denyop.c denyop-denyop.c
662 newdoc dsaschema/README dsaschema-README
663 doman lastmod/slapo-lastmod.5
664 doman nops/slapo-nops.5
665 newdoc passwd/README passwd-README
666 cd "${S}/contrib/slapi-plugins"
667 insinto /usr/$(get_libdir)/openldap/openldap
668 doins */*.so
669 docinto contrib
670 newdoc addrdnvalues/README addrdnvalues-README
671
672 insinto /etc/openldap/schema
673 newins "${DISTDIR}"/${BIS_P} ${BIS_PN}
674 fi
675 }
676
677 pkg_preinst() {
678 # keep old libs if any
679 preserve_old_lib /usr/$(get_libdir)/{liblber,libldap_r,liblber}-2.3$(get_libname 0)
680 }
681
682 pkg_postinst() {
683 if ! use minimal ; then
684 # You cannot build SSL certificates during src_install that will make
685 # binary packages containing your SSL key, which is both a security risk
686 # and a misconfiguration if multiple machines use the same key and cert.
687 if use ssl; then
688 install_cert /etc/openldap/ssl/ldap
689 use prefix || chown ldap:ldap "${EROOT}"etc/openldap/ssl/ldap.*
690 ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
691 ewarn "Self-signed SSL certificates are treated harshly by OpenLDAP 2.[12]"
692 ewarn "add 'TLS_REQCERT never' if you want to use them."
693 fi
694
695 if use prefix; then
696 # Warn about prefix issues with slapd
697 eerror "slapd might NOT be usable on Prefix systems as it requires root privileges"
698 eerror "to start up, and requires that certain files directories be owned by"
699 eerror "ldap:ldap. As Prefix does not support changing ownership of files and"
700 eerror "directories, you will have to manually fix this yourself."
701 fi
702
703 # These lines force the permissions of various content to be correct
704 use prefix || chown ldap:ldap "${EROOT}"var/run/openldap
705 chmod 0755 "${EROOT}"var/run/openldap
706 use prefix || chown root:ldap "${EROOT}"etc/openldap/slapd.conf{,.default}
707 chmod 0640 "${EROOT}"etc/openldap/slapd.conf{,.default}
708 use prefix || chown ldap:ldap "${EROOT}"var/lib/openldap-data
709 fi
710
711 elog "Getting started using OpenLDAP? There is some documentation available:"
712 elog "Gentoo Guide to OpenLDAP Authentication"
713 elog "(http://www.gentoo.org/doc/en/ldap-howto.xml)"
714 elog "---"
715 elog "An example file for tuning BDB backends with openldap is"
716 elog "DB_CONFIG.fast.example in /usr/share/doc/${PF}/"
717
718 preserve_old_lib_notify /usr/$(get_libdir)/{liblber,libldap,libldap_r}-2.3$(get_libname 0)
719 }