# 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=kscreenlocker
pkgver=6.3.5
pkgrel=0
pkgdesc="Library and components for secure lock screen architecture"
# armhf blocked by qt6-qtdeclarative -> ki18n
arch="all !armhf"
url="https://kde.org/plasma-desktop/"
license="GPL-2.0-or-later AND (GPL-2.0-only OR GPL-3.0-only)"
depends="
	elogind
	linux-pam
	"
depends_dev="
	elogind-dev
	kcmutils-dev
	kcrash-dev
	kdeclarative-dev
	kglobalaccel-dev
	ki18n-dev
	kidletime-dev
	knotifications-dev
	ksvg-dev
	ktextwidgets-dev
	kwayland-dev
	kwindowsystem-dev
	kxmlgui-dev
	layer-shell-qt-dev
	libkscreen-dev
	libseccomp-dev
	linux-pam-dev
	libplasma-dev
	qt6-qtbase-dev
	solid-dev
	xcb-util-keysyms-dev
	"
makedepends="$depends_dev
	extra-cmake-modules
	samurai
	"
checkdepends="xwayland-run"

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

subpackages="$pkgname-dev $pkgname-lang"
_repo_url="https://invent.kde.org/plasma/kscreenlocker.git"
source="https://download.kde.org/$_rel/plasma/$pkgver/kscreenlocker-$pkgver.tar.xz
	kde.pam
	kde-fingerprint.pam
	kde-smartcard.pam
	"
# Requires running loginctl
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

	install -D -m644 "$srcdir"/kde.pam "$pkgdir"/etc/pam.d/kde
	install -m644 "$srcdir"/kde-fingerprint.pam "$pkgdir"/etc/pam.d/kde-fingerprint
	install -m644 "$srcdir"/kde-smartcard.pam "$pkgdir"/etc/pam.d/kde-smartcard
}

sha512sums="
7a4e270de14718f4f29e5c26b559a79ca0189a87ad58931c0c3d425477ee056833099f8f9eb1ce8813a55e0f543495abf4335bad9ff61656569b8533b0a8b7f7  kscreenlocker-6.3.5.tar.xz
cdbc45fb74a3c43fb2302fe09bf2f9f644ca93693e0110cf748c403762236aaeea8284a8d21fc495014c69b6d5fe4789aaff7687ce9f03dda270490fa5042e2b  kde.pam
ffe092db00d5d633ac772a27bf921b968f2b46d19c2f7dec983acd4647bcbd7ca2f850177a56460d7290a296c0092101d8ba89a51c6831bad79aaedb322cce11  kde-fingerprint.pam
2ae866d25224ba345ea9d5ddb2fce668de5c51d1cfbb4d7a048c50107ccd6cffc3231a46855599c0ba3d62ff002a26e45b69d9029f88f4ab42661465a5e526c5  kde-smartcard.pam
"
