# Contributor: ProgCat <progcat@protonmail.com>
# Maintainer: Lindsay Zhou <i@lin.moe>
pkgname=fcitx5-configtool
pkgver=5.1.9
pkgrel=0
pkgdesc="A configure tool for Fcitx5"
url="https://github.com/fcitx/fcitx5-configtool"
arch="all !armhf"
license="GPL-2.0-or-later"
makedepends="
	cmake
	extra-cmake-modules
	fcitx5-dev
	fcitx5-qt-dev
	gettext-dev
	iso-codes
	iso-codes-dev
	kcoreaddons5-dev
	kdeclarative5-dev
	ki18n5-dev
	kiconthemes5-dev
	kirigami2-dev
	kpackage5-dev
	kwidgetsaddons5-dev
	libxkbcommon-dev
	libxkbfile-dev
	qt6-qtsvg-dev
	libplasma-dev
	qt6-qtdeclarative-dev
	samurai
	xkeyboard-config-dev
	"
checkdepends="appstream"
subpackages="$pkgname-lang"
source="$pkgname-$pkgver.tar.gz::https://github.com/fcitx/fcitx5-configtool/archive/refs/tags/$pkgver.tar.gz"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build -G Ninja\
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DUSE_QT6=True \
		-DCMAKE_BUILD_TYPE=None \
		$CMAKE_CROSSOPTS
	cmake --build build
}

check() {
	cd build
	ctest
}

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

sha512sums="
20577a65aad7d01a2e2f24e7b88c4fbbc490f1cefe7dd1baacf9b0ab5f6adc42192845fc6caf11b895e718575dcaefa0ff6744df1aed1bfa472a1df8f9a54cb9  fcitx5-configtool-5.1.9.tar.gz
"
