# Template file for 'fcitx5-configtool'
pkgname=fcitx5-configtool
version=5.1.6
revision=1
build_style=cmake
configure_args="-DENABLE_KCM=ON -DENABLE_CONFIG_QT=ON -DENABLE_TEST=ON
 -DKF6_HOST_TOOLING=/usr/lib/cmake -DKDE_INSTALL_QTPLUGINDIR=lib/qt6/plugins"
hostmakedepends="cldr-emoji-annotation pkg-config gettext doxygen
 extra-cmake-modules glib-devel qt6-base xkeyboard-config
 AppStream kf6-kcoreaddons kf6-kpackage kf6-kcmutils"
makedepends="libfcitx5-devel fcitx5-gtk-devel fcitx5-qt6-devel
 libglib-devel qt6-base-devel qt6-declarative-devel qt6-svg-devel
 kf6-kitemviews-devel kf6-kcoreaddons-devel kf6-ki18n-devel
 kf6-kpackage-devel kf6-kdeclarative-devel kf6-kirigami-devel
 libplasma-devel kf6-kiconthemes-devel kf6-kwidgetsaddons-devel
 kf6-ksvg-devel kf6-kcmutils-devel
 libxkbcommon-devel iso-codes libX11-devel libxkbfile-devel"
short_desc="Fcitx v5 - config tool"
maintainer="Đoàn Trần Công Danh <congdanhqx@gmail.com>"
license="GPL-2.0-or-later"
homepage="https://fcitx-im.org/wiki/Fcitx"
distfiles="https://download.fcitx-im.org/fcitx5/fcitx5-configtool/fcitx5-configtool-${version}.tar.zst"
checksum=4b18fe5c4c3706a3a6ad2332fabd9fc61754928b871e41f383031b88e87f9bb0
lib32disabled=yes

post_install() {
	# belongs to fcitx5-kcm
	rm ${DESTDIR}/usr/share/locale/*/*/kcm_fcitx5.mo
}

fcitx5-migrator_package() {
	short_desc="${short_desc/config/migration}"
	lib32disabled=yes
	pkg_install() {
		vmove usr/bin/fcitx5-migrator
		vmove "usr/lib/libFcitx5Migrator.so*"
		vmove usr/share/applications/org.fcitx.fcitx5-migrator.desktop
	}
}

fcitx5-kcm_package() {
	short_desc="KDE config module for Fcitx5"
	lib32disabled=yes
	depends="${sourcepkg}>=${version}_${revision}<=${version}_9999
	 kde-cli-tools"
	pkg_install() {
		vmove usr/bin/fcitx5-plasma-theme-generator
		vmove usr/lib/qt6/plugins
		vmove usr/share/applications/kcm_fcitx5.desktop
		DESTDIR=${PKGDESTDIR} \
			ninja -C build po/kcm_fcitx5/install
	}
}
