summary refs log tree commit diff
path: root/pkgs/development/libraries/libxkbcommon
diff options
context:
space:
mode:
authorMichael Weiss <dev.primeos@gmail.com>2021-01-25 14:52:05 +0100
committerGitHub <noreply@github.com>2021-01-25 14:52:05 +0100
commit428e0fdc540fb01cb02720009e40f83308877f34 (patch)
treee073b0181d8436ded4b543805794be58d394d9e5 /pkgs/development/libraries/libxkbcommon
parent464a247e93f43577a49a0c8666c30ce9a8aa3f87 (diff)
downloadnixpkgs-428e0fdc540fb01cb02720009e40f83308877f34.tar
nixpkgs-428e0fdc540fb01cb02720009e40f83308877f34.tar.gz
nixpkgs-428e0fdc540fb01cb02720009e40f83308877f34.tar.bz2
nixpkgs-428e0fdc540fb01cb02720009e40f83308877f34.tar.lz
nixpkgs-428e0fdc540fb01cb02720009e40f83308877f34.tar.xz
nixpkgs-428e0fdc540fb01cb02720009e40f83308877f34.tar.zst
nixpkgs-428e0fdc540fb01cb02720009e40f83308877f34.zip
libxkbcommon: Add a "USE flag" for Wayland support (#110693)
This can be used to enable the optional "interactive-wayland" subcommand
of xkbcli.
Diffstat (limited to 'pkgs/development/libraries/libxkbcommon')
-rw-r--r--pkgs/development/libraries/libxkbcommon/default.nix14
-rw-r--r--pkgs/development/libraries/libxkbcommon/fix-cross-compilation.patch20
2 files changed, 31 insertions, 3 deletions
diff --git a/pkgs/development/libraries/libxkbcommon/default.nix b/pkgs/development/libraries/libxkbcommon/default.nix
index c0785b34e89..5d9878c33f4 100644
--- a/pkgs/development/libraries/libxkbcommon/default.nix
+++ b/pkgs/development/libraries/libxkbcommon/default.nix
@@ -2,6 +2,8 @@
 , xkeyboard_config, libxcb, libxml2
 , python3
 , libX11
+# To enable the "interactive-wayland" subcommand of xkbcli:
+, withWaylandSupport ? false, wayland, wayland-protocols
 }:
 
 stdenv.mkDerivation rec {
@@ -13,18 +15,24 @@ stdenv.mkDerivation rec {
     sha256 = "0lmwglj16anhpaq0h830xsl1ivknv75i4lir9bk88aq73s2jy852";
   };
 
+  patches = [
+    ./fix-cross-compilation.patch
+  ];
+
   outputs = [ "out" "dev" "doc" ];
 
-  nativeBuildInputs = [ meson ninja pkg-config yacc doxygen ];
-  buildInputs = [ xkeyboard_config libxcb libxml2 ];
+  nativeBuildInputs = [ meson ninja pkg-config yacc doxygen ]
+    ++ lib.optional withWaylandSupport wayland;
+  buildInputs = [ xkeyboard_config libxcb libxml2 ]
+    ++ lib.optionals withWaylandSupport [ wayland wayland-protocols ];
   checkInputs = [ python3 ];
 
   mesonFlags = [
     "-Dxkb-config-root=${xkeyboard_config}/etc/X11/xkb"
     "-Dxkb-config-extra-path=/etc/xkb" # default=$sysconfdir/xkb ($out/etc)
     "-Dx-locale-root=${libX11.out}/share/X11/locale"
-    "-Denable-wayland=false"
     "-Denable-xkbregistry=false" # Optional, separate library (TODO: Install into extra output)
+    "-Denable-wayland=${lib.boolToString withWaylandSupport}"
   ];
 
   doCheck = true;
diff --git a/pkgs/development/libraries/libxkbcommon/fix-cross-compilation.patch b/pkgs/development/libraries/libxkbcommon/fix-cross-compilation.patch
new file mode 100644
index 00000000000..55730554a90
--- /dev/null
+++ b/pkgs/development/libraries/libxkbcommon/fix-cross-compilation.patch
@@ -0,0 +1,20 @@
+diff --git a/meson.build b/meson.build
+index 47c436f..536c60b 100644
+--- a/meson.build
++++ b/meson.build
+@@ -440,13 +440,12 @@ if build_tools
+     if get_option('enable-wayland')
+         wayland_client_dep = dependency('wayland-client', version: '>=1.2.0', required: false)
+         wayland_protocols_dep = dependency('wayland-protocols', version: '>=1.12', required: false)
+-        wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)
+-        if not wayland_client_dep.found() or not wayland_protocols_dep.found() or not wayland_scanner_dep.found()
++        if not wayland_client_dep.found() or not wayland_protocols_dep.found()
+             error('''The Wayland xkbcli programs require wayland-client >= 1.2.0, wayland-protocols >= 1.7 which were not found.
+ You can disable the Wayland xkbcli programs with -Denable-wayland=false.''')
+         endif
+ 
+-        wayland_scanner = find_program(wayland_scanner_dep.get_pkgconfig_variable('wayland_scanner'))
++        wayland_scanner = find_program('wayland-scanner', native: true)
+         wayland_scanner_code_gen = generator(
+             wayland_scanner,
+             output: '@BASENAME@-protocol.c',