183.1. libxkbcommon-1.13.2
Keymap compiler and support library, with its Wayland tools and xkbcommon-x11
| Version | 1.13.2, release 1 |
| Shelf | input — Input-device libraries, keyboard data, input methods and on-screen keyboards |
| Phase | 42_graphics (Graphics Stack), 44 of 189 in build order |
| Licence | MIT AND MIT-open-group AND HPND AND HPND-sell-variant AND LicenseRef-digital-equipment-corporation |
| Homepage | https://xkbcommon.org/ |
| Build time | 4.0 SBU |
| Installed size | 1.4 MiB in 45 files |
| Recipe | ports/core/input/libxkbcommon/kpkgbuild |
About
libxkbcommon compiles a keyboard description (rules, model, layout, variant, options) from the xkeyboard-config database into a keymap, and turns key codes into key symbols and text as modifiers and layout groups change. Every Wayland compositor and client that reads a keyboard uses it, so it sits under the whole desktop: KWin links it, as do GTK, Qt, the browsers and most of the other ports that depend on it. A layout it cannot compile makes the compositor fall back to US for the whole session, the lock screen’s password prompt included.
It also installs libxkbregistry, which lists the layouts and options the database offers (built on libxml2), and the xkbcli tools. kbd builds against it too, which places kbd, and kdos-tools after it, in 42_graphics; see Build phases are named, banded and closed for that edge.
Sources
libxkbcommon-1.13.2.tar.gz(1.2 MiB)
sha256acc4d5f7c3cbba5f9f8d08d8bdbeede84ecede46792f47929aa9321873385528
upstream: https://github.com/xkbcommon/libxkbcommon/archive/refs/tags/xkbcommon-1.13.2.tar.gz
archive copy: sources-3/input--libxkbcommon-1.13.2.tar.gz
Dependencies
Depends on: xkeyboard-config, meson, libxml2, wayland, wayland-protocols, libxcb.
Required by (49): blender, chromium, fcitx5, fcitx5-configtool, fcitx5-gtk, fcitx5-qt, firefox-esr, fltk, glfw, gtk3, gtk4, imv, inlyne, kbd, kdeconnect, kodi, krdp, kwin, kwindowsystem, layer-shell-qt, libei, librepcb, librewolf, mesa-demos, mpv, obs-studio, orcaslicer, plasma-desktop, plasma-keyboard, plasma-workspace, qt5-qtbase, qt5-qtwayland, qt6-qtbase, qt6-qtwebengine, retroarch, sdl3, selenium-webdriver-at-spi, sniffnet, surfer, swayimg, thunderbird, webkitgtk, webkitgtk6, wev, wine, wlvncc, wxwidgets, xdg-desktop-portal-kde, xwayland.
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/42_graphics/phase.env && kpkg install libxkbcommon'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/input/libxkbcommon.
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/libxkbcommon
echo 'acc4d5f7c3cbba5f9f8d08d8bdbeede84ecede46792f47929aa9321873385528 libxkbcommon-1.13.2.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/libxkbcommon
SRC=$SRC_ROOT/libxkbcommon-1.13.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libxkbcommon-1.13.2.tar.gz -C "$SRC" --strip-components=1
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 five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
meson setup build --buildtype=release \
--prefix=/usr --sysconfdir=/etc --libdir=lib \
-Denable-wayland=true \
-Denable-x11=true \
-Denable-docs=false
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build
The switches, and why each is set:
-Denable-wayland=true— Build the Waylandxkbcliprograms:xkbcli interactive-wayland, which prints what each key press resolves to under a Wayland compositor, andxkbcli dump-keymap-wayland, which prints the keymap the compositor sends. They need wayland and wayland-protocols, and the configure step stops if either is missing.-Denable-x11=true— Buildlibxkbcommon-x11, which reads the keymap from an X server overxcb-xkb, from libxcb, and thexkbcli interactive-x11andxkbcli dump-keymap-x11tools. Qt’s xcb platform plugin needs the library for every Qt program that runs under Xwayland.-Denable-docs=false— Build no API documentation.
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/libxkbcommon, 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 libxkbcommon-1.13.2-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/libxkbcommon, and runs the triggers its paths call for.
Contents
Installed programs: xkbcli.
Installed libraries: libxkbcommon-x11.so, libxkbcommon.so, libxkbregistry.so.
Installed directories: /usr/include/xkbcommon, /usr/libexec/xkbcommon, /usr/share/licenses/libxkbcommon.
Short descriptions
xkbcli |
tool to interact with X Keyboard keymaps |
xkbcommon.pc |
XKB API common to servers and clients |
xkbcommon-x11.pc |
XKB API common to servers and clients - X11 support |
xkbregistry.pc |
XKB API to query available rules, models, layouts, variants and options |
Notes
The path to the layout database is compiled in. The configure step reads it from xkeyboard-config’s pkg-config file, and when that is missing it compiles in the legacy X11 path instead, with no error. xkeyboard-config has to be installed before this port is built, which its place in depends ensures.