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