According to [1], since 21.1 series of Xorg, XWayland is packaged
separately. The attached patch replaces xorg-xserver-xwayland by the
xwayland package.

However it looks like it's not working so far, the tests fail with:
--8<---------------cut here---------------start------------->8---
XKB: Failed to compile keymap
Keyboard initialization failed. This could be a missing or incorrect setup of 
xkeyboard-config.
(EE) 
Fatal server error:
(EE) Failed to activate virtual core keyboard: 2(EE)
--8<---------------cut here---------------end--------------->8---

I tried adding the same keyboard-related parameters as the ones in
xorg-server (xbk_dir and xkb_bin_dir), but it doesn't seem to
make a difference.

Does someone have an idea?


[1] https://lists.x.org/archives/xorg/2021-October/060799.html
From 457921b36c49c68e58ac067ede50637ce71a200c Mon Sep 17 00:00:00 2001
From: Guillaume Le Vaillant <g...@posteo.net>
Date: Wed, 17 Nov 2021 15:20:34 +0100
Subject: [PATCH] WIP: gnu: Replace xorg-server-xwayland by xwayland.

* gnu/packages/xorg.scm (xorg-server-xwayland): Remove varable.
  (xwayland): New variable.
* gnu/packages/enlightenment.scm (enlightenment)[inputs]: Replace
  xorg-server-xwayland by xwayland.
* gnu/packages/freedesktop.scm (weston)[inputs, arguments]: Idem.
* gnu/packages/gnome.scm (mutter)[inputs, arguments]: Idem.
* gnu/packages/wm.scm (wlroots)[inputs, arguments]: Idem.
---
 gnu/packages/enlightenment.scm |  2 +-
 gnu/packages/freedesktop.scm   |  4 +--
 gnu/packages/gnome.scm         |  4 +--
 gnu/packages/wm.scm            |  5 ++-
 gnu/packages/xorg.scm          | 63 +++++++++++++++++++++++++++-------
 5 files changed, 57 insertions(+), 21 deletions(-)

