SUMMARY="A free collection of solitaire card games written using Qt"
DESCRIPTION="QSoloCards is a classic set of cards games including:
-Spider
-FreeCell
-Klondike
-Three Deck Spider
-Spiderette
-Yukon"
HOMEPAGE="https://sourceforge.net/projects/qsolocards/"
COPYRIGHT="2009 Steve Moore"
LICENSE="GNU GPL v3"
REVISION="2"
SOURCE_URI="http://downloads.sourceforge.net/project/qsolocards/qsolocards/$portVersion/QSoloCards-$portVersion-src.tar.gz"
CHECKSUM_SHA256="d962a976c335c4bbe239ec4479db60222906411bee3e24498593f2878761b418"
SOURCE_DIR="QSoloCards-$portVersion"
PATCHES="qsolocards-$portVersion.patchset"
ADDITIONAL_FILES="qsolocards.rdef.in"

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

PROVIDES="
	qsolocards$secondaryArchSuffix = $portVersion
	app:QSoloCards$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:make
	cmd:qmake$secondaryArchSuffix >= 5
	"

BUILD()
{
	qmake
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir
	cp QSoloCards $appsDir/QSoloCards

	local APP_SIGNATURE="application/x-vnd.qsolocards"
	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/qsolocards.rdef.in > $sourceDir/qsolocards.rdef

	addResourcesToBinaries  $sourceDir/qsolocards.rdef \
		$appsDir/QSoloCards

	mimeset -f $appsDir/QSoloCards

	addAppDeskbarSymlink $appsDir/QSoloCards QSoloCards
}
