# Contributor: Bart Ribbers <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-frameworks
maintainer="team/kde <bribbers@disroot.org>"
pkgname=kwindowsystem
pkgver=6.8.0
pkgrel=0
pkgdesc="Access to the windowing system"
arch="all"
url="https://community.kde.org/Frameworks"
license="MIT AND (LGPL-2.1-only OR LGPL-3.0-only"
depends_dev="
	libxrender-dev
	plasma-wayland-protocols
	qt6-qtwayland-dev
	xcb-util-keysyms-dev
	xcb-util-wm-dev
	"
makedepends="$depends_dev
	doxygen
	extra-cmake-modules
	graphviz
	qt6-qttools-dev
	samurai
	"
checkdepends="xvfb-run"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
_repo_url="https://invent.kde.org/frameworks/kwindowsystem.git"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/kwindowsystem-$pkgver.tar.xz"

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

check() {
	local skipped_tests="kwindowsystem-(kwindowsystem_threadtest"
	local tests="
		kwindowsystemx11test
		kwindowinfox11test
		compositingenabled_test
		netrootinfotestwm
		"
	case "$CARCH" in
		s390x)
			tests="$tests
				kwindoweffectstest
				netwininfotestwm
				"
			;;
	esac
	for test in $tests; do
		skipped_tests="$skipped_tests|$test"
	done
	skipped_tests="$skipped_tests)"
	echo $skipped_tests
	xvfb-run ctest --test-dir build --output-on-failure -E "$skipped_tests"
}

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

sha512sums="
fc4b8d57f51575b7c34052c881acff873226ac775c1d117cddef2e6b37ad2ee618d0d063ed4232a3f8f565240cb4e9b9d071f0e4e8cbec6b742262e3cc4dcdde  kwindowsystem-6.8.0.tar.xz
"
