/[gentoo-x86]/net-nds/openldap/openldap-2.4.30.ebuild
Gentoo

Contents of /net-nds/openldap/openldap-2.4.30.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations) (download)
Sat Mar 1 22:30:21 2014 UTC (4 months, 1 week ago) by mgorny
Branch: MAIN
CVS Tags: HEAD
Changes since 1.11: +3 -3 lines
Update libgcrypt dep to use slot :0.

(Portage version: 2.2.8-r1/cvs/Linux x86_64, signed Manifest commit with key EFB4464E!)

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

  ViewVC Help
Powered by ViewVC 1.1.20