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