347.9. fcitx5-gtk-5.1.7
Fcitx 5 input-method modules for GTK 3 and GTK 4
5.1.7-1 · LGPL-2.1-or-later · 0.1 SBU · 417.7 KiB, 16 files · 50_desktop, 22 of 92 · ports/core/input/fcitx5-gtk
Homepage: https://github.com/fcitx/fcitx5-gtk
Why it is in KDOS. The comment above it in script/phases/50_desktop/packages.txt:
Fcitx 5's GTK 3 and GTK 4 input-method modules, which reach fcitx5 over the session bus: the route a GTK program under Xwayland has to it.
fcitx5-gtk is fcitx5’s GTK side: an input-method module for GTK 3 (/usr/lib/gtk-3.0/3.0.0/immodules/im-fcitx5.so) and one for GTK 4 (/usr/lib/gtk-4.0/4.0.0/immodules/libim-fcitx5.so), both built on libFcitx5GClient, the D-Bus client for the running fcitx5 that the package also installs. A GTK program that loads the module speaks to fcitx5 over the session bus directly, without KWin’s text-input between them, so the module is what gives a GTK program on X11 (under Xwayland) an input method. fcitx5-gtk3-immodule-probing and fcitx5-gtk4-immodule-probing print which module a GTK program would choose; fcitx5-diagnose runs them.
Which module a GTK program chooses when GTK_IM_MODULE is unset differs between the two toolkits, and the Input methods section of the session chapter says which route each one takes.
Depends on: cmake, ninja, extra-cmake-modules, glib, gtk3, gtk4, libxkbcommon, libX11.
Required by (1): kde-plasma.
Sources: fcitx5-gtk-5.1.7.tar.zst (67.9 KiB). Every step kpkg takes applies to this port.
Install: script/chroot/exec.sh bash -c 'source script/phases/50_desktop/phase.env && kpkg install fcitx5-gtk'
build.sh:
tar -xf "$PORT_SRC/$name-$version.tar.zst" --strip-components=1
cmake -S . -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D ENABLE_GTK2_IM_MODULE=OFF \
-D ENABLE_GTK3_IM_MODULE=ON \
-D ENABLE_GTK4_IM_MODULE=ON \
-D ENABLE_GIR=OFF \
-D FCITX5_GTK_VERSION=$version \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
immod=/usr/lib/gtk-3.0/3.0.0
cache=$(LD_LIBRARY_PATH="$PKG/usr/lib" gtk-query-immodules-3.0 "$PKG$immod/immodules/im-fcitx5.so")
grep -q '"fcitx5"' <<<"$cache"
printf '%s\n' "${cache//"$PKG"/}" > "$PKG$immod/immodules.cache"
-D ENABLE_GTK2_IM_MODULE=OFF— No GTK 2 module. Upstream builds one by default and then requires GTK 2, which is not a port.-D ENABLE_GTK3_IM_MODULE=ON,-D ENABLE_GTK4_IM_MODULE=ON— The two modules, named because each one is the reason for a gtk3 or gtk4 dependency. Both GTKs are built with their X11 backend, so both modules link libX11 as well.-D ENABLE_GIR=OFF— NoFcitxG-1.0GObject introspection data forlibFcitx5GClient. Nothing in the tree loads it, and building it would make gobject-introspection a dependency.-D FCITX5_GTK_VERSION=$version— The version on theVersion:line ofFcitx5GClient.pc. The template reads this variable and upstream’s CMake never sets it, so the line would be empty, andkpkg’s lint refuses a package whose pkg-config file has an emptyVersion.
Programs: fcitx5-gtk3-immodule-probing, fcitx5-gtk4-immodule-probing.
Libraries: libFcitx5GClient.so.
Directories: /usr/include/Fcitx5/GClient, /usr/lib/cmake/Fcitx5GClient, /usr/lib/gtk-3.0/3.0.0/immodules, /usr/lib/gtk-4.0, /usr/share/licenses/fcitx5-gtk.
GTK 3 loads a module that is not compiled into libgtk-3 only through the list in /usr/lib/gtk-3.0/3.0.0/immodules.cache, and gtk3 is built with every one of its own modules compiled in, so it installs no such list. build.sh writes it from the staged module with gtk-query-immodules-3.0, with the staging directory on LD_LIBRARY_PATH so that the module’s own libFcitx5GClient resolves, and strips the staging prefix from the path the tool records. A list that does not name fcitx5 fails the build instead of shipping a module GTK 3 never loads. This package owns the file; a second port with a loadable GTK 3 module would have to write the list for both.
GTK 4 needs no such list: it loads every module in immodules/ through GIO’s extension points.
The source is a .tar.zst, which kpkg copies into the work directory whole instead of unpacking; build.sh unpacks it, as the other fcitx5 recipes do.