SUMMARY="A secure and open source web browser"
DESCRIPTION="Dooble is a web browser focused on security and privacy with \
many integrated features like support for advanced options and cookie \
management, Gopher support, a FTP browser, a file manager, a download \
manager, and many others."
HOMEPAGE="https://textbrowser.github.io/dooble/"
COPYRIGHT="Dooble"
LICENSE="BSD (3-clause)"
REVISION="4"
SOURCE_URI="https://github.com/textbrowser/dooble/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="e4ec2f1eec438a185840df5ca0b024b20f00d1d180a2e21fb4f78a1c96695203"
SOURCE_DIR="dooble-$portVersion/$portVersion"
PATCHES="dooble-$portVersion.patchset"
ADDITIONAL_FILES="
	dooble.rdef.in
	haikuicons.zip
	"

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

PROVIDES="
	dooble$secondaryArchSuffix = $portVersion
	app:Dooble$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libgcrypt$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libgpg_error$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5PrintSupport$secondaryArchSuffix
	lib:libQt5Script$secondaryArchSuffix
	lib:libQt5Sql$secondaryArchSuffix
	lib:libQt5WebKit$secondaryArchSuffix
	lib:libQt5WebKitWidgets$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libsqlite3$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcrypto$secondaryArchSuffix
	devel:libexecinfo$secondaryArchSuffix
	devel:libgcrypt$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Network$secondaryArchSuffix
	devel:libQt5PrintSupport$secondaryArchSuffix
	devel:libQt5Script$secondaryArchSuffix
	devel:libQt5Sql$secondaryArchSuffix
	devel:libQt5WebKit$secondaryArchSuffix
	devel:libQt5WebKitWidgets$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	devel:libsqlite3$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:g++$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:qmake$secondaryArchSuffix >= 5
	cmd:unzip
	"

BUILD()
{
	qmake dooble.qt5.pro
	make $jobArgs
}

INSTALL()
{
	mkdir -p $appsDir/Dooble/lib
	cp -rf {Icons,Images,Translations} $appsDir/Dooble
	unzip -o $portDir/additional-files/haikuicons.zip -d $appsDir/Dooble/Icons
	cp -f libSpotOn/libspoton.so $appsDir/Dooble/lib
	cp -f Dooble $appsDir/Dooble

	local MAJOR="1"
	local MIDDLE="56"
	local MINOR="0"
	sed \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@MIDDLE@|$MIDDLE|" \
		-e "s|@MINOR@|$MINOR|" \
		$portDir/additional-files/dooble.rdef.in > dooble.rdef
	addResourcesToBinaries dooble.rdef \
		$appsDir/Dooble/Dooble

	addAppDeskbarSymlink $appsDir/Dooble/Dooble
}
