SUMMARY="Minimalist image viewer"
DESCRIPTION="qView was designed from the very start to be as visually minimal \
and space efficient as possible. No cluttered interface, just your image and a \
titlebar.
qView opens practically instantly, and switching images is just as quick, all \
while having low memory and CPU usage.
With features such as animated GIF controls, file history, rotation/mirroring, \
and multithreaded preloading, minimalism doesn't have to be a compromise."
HOMEPAGE="https://interversehq.com/qview/"
COPYRIGHT="2018-2022 jurplel and qView contributors"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/jurplel/qView/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="c43a69f31c7b5011721c4509093044203fd81edb9046eafa32aa0a6e0846787a"
SOURCE_FILENAME="qview.$portVersion.tar.gz"
SOURCE_DIR="qView-$portVersion"
ADDITIONAL_FILES="qview.rdef.in"

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

PROVIDES="
	qview$secondaryArchSuffix = $portVersion
	app:qView
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	"

BUILD_PREREQUIRES="
	cmd:g++$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix >= 5
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	cmd:rcc$secondaryArchSuffix >= 5
	"

BUILD()
{
	qmake .
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir
	cp bin/qview $appsDir/qView

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

	addResourcesToBinaries qview.rdef $appsDir/qView
	addAppDeskbarSymlink $appsDir/qView
}
