# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-plasma
maintainer="team/kde <bribbers@disroot.org>"
pkgname=kde-cli-tools
pkgver=6.3.5
pkgrel=0
pkgdesc="Tools based on KDE Frameworks 5 to better interact with the system"
# armhf blocked by qt6-qtdeclarative -> ki18n
arch="all !armhf"
url="https://invent.kde.org/plasma/kde-cli-tools"
license="(GPL-2.0-only OR GPL-3.0-only) AND GPL-2.0-or-later AND GPL-2.0-only AND LGPL-2.1-only"
makedepends="
	extra-cmake-modules
	kcmutils-dev
	kconfig-dev
	kdeclarative-dev
	kdesu-dev
	kdoctools-dev
	ki18n-dev
	kiconthemes-dev
	kio-dev
	kparts-dev
	kservice-dev
	kwindowsystem-dev
	plasma-activities-dev
	qt6-qtbase-dev
	qt6-qtsvg-dev
	samurai
	"
checkdepends="xwayland-run"

case "$pkgver" in
	*.*.9*) _rel=unstable;;
	*) _rel=stable;;
esac

subpackages="$pkgname-doc $pkgname-lang $pkgname-zsh-completion"
_repo_url="https://invent.kde.org/plasma/kde-cli-tools.git"
source="https://download.kde.org/$_rel/plasma/$pkgver/kde-cli-tools-$pkgver.tar.xz"
# Broken
options="!check"

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

check() {
	wlheadless-run -- ctest --test-dir build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}
sha512sums="
b4dd9ddb94747d95fd379ff98fbca1a5d7fdc29e28774482bfe7ece71bdadf8f812c8e1501c859505bd07375a240c2f3a5060bfc3adbcc32de32dad6b975d4f3  kde-cli-tools-6.3.5.tar.xz
"
