SUMMARY="Address book API based on KDE Frameworks"
DESCRIPTION="KContact library provides vcard support."
HOMEPAGE="https://github.com/KDE/kcontacts/"
COPYRIGHT="2010-2021 KDE Organisation"
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://github.com/KDE/kcontacts/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="d1d998f6fb7621ea1176bb8bbf6d9205dccf8109b9690de9a321d7e6f9792ac5"
SOURCE_DIR="kcontacts-$portVersion"

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

GLOBAL_WRITABLE_FILES="
	settings/xdg/kcontacts.categories keep-old
	settings/xdg/kcontacts.renamecategories keep-old
	"

PROVIDES="
	kcontacts$secondaryArchSuffix = $portVersion
	lib:libKF5Contacts$secondaryArchSuffix = $portVersion compat >= 5
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libKF5Codecs$secondaryArchSuffix
	lib:libKF5ConfigCore$secondaryArchSuffix
	lib:libKF5ConfigGui$secondaryArchSuffix
	lib:libKF5ConfigWidgets$secondaryArchSuffix
	lib:libKF5CoreAddons$secondaryArchSuffix
	lib:libKF5I18n$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	"

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules$secondaryArchSuffix >= 5.86
	devel:libKF5Codecs$secondaryArchSuffix
	devel:libKF5ConfigCore$secondaryArchSuffix
	devel:libKF5ConfigWidgets$secondaryArchSuffix
	devel:libKF5CoreAddons$secondaryArchSuffix
	devel:libKF5I18n$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix >= 5.15
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:make
	cmd:python2
	cmd:qdbuscpp2xml$secondaryArchSuffix >= 5
	"

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 \
		libKF5Contacts

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

TEST()
{
	cd build
	make test
}
