SUMMARY="Qt addon library with a collection of non-GUI utilities"
DESCRIPTION="KCoreAddons provides classes built on top of QtCore to perform \
various tasks such as manipulating mime types, autosaving files, creating \
backup files, generating random sequences, performing text manipulations such \
as macro replacement, accessing user information and many more."
HOMEPAGE="https://github.com/KDE/kcoreaddons/"
COPYRIGHT="2010-2022 KDE Organisation"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://github.com/KDE/kcoreaddons/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="786956ca813c72a0109c07e85b79e62e1cf2dd91f645ade8eba921e55a353b0d"
PATCHES="kcoreaddons-$portVersion.patchset"

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

PROVIDES="
	kcoreaddons$secondaryArchSuffix = $portVersion
	cmd:desktoptojson$secondaryArchSuffix = $portVersion
	lib:libkf5coreaddons$secondaryArchSuffix = $portVersion compat >= 5
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Xml$secondaryArchSuffix
	"

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules$secondaryArchSuffix >= $portVersion
	devel:libQt5Core$secondaryArchSuffix >= 5.7
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix >= 5
	cmd:make
	"

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

INSTALL()
{
	cd build
	make install

	prepareInstalledDevelLibs \
		libKF5CoreAddons

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

TEST()
{
	cd build
	make test
}
