# Contributor: Bart Ribbers <bribbers@disroot.org>

# The group tag is just to easily find this APKBUILD by some scripts for automation
# group=kde-frameworks-old
maintainer="team/kde <bribbers@disroot.org>"
pkgname=kcoreaddons5
pkgver=5.116.0
pkgrel=1
pkgdesc="Addons to QtCore"
arch="all !armhf" # armhf blocked by extra-cmake-modules
url="https://community.kde.org/Frameworks"
license="LGPL-2.0-or-later AND (LGPL-2.1-only OR LGPL-3.0-only)"
depends_dev="qt5-qtbase-dev"
makedepends="$depends_dev
	doxygen
	extra-cmake-modules
	graphviz
	qt5-qttools-dev
	samurai
	shared-mime-info
	"
checkdepends="xvfb-run"
_repo_url="https://invent.kde.org/frameworks/kcoreaddons.git"
source="https://download.kde.org/stable/frameworks/${pkgver%.*}/kcoreaddons-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
builddir="$srcdir/kcoreaddons-$pkgver"

replaces="kcoreaddons<=5.110.0-r0"

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_unittest|kdirwatch_stat_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 ctest --test-dir build -E "($disabled_tests)"
}

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

sha512sums="
d77a1fcad6576692c6a6d80728acddb818acbc3a8f70fc59f3fa3c433a94c429e4b230840f7df23ae8027289e57fc0c8ae7c42b83ea734b567a640d5e248867d  kcoreaddons-5.116.0.tar.xz
"
