# 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=kcoreaddons
pkgver=6.13.0
pkgrel=0
pkgdesc="Addons to QtCore"
# armhf blocked by qt6-qtdeclarative
arch="all !armhf"
url="https://community.kde.org/Frameworks"
license="LGPL-2.0-or-later AND (LGPL-2.1-only OR LGPL-3.0-only)"
depends_dev="qt6-qtbase-dev"
makedepends="$depends_dev
	breeze-icons
	doxygen
	extra-cmake-modules
	graphviz
	qt6-qtdeclarative-dev
	qt6-qttools-dev
	samurai
	shared-mime-info
	"
checkdepends="xvfb-run"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang kde-default-icon-theme:icons:noarch"
_repo_url="https://invent.kde.org/frameworks/kcoreaddons.git"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/kcoreaddons-$pkgver.tar.xz"

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

check() {
	# klistopenfilesjobtest_unix requires >8000 open files
	local disabled_tests="klistopenfilesjobtest_unix|kdirwatch_(qfswatch|stat|inotify)_unittest|knetworkmountstestpaths"
	case "$CARCH" in
		s390x) disabled_tests="$disabled_tests|kdirwatch_inotify_unittest" ;;
		x86_64) disabled_tests="$disabled_tests|kfileutilstest" ;; # Only fails on builders
	esac

	xvfb-run -a ctest --test-dir build -E "($disabled_tests)"
}

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

icons() {
	pkgdesc="Virtual to automatically pull in breeze icons by default for KDE apps"
	install_if="$pkgname=$pkgver-r$pkgrel"
	depends="breeze-icons"

	mkdir -p "$subpkgdir"
}

sha512sums="
528c3410f07e8300d44ccf75c9796283aba3ecfc267466b3fa564846167d12c9ad337c2b9481c2e3405c4c6967b0e85e563745eb3686b2aad6bd83444a9f839d  kcoreaddons-6.13.0.tar.xz
"
