# Template file for 'tcc'
pkgname=tcc
version=0.9.27.20250903
revision=2
_gitrev=8c3396a76f1a49eb2209206cf1274c9fc00a7506
build_style=configure
configure_args="--prefix=/usr --libdir=\${prefix}/lib$XBPS_TARGET_WORDSIZE"
make_check_target="test"
hostmakedepends="perl which"
short_desc="Tiny C Compiler"
maintainer="Orphaned <orphan@voidlinux.org>"
license="LGPL-2.1-or-later"
homepage="http://bellard.org/tcc/"
distfiles="http://repo.or.cz/tinycc.git/snapshot/${_gitrev}.tar.gz"
checksum=43d9e2cba03ea2df7d3c3cf3fb28969c554fee8bb99c6a038fcce5d4835ef3ce
nopie=yes
nocross=yes

case "$XBPS_TARGET_LIBC" in
	musl) depends+=" musl-devel";;
	*) depends+=" glibc-devel";;
esac

case "$XBPS_TARGET_MACHINE" in
	ppc*) broken="ftbfs";;
	*-musl) configure_args+=" --config-musl";;
esac

do_build() {
	# Can't use (many of) our CFLAGS or LDFLAGS
	# because TCC is bootstrapped with the same flags
	make CFLAGS= LDFLAGS= ${makejobs}
}
