SUMMARY="Classic 2D platformer with physics-based gameplay and dozens of levels"
DESCRIPTION="Master your pedal-powered flying machine to pick up packages \
from your cave-dwelling clients and drop them off at the collection point. \
But beware! Mighty mastodons, terrifying pterodactyls and others \
would rather see you extinct."
HOMEPAGE="http://www.caveproductions.org/"
COPYRIGHT="2014-2021 Martin Gerhardy"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/mgerhardy/caveexpress/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="da8bd71bbb39f898acbfa540c84431629e75f0f8c43878e1f41db1e35f4d30e2"
PATCHES="caveexpress-$portVersion.patchset"

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

PROVIDES="
	caveexpress$secondaryArchSuffix = $portVersion
	app:CaveExpress = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libatomic$secondaryArchSuffix
	lib:libbox2d$secondaryArchSuffix
#	lib:libgtest$secondaryArchSuffix
	lib:liblua$secondaryArchSuffix
	lib:libncurses$secondaryArchSuffix
	lib:libSDL2_2.0$secondaryArchSuffix
	lib:libSDL2_image_2.0$secondaryArchSuffix
	lib:libSDL2_mixer_2.0$secondaryArchSuffix
	lib:libSDL2_net_2.0$secondaryArchSuffix
	lib:libsqlite3$secondaryArchSuffix
	lib:libyajl$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libbox2d$secondaryArchSuffix
	devel:glm
#	devel:libgtest$secondaryArchSuffix
	devel:liblua$secondaryArchSuffix >= 5.2
	devel:libncurses$secondaryArchSuffix
	devel:libSDL2_2.0$secondaryArchSuffix
	devel:libSDL2_image_2.0$secondaryArchSuffix
	devel:libSDL2_mixer_2.0$secondaryArchSuffix
	devel:libSDL2_net_2.0$secondaryArchSuffix
	devel:libsqlite3$secondaryArchSuffix
	devel:libyajl$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ninja
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	export CFLAGS="`pkg-config --cflags lua`"
	cmake -B build -GNinja . \
		-DCMAKE_BUILD_TYPE=Release \
		-DCAVEPACKER=OFF \
		-DCMAKE_INSTALL_PREFIX=$appsDir
	ninja -C build $jobArgs
}

INSTALL()
{
	ninja -C build install
	mv $appsDir/caveexpress/caveexpress $appsDir/caveexpress/CaveExpress
	addAppDeskbarSymlink $appsDir/caveexpress/CaveExpress
}
