SUMMARY="HTML rendering engine"
DESCRIPTION="KHTML is a web rendering engine, based on the KParts technology and using KJS for JavaScript support."
HOMEPAGE="https://github.com/KDE/khtml/"
COPYRIGHT="2010-2021 KDE Organisation"
LICENSE="
		GNU GPL v3
		GNU LGPL v2
		"
REVISION="1"
SOURCE_URI="https://github.com/KDE/khtml/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="b11461e1a400f55ae141ab57642e8fa56cf7e92aa83872c228de51e6515aa9fa"

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

GLOBAL_WRITABLE_FILES="
	settings/xdg/khtmlrc keep-old
	"

PROVIDES="
	khtml$secondaryArchSuffix = $portVersion
	lib:libKF5KHtml$secondaryArchSuffix = $portVersion compat >= 5
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libgif$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libKF5Archive$secondaryArchSuffix
	lib:libKF5Auth$secondaryArchSuffix
	lib:libKF5Bookmarks$secondaryArchSuffix
	lib:libKF5Codecs$secondaryArchSuffix
	lib:libKF5Completion$secondaryArchSuffix
	lib:libKF5ConfigCore$secondaryArchSuffix
	lib:libKF5ConfigGui$secondaryArchSuffix
	lib:libKF5ConfigWidgets$secondaryArchSuffix
	lib:libKF5CoreAddons$secondaryArchSuffix
	lib:libKF5GlobalAccel$secondaryArchSuffix
	lib:libKF5I18n$secondaryArchSuffix
	lib:libKF5IconThemes$secondaryArchSuffix
	lib:libKF5ItemViews$secondaryArchSuffix
	lib:libKF5JobWidgets$secondaryArchSuffix
	lib:libKF5JobWidgets$secondaryArchSuffix
	lib:libKF5JS$secondaryArchSuffix
	lib:libKF5JSApi$secondaryArchSuffix
	lib:libKF5KIOCore$secondaryArchSuffix
	lib:libKF5Notifications$secondaryArchSuffix
	lib:libKF5NotifyConfig$secondaryArchSuffix
	lib:libKF5Parts$secondaryArchSuffix
	lib:libKF5Service$secondaryArchSuffix
	lib:libKF5Solid$secondaryArchSuffix
	lib:libKF5SonnetCore$secondaryArchSuffix
	lib:libKF5SonnetUi$secondaryArchSuffix
	lib:libKF5TextWidgets$secondaryArchSuffix
	lib:libKF5Wallet$secondaryArchSuffix
	lib:libKF5WidgetsAddons$secondaryArchSuffix
	lib:libKF5WindowSystem$secondaryArchSuffix
	lib:libKF5XmlGui$secondaryArchSuffix
	lib:libphonon4qt5$secondaryArchSuffix
	lib:libphonon4qt5experimental$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5TextToSpeech$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libQt5Xml$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	khtml${secondaryArchSuffix}_devel = $portVersion
	devel:libKF5KHtml$secondaryArchSuffix = $portVersion compat >= 5
	"
REQUIRES_devel="
	khtml$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules$secondaryArchSuffix >= $portVersion
	devel:libcrypto$secondaryArchSuffix
	devel:libgif$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libKF5Archive$secondaryArchSuffix == $portVersion
	devel:libKF5Auth$secondaryArchSuffix == $portVersion
	devel:libKF5Bookmarks$secondaryArchSuffix == $portVersion
	devel:libKF5Codecs$secondaryArchSuffix == $portVersion
	devel:libKF5Completion$secondaryArchSuffix == $portVersion
	devel:libKF5ConfigCore$secondaryArchSuffix == $portVersion
	devel:libKF5ConfigGui$secondaryArchSuffix == $portVersion
	devel:libKF5ConfigWidgets$secondaryArchSuffix == $portVersion
	devel:libKF5CoreAddons$secondaryArchSuffix == $portVersion
	devel:libKF5GlobalAccel$secondaryArchSuffix == $portVersion
	devel:libKF5I18n$secondaryArchSuffix == $portVersion
	devel:libKF5IconThemes$secondaryArchSuffix == $portVersion
	devel:libKF5ItemViews$secondaryArchSuffix == $portVersion
	devel:libKF5JobWidgets$secondaryArchSuffix == $portVersion
	devel:libKF5JS$secondaryArchSuffix == $portVersion
	devel:libKF5JSApi$secondaryArchSuffix == $portVersion
	devel:libKF5KIOCore$secondaryArchSuffix == $portVersion
	devel:libKF5Notifications$secondaryArchSuffix == $portVersion
	devel:libKF5NotifyConfig$secondaryArchSuffix == $portVersion
	devel:libKF5Parts$secondaryArchSuffix == $portVersion
	devel:libKF5Service$secondaryArchSuffix == $portVersion
	devel:libKF5Solid$secondaryArchSuffix == $portVersion
	devel:libKF5SonnetCore$secondaryArchSuffix == $portVersion
	devel:libKF5SonnetUi$secondaryArchSuffix == $portVersion
	devel:libKF5TextWidgets$secondaryArchSuffix == $portVersion
	devel:libKF5Wallet$secondaryArchSuffix	 == $portVersion
	devel:libKF5WidgetsAddons$secondaryArchSuffix == $portVersion
	devel:libKF5WindowSystem$secondaryArchSuffix == $portVersion
	devel:libKF5XmlGui$secondaryArchSuffix == $portVersion
	devel:libphonon4qt5$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:gperf
	cmd:lrelease$secondaryArchSuffix
	cmd:make
	cmd:perl
	cmd:python2
	"

BUILD()
{
	mkdir -p build
	cd build

	cmake .. $cmakeDirArgs \
		-DCMAKE_BUILD_TYPE=Release \
		-DECM_MKSPECS_INSTALL_DIR=$dataDir/Qt5/mkspecs \
		-DECM_DIR=/system/data/cmake/Modules/ECM/cmake \
		-DKDE_INSTALL_PLUGINDIR=$addOnsDir/Qt5
	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	prepareInstalledDevelLibs \
		libKF5KHtml

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

TEST()
{
	cd build
	make test
}
