# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
pkgname=pimcommon
pkgver=24.08.1
pkgrel=0
pkgdesc="Common lib for KDEPim"
# armhf blocked by extra-cmake-modules
# ppc64le, s390x and riscv64 blocked by qt6-qtwebengine -> akonadi
# loongarch64 blocked by purpose
arch="all !armhf !ppc64le !s390x !riscv64 !loongarch64"
url='https://community.kde.org/KDE_PIM'
license="GPL-2.0-or-later"
depends_dev="
	akonadi-contacts-dev
	akonadi-dev
	karchive-dev
	kcodecs-dev
	kcompletion-dev
	kconfig-dev
	kconfigwidgets-dev
	kcontacts-dev
	kcoreaddons-dev
	kdbusaddons-dev
	ki18n-dev
	kiconthemes-dev
	kimap-dev
	kio-dev
	kitemmodels-dev
	kjobwidgets-dev
	kmime-dev
	knewstuff-dev
	kpimtextedit-dev
	kservice-dev
	ktextaddons-dev
	ktexttemplate-dev
	kwidgetsaddons-dev
	kxmlgui-dev
	libkdepim-dev
	purpose-dev
	qt6-qtbase-dev
	"
makedepends="$depends_dev
	extra-cmake-modules
	qt6-qttools-dev
	samurai
	"
checkdepends="xvfb-run"
subpackages="$pkgname-dev $pkgname-lang"
_repo_url="https://invent.kde.org/pim/pimcommon.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/pimcommon-$pkgver.tar.xz"
options="net" # net required for tests

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_DESIGNERPLUGIN=ON
	cmake --build build
}

check() {
	xvfb-run ctest --test-dir build --output-on-failure -E "pimcommon-needupdateversion-needupdateversionwidgettest"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}
sha512sums="
4bcefbbb46ddfb791a6341c0c19fb6c1208b590a8c989229b9623c6a11f150e1b889d75899e15cbc1bd7096e70e43631ad275fde92f4e11eab97482ff8d659c8  pimcommon-24.08.1.tar.xz
"
