SUMMARY="An ARPG game engine"
DESCRIPTION="A lightweight, free and open-source game engine for Action-RPGs

* A 2D game engine written in C++, and executing games made in Lua.
* Specifically designed with 16-bit classic Action-RPGs in mind.
* Available on multiple platforms.
* Completely free and open-source, under GPL v3 License."
HOMEPAGE="http://solarus-games.org"
COPYRIGHT="2006-2019 Christopho, Solarus"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://gitlab.com/solarus-games/solarus/-/archive/v$portVersion/solarus-v$portVersion.tar.gz"
CHECKSUM_SHA256="dbcd74605e4101a9df310159389e6a2db89bf654e6ee24943b3c05f3ab0b13fd"
SOURCE_DIR="solarus-v$portVersion"

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

PROVIDES="
	solarus$secondaryArchSuffix = $portVersion
	app:Solarus
	cmd:solarus = $portVersion
	cmd:solarus_launcher = $portVersion
	cmd:solarus_run = $portVersion
	lib:libsolarus$secondaryArchSuffix
	lib:libsolarus_gui$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libluajit_5.1$secondaryArchSuffix
	lib:libmodplug$secondaryArchSuffix >= 1.0
	lib:libogg$secondaryArchSuffix
	lib:libopenal$secondaryArchSuffix
	lib:libphysfs$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libSDL2_2.0$secondaryArchSuffix
	lib:libSDL2_image_2.0$secondaryArchSuffix
	lib:libSDL2_ttf_2.0$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:glm
	devel:libluajit_5.1$secondaryArchSuffix
	devel:libmodplug$secondaryArchSuffix >= 1.0
	devel:libogg$secondaryArchSuffix
	devel:libopenal$secondaryArchSuffix
	devel:libphysfs$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	devel:libSDL2_2.0$secondaryArchSuffix
	devel:libSDL2_image_2.0$secondaryArchSuffix
	devel:libSDL2_ttf_2.0$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize
	cmd:lrelease$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	cmake -DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX="$prefix" \
		-DSOLARUS_HEADERS_INSTALL_DESTINATION=$includeDir \
		-DSOLARUS_LIBRARY_INSTALL_DESTINATION=$libDir \
		-DSOLARUS_MANUAL_INSTALL_DESTINATION=$manDir \
		-DSOLARUS_WRITE_DIR=$settingsDir . -L
	make $jobArgs
}

INSTALL()
{
	make install

	rm -rf $prefix/share
	addAppDeskbarSymlink $prefix/bin/solarus-launcher Solarus
}
