# 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=kdepim-runtime
pkgver=24.08.1
pkgrel=0
pkgdesc="Extends the functionality of kdepim"
url="https://kontact.kde.org/"
# armhf blocked by extra-cmake-modules
# ppc64le, s390x, riscv64 and armv7 blocked by qt6-qtwebengine -> akonadi
# loongarch64 blocked by pimcommon
arch="all !armhf !ppc64le !s390x !riscv64 !armv7 !loongarch64"
license="LGPL-2.0-or-later"
makedepends="
	akonadi-calendar-dev
	akonadi-contacts-dev
	akonadi-dev
	akonadi-mime-dev
	akonadi-notes-dev
	extra-cmake-modules
	kcalendarcore-dev
	kcalutils-dev
	kcodecs-dev
	kconfig-dev
	kconfigwidgets-dev
	kcontacts-dev
	kdav-dev
	kdoctools-dev
	kholidays-dev
	kidentitymanagement-dev
	kimap-dev
	kio-dev
	kitemmodels-dev
	kmailtransport-dev
	kmbox-dev
	kmime-dev
	knotifications-dev
	knotifyconfig-dev
	ktextwidgets-dev
	kwindowsystem-dev
	libkgapi-dev
	libxslt-dev
	pimcommon-dev
	qca-qt6-dev
	qt6-qtbase-dev
	qt6-qtnetworkauth-dev
	qt6-qtspeech-dev
	samurai
	shared-mime-info
	"
checkdepends="
	dbus
	xvfb-run
	"
subpackages="$pkgname-dbg $pkgname-lang"
_repo_url="https://invent.kde.org/pim/kdepim-runtime.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/kdepim-runtime-$pkgver.tar.xz"

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

check() {
	local skipped_tests="("
	local tests="
		testresourcetask
		testsessionpool
		testaddcollectiontask
		testadditemtask
		testchangecollectiontask
		testchangeitemtask
		testexpungecollectiontask
		testmoveitemstask
		testretrievecollectionmetadatatask
		testretrievecollectionstask
		testretrieveitemtask
		testretrieveitemstask
		akonadi-mysql-synctest
		akonadi-sqlite-synctest
		akonadi-mysql-pop3test
		akonadi-sqlite-pop3test
		"
	for test in $tests; do
		skipped_tests="$skipped_tests|$test"
	done
	skipped_tests="$skipped_tests)"
	dbus-run-session -- xvfb-run ctest --test-dir build --output-on-failure -E "$skipped_tests"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
7e8c80aff33f4da9e81fe19ec083a52e8bfc16db4e8aea3ee0689e049c838273867fcd4b7f81542afbc71b6315c10cec77897489cafdddda455100e7e21ebc86  kdepim-runtime-24.08.1.tar.xz
"
