# Template file for 'chroot-distcc'
pkgname=chroot-distcc
version=3.4
revision=1
bootstrap=yes
build_style=gnu-configure
configure_args="--with-included-popt --without-avahi --without-gnome
 --without-gtk --disable-Werror --disable-pump-mode --without-libiberty"
make_install_target=install-programs
short_desc="Distributed compilation for faster C/C++ builds -- for xbps-src use"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="https://distcc.github.io"
distfiles="https://github.com/distcc/distcc/releases/download/v${version}/distcc-${version}.tar.gz"
checksum=2b99edda9dad9dbf283933a02eace6de7423fe5650daa4a728c950e5cd37bd7d
repository=bootstrap

conflicts="distcc>=0"

if [ "$CHROOT_READY" ]; then
	makedepends="binutils-devel"
fi

post_install() {
	local f x
	# Remove useless files.
	rm -f ${DESTDIR}/usr/bin/distccd
	rm -rf ${DESTDIR}/etc
	rm -rf ${DESTDIR}/usr/share

	# gcc wrappers
	vmkdir usr/lib/distcc/bin
	for f in gcc cc c++ g++ cpp; do
		ln -sfr ${DESTDIR}/usr/bin/distcc ${DESTDIR}/usr/lib/distcc/bin/${f}
	done
	# cross-gcc wrappers
	for x in arm-linux-gnueabi arm-linux-gnueabihf armv7l-linux-gnueabihf \
		arm-linux-musleabihf armv7l-linux-musleabihf aarch64-linux-gnu aarch64-linux-musl; do
		for f in gcc cc c++ g++ cpp; do
			ln -sfr ${DESTDIR}/usr/bin/distcc ${DESTDIR}/usr/lib/distcc/bin/${x}-${f}
		done
	done
}
