SUMMARY="A cross-platform, multi-protocol visual browser for the small-internet"
DESCRIPTION="Kristall is a browser without support for CSS/JS/WASM or graphical \
websites. It can display user-styled documents in several formats, \
including Gemini, HTML, and Markdown provided by a server via Gemini, \
Gopher, HTTP/HTTPS, and Finger protocols."
HOMEPAGE="https://kristall.random-projects.net/"
COPYRIGHT="2020 Felix Queißner"
LICENSE="GNU GPL v3"
REVISION="6"
srcGitRev="bca592adf686b11321b7185f234525674d7d474c"
SOURCE_URI="https://github.com/MasterQ32/kristall/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="326d3f3785ba5faf3caf12df1caf99e801816658b79881106e6b39204dfddfc5"
SOURCE_FILENAME="kristall-$portVersion-tar.gz"
SOURCE_DIR="kristall-$srcGitRev"
ADDITIONAL_FILES="kristall.rdef.in"

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

PROVIDES="
	kristall$secondaryArchSuffix = $portVersion
	app:Kristall$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5Svg$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libiconv$secondaryArchSuffix
	devel:libGL$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5Svg$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:g++$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix >= 5
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	"

PATCH()
{
	echo "\nCONFIG += resources_big" >> src/kristall.pro
}

BUILD()
{
	make -j1
}

INSTALL()
{
	mkdir $appsDir
	mv ./kristall $appsDir/Kristall

	local APP_SIGNATURE="application/x-vnd.kristall"
	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local LONG_INFO="$SUMMARY"
	sed \
		-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@LONG_INFO@|$LONG_INFO|" \
		$portDir/additional-files/kristall.rdef.in > $sourceDir/kristall.rdef
	addResourcesToBinaries $sourceDir/kristall.rdef $appsDir/Kristall
	addAppDeskbarSymlink $appsDir/Kristall
}