diff --git a/gnu/packages/enlightenment.scm b/gnu/packages/enlightenment.scm
index 8c7da4a5b4..9b3fcfabaa 100644
--- a/gnu/packages/enlightenment.scm
+++ b/gnu/packages/enlightenment.scm
@@ -369,7 +369,7 @@ (define-public enlightenment
        ("setxkbmap" ,setxkbmap)
        ("xcb-util-keysyms" ,xcb-util-keysyms)
        ("xkeyboard-config" ,xkeyboard-config)
-       ("xorg-server-xwayland" ,xorg-server-xwayland)))
+       ("xwayland" ,xwayland)))
     (propagated-inputs
      `(("efl" ,efl)
        ("libxkbcommon" ,libxkbcommon)
diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm
index 003da5c7a5..7511b2014c 100644
--- a/gnu/packages/freedesktop.scm
+++ b/gnu/packages/freedesktop.scm
@@ -1147,7 +1147,7 @@ (define-public weston
        ("pango" ,pango)
        ("pipewire" ,pipewire)
        ("wayland-protocols" ,wayland-protocols)
-       ("xorg-server-xwayland" ,xorg-server-xwayland)))
+       ("xwayland" ,xwayland)))
     (propagated-inputs
      `(("libxkbcommon" ,libxkbcommon)
        ("pixman" ,pixman)
@@ -1164,7 +1164,7 @@ (define-public weston
         "-Dbackend-default=auto"
         "-Dsystemd=false"
         (string-append "-Dxwayland-path="
-                       (assoc-ref %build-inputs "xorg-server-xwayland")
+                       (assoc-ref %build-inputs "xwayland")
                        "/bin/Xwayland"))
        #:parallel-tests? #f           ; Parallel tests cause failures.
        #:phases
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 39ab43c90c..73af9eddd9 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -7507,7 +7507,7 @@ (define-public mutter
 
              ;; The following flags are needed for the bundled clutter
              (string-append "-Dxwayland_path="
-                            (assoc-ref %build-inputs "xorg-server-xwayland")
+                            (assoc-ref %build-inputs "xwayland")
                             "/bin/Xwayland")
 
              ;; the remaining flags are needed for the bundled cogl
@@ -7572,7 +7572,7 @@ (define-public mutter
        ("startup-notification" ,startup-notification)
        ("upower-glib" ,upower)
        ("xkeyboard-config" ,xkeyboard-config)
-       ("xorg-server-xwayland" ,xorg-server-xwayland)
+       ("xwayland" ,xwayland)
        ("zenity" ,zenity)))
     (synopsis "Window and compositing manager")
     (home-page "https://www.gnome.org";)
diff --git a/gnu/packages/wm.scm b/gnu/packages/wm.scm
index e19a08da47..b746d68485 100644
--- a/gnu/packages/wm.scm
+++ b/gnu/packages/wm.scm
@@ -1486,8 +1486,7 @@ (define-public wlroots
          (add-before 'configure 'hardcode-paths
            (lambda* (#:key inputs #:allow-other-keys)
              (substitute* "xwayland/server.c"
-               (("Xwayland") (string-append (assoc-ref inputs
-                                                       "xorg-server-xwayland")
+               (("Xwayland") (string-append (assoc-ref inputs "xwayland")
                                             "/bin/Xwayland")))
              #t)))))
     (propagated-inputs
@@ -1503,7 +1502,7 @@ (define-public wlroots
        ("wayland-protocols" ,wayland-protocols)
        ("xcb-util-errors" ,xcb-util-errors)
        ("xcb-util-wm" ,xcb-util-wm)
-       ("xorg-server-xwayland" ,xorg-server-xwayland)))
+       ("xwayland" ,xwayland)))
     (native-inputs
      `(("pkg-config" ,pkg-config)))
     (home-page "https://github.com/swaywm/wlroots";)
diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index 574562f065..e387474990 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -32,6 +32,7 @@
 ;;; Copyright © 2021 Matthew James Kraai <kr...@ftbfs.org>
 ;;; Copyright © 2021 Maxime Devos <maximede...@telenet.be>
 ;;; Copyright © 2021 qblade <qbl...@protonmail.com>
+;;; Copyright © 2021 Guillaume Le Vaillant <g...@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -75,6 +76,7 @@ (define-module (gnu packages xorg)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages gperf)
+  #:use-module (gnu packages graphics)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages haskell-xyz)
   #:use-module (gnu packages inkscape)
@@ -86,6 +88,7 @@ (define-module (gnu packages xorg)
   #:use-module (gnu packages llvm)
   #:use-module (gnu packages m4)
   #:use-module (gnu packages ncurses)
+  #:use-module (gnu packages onc-rpc)
   #:use-module (gnu packages pciutils)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages perl-check)
@@ -5518,22 +5521,56 @@ (define-public xorg-server-for-tests
    (package
      (inherit xorg-server))))
 
-(define-public xorg-server-xwayland
-  (package/inherit xorg-server
-    (name "xorg-server-xwayland")
+(define-public xwayland
+  (package
+    (name "xwayland")
+    (version "21.1.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://xorg.freedesktop.org/archive/individual";
+                           "/xserver/xwayland-" version ".tar.xz"))
+       (sha256
+        (base32 "18pqvg76grbsyxa3mm3j06i1l8cwb28nbn2gcnqpsk7x75zpbhpb"))))
+    (build-system meson-build-system)
+    (native-inputs
+     `(("pkg-config" ,pkg-config)))
     (inputs
-     `(("wayland" ,wayland)
+     `(("egl-wayland" ,egl-wayland)
+       ("font-util" ,font-util)
+       ("libbsd" ,libbsd)
+       ("libdrm" ,libdrm)
+       ("libepoxy" ,libepoxy)
+       ("libgcrypt" ,libgcrypt)
+       ("libtirpc" ,libtirpc)
+       ("libx11" ,libx11)
+       ("libxfont2" ,libxfont2)
+       ("libxkbfile" ,libxkbfile)
+       ("libxshmfence" ,libxshmfence)
+       ("pixman" ,pixman)
+       ("wayland" ,wayland)
        ("wayland-protocols" ,wayland-protocols)
-       ,@(package-inputs xorg-server)))
+       ("xkbcomp" ,xkbcomp)
+       ("xkeyboard-config" ,xkeyboard-config)
+       ("xorgproto" ,xorgproto)
+       ("xtrans" ,xtrans)))
     (arguments
-     (substitute-keyword-arguments (package-arguments xorg-server)
-       ((#:configure-flags flags)
-        `(cons* "--enable-xwayland" "--disable-xorg"
-                "--disable-docs"    "--disable-devel-docs"
-                "--disable-xvfb"    "--disable-xnest"
-                "--disable-xquartz" "--disable-xwin"
-                ,flags))))
-    (synopsis "Xorg server with wayland backend")))
+     `(#:tests? #f ; FIXME
+       #:configure-flags
+       (list (string-append "-Dxkb_dir="
+                            (assoc-ref %build-inputs "xkeyboard-config")
+                            "/share/X11/xkb")
+             "-Dxkb_output_dir=/tmp"
+             (string-append "-Dxkb_bin_dir="
+                            (assoc-ref %build-inputs "xkbcomp")
+                            "/bin")
+             "-Ddefault_font_path=")))
+    (home-page "https://wayland.freedesktop.org/xserver.html";)
+    (synopsis "X server with Wayland backend")
+    (description
+     "XWayland is an X server running on Wayland to provide backwards
+compatibility for legacy X11 applications.")
+    (license license:x11)))
 
 
 ;; packages of height 4 in the propagated-inputs tree
-- 
2.33.1

Attachment: signature.asc
Description: PGP signature

Reply via email to