SUMMARY="An image viewer and organizer built with Qt and Exiv2"
DESCRIPTION="Phototonic features:
* Support for common image formats and GIF animation
* Supports tagging images, and filtering images by tags (IPTC)
* Browse thumbnails recursively down a folder tree
* Dynamic thumbnails loading
* Image transformation and color manipulation
* Display image information and metadata
* Does not depend on any desktop environment."
HOMEPAGE="https://github.com/oferkv/phototonic"
COPYRIGHT="2015-2018 Ofer Kashayov
	2015-2018 Christopher Roy Bratusek
	2015-2018 Krzysztof Pyrkosz
	2015-2018 Roman Chistokhodov
	2015-2018 Thomas Lübking
	2015-2018 Tung Le
	2015-2018 Peter Mattern"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/oferkv/phototonic/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="a8b2dbc81750efabb65a4732b1704641afd4a4f772ef9c90817871ca2a52f5ef"
SOURCE_FILENAME="phototonic-$portVersion.tar.gz"
PATCHES="phototonic-$portVersion.patchset"
ADDITIONAL_FILES="phototonic.rdef.in"

ARCHITECTURES="all !x86_gcc2"
if [ "$targetArchitecture" = x86_gcc2 ]; then
SECONDARY_ARCHITECTURES="x86"
fi

USER_SETTINGS_FILES="
	settings/Phototonic directory
	"

PROVIDES="
	phototonic$secondaryArchSuffix = $portVersion
	app:Phototonic = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libexiv2$secondaryArchSuffix
	lib:libexpat$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libexiv2$secondaryArchSuffix
	devel:libexpat$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:qmake$secondaryArchSuffix >= 5
	"

BUILD()
{
	qmake
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir
	cp Phototonic $appsDir
	local APP_SIGNATURE="application/x-vnd.Phototonic"
	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:-0}|" \
		-e "s|@LONG_INFO@|$LONG_INFO|" \
		$portDir/additional-files/phototonic.rdef.in > phototonic.rdef
	addResourcesToBinaries phototonic.rdef $appsDir/Phototonic
	addAppDeskbarSymlink $appsDir/Phototonic
}
