SUMMARY="A game similar to Super Mario Bros"
DESCRIPTION="SuperTux is a classic 2D jump'n run sidescroller game in a style \
similar to the original Super Mario games."
HOMEPAGE="https://supertux.org/"
COPYRIGHT="2003-2020 The SuperTux Team"
LICENSE="GNU GPL v3"
REVISION="2"
SOURCE_URI="https://github.com/SuperTux/supertux/releases/download/v$portVersion/SuperTux-v$portVersion-Source.tar.gz"
SOURCE_DIR="SuperTux-v$portVersion-Source"
CHECKSUM_SHA256="3a19e042cb10933bcbdc50a296779082a3bb46c8e98fe4afb68c19cc5e810c53"
PATCHES="supertux-$portVersion.patch"

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

PROVIDES="
	supertux$secondaryArchSuffix = $portVersion
	app:SuperTux
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libboost_system$secondaryArchSuffix
	lib:libcurl$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libfribidi$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libglew$secondaryArchSuffix
	lib:libGLU$secondaryArchSuffix
	lib:libharfbuzz$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libopenal$secondaryArchSuffix
	lib:libphysfs$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libraqm$secondaryArchSuffix
	lib:libSDL2_2.0$secondaryArchSuffix
	lib:libSDL2_image_2.0$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libboost_system$secondaryArchSuffix
	devel:libcurl$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libfribidi$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	devel:libglew$secondaryArchSuffix
	devel:libharfbuzz$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libopenal$secondaryArchSuffix
	devel:libphysfs$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libraqm$secondaryArchSuffix
	devel:libSDL2_2.0$secondaryArchSuffix
	devel:libSDL2_image_2.0$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:git
	cmd:ld$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	mkdir -p build
	cd build
	cmake .. $cmakeDirArgs \
		-DUSE_SYSTEM_PHYSFS=ON \
		-DCMAKE_INSTALL_PREFIX="$appsDir/SuperTux" \
		-DINSTALL_SUBDIR_BIN="$appsDir/SuperTux" \
		-DCMAKE_BUILD_TYPE=Release
	make $jobArgs
}

INSTALL()
{
	cd build
	make install
	mv "$appsDir/SuperTux/supertux2" "$appsDir/SuperTux/SuperTux"
	addAppDeskbarSymlink $appsDir/SuperTux/SuperTux
}
