# 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=baloo-widgets
pkgver=24.08.1
pkgrel=0
pkgdesc="Widgets for Baloo"
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://community.kde.org/Baloo"
license="LGPL-2.0-only AND LGPL-2.1-or-later"
depends_dev="
	baloo-dev
	kconfig-dev
	kfilemetadata-dev
	ki18n-dev
	kio-dev
	qt6-qtbase-dev
	"
makedepends="$depends_dev
	extra-cmake-modules
	samurai
	"
checkdepends="xvfb-run"
subpackages="$pkgname-dev $pkgname-lang"
_repo_url="https://invent.kde.org/libraries/baloo-widgets.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/baloo-widgets-$pkgver.tar.xz"

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

check() {
	# filemetadatadatedisplaytest, filemetadatawidgettest and filemetadataitemcounttest
	# require running dbus server
	local skipped_tests="("
	local tests="
		filemetadatadatedisplay
		filemetadatawidget
		filemetadataitemcount"
	for test in $tests; do
		skipped_tests="$skipped_tests|$test"
	done
	skipped_tests="$skipped_tests)|test"
	xvfb-run ctest --test-dir build --output-on-failure -E "$skipped_tests"
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}
sha512sums="
50e348083d50a5599d901f482e1571ccd4473c0ccd8941c9fe4e111813f2c0882946d4eced51f602e6d2032a31ff3e9278f6641f10a509c145f9bf13aad93850  baloo-widgets-24.08.1.tar.xz
"
