SUMMARY="3D arcade with unique fighting system and anthropomorphic character"
DESCRIPTION="Lugaru (pronounced Loo-GAH-roo) is a cross-platform third-person \
action game. The main character, Turner, is an anthropomorphic rebel bunny \
rabbit with impressive combat skills. In his quest to find those responsible \
for slaughtering his village, he uncovers a far-reaching conspiracy involving \
the corrupt leaders of the rabbit republic and the starving wolves from a nearby \
den. Turner takes it upon himself to fight against their plot and save his fellow \
rabbits from slavery."
HOMEPAGE="https://osslugaru.gitlab.io/"
COPYRIGHT="2017 OSS Lugaru Team"
LICENSE="GNU GPL v2
	CC-BY-SA-3.0"
REVISION="4"
SOURCE_URI="https://bitbucket.org/osslugaru/lugaru/downloads/lugaru-$portVersion.tar.xz"
CHECKSUM_SHA256="f3ea477caf78911c69939fbdc163f9f6517c7ef2267e716a0e050be1a166ef97"
SOURCE_DIR="lugaru-$portVersion"
PATCHES="lugaru-$portVersion.patchset"
ADDITIONAL_FILES="lugaru.rdef.in"

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

PROVIDES="
	lugaru$secondaryArchSuffix = $portVersion
	app:Lugaru$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libGLU$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libopenal$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libSDL2_2.0$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libGLU$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libopenal$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libSDL2$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	mkdir -p build
	cd build
	cmake .. \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=$appsDir/Lugaru
	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	local APP_SIGNATURE="application/x-vnd.lugaru"
	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local LONG_INFO="$SUMMARY"
	sed \
		-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@MIDDLE@|$MIDDLE|" \
		-e "s|@LONG_INFO@|$LONG_INFO|" \
		$portDir/additional-files/lugaru.rdef.in > $sourceDir/lugaru.rdef

	addResourcesToBinaries  $sourceDir/lugaru.rdef $appsDir/Lugaru/lugaru

	addAppDeskbarSymlink $appsDir/Lugaru/lugaru Lugaru
}
