# Template file for 'libsasl'
pkgname=libsasl
version=2.1.26
revision=2
build_style=gnu-configure
configure_args="--enable-cram --enable-digest --enable-auth-sasldb
 --enable-plain --enable-anon --enable-login --enable-gssapi --enable-ntlm
 --with-configdir=/etc/sasl2:/etc/sasl:/usr/lib/sasl2
 --disable-otp --disable-srp --disable-srp-setpass --disable-krb4
 --with-devrandom=/dev/urandom"
hostmakedepends="automake libtool pkg-config"
makedepends="db-devel mit-krb5-devel"
wrksrc="cyrus-sasl-${version}"
short_desc="Cyrus SASL - runtime shared libraries"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="http://cyrusimap.web.cmu.edu/"
license="BSD"
distfiles="ftp://ftp.cyrusimap.org/cyrus-sasl/cyrus-sasl-${version}.tar.gz"
checksum=8fbc5136512b59bb793657f36fadda6359cae3b08f01fd16b3d406f1345b7bc3

patch_args="-Np1"
disable_parallel_build=yes

pre_configure() {
	# XXX
	if [ "$CROSS_BUILD" ]; then
		sed 's,AC_TRY_RUN,AC_TRY_LINK_FUNC,' -i cmulocal/sasl2.m4
	fi
	rm -f config/config.guess config/config.sub
	rm -f config/ltconfig config/ltmain.sh config/libtool.m4
	rm -fr autom4te.cache
	libtoolize -c
	aclocal -I config -I cmulocal
	automake -a -c
	autoheader
	autoconf

	pushd saslauthd
	rm -f config/config.guess config/config.sub
	rm -f config/ltconfig config/ltmain.sh config/libtool.m4
	rm -fr autom4te.cache
	libtoolize -c
	aclocal -I config -I ../cmulocal -I ../config
	automake -a -c
	autoheader
	autoconf
	popd
}
post_install() {
	# We are only interested in libsasl.
	rm -rf ${DESTDIR}/usr/{sbin,share,lib/sasl2}
}

libsasl-devel_package() {
	depends="libsasl>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.so"
		vmove usr/lib/pkgconfig
	}
}
