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