# Template file for 'cyrus-sasl'
# keep in sync with libsasl
pkgname=cyrus-sasl
version=2.1.28
revision=4
build_style=gnu-configure
configure_args="--disable-static --enable-shared --enable-checkapop
 --enable-cram --enable-digest --disable-otp --disable-srp
 --disable-srp-setpass --disable-krb4 --enable-gssapi --enable-auth-sasldb
 --enable-plain --enable-anon --enable-login --enable-ntlm --disable-passdss
 --enable-sql --enable-ldapdb --disable-macos-framework --with-pam
 --with-saslauthd=/run/saslauthd --with-ldap --with-devrandom=/dev/urandom
 --with-configdir=/etc/sasl2:/etc/sasl:/usr/lib/sasl2
 --with-mysql=${XBPS_CROSS_BASE}/usr
 ac_cv_gssapi_supports_spnego=yes"
hostmakedepends="automake libtool groff pkg-config"
makedepends="libsasl-devel openssl-devel db-devel libldap-devel
 mit-krb5-devel pam-devel sqlite-devel postgresql-libs-devel
 libmariadbclient-devel"
depends="libsasl>=${version}"
short_desc="Cyrus SASL - auth daemon and administration tools"
maintainer="Orphaned <orphan@voidlinux.org>"
license="BSD-3-Clause-Attribution"
homepage="https://www.cyrusimap.org/sasl/"
distfiles="https://github.com/cyrusimap/cyrus-sasl/releases/download/cyrus-sasl-${version}/cyrus-sasl-${version}.tar.gz"
checksum=7ccfc6abd01ed67c1a0924b353e526f1b766b21f42d4562ee635a8ebfc5bb38c

if [ "$XBPS_TARGET_LIBC" = "glibc" ]; then
	makedepends+=" libxcrypt-devel"
fi

pre_configure() {
	autoreconf -fi
}

post_install() {
	# Remove libsasl{,-devel} files.
	rm -rf ${DESTDIR}/usr/include
	rm -f ${DESTDIR}/usr/lib/libsasl*
	rm -rf ${DESTDIR}/usr/share/man/man3
	rm ${DESTDIR}/usr/lib/pkgconfig/libsasl2.pc

	vlicense COPYING LICENSE
}

cyrus-sasl-modules-ldap_package() {
	short_desc="Cyrus SASL - pluggable authentication modules (LDAP)"
	pkg_install() {
		vmove "usr/lib/sasl2/libldapdb.*"
	}
}

cyrus-sasl-modules-sql_package() {
	short_desc="Cyrus SASL - pluggable authentication modules (SQL)"
	pkg_install() {
		vmove "usr/lib/sasl2/libsql.*"
	}
}

cyrus-sasl-modules-gssapi_package() {
	short_desc="Cyrus SASL - pluggable authentication modules (GSSAPI)"
	pkg_install() {
		vmove "usr/lib/sasl2/libgssapi*"
	}
}

cyrus-sasl-modules_package() {
	short_desc="Cyrus SASL - pluggable authentication modules"
	pkg_install() {
		vmove usr/lib/sasl2
	}
}
