# Template file for 'schroot'
pkgname=schroot
version=1.7.2
revision=9
build_style=cmake
configure_args="
	-DCMAKE_INSTALL_SYSCONFDIR=/etc
	-DCMAKE_INSTALL_LOCALSTATEDIR=/var
	-Ddchroot=ON
	-Ddchroot-dsa=ON
	-Ddebug=OFF
	-Dbash_completion_dir=/usr/share/bash-completion/completions
	-Dlvm-snapshot=ON
	-Dbtrfs-snapshot=ON

	-DBOOST_REGEX_EXITCODE=0
	-DSTD_REGEX_BROKEN_EXITCODE=1
	-DSTD_REGEX_EXITCODE=0" # fixes cross compilation
conf_files="
	/etc/pam.d/schroot
	/etc/schroot/default/copyfiles
	/etc/schroot/default/nssdatabases
	/etc/schroot/default/fstab
	/etc/schroot/setup.d/05file
	/etc/schroot/setup.d/05lvm
	/etc/schroot/setup.d/50chrootname
	/etc/schroot/setup.d/70services
	/etc/schroot/setup.d/05btrfs
	/etc/schroot/setup.d/00check
	/etc/schroot/setup.d/20copyfiles
	/etc/schroot/setup.d/15binfmt
	/etc/schroot/setup.d/20nssdatabases
	/etc/schroot/setup.d/99check
	/etc/schroot/setup.d/10mount
	/etc/schroot/setup.d/15killprocs
	/etc/schroot/setup.d/05union
	/etc/schroot/schroot.conf
	/etc/schroot/sbuild/copyfiles
	/etc/schroot/sbuild/nssdatabases
	/etc/schroot/sbuild/fstab
	/etc/schroot/buildd/copyfiles
	/etc/schroot/buildd/nssdatabases
	/etc/schroot/buildd/fstab
	/etc/schroot/desktop/copyfiles
	/etc/schroot/desktop/nssdatabases
	/etc/schroot/desktop/fstab
	/etc/schroot/minimal/copyfiles
	/etc/schroot/minimal/nssdatabases
	/etc/schroot/minimal/fstab"
make_dirs="
	/var/lib/schroot/unpack 0755 root root
	/var/lib/schroot/union/underlay 0755 root root
	/var/lib/schroot/union/overlay 0755 root root
	/var/lib/schroot/session 0755 root root
	/var/lib/schroot/mount 0755 root root
	/etc/schroot/chroot.d 0755 root root"
hostmakedepends="pkg-config groff"
makedepends="boost-devel pam-devel lockdev-devel libuuid-devel e2fsprogs-devel gtest-devel"
short_desc="Allows users to execute commands in different chroots"
maintainer="Andrea Brancaleoni <abc@pompel.me>"
license="GPL-3"
homepage="https://wiki.debian.org/Schroot"
distfiles="${DEBIAN_SITE}/main/s/${pkgname}/${pkgname}_${version}.orig.tar.xz"
checksum="0fabc156da95cfcd63493bf1c3a438efa4a550c4f280d8f1c6f9e67c3d424661"

LDFLAGS="-lboost_regex"

pre_configure() {
	sed -i 's/warn/message/g' man/CMakeLists.txt
	sed -i '/networks/d' \
		etc/profile-templates/default/all/nssdatabases \
		etc/profile-templates/desktop/all/nssdatabases \
		etc/profile-templates/buildd/all/copyfiles
}

post_install() {
	chmod 4755 $PKGDESTDIR/usr/bin/$pkgname
	rm -r $PKGDESTDIR/usr/include $PKGDESTDIR/usr/lib/pkgconfig
}
