# 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-frameworks
pkgname=qqc2-desktop-style
pkgver=6.5.0
pkgrel=2
pkgdesc="A style for Qt Quick Controls 2 to make it follow your desktop theme"
# armhf blocked by qt6-qtdeclarative
arch="all !armhf"
url="https://community.kde.org/Frameworks"
license="LGPL-3.0-only AND (GPL-2.0-only OR GPL-3.0-only)"
depends="
	sonnet
	"
depends_dev="
	kconfigwidgets-dev
	kiconthemes-dev
	kirigami-dev
	qt6-qtbase-dev
	qt6-qtdeclarative-dev
	"
makedepends="$depends_dev
	extra-cmake-modules
	samurai
	"
install_if="kirigami"
checkdepends="xvfb-run"
subpackages="$pkgname-dev"
_repo_url="https://invent.kde.org/frameworks/qqc2-desktop-style.git"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/qqc2-desktop-style-$pkgver.tar.xz"

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

check() {
	# TextFieldContextMenuTest requires working OpenGL
	xvfb-run ctest --test-dir build --output-on-failure -E "animationspeedmodifiertest|TextFieldContextMenuTest"
}

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

sha512sums="
f0a278a9550eb222fc5fc099d71fd28e70e016987bea773b87bd9b2b3f47cd9b8ed5890225b956bb603019ec2dc07831f5c13e11e04aa5b6eea4426be37452f4  qqc2-desktop-style-6.5.0.tar.xz
"
