# Template file for 'fakeroot'
pkgname=fakeroot
version=1.25.3
revision=1
build_style=gnu-configure
configure_args="--disable-static"
hostmakedepends="automake libtool"
makedepends="acl-devel libcap-devel"
#checkdepends="sharutils"
short_desc="Gives a fake root environment"
maintainer="Piraty <piraty1@inbox.ru>"
license="GPL-3.0-or-later"
homepage="https://salsa.debian.org/clint/fakeroot"
distfiles="${DEBIAN_SITE}/main/f/fakeroot/${pkgname}_${version}.orig.tar.gz"
checksum=8e903683357f7f5bcc31b879fd743391ad47691d4be33d24a76be3b6c21e956c

lib32disabled=yes

if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
	CFLAGS="-D_STAT_VER=0"
fi

post_patch() {
	# always force absolute path for LD_PRELOAD
	vsed -i scripts/fakeroot.in -e 's/@LDPRELOADABS@/1/'

	# don't build translated manpages
	vsed -i doc/Makefile.am -e '/SUBDIRS/d'

	# disable failing tests
	#
	# depends on chown which dosn't work in chroot
	vsed -i test/Makefile.am -e '/  t\.tar/d'
	if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
		#mknod: Operation not permitted
		vsed -i test/Makefile.am \
			-e '/  t\.chmod_dev/d' \
			-e '/  t\.mknod/d'
		#ls doesn't report owner as root
		vsed -i test/Makefile.am \
			-e '/  t\.touchinstall/d'
	fi
}

pre_configure() {
	sh ./bootstrap
}

pre_check() {
	export VERBOSE=x
}
