SUMMARY="Chromium-based rendering library for the Qt5 framework"
DESCRIPTION="QtWebEngine provides a Web browser engine that integrates \
Chromium's fast moving web capabilities into Qt. "
HOMEPAGE="https://www.qt.io"
COPYRIGHT="2015-2020 The Qt Company Ltd."
LICENSE="BSD (3-clause)
	GNU LGPL v2.1"
REVISION="5"
SOURCE_URI="https://github.com/threedeyes/qtwebengine-haiku/releases/download/v${portVersion}-4/qtwebengine-${portVersion}-4-x86_64.hpkg#noarchive"
CHECKSUM_SHA256="632d0ba0dd57fa7a25033a747fd0138f3b306668739af7924b280b6ff9bf4990"
SOURCE_URI_2="https://github.com/threedeyes/qtwebengine-haiku/releases/download/v${portVersion}-4/qtwebengine_devel-${portVersion}-4-x86_64.hpkg#noarchive"
CHECKSUM_SHA256_2="00e2b8b23afbff12c1b242b03866c78d880484be798fa891430a19f29de3056e"
DISABLE_SOURCE_PACKAGE="yes"

ARCHITECTURES="x86_64"

libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	qtwebengine_bin$secondaryArchSuffix = $portVersion compat >= 5
	lib:libQt5Pdf$secondaryArchSuffix = $libVersionCompat
	lib:libQt5PdfWidgets$secondaryArchSuffix = $libVersionCompat
	lib:libQt5WebEngine$secondaryArchSuffix = $libVersionCompat
	lib:libQt5WebEngineCore$secondaryArchSuffix = $libVersionCompat
	lib:libQt5WebEngineWidgets$secondaryArchSuffix = $libVersionCompat
	cmd:qwebengine_convert_dict
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libavcodec$secondaryArchSuffix
	lib:libavformat$secondaryArchSuffix
	lib:libavutil$secondaryArchSuffix
	lib:libdbus_1$secondaryArchSuffix
	lib:libexecinfo$secondaryArchSuffix
	lib:libexpat$secondaryArchSuffix
	lib:libevent_2.1$secondaryArchSuffix
	lib:libfontconfig$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libgl$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:liblcms2$secondaryArchSuffix
	lib:libminizip$secondaryArchSuffix
	lib:libnspr4$secondaryArchSuffix
	lib:libnss3$secondaryArchSuffix
	lib:libnssutil3$secondaryArchSuffix
	lib:libopus$secondaryArchSuffix
	lib:libplc4$secondaryArchSuffix
	lib:libplds4$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Network$secondaryArchSuffix
	lib:libQt5Positioning$secondaryArchSuffix
	lib:libQt5PrintSupport$secondaryArchSuffix
	lib:libQt5Qml$secondaryArchSuffix
	lib:libQt5QmlModels$secondaryArchSuffix
	lib:libQt5Quick$secondaryArchSuffix
	lib:libQt5QuickWidgets$secondaryArchSuffix
	lib:libQt5WebChannel$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libsmime3$secondaryArchSuffix
	lib:libsnappy$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	lib:libvpx$secondaryArchSuffix
	lib:libwebp$secondaryArchSuffix
	lib:libwebpdemux$secondaryArchSuffix
	lib:libwebpmux$secondaryArchSuffix
	lib:libxslt$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"
CONFLICTS="
	qtwebengine$secondaryArchSuffix
	"

PROVIDES_devel="
	qtwebengine_bin${secondaryArchSuffix}_devel = $portVersion compat >= 5
	devel:libQt5Pdf$secondaryArchSuffix = $libVersionCompat
	devel:libQt5PdfWidgets$secondaryArchSuffix = $libVersionCompat
	devel:libQt5WebEngine$secondaryArchSuffix = $libVersionCompat
	devel:libQt5WebEngineCore$secondaryArchSuffix = $libVersionCompat
	devel:libQt5WebEngineWidgets$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	haiku$secondaryArchSuffix
	qtwebengine_bin$secondaryArchSuffix == $portVersion base
	"
CONFLICTS_devel="
	qtwebengine${secondaryArchSuffix}_devel
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:cp
	"

BUILD()
{
	mv qtwebengine*.hpkg ../qtwebengine.hpkg
	mv ../../sources-2/qtwebengine_devel*.hpkg ../qtwebengine_devel.hpkg

	package extract ../qtwebengine.hpkg
	package extract ../qtwebengine_devel.hpkg
	rm .PackageInfo
}

INSTALL()
{
	cp -r * $prefix

	packageEntries devel \
		$developDir \
		$libDir/cmake \
		$dataDir/Qt5/mkspecs
}
