SUMMARY="A free, open-source cross-platform game engine"
DESCRIPTION="FIFE is a free, open-source cross-platform game engine. It \
features hardware-accelerated 2D graphics, integrated GUI, audio support, \
lighting, map editor supporting top-down and isometric maps, pathfinding, \
virtual filesystem and more!"
HOMEPAGE="http://www.fifengine.net/"
COPYRIGHT="2003-2015 FIFE"
LICENSE="GNU LGPL v2.1"
REVISION="3"
SOURCE_URI="https://github.com/fifengine/fifengine/archive/50d2f7cf9a5d5433102c32851e587e3e9142d2e0.tar.gz"
CHECKSUM_SHA256="b84ee1792df881d716ad1df4c75f90fd3b16ac63f1208ccdada3e28cb233288c"
SOURCE_DIR="fifengine-50d2f7cf9a5d5433102c32851e587e3e9142d2e0"
PATCHES="fife-$portVersion.patchset"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="!x86" # Would need hybrid python?

PROVIDES="
	fife$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	python
	lib:libboost_filesystem$secondaryArchSuffix
	lib:libboost_regex$secondaryArchSuffix
	lib:libboost_system$secondaryArchSuffix
	lib:libfifechan$secondaryArchSuffix
	lib:libfifechan_sdl$secondaryArchSuffix
	lib:libgl$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libopenal$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libSDL_image_1.2$secondaryArchSuffix
	lib:libSDL_ttf_2.0$secondaryArchSuffix
	lib:libvorbisfile$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	devel:libboost_filesystem$secondaryArchSuffix
	devel:libboost_regex$secondaryArchSuffix
	devel:libboost_system$secondaryArchSuffix
	devel:libfifechan$secondaryArchSuffix
	devel:libfifechan_sdl$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libopenal$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libSDL$secondaryArchSuffix
	devel:libSDL_image$secondaryArchSuffix
	devel:libSDL_ttf$secondaryArchSuffix
	devel:libvorbisfile$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:gcc$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	cmd:scons
	cmd:swig
	"

BUILD()
{
	scons --disable-opengl --disable-githash --local-tinyxml $jobArgs \
		fife-python
}

INSTALL()
{
	pythonVersion=$(python -c 'import sys; print(str(sys.version_info[0]) + "." + str(sys.version_info[1]))')

	vendorPackagesPath="$libDir/python$pythonVersion/vendor-packages"

	mkdir -p "$vendorPackagesPath"

	scons --disable-opengl --disable-githash --local-tinyxml $jobArgs \
		--python-prefix="$vendorPackagesPath" install-python
}
