Gentoo Archives: gentoo-commits

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