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="http://bitbucket.org/SpartanJ/eepp"
SOURCE_URI="hg+http://bitbucket.org/SpartanJ/eepp#7318464094366388344fe30e58f521c6b46781b6"
REVISION="1"
LICENSE="MIT"
COPYRIGHT="2011-2014 Martín Lucas Golini"

ARCHITECTURES="x86_gcc2 ?x86 ?x86_64"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	eepp$secondaryArchSuffix = $portVersion
	lib:libeepp$secondaryArchSuffix = $portVersion
	lib:libeepp_debug$secondaryArchSuffix = $portVersion
	"
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="
	haiku$secondaryArchSuffix
	lib:libsdl2$secondaryArchSuffix
	lib:libopenal$secondaryArchSuffix
	lib:libgl$secondaryArchSuffix
	lib:libgcc_s$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	"
REQUIRES_devel="
	eepp$secondaryArchSuffix = $portVersion
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libsdl2$secondaryArchSuffix
	devel:libopenal$secondaryArchSuffix
	devel:libgl$secondaryArchSuffix
	lib:libgcc_s$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:premake4$secondaryArchSuffix
	cmd:make
	cmd:hg
	"
# intentionally empty
SOURCE_DIR=""

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
}
