SUMMARY="A simple feed reader which supports web-based feed services"
DESCRIPTION="RSS Guard is simple RSS/ATOM feed reader which supports many \
online RSS services:

* Tiny Tiny RSS,
* Inoreader,
* Nextcloud News,
* Gmail,
* FreshRSS,
* The Old Reader,
* Bazqux,
* Reedah,
* Feedly."
HOMEPAGE="https://github.com/martinrotter/rssguard"
COPYRIGHT="2011-2022 Martin Rotter"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/martinrotter/rssguard/archive/refs/tags/$portVersion.tar.gz"
CHECKSUM_SHA256="2f9a846f12a1c70ec2d8d474daff4e7caeb14ade332b75f40a9900aa7fbc4994"
SOURCE_FILENAME="rssguard-$portVersion.tar.gz"
ADDITIONAL_FILES="rssguard.rdef.in"

ARCHITECTURES="!x86_gcc2 x86_64"
SECONDARY_ARCHITECTURES="!x86"

PROVIDES="
	rssguard$secondaryArchSuffix = $portVersion
	app:rssguard$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5DBus$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Multimedia$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5Positioning$secondaryArchSuffix
	lib:libQt5PrintSupport$secondaryArchSuffix
	lib:libQt5Qml$secondaryArchSuffix
	lib:libQt5QmlModels$secondaryArchSuffix
	lib:libQt5Quick$secondaryArchSuffix
	lib:libQt5Sql$secondaryArchSuffix
	lib:libQt5WebChannel$secondaryArchSuffix
	lib:libQt5WebEngineCore$secondaryArchSuffix
	lib:libQt5WebEngineWidgets$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libQt5Xml$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5DBus$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Multimedia$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5Positioning$secondaryArchSuffix
	devel:libQt5PrintSupport$secondaryArchSuffix
	devel:libQt5Sql$secondaryArchSuffix
	devel:libQt5Qml$secondaryArchSuffix
	devel:libQt5QmlModels$secondaryArchSuffix
	devel:libQt5Quick$secondaryArchSuffix
	devel:libQt5WebChannel$secondaryArchSuffix
	devel:libQt5WebEngineCore$secondaryArchSuffix
	devel:libQt5WebEngineWidgets$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	devel:libQt5Xml$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:g++$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix >= 5
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	cmd:sed
	"

defineDebugInfoPackage rssguard$secondaryArchSuffix \
	"$appsDir"/RSSGuard/RSSGuard


BUILD()
{
	qmake . \
		PREFIX=$appsDir/RSSGuard \
		CONFIG+=release \
		USE_WEBENGINE=yes
	make $jobArgs
}

INSTALL()
{
	make install
	mv $appsDir/RSSGuard/bin/rssguard $appsDir/RSSGuard/RSSGuard
	rm -rf $appsDir/RSSGuard/{bin,include,share}

	# Add Haiku resources
	local APP_SIGNATURE="application/x-vnd.qt5-rssguard"
	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local MINOR="`echo "$portVersion" | cut -d. -f3 | cut -d~ -f1`"
	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/rssguard.rdef.in > rssguard.rdef

	addResourcesToBinaries rssguard.rdef $appsDir/RSSGuard/RSSGuard
	addAppDeskbarSymlink $appsDir/RSSGuard/RSSGuard
}
