SUMMARY="GPS map/log file viewer and analyzer"
DESCRIPTION="GPXSee is a Qt-based GPS log file viewer and analyzer that \
supports all common GPS log file formats.

Main features:

* Opens GPX, TCX, FIT, KML, NMEA, IGC, CUP, SIGMA SLF, Suunto SML, LOC, GeoJSON, \
OziExplorer (PLT, RTE, WPT), Garmin GPI & CSV, TomTom OV2 &amp; ITN, ONmove OMD/GHP, \
TwoNav (TRK, RTE, WPT) and geotagged JPEG files
* User-definable online maps (OpenStreetMap/Google tiles, WMTS, WMS, TMS, \
QuadTiles)
* Offline maps (MBTiles, OziExplorer maps, TrekBuddy maps/atlases, Garmin IMG/GMAP \
& JNX maps, TwoNav RMaps, GeoTIFF images, BSB charts, KMZ maps, AlpineQuest maps, \
Locus/OsmAnd/RMaps SQLite maps, Mapsforge vector maps, QCT maps, \
ESRI World-File georeferenced images)
* Elevation, speed, heart rate, cadence, power, temperature and gear \
ratio/shifts graphs
* Support for DEM files (SRTM HGT)
* Support for multiple tracks in one view
* Support for POI files
* Print/export to PDF or PNG
* Full-screen mode
* HiDPI/Retina displays & maps support
* Real-time GPS position"
HOMEPAGE="https://www.gpxsee.org/"
COPYRIGHT="2015-2022 Martin Tůma"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/tumic0/gpxsee/archive/$portVersion/GPXSee-$portVersion.tar.gz"
CHECKSUM_SHA256="62b7efaeefe5d91b214f249af3bca08feb1e9282d375683295df01fb88b2125d"
SOURCE_DIR="GPXSee-$portVersion"
PATCHES="gpxsee-$portVersion.patchset"
ADDITIONAL_FILES="
	gpxsee.rdef.in
	icons.zip
	"

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

PROVIDES="
	gpxsee$secondaryArchSuffix = $portVersion
	app:GPXSee = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libQt5Concurrent$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Location$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5PrintSupport$secondaryArchSuffix
	lib:libQt5Sql$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	"

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

PATCH()
{
	unzip -o $sourceDir/../../additional-files/icons.zip -d $sourceDir/icons/GUI
}

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

INSTALL()
{
	mkdir -p $appsDir
	mkdir -p $dataDir/GPXSee/{maps,csv,translations}
	cp gpxsee $appsDir/GPXSee
	cp -r pkg/maps/* $dataDir/GPXSee/maps
	cp -r pkg/csv/* $dataDir/GPXSee/csv
	cp -r lang/*.qm $dataDir/GPXSee/translations

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

	addResourcesToBinaries gpxsee.rdef $appsDir/GPXSee
	addAppDeskbarSymlink $appsDir/GPXSee
}
