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