SUMMARY="A color matching game"
DESCRIPTION="The goal of the game is to rotate and position the circles so that \
each touching line matches in color. You rotate circles by right clicking, \
and you move circles by dragging them. The game stores the positions and \
rotations of the circles across runs."
HOMEPAGE="https://gottcode.org/hexalate/"
COPYRIGHT="2009-2020 Graeme Gott"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://gottcode.org/hexalate/hexalate-$portVersion-src.tar.bz2"
CHECKSUM_SHA256="5d3198523960d4df394d2092cd7e7b9003878a70a2934dbada60947651b1c88d"
SOURCE_DIR="hexalate-$portVersion"
ADDITIONAL_FILES="hexalate.rdef.in"

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

PROVIDES="
	hexalate$secondaryArchSuffix = $portVersion
	app:Hexalate$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix >= 5
	cmd:make
	cmd:qmake$secondaryArchSuffix >= 5
	"

BUILD()
{
	qmake
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir/Hexalate/translations
	cp hexalate $appsDir/Hexalate/Hexalate
	cp -Rf translations/*.qm $appsDir/Hexalate/translations

	local APP_SIGNATURE="application/x-vnd.gottcode-hexalate"
	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local MINOR="`echo "$portVersion" | cut -d. -f3`"
	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/hexalate.rdef.in > $sourceDir/hexalate.rdef

	addResourcesToBinaries  $sourceDir/hexalate.rdef \
		$appsDir/Hexalate/Hexalate

	mimeset -f $appsDir/Hexalate/Hexalate

	addAppDeskbarSymlink $appsDir/Hexalate/Hexalate Hexalate
}
