SUMMARY="An RSS/Atom feed reader"
DESCRIPTION="QuiteRSS is an open-source, cross-platform RSS/Atom news feed \
reader based on Qt.
Some of its features:
* Embedded browser (Webkit core)
* Feed and news filters: new, unread, starred, deleted (for news until \
restart application)
* User filters
* Adblock
* Automatic cleanup on close using criterias
* Enable/Disable images in news preview
* Open feed or news in own tab

... and much more"
HOMEPAGE="https://quiterss.org/"
COPYRIGHT="2011-2020 QuiteRSS Team"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/QuiteRSS/quiterss/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="d9dffa205a8ec4e7bf00d87183fd94d4a12f045fae04a6efd41d6557827233bc"
SOURCE_FILENAME="quiterss-$portVersion.tar.gz"
PATCHES="quiterss-$portVersion.patchset"
ADDITIONAL_FILES="
	haikuicons.zip
	quiterss.rdef.in
	"

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

PROVIDES="
	quiterss$secondaryArchSuffix = $portVersion
	app:quiterss$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Multimedia$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5PrintSupport$secondaryArchSuffix
	lib:libQt5Sql$secondaryArchSuffix
	lib:libQt5WebKit$secondaryArchSuffix
	lib:libQt5WebKitWidgets$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libQt5Xml$secondaryArchSuffix
	lib:libsqlite3$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Multimedia$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5PrintSupport$secondaryArchSuffix
	devel:libQt5Sql$secondaryArchSuffix
	devel:libQt5WebKit$secondaryArchSuffix
	devel:libQt5WebKitWidgets$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	devel:libQt5Xml$secondaryArchSuffix
	devel:libsqlite3$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:g++$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix >= 5
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	cmd:sed
	"

defineDebugInfoPackage quiterss$secondaryArchSuffix \
	"$appsDir"/QuiteRSS/QuiteRSS


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

BUILD()
{
	qmake .
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir/QuiteRSS

	cd release/target
	cp quiterss $appsDir/QuiteRSS/QuiteRSS
	cp -R lang $appsDir/QuiteRSS

	# Add Haiku resources
	local APP_SIGNATURE="application/x-vnd.qt5-quiterss"
	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/quiterss.rdef.in > quiterss.rdef

	addResourcesToBinaries quiterss.rdef $appsDir/QuiteRSS/QuiteRSS
	addAppDeskbarSymlink $appsDir/QuiteRSS/QuiteRSS
}
