SUMMARY="Widgets for configuration dialogs"
DESCRIPTION="KConfigWidgets provides easy-to-use classes to create \
configuration dialogs, as well as a set of widgets which uses KConfig \
to store their settings."
HOMEPAGE="https://github.com/KDE/kconfigwidgets/"
COPYRIGHT="2010-2021 KDE Organisation"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://github.com/KDE/kconfigwidgets/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="43fbd2a4be2a67e33a01cf439f573c13a588bb2050dd9896aebe7c3dc2745b9e"

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

PROVIDES="
	kconfigwidgets$secondaryArchSuffix = $portVersion
	cmd:preparetips5$secondaryArchSuffix = $portVersion
	lib:libKF5ConfigWidgets$secondaryArchSuffix = $portVersion compat >= 5
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libKF5Auth$secondaryArchSuffix
	lib:libKF5Codecs$secondaryArchSuffix
	lib:libKF5ConfigCore$secondaryArchSuffix
	lib:libKF5ConfigGui$secondaryArchSuffix
	lib:libKF5CoreAddons$secondaryArchSuffix
	lib:libKF5GuiAddons$secondaryArchSuffix
	lib:libKF5I18n$secondaryArchSuffix
	lib:libKF5WidgetsAddons$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	"

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules$secondaryArchSuffix >= $portVersion
	devel:libKF5Auth$secondaryArchSuffix == $portVersion
	devel:libKF5Codecs$secondaryArchSuffix == $portVersion
	devel:libKF5ConfigCore$secondaryArchSuffix == $portVersion
	devel:libKF5ConfigGui$secondaryArchSuffix == $portVersion
	devel:libKF5CoreAddons$secondaryArchSuffix == $portVersion
	devel:libKF5DocTools$secondaryArchSuffix == $portVersion
	devel:libKF5GuiAddons$secondaryArchSuffix == $portVersion
	devel:libKF5I18n$secondaryArchSuffix == $portVersion
	devel:libKF5WidgetsAddons$secondaryArchSuffix == $portVersion
	devel:libQt5Core$secondaryArchSuffix >= 5.7
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix >= 5
	cmd:make
	cmd:python2
	"

BUILD()
{
	# disable docs generation until libxml package is fixed
	sed -i s/add/#add/g docs/CMakeLists.txt
	sed -i s/kdoctools/#kdoctool/g CMakeLists.txt

	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
	make $jobArgs
}

INSTALL()
{
	cd build
	make install
	prepareInstalledDevelLibs \
		libKF5ConfigWidgets

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

TEST()
{
	cd build
	make test
}
