SUMMARY="Generic game engine"
DESCRIPTION="A generic game engine for 2D double-buffering animation"
HOMEPAGE="http://sarrazip.com/dev/burgerspace.html"
COPYRIGHT="1999-2019 Pierre Sarrazin"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="http://perso.b2b2c.ca/~sarrazip/dev/flatzebra-$portVersion.tar.gz"
CHECKSUM_SHA256="8809a655cd85b25701de3c627cdacfa49f59af13680d609730386fc402f14df4"
SOURCE_DIR="flatzebra-$portVersion"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

libVersion="2.0.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	flatzebra$secondaryArchSuffix = $portVersion
	lib:libflatzebra_0.1$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libSDL_image_1.2$secondaryArchSuffix
	lib:libSDL_mixer_1.2$secondaryArchSuffix
	"

PROVIDES_devel="
	flatzebra${secondaryArchSuffix}_devel = $portVersion
	devel:libflatzebra_0.1$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	flatzebra$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libSDL_1.2$secondaryArchSuffix
	devel:libSDL_image_1.2$secondaryArchSuffix
	devel:libSDL_mixer_1.2$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

TEST_REQUIRES="
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	# remove libtool file
	rm -rf $libDir/libflatzebra-0.1.la

	prepareInstalledDevelLib libflatzebra-0.1
	fixPkgconfig

	# fixPkgconfig
	if [ -n "$secondaryArchSuffix" ]; then
		sed -i 's,\${prefix}/develop/headers/x86,\${prefix}/develop/headers/x86/flatzebra-0.1,g' \
			$prefix/$relativeDevelopLibDir/pkgconfig/flatzebra-0.1.pc
	else
		sed -i 's,\${prefix}/develop/headers,\${prefix}/develop/headers/flatzebra-0.1,g' \
			$prefix/$relativeDevelopLibDir/pkgconfig/flatzebra-0.1.pc
	fi

	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
