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