SUMMARY="A gravity-flipping, retro 2D puzzle-platformer"
DESCRIPTION="VVVVVV is a hit 2010 indie video game from Super Hexagon creator \
Terry Cavanagh. As Captain Viridian your task is to rescue your crew after a \
teleporter mishap caused them to be separated in Dimension VVVVVV.

Notice requested by the author:
VVVVVV is a commercial game! The author has given special permission to make \
this Haiku version available for free. If you enjoy the game, please consider \
purchasing a copy at https://thelettervsixtim.es."
HOMEPAGE="https://thelettervsixtim.es"
COPYRIGHT="Terry Cavanagh 2010-2020"
LICENSE="VVVVVV Source Code License v1.0"
REVISION="5"
srcGitRev="5fdbaa007608e11d91a81dda7f0523255572018e"
SOURCE_URI="https://github.com/TerryCavanagh/VVVVVV/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="48625db48eedce1476e67ecb456f67f9eeb3d6e397b88f705397e441ff6b298b"
SOURCE_DIR="VVVVVV-$srcGitRev"
ADDITIONAL_FILES="vvvvvv.rdef.in"

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

PROVIDES="
	vvvvvv$secondaryArchSuffix = $portVersion
	app:vvvvvv = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libSDL2_2.0$secondaryArchSuffix
	lib:libSDL2_mixer_2.0$secondaryArchSuffix
	vvvvvv_data
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libSDL2_2.0$secondaryArchSuffix
	devel:libSDL2_mixer_2.0$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	cd desktop_version/
	mkdir -p flibitBuild && cd flibitBuild
	cmake ..
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir/vvvvvv
	cp desktop_version/flibitBuild/VVVVVV $appsDir/vvvvvv

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

	addAppDeskbarSymlink $appsDir/vvvvvv/VVVVVV
}
