1 # OpenLDAP, a license free (see http://www.OpenLDAP.org/license.html)
3 DESCRIPTION = "OpenLDAP Software is an open source implementation of the Lightweight Directory Access Protocol."
4 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).
16 LDAP_VER = "${@'.'.join(bb.data.getVar('PV',d,1).split('.')[0:2])}"
18 SRC_URI = "ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/${P}.tgz"
19 SRC_URI += "file://openldap-m4-pthread.patch;patch=1"
20 SRC_URI += "file://initscript"
21 # The build tries to run a host executable, this fails. The patch
22 # causes the executable and its data to be installed instead of
23 # the output - ucgendat must be run after the ipkg install!
24 #SRC_URI += "file://ucgendat.patch;patch=1"
25 # The original top.mk used INSTALL, not INSTALL_STRIP_PROGRAM when
26 # installing .so and executables, this fails in cross compilation
28 SRC_URI += "file://install-strip.patch;patch=1"
33 # The following two variables can be set in a distro or local.conf
34 # to switch features on. Each feature foo defines OPENLDAP_OPTION_foo
35 # and OPENLDAP_DEPENDS_foo in this file - to include feature foo add
36 # the two variables into the setting of the options below (please use
37 # += because that means this can be done in *both* distro.conf and
39 OPENLDAP_OPTIONS ?= ""
40 OPENLDAP_DEPENDS ?= ""
43 # Required to work round AC_FUNC_MEMCMP which gets the wrong answer
44 # when cross compiling (should be in site?)
45 EXTRA_OECONF += "ac_cv_func_memcmp_working=yes"
48 # The following is necessary because it cannot be determined for a
49 # cross compile automagically. Select should yield fine on all OE
51 EXTRA_OECONF += "--with-yielding-select=yes"
52 # Shared libraries are nice...
53 EXTRA_OECONF += "--enable-dynamic"
55 # Disable TLS to remove the need for openssl/libcrypto
56 OPENLDAP_OPTION_tls ?= "--without-tls"
57 # set the following to "openssl" to build tls support
58 OPENLDAP_DEPENDS_tls ?= ""
59 EXTRA_OECONF += "${OPENLDAP_OPTION_tls}"
60 DEPENDS += "${OPENLDAP_DEPENDS_tls}"
62 # Disable Cyrus SASL, which may or may not be working at present...
63 OPENLDAP_OPTION_sasl ?= "--without-cyrus-sasl"
64 # set the following to "cyrus-sasl" to build SASL support
65 OPENLDAP_DEPENDS_sasl ?= ""
66 EXTRA_OECONF += "${OPENLDAP_OPTION_sasl}"
67 DEPENDS += "${OPENLDAP_DEPENDS_sasl}"
71 # UNIX crypt(3) passwd support:
72 EXTRA_OECONF += "--enable-crypt"
74 # Enable dynamic module loading. If this is *disabled* the
75 # dependency on libtool is removed (to disable set the following
76 # to variables to "" in a .conf file).
77 OPENLDAP_OPTION_modules += "lt_cv_dlopen_self=yes --enable-modules"
78 OPENLDAP_DEPENDS_modules += "libtool"
79 EXTRA_OECONF += " ${OPENLDAP_OPTION_modules}"
80 DEPENDS += "${OPENLDAP_DEPENDS_modules}"
84 # The backend must be set by the configuration. This controls the
85 # required database, the default database, bdb, is turned off but
86 # can be turned back on again and it *is* below! The monitor backend
87 # is also disabled. If you try to change the backends but fail to
88 # enable a single one the build will fail in an obvious way.
90 EXTRA_OECONF += "--disable-bdb --disable-monitor"
92 # Backends="bdb dnssrv hdb ldap ldbm meta monitor null passwd perl shell sql"
94 # Note that multiple backends can be built. The ldbm backend requires a
95 # build-time choice of database API. The bdb backend forces this to be
96 # DB4. To use the gdbm (or other) API the Berkely database module must
97 # be removed from the build.
98 md = "${libexecdir}/openldap"
100 #--enable-bdb enable Berkeley DB backend no|yes|mod yes
101 # The Berkely DB is the standard choice. This version of OpenLDAP requires
102 # the version 4 implementation or better.
103 # To disable this set all three of the following variables to <empty> in
104 # a .conf file (this will allow ldbm to be build with gdbm).
105 OPENLDAP_OPTION_bdb ?= "--enable-bdb=mod"
106 OPENLDAP_DEPENDS_bdb ?= "db"
107 OPENLDAP_PACKAGE_bdb ?= "${PN}-backend-bdb"
108 FILES_${PN}-backend-bdb = "${md}/back_bdb.so ${md}/back_bdb.la ${md}/back_bdb-*.so.*"
109 EXTRA_OECONF += "${OPENLDAP_OPTION_bdb}"
110 DEPENDS += "${OPENLDAP_DEPENDS_bdb}"
111 PACKAGES += "${OPENLDAP_PACKAGE_bdb}"
113 #--enable-dnssrv enable dnssrv backend no|yes|mod no
114 # This has no dependencies.
115 FILES_${PN}-backend-dnssrv = "${md}/back_dnssrv.so ${md}/back_dnssrv.la ${md}/back_dnssrv-*.so.*"
116 EXTRA_OECONF += "--enable-dnssrv=mod"
117 PACKAGES += "${PN}-backend-dnssrv"
119 #--enable-hdb enable Hierarchical DB backend no|yes|mod no
120 # This forces ldbm to use Berkeley too, remove to use gdbm
121 OPENLDAP_OPTION_hdb ?= "--enable-hdb=mod"
122 OPENLDAP_DEPENDS_hdb ?= "db"
123 OPENLDAP_PACKAGE_hdb ?= "${PN}-backend-hdb"
124 FILES_${PN}-backend-hdb = "${md}/back_hdb.so ${md}/back_hdb.la ${md}/back_hdb-*.so.*"
125 EXTRA_OECONF += "${OPENLDAP_OPTION_hdb}"
126 DEPENDS += "${OPENLDAP_DEPENDS_hdb}"
127 PACKAGES += "${OPENLDAP_PACKAGE_hdb}"
129 #--enable-ldap enable ldap backend no|yes|mod no
130 # This has no dependencies
131 EXTRA_OECONF += "--enable-ldap=mod"
132 FILES_${PN}-backend-ldap = "${md}/back_ldap.so ${md}/back_ldap.la ${md}/back_ldap-*.so.*"
133 PACKAGES += "${PN}-backend-ldap"
135 #--enable-ldbm enable ldbm backend no|yes|mod no
136 # ldbm requires further specification of the underlying database API, because
137 # bdb is enabled above this must be set to berkeley, however the config
138 # defaults this correctly so --with-ldbm-api is *not* set. The build will
139 # fail if bdb is removed (above) but not database is built to provide the
140 # support for ldbm (because the 'DEPENDS_ldbm' is empty below.)
142 # So to use gdbm set:
143 #OPENLDAP_OPTION_ldbm = "--enable-ldbm=mod --with-ldbm-api=gdbm"
144 #OPENLDAP_DEPENDS_ldbm = gdbm
145 # And clear the bdb and hdb settings.
146 OPENLDAP_OPTION_ldbm ?= "--enable-ldbm=mod"
147 OPENLDAP_DEPENDS_ldbm ?= ""
148 OPENLDAP_PACKAGES_ldbm ?= "${PN}-backend-ldbm"
149 FILES_${PN}-backend-ldbm = "${md}/back_ldbm.so ${md}/back_ldbm.la ${md}/back_ldbm-*.so.*"
150 EXTRA_OECONF += "${OPENLDAP_OPTION_ldbm}"
151 DEPENDS += "${OPENLDAP_DEPENDS_ldbm}"
152 PACKAGES += "${PN}-backend-ldbm"
154 #--enable-meta enable metadirectory backend no|yes|mod no
156 EXTRA_OECONF += "--enable-meta=mod"
157 FILES_${PN}-backend-meta = "${md}/back_meta.so ${md}/back_meta.la ${md}/back_meta-*.so.*"
158 PACKAGES += "${PN}-backend-meta"
160 #--enable-monitor enable monitor backend no|yes|mod yes
161 EXTRA_OECONF += "--enable-monitor=mod"
162 FILES_${PN}-backend-monitor = "${md}/back_monitor.so ${md}/back_monitor.la ${md}/back_monitor-*.so.*"
163 PACKAGES += "${PN}-backend-monitor"
165 #--enable-null enable null backend no|yes|mod no
166 EXTRA_OECONF += "--enable-null=mod"
167 FILES_${PN}-backend-null = "${md}/back_null.so ${md}/back_null.la ${md}/back_null-*.so.*"
168 PACKAGES += "${PN}-backend-null"
170 #--enable-passwd enable passwd backend no|yes|mod no
171 EXTRA_OECONF += " --enable-passwd=mod"
172 FILES_${PN}-backend-passwd = "${md}/back_passwd.so ${md}/back_passwd.la ${md}/back_passwd-*.so.*"
173 PACKAGES += "${PN}-backend-passwd"
175 #--enable-perl enable perl backend no|yes|mod no
176 # This requires a loadable perl dynamic library, if enabled without
177 # doing something appropriate (building perl?) the build will pick
178 # up the build machine perl - not good.
179 OPENLDAP_OPTION_perl ?= "--enable-perl=mod"
180 OPENLDAP_DEPENDS_perl ?= "perl"
181 OPENLDAP_PACKAGES_perl ?= "${PN}-backend-perl"
182 FILES_${PN}-backend-perl = "${md}/back_perl.so ${md}/back_perl.la ${md}/back_perl-*.so.*"
183 #EXTRA_OECONF += "${OPENLDAP_OPTION_perl}"
184 #DEPENDS += "${OPENLDAP_DEPENDS_perl}"
185 #PACKAGES += "${PN}-backend-perl"
187 #--enable-shell enable shell backend no|yes|mod no
188 EXTRA_OECONF += "--enable-shell=mod"
189 FILES_${PN}-backend-shell = "${md}/back_shell.so ${md}/back_shell.la ${md}/back_shell-*.so.*"
190 PACKAGES += "${PN}-backend-shell"
192 #--enable-sql enable sql backend no|yes|mod no
193 # sql requires some sql backend which provides sql.h, sqlite* provides
194 # sqlite.h (which may be compatible but hasn't been tried.)
195 OPENLDAP_OPTION_sql ?= "--enable-sql=mod"
196 OPENLDAP_DEPENDS_sql ?= "sql"
197 OPENLDAP_PACKAGES_sql ?= "${PN}-backend-sql"
198 FILES_${PN}-backend-sql = "${md}/back_sql.so ${md}/back_sql.la ${md}/back_sql-*.so.*"
199 #EXTRA_OECONF += "${OPENLDAP_OPTION_sql}"
200 #DEPENDS += "${OPENLDAP_DEPENDS_sql}"
201 #PACKAGES += "${PN}-backend-sql"
203 #--enable-dyngroup Dynamic Group overlay no|yes|mod no
204 # This is a demo, Proxy Cache defines init_module which conflicts with the
205 # same symbol in dyngroup
206 #EXTRA_OECONF += "--enable-dyngroup=mod"
207 #FILES_${PN}-overlay-dyngroup = "${md}/back_dyngroup.so ${md}/back_dyngroup.la ${md}/back_dyngroup-*.so.*"
208 #PACKAGES += "${PN}-overlay-dyngroup"
210 #--enable-proxycache Proxy Cache overlay no|yes|mod no
211 EXTRA_OECONF += "--enable-proxycache=mod"
212 FILES_${PN}-overlay-proxycache = "${md}/pcache.so ${md}/pcache.la ${md}/pcache-*.so.*"
213 PACKAGES += "${PN}-overlay-proxycache"
215 # LOCAL OPTION OVERRIDES
216 # The distro/lcoal options must be added in *last*
217 EXTRA_OECONF += "${OPENLDAP_OPTIONS}"
218 DEPENDS += "${OPENLDAP_DEPENDS}"
220 CPPFLAGS_append = " -D_GNU_SOURCE"
227 #FIXME: this is a hack, at present an openldap build will pick up the header
228 # files from staging rather than the local ones (bad -I order), so remove
229 # the headers (from openldap-old.x) before compiling...
230 do_compile_prepend() {
231 ( cd ${STAGING_INCDIR}
232 rm -f ldap.h ldap_*.h
234 ( cd ${STAGING_LIBDIR}
235 rm -f libldap* liblber*
240 echo "staging libldap-${LDAP_VER}" >&2
242 autotools_stage_includes
243 # Install the -${LDAP_VER} versions, but link foo.so to foo-x.y.so ONLY
244 # if they do not exist!
245 oe_libinstall -so -C libraries/libldap/.libs libldap-${LDAP_VER} ${STAGING_LIBDIR}
246 test -e ${STAGING_LIBDIR}/libldap.so ||
247 ln -s $(basename ${STAGING_LIBDIR}/libldap-${LDAP_VER}.so.*.*.*) ${STAGING_LIBDIR}/libldap.so
248 oe_libinstall -so -C libraries/libldap_r/.libs libldap_r-${LDAP_VER} ${STAGING_LIBDIR}
249 test -e ${STAGING_LIBDIR}/libldap_r.so ||
250 ln -s $(basename ${STAGING_LIBDIR}/libldap_r-${LDAP_VER}.so.*.*.*) ${STAGING_LIBDIR}/libldap_r.so
251 oe_libinstall -so -C libraries/liblber/.libs liblber-${LDAP_VER} ${STAGING_LIBDIR}
252 test -e ${STAGING_LIBDIR}/liblber.so ||
253 ln -s $(basename ${STAGING_LIBDIR}/liblber-${LDAP_VER}.so.*.*.*) ${STAGING_LIBDIR}/liblber.so
256 LEAD_SONAME = "libldap-${LDAP_VER}.so.*"
258 # The executables go in a separate package. This allows the
259 # installation of the libraries with no daemon support.
260 # Each module also has its own package - see above.
261 PACKAGES += "${PN}-slapd ${PN}-slurpd ${PN}-bin"
263 # Package contents - shift most standard contents to -bin
264 FILES_${PN} = "${libdir}/lib*.so.* ${sysconfdir}/openldap/ldap.* ${localstatedir}/openldap-data"
265 FILES_${PN}-slapd = "${sysconfdir}/init.d ${libexecdir}/slapd ${sbindir} ${localstatedir}/run \
266 ${sysconfdir}/openldap/slapd.* ${sysconfdir}/openldap/schema \
267 ${sysconfdir}/openldap/DB_CONFIG.example"
268 FILES_${PN}-slurpd = "${libexecdir}/slurpd ${localstatedir}/openldap-slurp ${localstatedir}/run"
269 FILES_${PN}-bin = "${bindir}"
270 FILES_${PN}-dev = "${includedir} ${libdir}/lib*.so ${libdir}/*.la ${libdir}/*.a ${libexecdir}/openldap/*.a"
272 do_install_append() {
273 install -d ${D}${sysconfdir}/init.d
274 cat ${WORKDIR}/initscript > ${D}${sysconfdir}/init.d/openldap
275 chmod 755 ${D}${sysconfdir}/init.d/openldap
276 # This is duplicated in /etc/openldap and is for slapd
277 rm -f ${D}${localstatedir}/openldap-data/DB_CONFIG.example
280 pkg_postinst_${PN}-slapd () {
281 if test -n "${D}"; then
284 update-rc.d $D openldap defaults
287 pkg_prerm_${PN}-slapd () {
288 if test -n "${D}"; then
291 update-rc.d $D openldap remove