# Description: Lightweight Directory Access Protocol (LDAP) Toolkit
# URL: http://www.openldap.org/
# Packager: Daniel Mueller, daniel at danm dot de
# Maintainer: Jose V Beneyto, sepen at crux dot nu
# Depends on: perl, openssl, cyrus-sasl

name=openldap
version=2.4.43
release=2
source=(ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/$name-$version.tgz \
	$name-config.patch slapd)

build() {
	cd $name-$version
	patch -p0 -i $SRC/$name-config.patch

	./configure --prefix=/usr \
		--sysconfdir=/etc \
		--libexecdir=/usr/sbin \
		--localstatedir=/var/openldap \
		--enable-syslog \
		--with-threads \
		--with-tls \
		--with-cyrus-sasl \
		--enable-spasswd \
		--enable-dynamic \
		--enable-ipv6 \
		--enable-modules \
		--enable-crypt \
		--enable-rewrite \
		--enable-bdb \
		--enable-hdb \
		--enable-ldap \
		--enable-meta \
		--enable-monitor \
		--enable-dnssrv \
		--enable-null \
		--enable-perl \
		--enable-aci \
		--enable-shared

	make depend
	make
	make DESTDIR=$PKG install   

	ln -sf liblber.so $PKG/usr/lib/liblber.so.2
	ln -sf libldap.so $PKG/usr/lib/libldap.so.2
	ln -sf libldap_r.so $PKG/usr/lib/libldap_r.so.2

	install -D -m 0755 $SRC/slapd $PKG/etc/rc.d/slapd
	rm -f $PKG/etc/openldap/schema/README
}