SUMMARY="A C++ GUI library designed for games"
DESCRIPTION="Fifechan is a C++ GUI library designed for games. It comes with a \
standard set of 'widgets' and can use several different objects for displaying \
graphics and capturing user input."
HOMEPAGE="http://fifengine.github.com/fifechan/"
COPYRIGHT="2004-2019 fifechan developers"
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://github.com/fifengine/fifechan/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="29be5ff4b379e2fc4f88ef7d8bc172342130dd3e77a3061f64c8a75efe4eba73"
SOURCE_FILENAME="fifechan-$portVersion.tar.gz"
PATCHES="fifechan-$portVersion.patchset"

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

PROVIDES="
	fifechan$secondaryArchSuffix = $portVersion
	lib:libfifechan$secondaryArchSuffix = $portVersion
	lib:libfifechan_allegro$secondaryArchSuffix = $portVersion
	lib:libfifechan_irrlicht$secondaryArchSuffix = $portVersion
	lib:libfifechan_opengl$secondaryArchSuffix = $portVersion
	lib:libfifechan_sdl$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:liballeg$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libGLU$secondaryArchSuffix
	lib:libirrlicht$secondaryArchSuffix
	lib:libSDL2_2.0$secondaryArchSuffix
	lib:libSDL2_image_2.0$secondaryArchSuffix
	"

PROVIDES_devel="
	fifechan${secondaryArchSuffix}_devel = $portVersion
	devel:libfifechan$secondaryArchSuffix = $portVersion
	devel:libfifechan_allegro$secondaryArchSuffix = $portVersion
	devel:libfifechan_irrlicht$secondaryArchSuffix = $portVersion
	devel:libfifechan_opengl$secondaryArchSuffix = $portVersion
	devel:libfifechan_sdl$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	fifechan$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:liballeg$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	devel:libirrlicht$secondaryArchSuffix
	devel:libSDL2$secondaryArchSuffix
	devel:libSDL2_image$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	mkdir -p build && cd build
	cmake \
		-DCMAKE_INSTALL_PREFIX=$prefix \
		-DLIB_INSTALL_DIR=$libDir \
		-DINCLUDE_INSTALL_DIR=$includeDir \
		-DBUILD_FIFECHAN_ALLEGRO_SHARED=ON \
		-DENABLE_ALLEGRO=ON \
		-DBUILD_FIFECHAN_IRRLICHT_SHARED=ON \
		-DENABLE_IRRLICHT=ON \
		..
	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	prepareInstalledDevelLibs \
		libfifechan \
		libfifechan_allegro \
		libfifechan_irrlicht \
		libfifechan_opengl \
		libfifechan_sdl
	fixPkgconfig

	packageEntries devel \
		$developDir
}
