# Template file for 'zfs'
pkgname=zfs
version=0.6.3
revision=3
build_style=gnu-configure
configure_args="--with-config=user --sbindir=/usr/bin
 --with-udevdir=/usr/lib/udev --with-udevruledir=/usr/lib/udev/rules.d
 --with-dracutdir=/usr/lib/dracut"
hostmakedepends="dracut"
makedepends="spl-devel>=${version} zlib-devel libuuid-devel libblkid-devel"
conf_files="/etc/zfs/zed.d/zed.rc"
short_desc="Z File System -- userland and kernel modules (using DKMS)"
maintainer="Christian Neukirchen <chneukirchen@gmail.com>"
license="CDDL"
homepage="http://zfsonlinux.org/"
distfiles="http://archive.zfsonlinux.org/downloads/zfsonlinux/zfs/zfs-${version}.tar.gz"
checksum=29bcfdd4161521692d2ca2515ad27a9edd9491c9cb5c6fb1e923d8eed28d391b

triggers="dkms"
dkms_modules="zfs ${version}"
depends="dkms spl>=${version} glibc-devel"

post_install() {
	# mount.zfs needs to be in /usr/sbin.
	mv ${DESTDIR}/sbin ${DESTDIR}/usr
	rm ${DESTDIR}/etc/init.d/zfs

	vlicense COPYRIGHT
	vlicense OPENSOLARIS.LICENSE

	vmkdir usr/src
	tar xzf ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${pkgname}-${version}.tar.gz -C ${DESTDIR}/usr/src
	scripts/dkms.mkconf -v ${version} -f ${DESTDIR}/usr/src/${pkgname}-${version}/dkms.conf -n zfs
}

zfs-devel_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc="Z File System -- development files"
	pkg_install() {
		vmove usr/include
		vmove "usr/lib/*.a"
		vmove "usr/lib/*.so"
	}
}