SUMMARY="Open source high performance realtime 3D engine written in C++"
DESCRIPTION="The Irrlicht Engine is an open source high performance realtime 3D engine \
written in C++. It is completely cross-platform, using D3D, OpenGL, and its \
own software renderer, and has all of the state-of-the-art features which can \
be found in commercial 3d engines. We've got a huge active community, and \
there are lots of games in development that use the engine. You can find \
enhancements for Irrlicht all over the web, like alternative terrain \
renderers, portal renderers, world layers, tutorials, editors, bindings for \
perl, ruby, python, and so on. And best of all: It's completely free."
HOMEPAGE="http://irrlicht.sourceforge.net"
COPYRIGHT="2002-2016 Nikolaus Gebhardt"
LICENSE="Zlib"
REVISION="3"
SOURCE_URI="http://downloads.sourceforge.net/irrlicht/irrlicht-$portVersion.zip"
CHECKSUM_SHA256="f42b280bc608e545b820206fe2a999c55f290de5c7509a02bdbeeccc1bf9e433"
PATCHES="irrlicht-$portVersion.patchset"

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

PROVIDES="
	irrlicht$secondaryArchSuffix = $portVersion compat >= 1.8
	lib:libIrrlicht$secondaryArchSuffix = $portVersion compat >= 1.8
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libGLU$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libSDL_1.2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	irrlicht${secondaryArchSuffix}_devel = $portVersion compat >= 1.8
	devel:irrlicht$secondaryArchSuffix = $portVersion compat >= 1.8
	devel:libIrrlicht$secondaryArchSuffix = $portVersion compat >= 1.8
	"
REQUIRES_devel="
	irrlicht$secondaryArchSuffix == $portVersion
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libGLU$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libSDL$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	cd source
	cd Irrlicht
	make sharedlib NDEBUG=1
}

INSTALL()
{
	cd source
	cd Irrlicht
	mkdir -p $includeDir/irrlicht
	mkdir -p $libDir
	cp ../../include/*.h $includeDir/irrlicht/
	cp libIrrlicht.so.$portVersion $libDir
	ln -s -f $libDir/libIrrlicht.so.$portVersion $libDir/libIrrlicht.so.1.8
	ln -s -f $libDir/libIrrlicht.so.1.8 $libDir/libIrrlicht.so

	prepareInstalledDevelLibs libIrrlicht

	packageEntries devel $developDir
}
