# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-plasma
pkgname=xdg-desktop-portal-kde
pkgver=6.1.5
pkgrel=0
pkgdesc="A backend implementation for xdg-desktop-portal that is using Qt/KDE"
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://phabricator.kde.org/source/xdg-desktop-portal-kde"
license="LGPL-2.0-or-later"
depends="xdg-desktop-portal"
makedepends="
	cups-dev
	extra-cmake-modules
	glib-dev
	kcoreaddons-dev
	kdeclarative-dev
	kio-dev
	kirigami-dev
	kstatusnotifieritem-dev
	kwayland-dev
	libepoxy-dev
	pipewire-dev
	libplasma-dev
	plasma-wayland-protocols
	qt6-qtbase-dev
	samurai
	xdg-desktop-portal-dev
	"
checkdepends="
	dbus-x11
	py3-gobject3
	xvfb-run
	"
subpackages="$pkgname-lang"

case "$pkgver" in
	*.90*) _rel=unstable;;
	*) _rel=stable;;
esac
_repo_url="https://invent.kde.org/plasma/xdg-desktop-portal-kde.git"
source="https://download.kde.org/stable/plasma/$pkgver/xdg-desktop-portal-kde-$pkgver.tar.xz"

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

check() {
	# colorschemetest requires the package itself installed
	xvfb-run ctest --test-dir build --output-on-failure -E "colorschemetest"
}

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

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

sha512sums="
7866d3bedbb395cf8de84c86de5d1b4db0df776986f71acb622f72d04a654c11a9645d5376d20793992886d4149f608ed4a58d701368fe2f9b40c152fe25074c  xdg-desktop-portal-kde-6.1.5.tar.xz
"
