SUMMARY="A universal viewer for medical timeseries storage files"
DESCRIPTION="A free, opensource, multiplatform, universal viewer and toolbox \
intended for, but not limited to, timeseries storage files like EEG, EMG, ECG, \
BioImpedance, etc."
HOMEPAGE="https://www.teuniz.net/edfbrowser"
COPYRIGHT="2007-2020 Teunis van Beelen"
LICENSE="GNU GPL v3"
REVISION="1"
EDFBROWSER_VERSION=`echo $portVersion | sed 's/\.//g'`
SOURCE_URI="https://www.teuniz.net/edfbrowser/edfbrowser_${EDFBROWSER_VERSION}_source.tar.gz"
CHECKSUM_SHA256="67703c3b3a4f571e2e03c550e216dc1e3af81fba61259beb0f5b9cf01a0a992f"
SOURCE_FILENAME="edfbrowser-$portVersion.tar.gz"
SOURCE_DIR="edfbrowser_${EDFBROWSER_VERSION}_source"
ADDITIONAL_FILES="edfbrowser.rdef.in"

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

PROVIDES="
	edfbrowser$secondaryArchSuffix = $portVersion
	app:EDFbrowser = $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:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5PrintSupport$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:g++$secondaryArchSuffix
	cmd:make
	cmd:qmake$secondaryArchSuffix >= 5
	"

BUILD()
{
	qmake
	make $jobArgs
}

INSTALL()
{
	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	sed \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@MIDDLE@|$MIDDLE|" \
		$portDir/additional-files/edfbrowser.rdef.in > $sourceDir/edfbrowser.rdef

	mkdir -p $appsDir
	cp $sourceDir/edfbrowser $appsDir/EDFbrowser

	addResourcesToBinaries $sourceDir/edfbrowser.rdef $appsDir/EDFbrowser

	addAppDeskbarSymlink $appsDir/EDFbrowser
}
