SUMMARY="Library for managing partitions"
DESCRIPTION="KPMcore, the KDE Partition Manager core, is a library for \
examining and modifying partitions, disk devices, and filesystems on a \
Linux system. It provides a unified programming interface over top of \
(external) system-manipulation tools.

KPMcore is a library for examining and manipulating all facets of storage \
devices on a system:

* raw disk devices
* partition tables on a device
* filesystems within a partition

There are multiple backends so that KPMcore can support different operating \
systems, although the only functional backend is the one for Linux systems:

* sfdisk backend (Linux)
* null backend"
HOMEPAGE="https://github.com/KDE/kpmcore/"
COPYRIGHT="2010-2021 KDE Organisation"
LICENSE="GNU LGPL v2"
REVISION="1"
srcGitRev="9e6cf4063a29dd13fafed939e2ee4ae3061a37d6"
SOURCE_URI="https://github.com/KDE/kpmcore/archive/$srcGitRev.zip"
CHECKSUM_SHA256="0b641ca970c6f109fdf40d3693fb7eddeb8cb1f6e0e807310ce9f1d41dbe87cd"
SOURCE_DIR="kpmcore-$srcGitRev"
PATCHES="kpmcore-$portVersion.patchset"

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

GLOBAL_WRITABLE_FILES="
	settings/dbus-1/system.d/org.kde.kpmcore.helperinterface.conf keep-old
	"

PROVIDES="
	kpmcore$secondaryArchSuffix = $portVersion
	lib:libkpmcore$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libKF5Auth$secondaryArchSuffix
	lib:libKF5CoreAddons$secondaryArchSuffix
	lib:libKF5I18n$secondaryArchSuffix
	lib:libKF5WidgetsAddons$secondaryArchSuffix
	lib:libqca$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix >= 5.7
	"

PROVIDES_devel="
	kpmcore${secondaryArchSuffix}_devel = $portVersion
	devel:libkpmcore$secondaryArchSuffix = $portVersion compat >= 9
	"
REQUIRES_devel="
	kpmcore$secondaryArchSuffix == $portVersion
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules >= 5.45
	devel:libKF5Auth$secondaryArchSuffix
	devel:libKF5CoreAddons$secondaryArchSuffix
	devel:libKF5I18n$secondaryArchSuffix
	devel:libKF5WidgetsAddons$secondaryArchSuffix
	devel:libqca$secondaryArchSuffix >= 2
	devel:libQt5Core$secondaryArchSuffix >= 5.7
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:make
	cmd:qdbuscpp2xml$secondaryArchSuffix
	"

BUILD()
{
	mkdir -p build
	cd build

	cmake .. $cmakeDirArgs \
		-DCMAKE_BUILD_TYPE=Release \
		-DKDE_INSTALL_PLUGINDIR=$addOnsDir/Qt5 \
		-DECM_DIR=/system/data/cmake/Modules/ECM/cmake \
		-DINCLUDE_INSTALL_DIR=$includeDir \
		-DKAUTH_HELPER_INSTALL_DIR:PATH=$addOnsDir/Qt5/kauth/helper

	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	prepareInstalledDevelLibs \
		libkpmcore

	packageEntries devel \
		$libDir/cmake \
		$developDir
}

TEST()
{
	cd build
	make test
}
