# Template file for 'chroot-git'
pkgname=chroot-git
version=2.31.1
revision=1
bootstrap=yes
wrksrc="git-${version}"
make_check_target=test
makedepends="zlib-devel"
short_desc="GIT Tree History Storage Tool -- for xbps-src use"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="GPL-2.0-only"
homepage="https://git-scm.com/"
distfiles="https://www.kernel.org/pub/software/scm/git/git-${version}.tar.xz"
checksum=9f61417a44d5b954a5012b6f34e526a3336dcf5dd720e2bb7ada92ad8b3d6680

if [ "$CHROOT_READY" ]; then
	hostmakedepends="perl tar"
else
	configure_args+=" --with-zlib=${XBPS_MASTERDIR}/usr"
fi

do_configure() {
	cat <<-EOF >config.mak
	prefix = /usr
	CC = $CC
	AR = $AR
	TAR = $(command -v bsdtar || command -v tar)
	CFLAGS = $CFLAGS
	LDFLAGS = $LDFLAGS
	CC_LD_DYNPATH=-L
	NO_INSTALL_HARDLINKS=Yes
	NO_GETTEXT=Yes
	NO_OPENSSL = Yes
	USE_LIBPCRE :=
	USE_LIBPCRE2 :=
	NO_CURL = Yes
	NO_EXPAT = Yes
	NO_PERL = Yes
	NO_PYTHON = Yes
	NO_TCLTK = Yes
	EOF

	if [ "$XBPS_TARGET_LIBC" = musl ]; then
		cat <<-EOF >>config.mak
		ICONV_OMITS_BOM = Yes
		NO_REGEX = Yes
		EOF
	fi
}

do_build() {
	make ${makejobs} git
}

do_install() {
	vbin git chroot-git
}
