SUMMARY="Time Tracker for Freelancers and Individual Contractors"
DESCRIPTION="What Have I Done - \
Time Tracker for Freelancers and Individual Contractors.
Features:
* Very easy and intuitive to use
* Measures time for active tasks
* Maintains a tree-structures of folders, customers, projects and tasks
* Reports time spent, breakdowns for each day in a week
* Reports time spent on selected items in the tree structure of tasks
* Stores the data in SQLite"
COPYRIGHT="1999-2019 Jarle Aase"
HOMEPAGE="https://github.com/jgaa/whid"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/jgaa/whid/archive/${portVersion/\~beta/-beta-01}.tar.gz"
CHECKSUM_SHA256="b058ea8040ca6bf5dd2c6333b3966b77354a13e581cadd023dfbaf26ba3045a9"
SOURCE_FILENAME="whid-${portVersion/\~beta/-beta-01}.tar.gz"
SOURCE_DIR="whid-${portVersion/\~beta/-beta-01}"
ADDITIONAL_FILES="whid.rdef.in"
ARCHITECTURES="all !x86_gcc2"
if [ "$targetArchitecture" = x86_gcc2 ]; then
	SECONDARY_ARCHITECTURES="x86"
fi

PROVIDES="
	whid$secondaryArchSuffix = $portVersion
	app:Whid = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Sql$secondaryArchSuffix
	lib:libz$secondaryArchSuffixcondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Sql$secondaryArchSuffix
	devel:libz$secondaryArchSuffixcondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:make
	cmd:g++$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	"

BUILD()
{
	qmake
	make $jobArgs
}

INSTALL()
{
	install -d $appsDir
	install -T ./whid $appsDir/Whid

	local APP_SIGNATURE="application/x-vnd.Whid"
	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local MINOR="`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|@MINOR@|$MINOR|" \
		-e "s|@LONG_INFO@|$LONG_INFO|" \
		"$portDir"/additional-files/whid.rdef.in > whid.rdef

	addResourcesToBinaries whid.rdef $appsDir/Whid
	addAppDeskbarSymlink $appsDir/Whid
}
