# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: team/kde <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-applications
pkgname=spectacle
pkgver=24.08.0
pkgrel=0
pkgdesc="Application for capturing desktop screenshots"
# armhf blocked by extra-cmake-modules
# ppc64le, s390x, riscv64 and loongarch64 blocked by qt6-qtwebengine -> purpose
arch="all !armhf !ppc64le !s390x !riscv64 !loongarch64"
url="https://kde.org/applications/utilities/org.kde.spectacle"
license="GPL-2.0-only"
makedepends="
	extra-cmake-modules
	kconfig-dev
	kcoreaddons-dev
	kdbusaddons-dev
	kdeclarative-dev
	kdoctools-dev
	ki18n-dev
	kio-dev
	knewstuff-dev
	knotifications-dev
	kpipewire-dev
	kstatusnotifieritem-dev
	kwayland-dev
	kwidgetsaddons-dev
	kwindowsystem-dev
	prison-dev
	layer-shell-qt-dev
	libxcb-dev
	opencv-dev
	pipewire-dev
	purpose-dev
	qt6-qtbase-dev
	samurai
	xcb-util-cursor-dev
	xcb-util-image-dev
	xcb-util-renderutil-dev
	zxing-cpp-dev
	"
subpackages="$pkgname-doc $pkgname-lang"
_repo_url="https://invent.kde.org/graphics/spectacle.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/spectacle-$pkgver.tar.xz
	spectacle.desktop
	"

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

check() {
	ctest --test-dir build --output-on-failure -E "filename_test"
}

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

	install -Dm644 "$srcdir"/spectacle.desktop -t "$pkgdir"/etc/xdg/autostart/

	# We don't ship systemd
	rm -r "$pkgdir"/usr/lib/systemd
}
sha512sums="
89ba54a284d7f7c36b1c699a7c5f8d7dc53ce7892c08370d4528f96e52a91096d28e669356a09e6cb6daf0ad05577dcafd789ca06e3ff2591e18cd49baa97e56  spectacle-24.08.0.tar.xz
7c563d811f30d26f83e01a465e803b95167c5b2b842315257216ab282e07c69e7582a14d7f429cd19678199179ad8f3f2854265092f5a4c9ce9b65c87ed3849d  spectacle.desktop
"
