# Template file for 'libldap'
pkgname=libldap
version=2.4.36
revision=1
wrksrc="openldap-${version}"
build_style=gnu-configure
configure_args="--enable-dynamic --enable-proctitle --with-tls
 --enable-ipv6 --enable-local --with-cyrus-sasl --with-threads
 --enable-syslog --disable-slapd --disable-static
 --with-yielding_select=yes ac_cv_func_memcmp_working=yes"
hostmakedepends="pkg-config groff automake libtool"
makedepends="libsasl-devel openssl-devel"
short_desc="OpenLDAP libraries"
license="OpenLDAP License v2.8 -- BSD alike"
maintainer="Juan RP <xtraeme@gmail.com>"
homepage="http://www.openldap.org"
distfiles="ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/openldap-$version.tgz"
checksum=05b013faa789f38012aa92e2dc42ac02ea77502302ae7dac5ab225cbe73ce67a
long_desc="
 These are the run-time libraries for the OpenLDAP (Lightweight Directory
 Access Protocol) servers and clients."

pre_configure() {
	sed -e '/^STRIP/s,-s,,g' -i build/top.mk
	sed -e "s/^AC_INIT.*/AC_INIT([openldap],[${version}])/" \
		-e "s/^AM_INIT_AUTOMAKE.*/AM_INIT_AUTOMAKE/" -i configure.in
	aclocal
	autoconf
	autoheader
	libtoolize -f
}

post_install() {
	# Remove unused stuff.
	rm -rf ${DESTDIR}/usr/bin
	rm -rf ${DESTDIR}/usr/share/man/man[18]
	rm -f ${DESTDIR}/etc/openldap/*.default
	mv ${DESTDIR}/usr/share/man/man5/ldap.conf.5 ${DESTDIR}/usr/share/man
	rm -f ${DESTDIR}/usr/share/man/man5/*
	mv ${DESTDIR}/usr/share/man/ldap.conf.5 ${DESTDIR}/usr/share/man/man5
	# License	
	vinstall LICENSE 644 usr/share/licenses/$pkgname

	chmod 755 ${DESTDIR}/usr/lib/*.so.*
}

libldap-devel_package() {
	depends="openssl-devel libsasl-devel ${sourcepkg}-${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.so"
		vmove usr/share/man/man3
	}
}

libldap_package() {
	conf_files="/etc/openldap/ldap.conf" 
	pkg_install() {
		vmove all
	}
}
