# Template file for 'pam_zfscrypt'
pkgname=pam_zfscrypt
version=0.2.0
revision=3
wrksrc="zfscrypt-${version}"
build_style=gnu-makefile
makedepends="pam-devel zfs-devel"
depends="pam"
short_desc="Automatically decrypt and mount encrypted ZFS home directories"
maintainer="Zach Dykstra <dykstra.zachary@gmail.com>"
license="MIT"
homepage="https://github.com/project-trident/zfscrypt"
distfiles="${homepage}/archive/v${version}.tar.gz"
checksum=73244e7e97ab5a47a9ea4a24ac490f07bfe7c1eb0c920e03df202494ea61b650
# Makefile is racy, build sequentially
disable_parallel_build=yes

CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -fPIC -Iinclude"

post_patch() {
	if [ "${CROSS_BUILD}" ]; then
		vsed -i Makefile \
			-e "/ZFSINC :=/s,-isystem/usr/,-I${XBPS_CROSS_BASE}/usr/,g"
	fi
}

do_install() {
	vinstall build/pam_zfscrypt.so 0755 usr/lib/security
	vlicense LICENSE
}
