blob: ecc219d35d4b6f55cd48a79bc1ca99ffe19c4e7d [file] [log] [blame]
Brad Bishop19323692019-04-05 15:28:33 -04001SUMMARY = "OpenLDAP Directory Service"
2DESCRIPTION = "OpenLDAP Software is an open source implementation of the Lightweight Directory Access Protocol."
3HOMEPAGE = "http://www.OpenLDAP.org/license.html"
4# The OpenLDAP Public License - see the HOMEPAGE - defines
5# the license. www.openldap.org claims this is Open Source
6# (see http://www.openldap.org), the license appears to be
7# basically BSD. opensource.org does not record this license
8# at present (so it is apparently not OSI certified).
9LICENSE = "OpenLDAP"
Brad Bishop26bdd442019-08-16 17:08:17 -040010LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=ad914c35f97b468f421f8ac0f3d821f4 \
Brad Bishop19323692019-04-05 15:28:33 -040011 file://LICENSE;md5=153d07ef052c4a37a8fac23bc6031972 \
12 "
13SECTION = "libs"
14
15LDAP_VER = "${@'.'.join(d.getVar('PV').split('.')[0:2])}"
16
17SRC_URI = "http://www.openldap.org/software/download/OpenLDAP/openldap-release/${BP}.tgz \
18 file://openldap-m4-pthread.patch \
19 file://kill-icu.patch \
20 file://openldap-2.4.28-gnutls-gcrypt.patch \
21 file://use-urandom.patch \
22 file://initscript \
23 file://slapd.service \
24 file://thread_stub.patch \
25 file://openldap-CVE-2015-3276.patch \
26 file://remove-user-host-pwd-from-version.patch \
27"
28
Brad Bishop26bdd442019-08-16 17:08:17 -040029SRC_URI[md5sum] = "0729a0711fe096831dedc159e0bbe73f"
30SRC_URI[sha256sum] = "d9523ffcab5cd14b709fcf3cb4d04e8bc76bb8970113255f372bc74954c6074d"
Brad Bishop19323692019-04-05 15:28:33 -040031
32DEPENDS = "util-linux groff-native"
33
34# The original top.mk used INSTALL, not INSTALL_STRIP_PROGRAM when
35# installing .so and executables, this fails in cross compilation
36# environments
37SRC_URI += "file://install-strip.patch"
38
39inherit autotools-brokensep update-rc.d systemd
40
41# CV SETTINGS
42# Required to work round AC_FUNC_MEMCMP which gets the wrong answer
43# when cross compiling (should be in site?)
44EXTRA_OECONF += "ac_cv_func_memcmp_working=yes"
45
46# CONFIG DEFINITIONS
47# The following is necessary because it cannot be determined for a
48# cross compile automagically. Select should yield fine on all OE
49# systems...
50EXTRA_OECONF += "--with-yielding-select=yes"
51# Shared libraries are nice...
52EXTRA_OECONF += "--enable-dynamic"
53
54PACKAGECONFIG ??= "gnutls modules \
55 mdb ldap meta monitor null passwd shell proxycache dnssrv \
56 ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \
57"
58#--with-tls with TLS/SSL support auto|openssl|gnutls [auto]
59PACKAGECONFIG[gnutls] = "--with-tls=gnutls,,gnutls libgcrypt"
60PACKAGECONFIG[openssl] = "--with-tls=openssl,,openssl"
61
62PACKAGECONFIG[sasl] = "--with-cyrus-sasl,--without-cyrus-sasl,cyrus-sasl"
63PACKAGECONFIG[modules] = "lt_cv_dlopen_self=yes --enable-modules,--disable-modules,libtool"
64PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6"
65
66# SLAPD options
67#
68# UNIX crypt(3) passwd support:
69EXTRA_OECONF += "--enable-crypt"
70
71# SLAPD BACKEND
72#
73# The backend must be set by the configuration. This controls the
74# required database.
75#
76# Backends="bdb dnssrv hdb ldap mdb meta monitor ndb null passwd perl relay shell sock sql"
77#
78# Note that multiple backends can be built. The ldbm backend requires a
79# build-time choice of database API. The bdb backend forces this to be
80# DB4. To use the gdbm (or other) API the Berkely database module must
81# be removed from the build.
82md = "${libexecdir}/openldap"
83#
84#--enable-bdb enable Berkeley DB backend no|yes|mod yes
85# The Berkely DB is the standard choice. This version of OpenLDAP requires
86# the version 4 implementation or better.
87PACKAGECONFIG[bdb] = "--enable-bdb=yes,--enable-bdb=no,db"
88
89#--enable-dnssrv enable dnssrv backend no|yes|mod no
90PACKAGECONFIG[dnssrv] = "--enable-dnssrv=mod,--enable-dnssrv=no"
91
92#--enable-hdb enable Hierarchical DB backend no|yes|mod no
93PACKAGECONFIG[hdb] = "--enable-hdb=yes,--enable-hdb=no,db"
94
95#--enable-ldap enable ldap backend no|yes|mod no
96PACKAGECONFIG[ldap] = "--enable-ldap=mod,--enable-ldap=no,"
97
98#--enable-mdb enable mdb database backend no|yes|mod [yes]
99PACKAGECONFIG[mdb] = "--enable-mdb=yes,--enable-mdb=no,"
100
101#--enable-meta enable metadirectory backend no|yes|mod no
102PACKAGECONFIG[meta] = "--enable-meta=mod,--enable-meta=no,"
103
104#--enable-monitor enable monitor backend no|yes|mod yes
105PACKAGECONFIG[monitor] = "--enable-monitor=mod,--enable-monitor=no,"
106
107#--enable-ndb enable MySQL NDB Cluster backend no|yes|mod [no]
108PACKAGECONFIG[ndb] = "--enable-ndb=mod,--enable-ndb=no,"
109
110#--enable-null enable null backend no|yes|mod no
111PACKAGECONFIG[null] = "--enable-null=mod,--enable-null=no,"
112
113#--enable-passwd enable passwd backend no|yes|mod no
114PACKAGECONFIG[passwd] = "--enable-passwd=mod,--enable-passwd=no,"
115
116#--enable-perl enable perl backend no|yes|mod no
117# This requires a loadable perl dynamic library, if enabled without
118# doing something appropriate (building perl?) the build will pick
119# up the build machine perl - not good (inherit perlnative?)
120PACKAGECONFIG[perl] = "--enable-perl=mod,--enable-perl=no,perl"
121
122#--enable-relay enable relay backend no|yes|mod [yes]
123PACKAGECONFIG[relay] = "--enable-relay=mod,--enable-relay=no,"
124
125#--enable-shell enable shell backend no|yes|mod no
126# configure: WARNING: Use of --without-threads is recommended with back-shell
127PACKAGECONFIG[shell] = "--enable-shell=mod --without-threads,--enable-shell=no,"
128
129#--enable-sock enable sock backend no|yes|mod [no]
130PACKAGECONFIG[sock] = "--enable-sock=mod,--enable-sock=no,"
131
132#--enable-sql enable sql backend no|yes|mod no
133# sql requires some sql backend which provides sql.h, sqlite* provides
134# sqlite.h (which may be compatible but hasn't been tried.)
135PACKAGECONFIG[sql] = "--enable-sql=mod,--enable-sql=no,sqlite3"
136
137#--enable-dyngroup Dynamic Group overlay no|yes|mod no
138# This is a demo, Proxy Cache defines init_module which conflicts with the
139# same symbol in dyngroup
140PACKAGECONFIG[dyngroup] = "--enable-dyngroup=mod,--enable-dyngroup=no,"
141
142#--enable-proxycache Proxy Cache overlay no|yes|mod no
143PACKAGECONFIG[proxycache] = "--enable-proxycache=mod,--enable-proxycache=no,"
144FILES_${PN}-overlay-proxycache = "${md}/pcache-*.so.*"
145PACKAGES += "${PN}-overlay-proxycache"
146
147# Append URANDOM_DEVICE='/dev/urandom' to CPPFLAGS:
148# This allows tls to obtain random bits from /dev/urandom, by default
149# it was disabled for cross-compiling.
150CPPFLAGS_append = " -D_GNU_SOURCE -DURANDOM_DEVICE=\'/dev/urandom\' -fPIC"
151
152LDFLAGS_append = " -pthread"
153
154do_configure() {
155 cp ${STAGING_DATADIR_NATIVE}/libtool/build-aux/ltmain.sh ${S}/build
156 rm -f ${S}/libtool
157 aclocal
158 libtoolize --force --copy
159 gnu-configize
160 autoconf
161 oe_runconf
162}
163
164LEAD_SONAME = "libldap-${LDAP_VER}.so.*"
165
166# The executables go in a separate package. This allows the
167# installation of the libraries with no daemon support.
168# Each module also has its own package - see above.
169PACKAGES += "${PN}-slapd ${PN}-slurpd ${PN}-bin"
170
171# Package contents - shift most standard contents to -bin
172FILES_${PN} = "${libdir}/lib*.so.* ${sysconfdir}/openldap/ldap.* ${localstatedir}/${BPN}/data"
173FILES_${PN}-slapd = "${sysconfdir}/init.d ${libexecdir}/slapd ${sbindir} ${localstatedir}/run ${localstatedir}/volatile/run \
174 ${sysconfdir}/openldap/slapd.* ${sysconfdir}/openldap/schema \
175 ${sysconfdir}/openldap/DB_CONFIG.example ${systemd_unitdir}/system/*"
176FILES_${PN}-slurpd = "${libexecdir}/slurpd ${localstatedir}/openldap-slurp ${localstatedir}/run ${localstatedir}/volatile/run"
177FILES_${PN}-bin = "${bindir}"
178FILES_${PN}-dev = "${includedir} ${libdir}/lib*.so ${libdir}/*.la ${libdir}/*.a ${libexecdir}/openldap/*.a ${libexecdir}/openldap/*.la ${libexecdir}/openldap/*.so"
179FILES_${PN}-dbg += "${libexecdir}/openldap/.debug"
180
181do_install_append() {
182 install -d ${D}${sysconfdir}/init.d
183 cat ${WORKDIR}/initscript > ${D}${sysconfdir}/init.d/openldap
184 chmod 755 ${D}${sysconfdir}/init.d/openldap
185 # This is duplicated in /etc/openldap and is for slapd
186 rm -f ${D}${localstatedir}/openldap-data/DB_CONFIG.example
187
188 # Installing slapd under ${sbin} is more FHS and LSB compliance
189 mv ${D}${libexecdir}/slapd ${D}/${sbindir}/slapd
190 rmdir --ignore-fail-on-non-empty ${D}${libexecdir}
191 SLAPTOOLS="slapadd slapcat slapdn slapindex slappasswd slaptest slapauth slapacl slapschema"
192 cd ${D}/${sbindir}/
193 rm -f ${SLAPTOOLS}
194 for i in ${SLAPTOOLS}; do ln -sf slapd $i; done
195
196 rmdir "${D}${localstatedir}/run"
197 rmdir --ignore-fail-on-non-empty "${D}${localstatedir}"
198
199 install -d ${D}${systemd_unitdir}/system/
200 install -m 0644 ${WORKDIR}/slapd.service ${D}${systemd_unitdir}/system/
201 sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/*.service
202
203 # Uses mdm as the database
204 # and localstatedir as data directory ...
205 sed -e 's/# modulepath/modulepath/' \
206 -e 's/# moduleload\s*back_bdb.*/moduleload back_mdb/' \
207 -e 's/database\s*bdb/database mdb/' \
208 -e 's%^directory\s*.*%directory ${localstatedir}/${BPN}/data/%' \
209 -i ${D}${sysconfdir}/openldap/slapd.conf
210
211 mkdir -p ${D}${localstatedir}/${BPN}/data
212
213
214}
215
216INITSCRIPT_PACKAGES = "${PN}-slapd"
217INITSCRIPT_NAME_${PN}-slapd = "openldap"
218INITSCRIPT_PARAMS_${PN}-slapd = "defaults"
219SYSTEMD_SERVICE_${PN}-slapd = "hostapd.service"
220SYSTEMD_AUTO_ENABLE_${PN}-slapd ?= "disable"
221
222
223PACKAGES_DYNAMIC += "^${PN}-backends.* ^${PN}-backend-.*"
224
225# The modules require their .so to be dynamicaly loaded
226INSANE_SKIP_${PN}-backend-dnssrv += "dev-so"
227INSANE_SKIP_${PN}-backend-ldap += "dev-so"
228INSANE_SKIP_${PN}-backend-meta += "dev-so"
229INSANE_SKIP_${PN}-backend-mdb += "dev-so"
230INSANE_SKIP_${PN}-backend-monitor += "dev-so"
231INSANE_SKIP_${PN}-backend-null += "dev-so"
232INSANE_SKIP_${PN}-backend-passwd += "dev-so"
233INSANE_SKIP_${PN}-backend-shell += "dev-so"
234
235
236python populate_packages_prepend () {
237 backend_dir = d.expand('${libexecdir}/openldap')
238 do_split_packages(d, backend_dir, 'back_([a-z]*)\.so$', 'openldap-backend-%s', 'OpenLDAP %s backend', prepend=True, extra_depends='', allow_links=True)
239 do_split_packages(d, backend_dir, 'back_([a-z]*)\-.*\.so\..*$', 'openldap-backend-%s', 'OpenLDAP %s backend', extra_depends='', allow_links=True)
240
241 metapkg = "${PN}-backends"
242 d.setVar('ALLOW_EMPTY_' + metapkg, "1")
243 d.setVar('FILES_' + metapkg, "")
244 metapkg_rdepends = []
245 packages = d.getVar('PACKAGES').split()
246 for pkg in packages[1:]:
247 if pkg.count("openldap-backend-") and not pkg in metapkg_rdepends and not pkg.count("-dev") and not pkg.count("-dbg") and not pkg.count("static") and not pkg.count("locale"):
248 metapkg_rdepends.append(pkg)
249 d.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends))
250 d.setVar('DESCRIPTION_' + metapkg, 'OpenLDAP backends meta package')
251 packages.append(metapkg)
252 d.setVar('PACKAGES', ' '.join(packages))
253}
254
255BBCLASSEXTEND = "native"