SUMMARY="A 2D fantasy underwater action-adventure game"
DESCRIPTION="Aquaria is an award-winning action-adventure game set in a \
massive underwater world teeming with life and filled with ancient secrets. \
Join Naija, a lone underwater adventurer, as she travels from hidden caves \
shrouded in darkness, to beautiful, sunlit oases in search of her past. \
She'll uncover hidden treasures, explore uncharted waters, and do battle \
with massive underwater beasts to learn the truth about her family \
and reveal the secret of Aquaria.

* Massive, beautiful world to explore
* Compelling story woven through beautiful visuals, music and voice-overs
* Innovative mouse-based control scheme and magic-based combat
* 175 unique creatures to discover, interact and do battle with
* Dozens of treasures to attain
* Cooking system for creation of powerful items
* Unlock all the Steam Achievements"
HOMEPAGE="https://github.com/AquariaOSE/Aquaria/"
COPYRIGHT="Bit Blot, LLC"
LICENSE="GNU GPL v2"
REVISION="2"
srcGitRev="c37f6ea6d81a85005ef718e2958872bda3ee0c30"
SOURCE_URI="https://github.com/AquariaOSE/Aquaria/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="65b0c3ca8beb1a780f0a54fc0b3731efd6552a34e56013a27a53f0f78ad81768"
SOURCE_DIR="Aquaria-$srcGitRev"
srcGitRev2="9a77c718e1a61d378aadcc60efe8f5e78d14c685"
SOURCE_URI_2="https://github.com/EXL/BeGameLauncher/archive/$srcGitRev2.tar.gz"
CHECKSUM_SHA256_2="f4884f28d7e87f94f1f64b5eec2d5f7e5cc3503c85d950c4b78eb7736a314144"
SOURCE_DIR_2="BeGameLauncher-$srcGitRev2"
PATCHES="aquaria-$portVersion.patchset"
ADDITIONAL_FILES="
	aquaria.rdef.in
	aquaria.sh
	default_usersettings.xml
	"

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

PROVIDES="
	aquaria$secondaryArchSuffix = $portVersion
	app:Aquaria
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libglu$secondaryArchSuffix
	lib:libSDL2_2.0$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libopenal$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libfreetype$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	devel:libglu$secondaryArchSuffix
	devel:libSDL2_2.0$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libopenal$secondaryArchSuffix
	devel:libpng16$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 \
		-DAQUARIA_INTERNAL_ZLIB=OFF \
		-DAQUARIA_INTERNAL_PNG=OFF \
		-DAQUARIA_INTERNAL_FREETYPE=OFF \
		-DAQUARIA_INTERNAL_OGGVORBIS=OFF \
		-DAQUARIA_INTERNAL_SDL=OFF \
		-DAQUARIA_INTERNAL_OPENAL=OFF \
		-DAQUARIA_USE_SDL2=ON \
		-DFREETYPE_INCLUDE_DIRS=/system/$relativeIncludeDir/freetype2 \
		-DOGGVORBIS_INCLUDE_DIRS=/system/$relativeIncludeDir/vorbis \
		-DSDL2_INCLUDE_DIR=/system/$relativeIncludeDir/SDL2

	make $jobArgs

	cd $sourceDir2
	mkdir -p build
	cd build
	cmake .. \
		-DCMAKE_BUILD_TYPE=Release \
		-DLAUNCHER=aquaria
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir/Aquaria

	cp -R files $appsDir/Aquaria
	cp build/aquaria $appsDir/Aquaria/Aquaria
	cp $sourceDir2/build/AquariaLauncher $appsDir/Aquaria/AquariaLauncher
	cp $portDir/additional-files/aquaria.sh $appsDir/Aquaria
	cp $portDir/additional-files/default_usersettings.xml $appsDir/Aquaria

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

	addResourcesToBinaries  $sourceDir/aquaria.rdef $appsDir/Aquaria/Aquaria
	addAppDeskbarSymlink $appsDir/Aquaria/AquariaLauncher Aquaria
}
