openldap_2.4.44.bb 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. # OpenLDAP, a license free (see http://www.OpenLDAP.org/license.html)
  2. #
  3. SUMMARY = "OpenLDAP Directory Service"
  4. DESCRIPTION = "OpenLDAP Software is an open source implementation of the Lightweight Directory Access Protocol."
  5. HOMEPAGE = "http://www.OpenLDAP.org/license.html"
  6. # The OpenLDAP Public License - see the HOMEPAGE - defines
  7. # the license. www.openldap.org claims this is Open Source
  8. # (see http://www.openldap.org), the license appears to be
  9. # basically BSD. opensource.org does not record this license
  10. # at present (so it is apparently not OSI certified).
  11. LICENSE = "OpenLDAP"
  12. LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=c933fba6d89fda89f58df1e086e3f2e7 \
  13. file://LICENSE;md5=153d07ef052c4a37a8fac23bc6031972 \
  14. "
  15. SECTION = "libs"
  16. LDAP_VER = "${@'.'.join(d.getVar('PV').split('.')[0:2])}"
  17. SRC_URI = "ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${BP}.tgz \
  18. file://openldap-m4-pthread.patch \
  19. file://kill-icu.patch \
  20. file://openldap-2.4.28-gnutls-gcrypt.patch \
  21. file://use-urandom.patch \
  22. file://initscript \
  23. file://slapd.service \
  24. file://thread_stub.patch \
  25. file://openldap-CVE-2015-3276.patch \
  26. "
  27. SRC_URI[md5sum] = "693ac26de86231f8dcae2b4e9d768e51"
  28. SRC_URI[sha256sum] = "d7de6bf3c67009c95525dde3a0212cc110d0a70b92af2af8e3ee800e81b88400"
  29. DEPENDS = "util-linux groff-native"
  30. # The original top.mk used INSTALL, not INSTALL_STRIP_PROGRAM when
  31. # installing .so and executables, this fails in cross compilation
  32. # environments
  33. SRC_URI += "file://install-strip.patch"
  34. inherit autotools-brokensep update-rc.d systemd
  35. # CV SETTINGS
  36. # Required to work round AC_FUNC_MEMCMP which gets the wrong answer
  37. # when cross compiling (should be in site?)
  38. EXTRA_OECONF += "ac_cv_func_memcmp_working=yes"
  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...
  43. EXTRA_OECONF += "--with-yielding-select=yes"
  44. # Shared libraries are nice...
  45. EXTRA_OECONF += "--enable-dynamic"
  46. PACKAGECONFIG ??= "gnutls modules \
  47. mdb ldap meta monitor null passwd shell proxycache dnssrv \
  48. ${@bb.utils.contains('DISTRO_FEATURES', 'ipv6', 'ipv6', '', d)} \
  49. "
  50. #--with-tls with TLS/SSL support auto|openssl|gnutls [auto]
  51. PACKAGECONFIG[gnutls] = "--with-tls=gnutls,,gnutls libgcrypt"
  52. PACKAGECONFIG[openssl] = "--with-tls=openssl,,openssl"
  53. PACKAGECONFIG[sasl] = "--with-cyrus-sasl,--without-cyrus-sasl,cyrus-sasl"
  54. PACKAGECONFIG[modules] = "lt_cv_dlopen_self=yes --enable-modules,--disable-modules,libtool"
  55. PACKAGECONFIG[ipv6] = "--enable-ipv6,--disable-ipv6"
  56. # SLAPD options
  57. #
  58. # UNIX crypt(3) passwd support:
  59. EXTRA_OECONF += "--enable-crypt"
  60. # SLAPD BACKEND
  61. #
  62. # The backend must be set by the configuration. This controls the
  63. # required database.
  64. #
  65. # Backends="bdb dnssrv hdb ldap mdb meta monitor ndb null passwd perl relay shell sock sql"
  66. #
  67. # Note that multiple backends can be built. The ldbm backend requires a
  68. # build-time choice of database API. The bdb backend forces this to be
  69. # DB4. To use the gdbm (or other) API the Berkely database module must
  70. # be removed from the build.
  71. md = "${libexecdir}/openldap"
  72. #
  73. #--enable-bdb enable Berkeley DB backend no|yes|mod yes
  74. # The Berkely DB is the standard choice. This version of OpenLDAP requires
  75. # the version 4 implementation or better.
  76. PACKAGECONFIG[bdb] = "--enable-bdb=yes,--enable-bdb=no,db"
  77. #--enable-dnssrv enable dnssrv backend no|yes|mod no
  78. PACKAGECONFIG[dnssrv] = "--enable-dnssrv=mod,--enable-dnssrv=no"
  79. #--enable-hdb enable Hierarchical DB backend no|yes|mod no
  80. PACKAGECONFIG[hdb] = "--enable-hdb=yes,--enable-hdb=no,db"
  81. #--enable-ldap enable ldap backend no|yes|mod no
  82. PACKAGECONFIG[ldap] = "--enable-ldap=mod,--enable-ldap=no,"
  83. #--enable-mdb enable mdb database backend no|yes|mod [yes]
  84. PACKAGECONFIG[mdb] = "--enable-mdb=yes,--enable-mdb=no,"
  85. #--enable-meta enable metadirectory backend no|yes|mod no
  86. PACKAGECONFIG[meta] = "--enable-meta=mod,--enable-meta=no,"
  87. #--enable-monitor enable monitor backend no|yes|mod yes
  88. PACKAGECONFIG[monitor] = "--enable-monitor=mod,--enable-monitor=no,"
  89. #--enable-ndb enable MySQL NDB Cluster backend no|yes|mod [no]
  90. PACKAGECONFIG[ndb] = "--enable-ndb=mod,--enable-ndb=no,"
  91. #--enable-null enable null backend no|yes|mod no
  92. PACKAGECONFIG[null] = "--enable-null=mod,--enable-null=no,"
  93. #--enable-passwd enable passwd backend no|yes|mod no
  94. PACKAGECONFIG[passwd] = "--enable-passwd=mod,--enable-passwd=no,"
  95. #--enable-perl enable perl backend no|yes|mod no
  96. # This requires a loadable perl dynamic library, if enabled without
  97. # doing something appropriate (building perl?) the build will pick
  98. # up the build machine perl - not good (inherit perlnative?)
  99. PACKAGECONFIG[perl] = "--enable-perl=mod,--enable-perl=no,perl"
  100. #--enable-relay enable relay backend no|yes|mod [yes]
  101. PACKAGECONFIG[relay] = "--enable-relay=mod,--enable-relay=no,"
  102. #--enable-shell enable shell backend no|yes|mod no
  103. # configure: WARNING: Use of --without-threads is recommended with back-shell
  104. PACKAGECONFIG[shell] = "--enable-shell=mod --without-threads,--enable-shell=no,"
  105. #--enable-sock enable sock backend no|yes|mod [no]
  106. PACKAGECONFIG[sock] = "--enable-sock=mod,--enable-sock=no,"
  107. #--enable-sql enable sql backend no|yes|mod no
  108. # sql requires some sql backend which provides sql.h, sqlite* provides
  109. # sqlite.h (which may be compatible but hasn't been tried.)
  110. PACKAGECONFIG[sql] = "--enable-sql=mod,--enable-sql=no,sqlite3"
  111. #--enable-dyngroup Dynamic Group overlay no|yes|mod no
  112. # This is a demo, Proxy Cache defines init_module which conflicts with the
  113. # same symbol in dyngroup
  114. PACKAGECONFIG[dyngroup] = "--enable-dyngroup=mod,--enable-dyngroup=no,"
  115. #--enable-proxycache Proxy Cache overlay no|yes|mod no
  116. PACKAGECONFIG[proxycache] = "--enable-proxycache=mod,--enable-proxycache=no,"
  117. FILES_${PN}-overlay-proxycache = "${md}/pcache-*.so.*"
  118. PACKAGES += "${PN}-overlay-proxycache"
  119. # Append URANDOM_DEVICE='/dev/urandom' to CPPFLAGS:
  120. # This allows tls to obtain random bits from /dev/urandom, by default
  121. # it was disabled for cross-compiling.
  122. CPPFLAGS_append = " -D_GNU_SOURCE -DURANDOM_DEVICE=\'/dev/urandom\' -fPIC"
  123. LDFLAGS += "-pthread"
  124. do_configure() {
  125. cp ${STAGING_DATADIR_NATIVE}/libtool/build-aux/ltmain.sh ${S}/build
  126. rm -f ${S}/libtool
  127. aclocal
  128. libtoolize --force --copy
  129. gnu-configize
  130. autoconf
  131. oe_runconf
  132. }
  133. LEAD_SONAME = "libldap-${LDAP_VER}.so.*"
  134. # The executables go in a separate package. This allows the
  135. # installation of the libraries with no daemon support.
  136. # Each module also has its own package - see above.
  137. PACKAGES += "${PN}-slapd ${PN}-slurpd ${PN}-bin"
  138. # Package contents - shift most standard contents to -bin
  139. FILES_${PN} = "${libdir}/lib*.so.* ${sysconfdir}/openldap/ldap.* ${localstatedir}/${BPN}/data"
  140. FILES_${PN}-slapd = "${sysconfdir}/init.d ${libexecdir}/slapd ${sbindir} ${localstatedir}/run ${localstatedir}/volatile/run \
  141. ${sysconfdir}/openldap/slapd.* ${sysconfdir}/openldap/schema \
  142. ${sysconfdir}/openldap/DB_CONFIG.example ${systemd_unitdir}/system/*"
  143. FILES_${PN}-slurpd = "${libexecdir}/slurpd ${localstatedir}/openldap-slurp ${localstatedir}/run ${localstatedir}/volatile/run"
  144. FILES_${PN}-bin = "${bindir}"
  145. FILES_${PN}-dev = "${includedir} ${libdir}/lib*.so ${libdir}/*.la ${libdir}/*.a ${libexecdir}/openldap/*.a ${libexecdir}/openldap/*.la ${libexecdir}/openldap/*.so"
  146. FILES_${PN}-dbg += "${libexecdir}/openldap/.debug"
  147. do_install_append() {
  148. install -d ${D}${sysconfdir}/init.d
  149. cat ${WORKDIR}/initscript > ${D}${sysconfdir}/init.d/openldap
  150. chmod 755 ${D}${sysconfdir}/init.d/openldap
  151. # This is duplicated in /etc/openldap and is for slapd
  152. rm -f ${D}${localstatedir}/openldap-data/DB_CONFIG.example
  153. # Installing slapd under ${sbin} is more FHS and LSB compliance
  154. mv ${D}${libexecdir}/slapd ${D}/${sbindir}/slapd
  155. SLAPTOOLS="slapadd slapcat slapdn slapindex slappasswd slaptest slapauth slapacl slapschema"
  156. cd ${D}/${sbindir}/
  157. rm -f ${SLAPTOOLS}
  158. for i in ${SLAPTOOLS}; do ln -sf slapd $i; done
  159. rmdir "${D}${localstatedir}/run"
  160. rmdir --ignore-fail-on-non-empty "${D}${localstatedir}"
  161. install -d ${D}${systemd_unitdir}/system/
  162. install -m 0644 ${WORKDIR}/slapd.service ${D}${systemd_unitdir}/system/
  163. sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/*.service
  164. # Uses mdm as the database
  165. # and localstatedir as data directory ...
  166. sed -e 's/# modulepath/modulepath/' \
  167. -e 's/# moduleload\s*back_bdb.*/moduleload back_mdb/' \
  168. -e 's/database\s*bdb/database mdb/' \
  169. -e 's%^directory\s*.*%directory ${localstatedir}/${BPN}/data/%' \
  170. -i ${D}${sysconfdir}/openldap/slapd.conf
  171. mkdir -p ${D}${localstatedir}/${BPN}/data
  172. }
  173. INITSCRIPT_PACKAGES = "${PN}-slapd"
  174. INITSCRIPT_NAME_${PN}-slapd = "openldap"
  175. INITSCRIPT_PARAMS_${PN}-slapd = "defaults"
  176. SYSTEMD_SERVICE_${PN}-slapd = "hostapd.service"
  177. SYSTEMD_AUTO_ENABLE_${PN}-slapd ?= "disable"
  178. PACKAGES_DYNAMIC += "^${PN}-backends.* ^${PN}-backend-.*"
  179. # The modules require their .so to be dynamicaly loaded
  180. INSANE_SKIP_${PN}-backend-dnssrv += "dev-so"
  181. INSANE_SKIP_${PN}-backend-ldap += "dev-so"
  182. INSANE_SKIP_${PN}-backend-meta += "dev-so"
  183. INSANE_SKIP_${PN}-backend-mdb += "dev-so"
  184. INSANE_SKIP_${PN}-backend-monitor += "dev-so"
  185. INSANE_SKIP_${PN}-backend-null += "dev-so"
  186. INSANE_SKIP_${PN}-backend-passwd += "dev-so"
  187. INSANE_SKIP_${PN}-backend-shell += "dev-so"
  188. python populate_packages_prepend () {
  189. backend_dir = d.expand('${libexecdir}/openldap')
  190. do_split_packages(d, backend_dir, 'back_([a-z]*)\.so$', 'openldap-backend-%s', 'OpenLDAP %s backend', prepend=True, extra_depends='', allow_links=True)
  191. do_split_packages(d, backend_dir, 'back_([a-z]*)\-.*\.so\..*$', 'openldap-backend-%s', 'OpenLDAP %s backend', extra_depends='', allow_links=True)
  192. metapkg = "${PN}-backends"
  193. d.setVar('ALLOW_EMPTY_' + metapkg, "1")
  194. d.setVar('FILES_' + metapkg, "")
  195. metapkg_rdepends = []
  196. packages = d.getVar('PACKAGES').split()
  197. for pkg in packages[1:]:
  198. 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"):
  199. metapkg_rdepends.append(pkg)
  200. d.setVar('RDEPENDS_' + metapkg, ' '.join(metapkg_rdepends))
  201. d.setVar('DESCRIPTION_' + metapkg, 'OpenLDAP backends meta package')
  202. packages.append(metapkg)
  203. d.setVar('PACKAGES', ' '.join(packages))
  204. }
  205. BBCLASSEXTEND = "native"