# Template file for 'nfs-utils'
pkgname=nfs-utils
version=1.3.2
revision=4
short_desc="Network File System utilities"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="GPL-2"
homepage="http://nfs.sourceforge.net"
distfiles="${KERNEL_SITE}/utils/${pkgname}/${version}/${pkgname}-${version}.tar.xz"
checksum=2966bb431c06e9ba35a54f48f89db03a5132bc2d8ed8084ac8ccb34e25a9b739

hostmakedepends="pkg-config"
makedepends="libblkid-devel libmount-devel libtirpc-devel
 librpcsecgss-devel libnfsidmap-devel keyutils-devel
 libevent-devel device-mapper-devel libcap-devel mit-krb5-devel
 libblkid-devel sqlite-devel"
depends="rpcbind"
conf_files="/etc/exports /etc/idmapd.conf"
replaces="nfs-utils-server>=0"
make_dirs="
 /var/lib/nfs/rpc_pipefs	0755	root	root
 /var/lib/nfs/sm		0750	root	root
 /var/lib/nfs/v4recovery 	0755    root    root
 /etc/exports.d			0750	root	root
"

do_configure() {
	configure_args+=" --with-statduser=nobody --enable-gss --enable-nfsv4
		--with-statedir=/var/lib/nfs --enable-libmount-mount
		--with-gssglue --without-tcp-wrappers --enable-ipv6
		--sbindir=/usr/bin "

	./configure ${configure_args} \
		--with-tirpcinclude=$XBPS_CROSS_BASE/usr/include/tirpc \
		--with-krb5=$XBPS_CROSS_BASE \
		CC_FOR_BUILD="$CC" CFLAGS_FOR_BUILD="$CFLAGS"
}

do_build() {
	make ${makejobs}
}
do_install() {
	make DESTDIR=${DESTDIR} install

	mv ${DESTDIR}/sbin/* ${DESTDIR}/usr/bin
	# conffiles
	vconf ${FILESDIR}/exports
	vconf ${FILESDIR}/idmapd.conf
	# runit services
	vsv statd
	vsv nfs-server

	rm -rf ${DESTDIR}/var/lib/nfs
}
