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