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