SUMMARY="A Sokoban game"
DESCRIPTION="Keep your cave tidy. To do this, make sure that all the spread \
packages are put onto their targets. You can only push, pulling is not \
allowed. You get higher ratings the fewer moves you need.
The first few maps might be easy to solve - but the more you progress in the \
game, the harder the maps will be. The map set is from XSokoban."
HOMEPAGE="http://www.caveproductions.org/"
COPYRIGHT="2014-2020 Martin Gerhardy"
LICENSE="GNU GPL v3"
REVISION="2"
SOURCE_URI="https://github.com/mgerhardy/caveexpress/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="54b8fb68efc837a78a73b2d285412bc75a28d692918aea4312305fff964f9a26"
SOURCE_DIR="caveexpress-$portVersion"
PATCHES="cavepacker-$portVersion.patchset"

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

PROVIDES="
	cavepacker$secondaryArchSuffix = $portVersion
	app:CavePacker = $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:ccache
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	mkdir -p build && cd build
	export CFLAGS="`pkg-config --cflags lua`"
	cmake .. -DCMAKE_BUILD_TYPE=Release \
		-DCAVEEXPRESS=OFF \
		-DCMAKE_INSTALL_PREFIX=$appsDir
	make $jobArgs
}

INSTALL()
{
	cd build
	make install
	mv $appsDir/cavepacker/cavepacker $appsDir/cavepacker/CavePacker
	addAppDeskbarSymlink $appsDir/cavepacker/CavePacker
}
