# SliTaz package receipt.

PACKAGE="tcc"
VERSION="0.9.25"
CATEGORY="development"
SHORT_DESC="fast Tiny C Compiler."
MAINTAINER="pascal.bellard@slitaz.org"
TARBALL="$PACKAGE-$VERSION.tar.bz2"
WEB_SITE="http://bellard.org/$PACKAGE/"
DEPENDS="tcc-common"
BUILD_DEPENDS="perl"
WGET_URL="http://download.savannah.nongnu.org/releases/tinycc/$TARBALL"
TAGS="compiler C"

# Rules to configure and make the package.
compile_rules()
{
	cd $src
	if [ ! -f done.Makefile.u ]; then
		patch < $stuff/Makefile.u || return 1
		touch done.Makefile.u
	fi
	sed -i 's/cp -u/cp/' tests/Makefile
	sed -i 's, tcctest.gcc .*, tcctest.gcc $< -I. -w $(shell echo $(CFLAGS) | sed "/-O2//"),' \
		tests/Makefile
	./configure --prefix=/usr --enable-cross $CONFIGURE_ARGS &&
	make &&
	make test &&
	make DESTDIR=$PWD/_pkg install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/bin
	cp -a $_pkg/usr/bin/tcc $fs/usr/bin
}