# Template file for 'ecryptfs-utils'
pkgname=ecryptfs-utils
version=111
revision=13
build_style=gnu-configure
configure_args="--sbindir=/usr/bin
 --with-pamdir=/usr/lib/security --enable-gpg --enable-gui
 --with-gpgme-prefix=${XBPS_CROSS_BASE}/usr --disable-pywrap"
hostmakedepends="automake gettext-devel glib-devel libtool pkg-config intltool swig"
makedepends="pam-devel nss-devel openssl-devel keyutils-devel gpgme-devel gtk+-devel"
depends="gettext"
_desc="Ecryptfs cryptographic filesystem"
short_desc="${_desc} - utilities"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="http://ecryptfs.org/"
distfiles="http://launchpad.net/ecryptfs/trunk/${version}/+download/${pkgname}_${version}.orig.tar.gz"
checksum=112cb3e37e81a1ecd8e39516725dec0ce55c5f3df6284e0f4cc0f118750a987f
lib32disabled=yes

CPPFLAGS="-D_FILE_OFFSET_BITS=64"

pre_configure() {
	NOCONFIGURE=1 ./autogen.sh
	sed -i 's/__SWORD_TYPE/unsigned long/g' src/utils/mount.ecryptfs_private.c
}

post_install() {
	vmkdir usr
	mv ${DESTDIR}/sbin/* ${DESTDIR}/usr/bin
	chmod +s ${DESTDIR}/usr/bin/mount.ecryptfs_private

	vmkdir usr/lib/modules-load.d
	echo "ecryptfs" > ${DESTDIR}/usr/lib/modules-load.d/ecryptfs.conf
	chmod 644 ${DESTDIR}/usr/lib/modules-load.d/ecryptfs.conf
}

libecryptfs_package() {
	short_desc="${_desc} - shared library"
	pkg_install() {
		vmove "usr/lib/*.so.*"
	}
}

libecryptfs-devel_package() {
	depends="keyutils-devel libecryptfs>=${version}_${revision}"
	short_desc="${_desc} - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
	}
}
