347.3. fcitx5-chinese-addons-5.1.14
Pinyin, shuangpin and table input for fcitx5
| Version | 5.1.14, release 1 |
| Shelf | input — Input-device libraries, keyboard data, input methods and on-screen keyboards |
| Phase | 50_desktop (Desktop), 16 of 92 in build order |
| Licence | LGPL-2.1-or-later AND GPL-2.0-or-later |
| Homepage | https://github.com/fcitx/fcitx5-chinese-addons |
| Build time | 0.7 SBU |
| Installed size | 4.4 MiB in 187 files |
| Recipe | ports/core/input/fcitx5-chinese-addons/kpkgbuild |
About
The Chinese engines for fcitx5: pinyin, shuangpin and the table-based methods (Wubi, Cangjie and the rest), on top of libime, with the modules that go with them: simplified-to-traditional conversion, the pinyin and stroke helpers that show how a character is typed, and punctuation. It is the Chinese engine among the language engines KDOS builds; the input method as a whole is described in Input methods.
Two of upstream’s features are left out: the Qt editors for custom phrases and pinyin dictionaries, and cloud pinyin.
Sources
fcitx5-chinese-addons-5.1.14.tar.zst(392.0 KiB)
sha25627d84584fa88ab4648838ab6afeab66356d6351c19e6da386a2fedd4ad5a3dbf
upstream: https://download.fcitx-im.org/fcitx5/fcitx5-chinese-addons/fcitx5-chinese-addons-5.1.14.tar.zst
archive copy: sources-3/input--fcitx5-chinese-addons-5.1.14.tar.zstpy_table-20121124.tar.gz(182.4 KiB)
sha25642146ac97de6c13d55f9e99ed873915f4c66739e9c11532a34556badf9792c04
upstream: https://download.fcitx-im.org/data/py_table-20121124.tar.gz
archive copy: sources-3/input--py_table-20121124.tar.gzpy_stroke-20250329.tar.gz(435.5 KiB)
sha256c1a7ca7225d3614ab83353fc827503006a980447762018f53760425d7b5303a6
upstream: https://download.fcitx-im.org/data/py_stroke-20250329.tar.gz
archive copy: sources-3/input--py_stroke-20250329.tar.gz
Dependencies
Depends on: cmake, extra-cmake-modules, fcitx5, libime, opencc, nlohmann-json, boost, gettext.
Required by (1): kde-plasma.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/50_desktop/phase.env && kpkg install fcitx5-chinese-addons'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/input/fcitx5-chinese-addons.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/input/fcitx5-chinese-addons
echo '27d84584fa88ab4648838ab6afeab66356d6351c19e6da386a2fedd4ad5a3dbf fcitx5-chinese-addons-5.1.14.tar.zst' | sha256sum -c -
echo '42146ac97de6c13d55f9e99ed873915f4c66739e9c11532a34556badf9792c04 py_table-20121124.tar.gz' | sha256sum -c -
echo 'c1a7ca7225d3614ab83353fc827503006a980447762018f53760425d7b5303a6 py_stroke-20250329.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/fcitx5-chinese-addons
SRC=$SRC_ROOT/fcitx5-chinese-addons-5.1.14
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
cp fcitx5-chinese-addons-5.1.14.tar.zst "$SRC"
tar --no-same-permissions --warning=no-unknown-keyword -xf py_table-20121124.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf py_stroke-20250329.tar.gz -C "$SRC_ROOT"
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the recipe’s helpers _pytable, _pystroke and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
tar -xf "$PORT_SRC/$name-$version.tar.zst" --strip-components=1
cp "$PORT_SRC/$_pytable" "$PORT_SRC/$_pystroke" modules/pinyinhelper/
cmake -S . -B build -G Ninja \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D ENABLE_GUI=Off \
-D ENABLE_BROWSER=Off \
-D ENABLE_CLOUDPINYIN=Off \
-D ENABLE_OPENCC=On \
-D ENABLE_TEST=Off \
-D ENABLE_DATA=On \
-D ENABLE_TOOLS=On \
-D CMAKE_DISABLE_FIND_PACKAGE_Fcitx5ModuleLuaAddonLoader=ON \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
The switches, and why each is set:
-D ENABLE_GUI=Off— Builds neither Qt plugin that upstream’s settings window loads: the custom phrase editor and the pinyin dictionary manager, installed under/usr/lib/fcitx5/qt6. Both linkFcitx5Qt6WidgetsAddonsfrom fcitx5-qt, which is not in this port’sdepends. The engines’ ordinary options are still set on the Input Method page of fcitx5-configtool, and custom phrases are the text file~/.local/share/fcitx5/pinyin/customphrase.-D ENABLE_BROWSER=Off— Builds no built-in browser for the dictionary manager, which would need Qt WebEngine. It is read only whenENABLE_GUIis on.-D ENABLE_CLOUDPINYIN=Off— Builds no cloud pinyin addon, which sends the pinyin being typed to an online service and offers what comes back as a candidate: off, what is typed never leaves the machine. With it on, configure also requires curl’slibcurl.-D ENABLE_OPENCC=On— Adds opencc as a second backend to thechttransmodule, which converts between simplified and traditional characters; without it the module has only its built-in character table,gbks2t.tab. Once on, OpenCC and nlohmann-json are required at configure time.-D ENABLE_DATA=On— Compiles the pinyin engine’schaizi.dict, the dictionary of characters by their components, with libime’slibime_pinyindict.-D ENABLE_TOOLS=On— Builds and installsscel2org5, which converts a Sogou.scelword list into libime’s text dictionary format, the inputlibime_pinyindictcompiles.-D CMAKE_DISABLE_FIND_PACKAGE_Fcitx5ModuleLuaAddonLoader=ON— Makes CMake skip the search for fcitx5’s Lua addon loader. Upstream looks for it with afind_packagethat no option controls, and links the pinyin engine against it when it is found. There is no fcitx5-lua port, and the switch keeps the result from depending on what else is installed.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/fcitx5-chinese-addons, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf fcitx5-chinese-addons-5.1.14-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/fcitx5-chinese-addons, and runs the triggers its paths call for.
Contents
Installed programs: scel2org5.
Installed directories: /usr/include/Fcitx5/Module/fcitx-module/pinyinhelper, /usr/include/Fcitx5/Module/fcitx-module/punctuation, /usr/lib/cmake/Fcitx5ModulePinyinHelper, /usr/lib/cmake/Fcitx5ModulePunctuation, /usr/share/fcitx5/chttrans, /usr/share/fcitx5/pinyin, /usr/share/fcitx5/pinyinhelper, /usr/share/fcitx5/punctuation, /usr/share/licenses/fcitx5-chinese-addons.
Notes
The pinyin helper module fetches two data sets with file(DOWNLOAD) at build time, the pinyin table and the stroke table, and the build runs with no network. As for libime, the download step does nothing when the archive with the expected sha256 is already where it would write it, so build.sh copies both archives, still packed, into modules/pinyinhelper/. These two are prebuilt .mb tables that the module extracts and installs as they are; they are among the data files What is built from source exempts, as they have no other source form. kpkg does not unpack a .tar.zst, so build.sh unpacks the source archive itself.
Each table’s name and sha256 are written twice, in kpkgbuild and in modules/pinyinhelper/CMakeLists.txt, and a release that moves to newer tables needs both changed. Otherwise the build is left without the table: upstream’s step deletes a copy whose hash does not match without fetching another, and tries the network for a file name it does not find.