# 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=libkcddb
pkgver=24.08.0
pkgrel=0
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://www.kde.org/applications/multimedia/"
pkgdesc="KDE CDDB library"
license="LGPL-2.0-or-later AND GPL-2.0-or-later"
makedepends="
	extra-cmake-modules
	kcmutils-dev
	kcodecs-dev
	kconfig-dev
	kdoctools-dev
	ki18n-dev
	kio-dev
	kwidgetsaddons-dev
	libmusicbrainz-dev
	qt6-qtbase-dev
	samurai
	"
checkdepends="
	dbus
	xvfb-run
	"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
_repo_url="https://invent.kde.org/multimedia/libkcddb.git"
source="https://download.kde.org/stable/release-service/$pkgver/src/libkcddb-$pkgver.tar.xz"
options="net" # Required for tests

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

check() {
	# musicbrainztest-severaldiscs fails due to utf16/8 (?)
	# synchttplookuptest hangs
	# asyncmusicbrainztest http request
	dbus-run-session -- xvfb-run -a ctest --test-dir build --output-on-failure \
		-E "(asyncmusicbrainztest|synchttplookuptest|musicbrainztest-severaldiscs|synccddblookuptest|asynchttpsubmittest|synchttpsubmittest|sitestest|utf8test)"
}

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

sha512sums="
34f9245d26b6e95e3851d595c6160f9ec2df9cc7497edd7a39b58cfc8c9f7d3a6a69ce22d6c971b638037a04bc9ae3deec06a1d6f4aaf0185b517a9c436769ab  libkcddb-24.08.0.tar.xz
"
