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