libxkbcommon ported to the zig build system
  • C 90.3%
  • Zig 9.7%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-10-14 22:37:13 +02:00
.github/workflows CI: do not run on latest nightly Zig version 2025-08-31 01:32:18 +02:00
.gitattributes initial commit 2024-12-18 21:05:44 +01:00
.gitignore update to Zig 0.16.0 2026-10-01 22:02:04 +02:00
build.zig update to Zig 0.17.0 2026-10-14 22:37:13 +02:00
build.zig.zon update to Zig 0.17.0 2026-10-14 22:37:13 +02:00
LICENSE initial commit 2024-12-18 21:05:44 +01:00
parser.c update upstream to 1.13.1 2026-04-13 21:44:13 +02:00
parser.h update upstream to 1.13.1 2026-04-13 21:44:13 +02:00
README.md update to Zig 0.17.0 2026-10-14 22:37:13 +02:00

CI

libxkbcommon

This is libxkbcommon, packaged for Zig.

Installation

First, update your build.zig.zon:

# Initialize a `zig build` project if you haven't already
zig init
zig fetch --save git+https://github.com/allyourcodebase/libxkbcommon.git#1.13.2

You can then import libxkbcommon in your build.zig with:

const libxkbcommon_dependency = b.dependency("libxkbcommon", .{
    .target = target,
    .optimize = optimize,

    // The system install prefix. Defaults to `/usr` which matches most distributions.
    // This does not work on distributions that don't follow the Filesystem Hierarchy Standard (FHS) like NixOS.
    // .@"install-prefix" = "/usr/local/",

    // Set the XKB config root.
    // Will default to "${INSTALL_PREFIX}/share/X11/xkb" i.e. `zig-out/share/X11/xkb`.
    // Most distributions will use `/usr/share/X11/xkb`.
    //
    // The value `""` will not set a default config root directory.
    // To configure the config root at runtime, use the "XKB_CONFIG_ROOT" environment variable.
    //
    // This example will assume that the config root of the host system is in `/usr`.
    // This does not work on distributions that don't follow the Filesystem Hierarchy Standard (FHS) like NixOS.
    .@"xkb-config-root" = "/usr/share/X11/xkb",
    .@"xkb-legacy-root" = "/usr/share/X11/xkb", // Legacy X11 config root

    // The X locale root.
    // Will default to "${INSTALL_PREFIX}/share/X11/locale" i.e. `zig-out/share/X11/locale`.
    // Most distributions will use `/usr/share/X11/locale`.
    //
    // To configure the config root at runtime, use the "XLOCALEDIR" environment variable.
    //
    // This example will assume that the config root of the host system is in `/usr`.
    // This does not work on distributions that don't follow the Filesystem Hierarchy Standard (FHS) like NixOS.
    .@"x-locale-root" = "/usr/share/X11/locale",
});
your_exe.linkLibrary(libxkbcommon_dependency.artifact("libxkbcommon"));

For more information, please refer to the XKB data locations docs of libxkbcommon.