# 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=kconfig
pkgver=6.5.0
pkgrel=0
pkgdesc="Configuration system"
arch="all !armhf" # armhf blocked by extra-cmake-modules
url="https://community.kde.org/Frameworks"
license="LGPL-2.0-or-later AND LGPL-2.0-only AND LGPL-2.1-or-later"
makedepends="
	doxygen
	extra-cmake-modules
	graphviz
	qt6-qtdeclarative-dev
	qt6-qttools-dev
	samurai
	"
checkdepends="xvfb-run"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
_repo_url="https://invent.kde.org/frameworks/kconfig.git"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/kconfig-$pkgver.tar.xz"

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

check() {
	local _home="${srcdir:?}"/home
	mkdir "$_home"
	chmod 0700 "$_home"
	XDG_RUNTIME_DIR="$_home" \
		HOME="$_home" \
		xvfb-run ctest --test-dir build --output-on-failure -E 'kconfig(core-(kconfigtest|kdesktopfiletest|test_kconf_update)|gui-kstandardshortcutwatchertest)'
	rm -rf "$_home"
}

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

sha512sums="
fc50dff9bc474c4386f5820c2e0d770a8ac4313693d8c4aa96d08ad626dc100ab45aeb831c565c871f0778f146935706ba42e80646f459bf9a96f95351ea2050  kconfig-6.5.0.tar.xz
"
