# Template file for 'autofs'
pkgname=autofs
version=5.1.4
revision=2
build_style=gnu-configure
conf_files="/etc/autofs/*"
configure_args="--with-libtirpc --with-mapdir=/etc/autofs --sbindir=/usr/bin"
hostmakedepends="pkg-config flex kmod rpcgen"
makedepends="libtirpc-devel libxml2-devel"
short_desc="A kernel-based automounter for Linux"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="GPL-2"
homepage="${KERNEL_SITE}/daemons/autofs"
distfiles="${KERNEL_SITE}/daemons/autofs/v5/autofs-${version}.tar.xz"
checksum=8fce30ee51ffd528fe1a4e8374ef57f43367e1f123030e175fb1b1cf15bc1722

CFLAGS="-I${XBPS_CROSS_BASE}/usr/include/gssglue -I${XBPS_CROSS_BASE}/usr/include/tirpc"

case "$XBPS_TARGET_MACHINE" in
	*-musl) # sssd cannot be built for musl
		;;
	*)	makedepends+=" sssd-devel"
		;;
esac

pre_configure() {
	sed -i 's,nfs/nfs.h,linux/nfs.h,g' */*.[ch]
	sed -i 's,__S_IEXEC,S_IXUSR,g' */*.[ch]
}
post_install() {
	vsv $pkgname
	# Remove unused stuff
	rm ${DESTDIR}/usr/share/man/man5/autofs.5
	rm -r ${DESTDIR}/etc/default || :
	rm ${DESTDIR}/autofs || :
}
