1{ lib
2, stdenv
3, fetchurl
4, meson
5, ninja
6, pkg-config
7, bison
8, doxygen
9, xkeyboard_config
10, libxcb
11, libxml2
12, python3
13, libX11
14 # To enable the "interactive-wayland" subcommand of xkbcli. This is the
15 # wayland equivalent of `xev` on X11.
16, withWaylandTools ? stdenv.isLinux
17, wayland
18, wayland-protocols
19, wayland-scanner
20}:
21
22stdenv.mkDerivation rec {
23 pname = "libxkbcommon";
24 version = "1.5.0";
25
26 src = fetchurl {
27 url = "https://xkbcommon.org/download/${pname}-${version}.tar.xz";
28 sha256 = "sha256-Vg8RxLu8oQ9JXz7306aqTKYrT4+wtS59RZ0Yom5G4Bc=";
29 };
30
31 outputs = [ "out" "dev" "doc" ];
32
33 depsBuildBuild = [ pkg-config ];
34 nativeBuildInputs = [ meson ninja pkg-config bison doxygen ]
35 ++ lib.optional withWaylandTools wayland-scanner;
36 buildInputs = [ xkeyboard_config libxcb libxml2 ]
37 ++ lib.optionals withWaylandTools [ wayland wayland-protocols ];
38 nativeCheckInputs = [ python3 ];
39
40 mesonFlags = [
41 "-Dxkb-config-root=${xkeyboard_config}/etc/X11/xkb"
42 "-Dxkb-config-extra-path=/etc/xkb" # default=$sysconfdir/xkb ($out/etc)
43 "-Dx-locale-root=${libX11.out}/share/X11/locale"
44 "-Denable-wayland=${lib.boolToString withWaylandTools}"
45 ];
46
47 doCheck = true;
48 preCheck = ''
49 patchShebangs ../test/
50 '';
51
52 meta = with lib; {
53 description = "A library to handle keyboard descriptions";
54 longDescription = ''
55 libxkbcommon is a keyboard keymap compiler and support library which
56 processes a reduced subset of keymaps as defined by the XKB (X Keyboard
57 Extension) specification. It also contains a module for handling Compose
58 and dead keys.
59 ''; # and a separate library for listing available keyboard layouts.
60 homepage = "https://xkbcommon.org";
61 changelog = "https://github.com/xkbcommon/libxkbcommon/blob/xkbcommon-${version}/NEWS";
62 license = licenses.mit;
63 maintainers = with maintainers; [ primeos ttuegel ];
64 mainProgram = "xkbcli";
65 platforms = with platforms; unix;
66 pkgConfigModules = [
67 "xkbcommon"
68 "xkbcommon-x11"
69 "xkbregistry"
70 ];
71 };
72}