# Template file for 'libldap'
pkgname=libldap
version=2.4.40
revision=4
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"
hostmakedepends="pkg-config groff automake libtool"
makedepends="libressl-devel>=2.1.4 libsasl-devel"
conf_files="/etc/openldap/ldap.conf" 
short_desc="OpenLDAP (Lightweight Directory Access Protocol) 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=d12611a5c25b6499293c2bb7b435dc2b174db73e83f5a8cb7e34f2ce5fa6dadb

pre_configure() {
	sed -e '/^STRIP/s,-s,,g' -i build/top.mk
	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	
	vlicense LICENSE

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

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