SUMMARY="A C++ 2D game engine for easy cross-platform development"
DESCRIPTION="Entropia Engine++ is a C++ 2D game engine designed for an easy \
cross-platform game development."
HOMEPAGE="https://bitbucket.org/SpartanJ/eepp"
COPYRIGHT="2011-2014 Martín Lucas Golini"
LICENSE="MIT"
REVISION="4"
SOURCE_URI="https://bitbucket.org/SpartanJ/eepp/get/release-0.9.5.tar.gz"
CHECKSUM_SHA256="b4094be1b29361c66ab15cae166576d3600f7b6d914b339af857878559156b48"
SOURCE_DIR="SpartanJ-eepp-b44ee6ad7704"
PATCHES="eepp-$portVersion.patchset"

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

PROVIDES="
	eepp$secondaryArchSuffix = $portVersion
	lib:libeepp$secondaryArchSuffix = $portVersion
	lib:libeepp_debug$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgl$secondaryArchSuffix
	lib:libopenal$secondaryArchSuffix
	lib:libsdl2_2.0$secondaryArchSuffix
	"

PROVIDES_devel="
	eepp${secondaryArchSuffix}_devel = $portVersion
	devel:libeepp$secondaryArchSuffix = $portVersion
	devel:libeepp_debug$secondaryArchSuffix = $portVersion
	devel:libeepp_main$secondaryArchSuffix = $portVersion
	devel:libeepp_static_debug$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	eepp$secondaryArchSuffix == $portVersion
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libgl$secondaryArchSuffix
	devel:libopenal$secondaryArchSuffix
	devel:libsdl2_2.0$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:hg
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:premake4$secondaryArchSuffix
	"

BUILD()
{
	cd src/eepp/helper
	rm -rf SOIL2
	hg clone http://bitbucket.org/SpartanJ/soil2 SOIL2 -r 5ebbd585ec79022bf94db977c0e56eae374e7156
	sed -i '/targetname "soil2"/a \
	\
		configuration "haiku" \
			buildoptions{ "-march=native" }' SOIL2/premake4.lua
	cd ../../..
	premake4 gmake --os=haiku
	cd make/haiku
	make
}

INSTALL()
{
	mkdir -p $includeDir
	mkdir -p $developLibDir
	mkdir -p $libDir
	cp -r include/* $includeDir/
	cp libs/haiku/lib*.a $developLibDir/
	cp libs/haiku/lib*.so $libDir/

	prepareInstalledDevelLibs libeepp-debug
	packageEntries devel $developDir
}
