# 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-other
pkgname=ktextaddons
pkgver=1.5.4
pkgrel=0
pkgdesc="Various text handling addons"
# armhf blocked by extra-cmake-modules
arch="all !armhf"
url="https://invent.kde.org/libraries/ktextaddons/"
license="LGPL-2.0-or-later AND GPL-2.0-or-later"
depends_dev="
	karchive-dev
	kconfigwidgets-dev
	kcoreaddons-dev
	ki18n-dev
	kio-dev
	kxmlgui-dev
	qt6-qtbase-dev
	qtkeychain-dev
	syntax-highlighting-dev
	"
makedepends="
	$depends_dev
	doxygen
	extra-cmake-modules
	graphviz
	samurai
	"
checkdepends="xvfb-run"
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang"
_repo_url="https://invent.kde.org/libraries/ktextaddons.git"
source="https://download.kde.org/stable/ktextaddons/ktextaddons-$pkgver.tar.xz"

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

check() {
	local skipped_tests="("
	local tests="
		languagetoolconfigwidget
		translator-translatorwidget
		translator-translatorengineloader
		grammaleceresultwidget
		grammaleceresultjob
		grammalececonfigwidget
	"
	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="
76829c265c68e374fc7012c270a0328bb9d724d78165f0bda8da126994a5eb692af0b66b93e1151af3fc3e1755bbedfabcae73b60bb47c871181d2d50530e243  ktextaddons-1.5.4.tar.xz
"
