SUMMARY="A program to show and manipulate GPS tracks"
DESCRIPTION="GPXLab is an application to display and manage GPS tracks \
previously recorded with a GPS tracker.

Features & Functions

* Open GPX (v1.0 or v1.1), NMEA and SpoQ files
* Combine several tracks into one single GPX file
* Rearrange the tracks (move/add/delete)
* Modify the meta data of the GPX file and of any tracks inside the file
* Get altitude data from the SRTM database
* Show statistical information about the summarized tracks or a single track
* Show a map of all tracks
* Show an altitude and a speed diagram
* Show a list of all track points"
HOMEPAGE="https://github.com/BourgeoisLab/GPXLab"
COPYRIGHT="2014-2020 Frédéric Bourgeois"
LICENSE="GNU GPL v3"
REVISION="2"
SOURCE_URI="https://github.com/BourgeoisLab/GPXLab/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="cb9fbcde4688c388b781c90b7c48a60a76c5d5bed14e5040e55a13a3f810aa0e"
SOURCE_FILENAME="GPXLab-$portVersion.tar.gz"
SOURCE_DIR="GPXLab-$portVersion"
ADDITIONAL_FILES="gpxlab.rdef.in"

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

PROVIDES="
	gpxlab$secondaryArchSuffix = $portVersion
	app:GPXLab = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5PrintSupport$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5PrintSupport$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:g++$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix
	cmd:make
	cmd:qmake$secondaryArchSuffix
	"

BUILD()
{
	lrelease GPXLab/GPXLab.pro
	qmake GPXLab.pro
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir
	mkdir -p $dataDir/GPXLab/translations
	cp GPXLab/gpxlab $appsDir/GPXLab
	cp -r GPXLab/locale/*.qm $dataDir/GPXLab/translations

	local APP_SIGNATURE="application/x-vnd.qt5-gpxlab"
	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/gpxlab.rdef.in > gpxlab.rdef

	addResourcesToBinaries gpxlab.rdef $appsDir/GPXLab
	addAppDeskbarSymlink $appsDir/GPXLab
}
