# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-plasma-old
pkgname=libkscreen5
pkgver=5.27.10
pkgrel=0
pkgdesc="KDE screen management software"
arch="all !armhf" # armhf blocked by extra-cmake-modules
url="https://kde.org/plasma-desktop/"
license="LGPL-2.1-or-later AND GPL-2.0-or-later AND (GPL-2.0-only OR GPL-3.0-only)"
depends_dev="
	kconfig5-dev
	kwayland5-dev
	qt5-qtbase-dev
	qt5-qtx11extras-dev
	"
makedepends="$depends_dev
	doxygen
	extra-cmake-modules
	graphviz
	plasma-wayland-protocols
	qt5-qttools-dev
	samurai
	"

case "$pkgver" in
	*.90*) _rel=unstable;;
	*) _rel=stable;;
esac
_repo_url="https://invent.kde.org/plasma/libkscreen.git"
source="https://download.kde.org/$_rel/plasma/$pkgver/libkscreen-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-doc"
options="!check" # Fails due to requiring dbus-x11 and it running
builddir="$srcdir/libkscreen-$pkgver"

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

check() {
	ctest --test-dir python --output-on-failure
}

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

	rm -rf "$pkgdir"/usr/lib/systemd
}

sha512sums="
a390713faec2698228d81196e8c8aaa9824bcc83cb186a58b232c5f81d8f39adec485e67176bf2b2b03f2f10cd605fc1e0889ce07f90c04220b0aa1c4ba91118  libkscreen-5.27.10.tar.xz
"
