# 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=korganizer
pkgver=24.08.1
pkgrel=0
# armhf blocked by extra-cmake-modules
# ppc64le, s390x, riscv64 and armv7 blocked by qt6-qtwebengine -> kmailtransport
# loongarch64 blocked by pimcommon
arch="all !armhf !ppc64le !s390x !riscv64 !armv7 !loongarch64"
url="https://apps.kde.org/korganizer/"
pkgdesc="The calendar and scheduling component of Kontact"
license="GPL-2.0-or-later"
depends="kdepim-runtime"
makedepends="
	akonadi-calendar-dev
	akonadi-contacts-dev
	akonadi-dev
	akonadi-mime-dev
	akonadi-notes-dev
	akonadi-search-dev
	calendarsupport-dev
	eventviews-dev
	extra-cmake-modules
	incidenceeditor-dev
	kcalendarcore-dev
	kcalutils-dev
	kcmutils-dev
	kcodecs-dev
	kcompletion-dev
	kconfig-dev
	kconfigwidgets-dev
	kcontacts-dev
	kcoreaddons-dev
	kcrash-dev
	kdbusaddons-dev
	kdoctools-dev
	kholidays-dev
	kiconthemes-dev
	kidentitymanagement-dev
	kitemviews-dev
	kjobwidgets-dev
	kldap-dev
	kmailtransport-dev
	kmime-dev
	knewstuff-dev
	knotifications-dev
	kontactinterface-dev
	kparts-dev
	kpimtextedit-dev
	kservice-dev
	kuserfeedback-dev
	kwidgetsaddons-dev
	kwindowsystem-dev
	kxmlgui-dev
	libkdepim-dev
	phonon-dev
	pimcommon-dev
	qt6-qtbase-dev
	samurai
	"
checkdepends="xvfb-run"
subpackages="$pkgname-doc $pkgname-lang"
_repo_url="https://invent.kde.org/pim/korganizer.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/korganizer-$pkgver.tar.xz"

replaces="kdepim-addons<=24.05.2-r0"

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

check() {
	# akonadi-sqlite-koeventpopupmenutest and akonadi-mysql-koeventpopupmenutest require running dbus server
	# reparentingmodeltest is broken
	local skipped_tests="("
	local tests="
		akonadi-sqlite-koeventpopupmenu
		akonadi-mysql-koeventpopupmenu
		reparentingmodel
		"
	for test in $tests; do
		skipped_tests="$skipped_tests|$test"
	done
	skipped_tests="$skipped_tests)test"
	xvfb-run ctest --test-dir build --output-on-failure -E "$skipped_tests"
}

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

sha512sums="
484ea10161d698ed9bb5aacd91143d0cff859c65f30d814f453a18ee85d55de4f13e50cf6d633cb75ef1545a3e3e952f574538c7e018649a19e7203cb35392ce  korganizer-24.08.1.tar.xz
"
