blob: b117677f9b9f896bcd38416a310b648d462fa3cd [file] [log] [blame]
Andrew Geissler595f6302022-01-24 19:11:47 +00001SUMMARY = "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"
Andrew Geisslerd5838332022-05-27 11:33:10 -050010LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=beceb5ac7100b6430640c61655b25c1f \
Andrew Geissler595f6302022-01-24 19:11:47 +000011 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 \
Andrew Geissler595f6302022-01-24 19:11:47 +000018 file://initscript \
19 file://slapd.service \
20 file://remove-user-host-pwd-from-version.patch \
Andrew Geissler595f6302022-01-24 19:11:47 +000021 file://0001-build-top.mk-unset-STRIP_OPTS.patch \
Andrew Geissler87f5cff2022-09-30 13:13:31 -050022 file://0001-configure-Pass-pthread_t-to-pthread_detach.patch \
Andrew Geissler595f6302022-01-24 19:11:47 +000023"
24
Patrick Williams2194f502022-10-16 14:26:09 -050025SRC_URI[sha256sum] = "ee3c430c4ef7b87c57b622108c7339376d6c27fbbf2767770be3de1df63d008c"
Andrew Geissler595f6302022-01-24 19:11:47 +000026
27DEPENDS = "util-linux groff-native"
28
29inherit autotools-brokensep update-rc.d systemd pkgconfig
30
31# CV SETTINGS
32# Required to work round AC_FUNC_MEMCMP which gets the wrong answer
33# when cross compiling (should be in site?)
34EXTRA_OECONF += "ac_cv_func_memcmp_working=yes"
35
36# CONFIG DEFINITIONS
37# The following is necessary because it cannot be determined for a
38# cross compile automagically. Select should yield fine on all OE
39# systems...
40EXTRA_OECONF += "--with-yielding-select=yes"
41# Shared libraries are nice...
42EXTRA_OECONF += "--enable-dynamic"
43
44PACKAGECONFIG ??= "asyncmeta gnutls modules \
45 mdb ldap meta null passwd proxycache dnssrv \
46 ${@bb.utils.filter('DISTRO_FEATURES', 'ipv6', d)} \
47"
48#--with-tls with TLS/SSL support auto|openssl|gnutls [auto]
Andrew Geisslerd5838332022-05-27 11:33:10 -050049PACKAGECONFIG[gnutls] = "--with-tls=gnutls,,gnutls"
Andrew Geissler595f6302022-01-24 19:11:47 +000050PACKAGECONFIG[openssl] = "--with-tls=openssl,,openssl"
51
52PACKAGECONFIG[sasl] = "--with-cyrus-sasl,--without-cyrus-sasl,cyrus-sasl"
53PACKAGECONFIG[modules] = "lt_cv_dlopen_self=yes --enable-modules,--disable-modules,libtool"
54PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6"
55
56# SLAPD options
57#
58# UNIX crypt(3) passwd support:
59EXTRA_OECONF += "--enable-crypt"
60
61# SLAPD BACKEND
62#
63# The backend must be set by the configuration. This controls the
64# required database.
65#
66# Backends="asyncmeta dnssrv ldap mdb meta ndb null passwd perl relay sock sql wt"
67#
68# Note that multiple backends can be built. The ldbm backend requires a
69# build-time choice of database API. To use the gdbm (or other) API the
70# Berkely database module must be removed from the build.
71md = "${libexecdir}/openldap"
72#
73
74#--enable-asyncmeta enable asyncmeta backend no|yes|mod no
75PACKAGECONFIG[asyncmeta] = "--enable-asyncmeta=mod,--enable-asyncmeta=no"
76
77#--enable-dnssrv enable dnssrv backend no|yes|mod no
78PACKAGECONFIG[dnssrv] = "--enable-dnssrv=mod,--enable-dnssrv=no"
79
80#--enable-ldap enable ldap backend no|yes|mod no
81PACKAGECONFIG[ldap] = "--enable-ldap=mod,--enable-ldap=no,"
82
83#--enable-mdb enable mdb database backend no|yes|mod [yes]
84PACKAGECONFIG[mdb] = "--enable-mdb=yes,--enable-mdb=no,"
85
86#--enable-meta enable metadirectory backend no|yes|mod no
87PACKAGECONFIG[meta] = "--enable-meta=mod,--enable-meta=no,"
88
89#--enable-ndb enable MySQL NDB Cluster backend no|yes|mod [no]
90PACKAGECONFIG[ndb] = "--enable-ndb=mod,--enable-ndb=no,"
91
92#--enable-null enable null backend no|yes|mod no
93PACKAGECONFIG[null] = "--enable-null=mod,--enable-null=no,"
94
95#--enable-passwd enable passwd backend no|yes|mod no
96PACKAGECONFIG[passwd] = "--enable-passwd=mod,--enable-passwd=no,"
97
98#--enable-perl enable perl backend no|yes|mod no
99# This requires a loadable perl dynamic library, if enabled without
100# doing something appropriate (building perl?) the build will pick
101# up the build machine perl - not good (inherit perlnative?)
102PACKAGECONFIG[perl] = "--enable-perl=mod,--enable-perl=no,perl"
103
104#--enable-relay enable relay backend no|yes|mod [yes]
105PACKAGECONFIG[relay] = "--enable-relay=mod,--enable-relay=no,"
106
107#--enable-sock enable sock backend no|yes|mod [no]
108PACKAGECONFIG[sock] = "--enable-sock=mod,--enable-sock=no,"
109
110#--enable-sql enable sql backend no|yes|mod no
111# sql requires some sql backend which provides sql.h, sqlite* provides
112# sqlite.h (which may be compatible but hasn't been tried.)
113PACKAGECONFIG[sql] = "--enable-sql=mod,--enable-sql=no,sqlite3"
114
115#--enable-wt enable wt backend no|yes|mod no
116# back-wt is marked currently as experimental
117PACKAGECONFIG[wt] = "--enable-wt=mod,--enable-wt=no"
118
119#--enable-dyngroup Dynamic Group overlay no|yes|mod no
120# This is a demo, Proxy Cache defines init_module which conflicts with the
121# same symbol in dyngroup
122PACKAGECONFIG[dyngroup] = "--enable-dyngroup=mod,--enable-dyngroup=no,"
123
124#--enable-proxycache Proxy Cache overlay no|yes|mod no
125PACKAGECONFIG[proxycache] = "--enable-proxycache=mod,--enable-proxycache=no,"
126FILES:${PN}-overlay-proxycache = "${md}/pcache-*.so.*"
127PACKAGES += "${PN}-overlay-proxycache"
128
129# Append URANDOM_DEVICE='/dev/urandom' to CPPFLAGS:
130# This allows tls to obtain random bits from /dev/urandom, by default
131# it was disabled for cross-compiling.
Andrew Geissler615f2f12022-07-15 14:00:58 -0500132CPPFLAGS:append = " -D_GNU_SOURCE -DURANDOM_DEVICE=\\"/dev/urandom\\" -fPIC"
Andrew Geissler595f6302022-01-24 19:11:47 +0000133
134LDFLAGS:append = " -pthread"
135
136do_configure() {
137 rm -f ${S}/libtool
138 aclocal
139 libtoolize --force --copy
140 gnu-configize
141 cp ${STAGING_DATADIR_NATIVE}/libtool/build-aux/ltmain.sh ${S}/build
142 cp ${STAGING_DATADIR_NATIVE}/libtool/build-aux/missing ${S}/build
143 cp ${STAGING_DATADIR_NATIVE}/libtool/build-aux/compile ${S}/build
144 autoconf
145 oe_runconf
146}
147
148LEAD_SONAME = "libldap-${LDAP_VER}.so.*"
149
150# The executables go in a separate package. This allows the
151# installation of the libraries with no daemon support.
152# Each module also has its own package - see above.
153PACKAGES += "${PN}-slapd ${PN}-slurpd ${PN}-bin"
154
155# Package contents - shift most standard contents to -bin
156FILES:${PN} = "${libdir}/lib*.so.* ${sysconfdir}/openldap/ldap.* ${localstatedir}/${BPN}/data"
157FILES:${PN}-slapd = "${sysconfdir}/init.d ${libexecdir}/slapd ${sbindir} ${localstatedir}/run ${localstatedir}/volatile/run \
158 ${sysconfdir}/openldap/slapd.* ${sysconfdir}/openldap/schema \
159 ${sysconfdir}/openldap/DB_CONFIG.example ${systemd_unitdir}/system/*"
160FILES:${PN}-slurpd = "${libexecdir}/slurpd ${localstatedir}/openldap-slurp"
161FILES:${PN}-bin = "${bindir}"
162FILES:${PN}-dev = "${includedir} ${libdir}/lib*.so ${libdir}/*.la ${libexecdir}/openldap/*.a ${libexecdir}/openldap/*.la ${libexecdir}/openldap/*.so ${libdir}/pkgconfig/*.pc"
163FILES:${PN}-dbg += "${libexecdir}/openldap/.debug"
164
165do_install:append() {
166 install -d ${D}${sysconfdir}/init.d
167 cat ${WORKDIR}/initscript > ${D}${sysconfdir}/init.d/openldap
168 chmod 755 ${D}${sysconfdir}/init.d/openldap
169 # This is duplicated in /etc/openldap and is for slapd
170 rm -f ${D}${localstatedir}/openldap-data/DB_CONFIG.example
171
172 # Installing slapd under ${sbin} is more FHS and LSB compliance
173 mv ${D}${libexecdir}/slapd ${D}/${sbindir}/slapd
174 rmdir --ignore-fail-on-non-empty ${D}${libexecdir}
175 SLAPTOOLS="slapadd slapcat slapdn slapindex slappasswd slaptest slapauth slapacl slapschema slapmodify"
176 cd ${D}/${sbindir}/
177 rm -f ${SLAPTOOLS}
178 for i in ${SLAPTOOLS}; do ln -sf slapd $i; done
179
180 rmdir "${D}${localstatedir}/run"
181 rmdir --ignore-fail-on-non-empty "${D}${localstatedir}"
182
183 install -d ${D}${systemd_unitdir}/system/
184 install -m 0644 ${WORKDIR}/slapd.service ${D}${systemd_unitdir}/system/
185 sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/*.service
186
187 # Uses mdm as the database
188 # and localstatedir as data directory ...
189 sed -e 's/# modulepath/modulepath/' \
190 -e 's/# moduleload\s*back_bdb.*/moduleload back_mdb/' \
191 -e 's/database\s*bdb/database mdb/' \
192 -e 's%^directory\s*.*%directory ${localstatedir}/${BPN}/data/%' \
193 -i ${D}${sysconfdir}/openldap/slapd.conf
194
195 mkdir -p ${D}${localstatedir}/${BPN}/data
196}
197
198INITSCRIPT_PACKAGES = "${PN}-slapd"
199INITSCRIPT_NAME:${PN}-slapd = "openldap"
200INITSCRIPT_PARAMS:${PN}-slapd = "defaults"
Andrew Geissler9aee5002022-03-30 16:27:02 +0000201SYSTEMD_PACKAGES = "${PN}-slapd"
202SYSTEMD_SERVICE:${PN}-slapd = "slapd.service"
Andrew Geissler595f6302022-01-24 19:11:47 +0000203SYSTEMD_AUTO_ENABLE:${PN}-slapd ?= "disable"
204
205PACKAGES_DYNAMIC += "^${PN}-backends.* ^${PN}-backend-.*"
206
207# The modules require their .so to be dynamicaly loaded
208INSANE_SKIP:${PN}-backend-asyncmeta += "dev-so"
209INSANE_SKIP:${PN}-backend-dnssrv += "dev-so"
210INSANE_SKIP:${PN}-backend-ldap += "dev-so"
211INSANE_SKIP:${PN}-backend-meta += "dev-so"
212INSANE_SKIP:${PN}-backend-mdb += "dev-so"
213INSANE_SKIP:${PN}-backend-null += "dev-so"
214INSANE_SKIP:${PN}-backend-passwd += "dev-so"
215
216python populate_packages:prepend () {
217 backend_dir = d.expand('${libexecdir}/openldap')
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000218 do_split_packages(d, backend_dir, r'back_([a-z]*)\.so$', 'openldap-backend-%s', 'OpenLDAP %s backend', prepend=True, extra_depends='', allow_links=True)
219 do_split_packages(d, backend_dir, r'back_([a-z]*)\-.*\.so\..*$', 'openldap-backend-%s', 'OpenLDAP %s backend', extra_depends='', allow_links=True)
Andrew Geissler595f6302022-01-24 19:11:47 +0000220
221 metapkg = "${PN}-backends"
222 d.setVar('ALLOW_EMPTY:' + metapkg, "1")
223 d.setVar('FILES:' + metapkg, "")
224 metapkg_rdepends = []
225 packages = d.getVar('PACKAGES').split()
226 for pkg in packages[1:]:
227 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"):
228 metapkg_rdepends.append(pkg)
229 d.setVar('RDEPENDS:' + metapkg, ' '.join(metapkg_rdepends))
230 d.setVar('DESCRIPTION:' + metapkg, 'OpenLDAP backends meta package')
231 packages.append(metapkg)
232 d.setVar('PACKAGES', ' '.join(packages))
233}
234
235BBCLASSEXTEND = "native"
Andrew Geissler7e0e3c02022-02-25 20:34:39 +0000236
237# CVE-2015-3276 has no target code.
238CVE_CHECK_IGNORE += "CVE-2015-3276"