# 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=zanshin
pkgver=24.08.0
pkgrel=0
# armhf blocked by qt6-qtdeclarative
# armv7, ppc64le and s390x blocked by qt6-qtwebengine -> akonadi-calendar
# loongarch64 blocked by akonadi-calendar
arch="all !armhf !armv7 !ppc64le !s390x !riscv64 !loongarch64"
url="https://zanshin.kde.org/"
pkgdesc="A Getting Things Done application which aims at getting your mind like water"
license="(GPL-2.0-only OR GPL-3.0-only) AND LGPL-2.0-or-later"
makedepends="
	akonadi-calendar-dev
	boost-dev
	extra-cmake-modules
	ki18n-dev
	kontactinterface-dev
	krunner-dev
	kwindowsystem-dev
	qt6-qtbase-dev
	samurai
	"
checkdepends="
	dbus
	xvfb-run
	"
subpackages="$pkgname-lang"
_repo_url="https://invent.kde.org/pim/zanshin.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/zanshin-$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() {
	# tests-units-akonadi-akonadistoragetest, tests-units-akonadi-akonadicachingstorageintegrationtest,
	# tests-units-presentation-alltaskspagemodeltest, tests-units-widgets-editorviewtest,
	# tests-units-widgets-pageviewtest, tests-units-migrator-zanshin021migrationtest,
	# tests-units-migrator-zanshincontextitemsmigrationtest are broken
	local skipped_tests="("
	local tests="
		tests-units-akonadi-akonadistoragetest
		tests-units-akonadi-akonadicachingstorageintegrationtest
		tests-units-presentation-alltaskspagemodeltest
		tests-units-widgets-editorviewtest
		tests-units-widgets-pageviewtest
		tests-units-migrator-zanshin021migrationtest
		tests-units-migrator-zanshincontextitemsmigrationtest"
	for test in $tests; do
		skipped_tests="$skipped_tests|$test"
	done
	skipped_tests="$skipped_tests)"
	xvfb-run ctest --test-dir build --output-on-failure -E "$skipped_tests"
}

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

sha512sums="
74b0d76c8e50721553b076e5394b6eccf1051b85e818fc9bf2df358432fef15527a522c600b3e70a40d6551d18fda5db7bc8ef47c44e1c0438695c0415f7eb81  zanshin-24.08.0.tar.xz
"
