diff mbox series

[v1,1/1] package/x11r7/xwayland: new package

Message ID 20230215143534.19834-1-raphael.pavlidis@gmail.com
State Superseded
Headers show
Series [v1,1/1] package/x11r7/xwayland: new package | expand

Commit Message

Raphael Pavlidis Feb. 15, 2023, 2:35 p.m. UTC
XServer to run X clients under wayland

This XServer is required to run the X clients under Wayland compositor,
for example weston or wlroots based compositors.

Signed-off-by: Raphael Pavlidis <raphael.pavlidis@gmail.com>
---
 DEVELOPERS                           |  1 +
 package/weston/Config.in             |  8 +++
 package/weston/weston.mk             |  2 +-
 package/wlroots/Config.in            | 12 ++++
 package/wlroots/wlroots.mk           |  6 +-
 package/x11r7/Config.in              |  1 +
 package/x11r7/xwayland/Config.in     | 26 ++++++++
 package/x11r7/xwayland/xwayland.hash |  6 ++
 package/x11r7/xwayland/xwayland.mk   | 94 ++++++++++++++++++++++++++++
 9 files changed, 154 insertions(+), 2 deletions(-)
 create mode 100644 package/x11r7/xwayland/Config.in
 create mode 100644 package/x11r7/xwayland/xwayland.hash
 create mode 100644 package/x11r7/xwayland/xwayland.mk

Comments

Thomas Petazzoni Feb. 15, 2023, 8:22 p.m. UTC | #1
Hello 

On Wed, 15 Feb 2023 15:35:34 +0100
Raphael Pavlidis <raphael.pavlidis@gmail.com> wrote:

> XServer to run X clients under wayland
> 
> This XServer is required to run the X clients under Wayland compositor,
> for example weston or wlroots based compositors.
> 
> Signed-off-by: Raphael Pavlidis <raphael.pavlidis@gmail.com>

Thanks for the patch! I have a few questions/suggestions below.

>  DEVELOPERS                           |  1 +
>  package/weston/Config.in             |  8 +++
>  package/weston/weston.mk             |  2 +-
>  package/wlroots/Config.in            | 12 ++++
>  package/wlroots/wlroots.mk           |  6 +-
>  package/x11r7/Config.in              |  1 +
>  package/x11r7/xwayland/Config.in     | 26 ++++++++
>  package/x11r7/xwayland/xwayland.hash |  6 ++
>  package/x11r7/xwayland/xwayland.mk   | 94 ++++++++++++++++++++++++++++
>  9 files changed, 154 insertions(+), 2 deletions(-)

This should probably be split into 3 patches: one adding the xwayland
package, one tweaking the existing weston package, and one tweaking the
wlroots package.


> diff --git a/package/weston/Config.in b/package/weston/Config.in
> index 3b4e932b7d..db12afc43a 100644
> --- a/package/weston/Config.in
> +++ b/package/weston/Config.in
> @@ -111,14 +111,22 @@ config BR2_PACKAGE_WESTON_XWAYLAND
>  	bool "XWayland support"
>  	depends on BR2_PACKAGE_XORG7
>  	depends on BR2_PACKAGE_LIBEPOXY
> +	depends on BR2_USE_MMU # xwayland
> +	depends on !BR2_STATIC_LIBS # xwayland
> +	depends on BR2_TOOLCHAIN_HAS_THREADS # xwayland
>  	select BR2_PACKAGE_CAIRO
>  	select BR2_PACKAGE_LIBXCB
>  	select BR2_PACKAGE_XLIB_LIBX11
>  	select BR2_PACKAGE_XLIB_LIBXCURSOR
> +	select BR2_PACKAGE_XWAYLAND

So does that means that the current BR2_PACKAGE_WESTON_XWAYLAND option
is broken?

I am rather confused by how XWayland works. Isn't XWayland a normal
Wayland client? Why does Weston or wlroots, as Wayland compositors,
need to have some support/knowledge for XWayland?

> +config BR2_PACKAGE_WLROOTS_XWAYLAND
> +	bool "XWayland support"
> +	depends on BR2_PACKAGE_XORG7 # libxcb, xcb-util-wm, xwayland
> +	select BR2_PACKAGE_LIBXCB
> +	select BR2_PACKAGE_XCB_UTIL_WM
> +	select BR2_PACKAGE_XWAYLAND

Since you're selecting BR2_PACKAGE_XWAYLAND, you need to replicate:

	depends on BR2_USE_MMU # fork()
	depends on !BR2_STATIC_LIBS # wayland
	depends on BR2_TOOLCHAIN_HAS_THREADS # wayland

and add the corresponding Config.in comment.

> diff --git a/package/wlroots/wlroots.mk b/package/wlroots/wlroots.mk
> index 4f14d20b11..5b930a51be 100644
> --- a/package/wlroots/wlroots.mk
> +++ b/package/wlroots/wlroots.mk
> @@ -30,8 +30,12 @@ WLROOTS_BACKENDS = libinput drm
>  
>  ifeq ($(BR2_PACKAGE_WLROOTS_X11),y)
>  WLROOTS_BACKENDS += x11
> -WLROOTS_CONF_OPTS += -Dxwayland=enabled

So this is also a bug in the current package?

What is WLROOTS_X11 controlling then? Running wlroots as a X11 client?

Otherwise, the xwayland package looks fine from a pure review point of
view (I did not do any testing).

Thanks!

Thomas
Raphael Pavlidis Feb. 16, 2023, 6:31 p.m. UTC | #2
Hi Thomas,

On 15.02.23 21:22, Thomas Petazzoni wrote:
[SNIP]
> 
> This should probably be split into 3 patches: one adding the xwayland
> package, one tweaking the existing weston package, and one tweaking the
> wlroots package.
> 
> 

Okay, I will split the commit into 3 patches.

[SNIP]
> 
> So does that means that the current BR2_PACKAGE_WESTON_XWAYLAND option
> is broken?
> 

Yes, it is broken. To use the XWayland support, you need the XWayland 
binary, which is not build yet by buildroot.


> I am rather confused by how XWayland works. Isn't XWayland a normal
> Wayland client? Why does Weston or wlroots, as Wayland compositors,
> need to have some support/knowledge for XWayland?

Yes, as far as I know, it is a Wayland client. It acts as an XServer, 
which X11 application connects to, and then it forward (lets say) to the 
Wayland compositor. The Wayland compositor executes the XWayland server. 
The compositor needs the xwayland as build dependency, because in the 
.pc file it is written, where the xwayland binary is located and which 
features are enabled.

https://gitlab.freedesktop.org/wlroots/wlroots/-/blob/master/xwayland/meson.build#L65

[SNIP]
> 
> Since you're selecting BR2_PACKAGE_XWAYLAND, you need to replicate:
> 
> 	depends on BR2_USE_MMU # fork()
> 	depends on !BR2_STATIC_LIBS # wayland
> 	depends on BR2_TOOLCHAIN_HAS_THREADS # wayland
> 
> and add the corresponding Config.in comment.
> 

Good point, I forgot that.

[SNIP]
> 
> So this is also a bug in the current package?
> 
> What is WLROOTS_X11 controlling then? Running wlroots as a X11 client?

The X11 backend has nothing to do with the XWayland support. X11 backend 
means that the compositor can run on an XServer. The XWayland support 
means that X11 application can run on the Wayland compositor.

[SNIP]

Thanks,
Raphael Pavlidis
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index df2b98ad53..b240b7c92a 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -2515,6 +2515,7 @@  F:	support/testing/tests/package/test_python_s3transfer.py
 N:	Raphael Pavlidis <raphael.pavlidis@gmail.com>
 F:	package/slirp4netns/
 F:	package/sway/
+F:	package/x11r7/xwayland/
 
 N:	Refik Tuzakli <tuzakli.refik@gmail.com>
 F:	package/freescale-imx/
diff --git a/package/weston/Config.in b/package/weston/Config.in
index 3b4e932b7d..db12afc43a 100644
--- a/package/weston/Config.in
+++ b/package/weston/Config.in
@@ -111,14 +111,22 @@  config BR2_PACKAGE_WESTON_XWAYLAND
 	bool "XWayland support"
 	depends on BR2_PACKAGE_XORG7
 	depends on BR2_PACKAGE_LIBEPOXY
+	depends on BR2_USE_MMU # xwayland
+	depends on !BR2_STATIC_LIBS # xwayland
+	depends on BR2_TOOLCHAIN_HAS_THREADS # xwayland
 	select BR2_PACKAGE_CAIRO
 	select BR2_PACKAGE_LIBXCB
 	select BR2_PACKAGE_XLIB_LIBX11
 	select BR2_PACKAGE_XLIB_LIBXCURSOR
+	select BR2_PACKAGE_XWAYLAND
 
 comment "XWayland support needs libepoxy and X.org enabled"
 	depends on !BR2_PACKAGE_XORG7 || !BR2_PACKAGE_LIBEPOXY
 
+comment "XWayland support needs a toolchain w/ threads, dynamic library"
+	depends on BR2_USE_MMU
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
+
 # Weston needs at least one shell; this can be one of the bundled ones,
 # below, of from a third-party package, which should then select this.
 config BR2_PACKAGE_WESTON_HAS_SHELL
diff --git a/package/weston/weston.mk b/package/weston/weston.mk
index 5e71473640..01f84178b2 100644
--- a/package/weston/weston.mk
+++ b/package/weston/weston.mk
@@ -123,7 +123,7 @@  WESTON_CONF_OPTS += -Dbackend-default=$(call qstrip,$(BR2_PACKAGE_WESTON_DEFAULT
 
 ifeq ($(BR2_PACKAGE_WESTON_XWAYLAND),y)
 WESTON_CONF_OPTS += -Dxwayland=true
-WESTON_DEPENDENCIES += cairo libepoxy libxcb xlib_libX11 xlib_libXcursor
+WESTON_DEPENDENCIES += cairo libepoxy libxcb xlib_libX11 xlib_libXcursor xwayland
 else
 WESTON_CONF_OPTS += -Dxwayland=false
 endif
diff --git a/package/wlroots/Config.in b/package/wlroots/Config.in
index 84a4ef846e..26992ca326 100644
--- a/package/wlroots/Config.in
+++ b/package/wlroots/Config.in
@@ -41,4 +41,16 @@  config BR2_PACKAGE_WLROOTS_X11
 	help
 	  Support Wayland sessions nested inside a X11 window
 
+config BR2_PACKAGE_WLROOTS_XWAYLAND
+	bool "XWayland support"
+	depends on BR2_PACKAGE_XORG7 # libxcb, xcb-util-wm, xwayland
+	select BR2_PACKAGE_LIBXCB
+	select BR2_PACKAGE_XCB_UTIL_WM
+	select BR2_PACKAGE_XWAYLAND
+	help
+	  Support for X11 applications
+
+comment "XWayland support needs X.org enabled"
+	depends on !BR2_PACKAGE_XORG7
+
 endif
diff --git a/package/wlroots/wlroots.mk b/package/wlroots/wlroots.mk
index 4f14d20b11..5b930a51be 100644
--- a/package/wlroots/wlroots.mk
+++ b/package/wlroots/wlroots.mk
@@ -30,8 +30,12 @@  WLROOTS_BACKENDS = libinput drm
 
 ifeq ($(BR2_PACKAGE_WLROOTS_X11),y)
 WLROOTS_BACKENDS += x11
-WLROOTS_CONF_OPTS += -Dxwayland=enabled
 WLROOTS_DEPENDENCIES += libxcb xcb-util-wm xcb-util-renderutil xlib_libX11
+endif
+
+ifeq ($(BR2_PACKAGE_WLROOTS_XWAYLAND),y)
+WLROOTS_CONF_OPTS += -Dxwayland=enabled
+WLROOTS_DEPENDENCIES += libxcb xcb-util-wm xwayland
 else
 WLROOTS_CONF_OPTS += -Dxwayland=disabled
 endif
diff --git a/package/x11r7/Config.in b/package/x11r7/Config.in
index 365de34c98..4de8922e0d 100644
--- a/package/x11r7/Config.in
+++ b/package/x11r7/Config.in
@@ -12,6 +12,7 @@  menuconfig BR2_PACKAGE_XORG7
 if BR2_PACKAGE_XORG7
 	menu "X11R7 Servers"
 		source package/x11r7/xserver_xorg-server/Config.in
+		source package/x11r7/xwayland/Config.in
 	endmenu
 	menu "X11R7 Libraries"
 		source package/x11r7/libxcb/Config.in
diff --git a/package/x11r7/xwayland/Config.in b/package/x11r7/xwayland/Config.in
new file mode 100644
index 0000000000..4f14f2cc36
--- /dev/null
+++ b/package/x11r7/xwayland/Config.in
@@ -0,0 +1,26 @@ 
+config BR2_PACKAGE_XWAYLAND
+	bool "xwayland server"
+	depends on BR2_USE_MMU # fork()
+	depends on !BR2_STATIC_LIBS # wayland
+	depends on BR2_TOOLCHAIN_HAS_THREADS # wayland
+	# We need a SHA1 implementation. If either openssl or
+	# libgcrypt are already part of the build, we'll use one of
+	# them, otherwise, use the small libsha1 library.
+	select BR2_PACKAGE_LIBSHA1 if (!BR2_PACKAGE_OPENSSL && !BR2_PACKAGE_LIBGCRYPT)
+	select BR2_PACKAGE_PIXMAN
+	select BR2_PACKAGE_WAYLAND
+	select BR2_PACKAGE_WAYLAND_PROTOCOLS
+	select BR2_PACKAGE_XLIB_LIBXCVT
+	select BR2_PACKAGE_XLIB_LIBXFONT2
+	select BR2_PACKAGE_XLIB_LIBXKBFILE
+	select BR2_PACKAGE_XLIB_LIBXRANDR
+	select BR2_PACKAGE_XLIB_XTRANS
+	select BR2_PACKAGE_XORGPROTO
+	help
+	  X.Org X server to run X clients under wayland
+
+	  http://xorg.freedesktop.org
+
+comment "xwayland needs a toolchain w/ threads, dynamic library"
+	depends on BR2_USE_MMU
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS
diff --git a/package/x11r7/xwayland/xwayland.hash b/package/x11r7/xwayland/xwayland.hash
new file mode 100644
index 0000000000..0c476f3183
--- /dev/null
+++ b/package/x11r7/xwayland/xwayland.hash
@@ -0,0 +1,6 @@ 
+# From https://lists.x.org/archives/xorg-announce/2023-February/003322.html
+sha256  d11eeee73290b88ea8da42a7d9350dedfaba856ce4ae44e58c045ad9ecaa2f73  xwayland-22.1.8.tar.xz
+sha512  f52c6f99d8ef7605bc1c651d5ee5e306c12af30649a2d712b1c4c3cf4c7c80246ae24bd9ac39461d47aafc78f5d659446a459cd6259e05ef3128b204981d114a  xwayland-22.1.8.tar.xz
+
+# Locally calculated
+sha256  4cc0447a22635c7b2f1a93fec4aa94f1970fadeb72a063de006b51cf4963a06f  COPYING
diff --git a/package/x11r7/xwayland/xwayland.mk b/package/x11r7/xwayland/xwayland.mk
new file mode 100644
index 0000000000..174b440b07
--- /dev/null
+++ b/package/x11r7/xwayland/xwayland.mk
@@ -0,0 +1,94 @@ 
+################################################################################
+#
+# xwayland
+#
+################################################################################
+
+XWAYLAND_VERSION = 22.1.8
+XWAYLAND_SOURCE = xwayland-$(XWAYLAND_VERSION).tar.xz
+XWAYLAND_SITE = https://xorg.freedesktop.org/archive/individual/xserver
+XWAYLAND_LICENSE = MIT
+XWAYLAND_LICENSE_FILES = COPYING
+XWAYLAND_INSTALL_STAGING = YES
+XWAYLAND_DEPENDENCIES = \
+	pixman \
+	wayland \
+	wayland-protocols \
+	xlib_libxcvt \
+	xlib_libXfont2 \
+	xlib_libxkbfile \
+	xlib_libXrandr \
+	xlib_xtrans \
+	xorgproto
+XWAYLAND_CONF_OPTS = \
+	-Dxwayland_eglstream=false \
+	-Dxvfb=false \
+	-Ddefault_font_path=/usr/share/fonts/X11/ \
+	-Ddtrace=false \
+	-Ddocs=false
+
+ifeq ($(BR2_PACKAGE_LIBDRM)$(BR2_PACKAGE_LIBEPOXY),yy)
+XWAYLAND_CONF_OPTS += -Dglamor=true
+XWAYLAND_DEPENDENCIES += libdrm libepoxy
+else
+XWAYLAND_CONF_OPTS += -Dglamor=false
+endif
+
+ifeq ($(BR2_PACKAGE_HAS_LIBGL),y)
+XWAYLAND_CONF_OPTS += -Dglx=true
+XWAYLAND_DEPENDENCIES += libgl
+else
+XWAYLAND_CONF_OPTS += -Dglx=false
+endif
+
+ifeq ($(BR2_PACKAGE_XLIB_LIBXDMCP),y)
+XWAYLAND_CONF_OPTS += \
+	-Dxdmcp=true \
+	-Dxdm-auth-1=true
+XWAYLAND_DEPENDENCIES += xlib_libXdmcp
+else
+XWAYLAND_CONF_OPTS += \
+	-Dxdmcp=false \
+	-Dxdm-auth-1=false
+endif
+
+ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
+XWAYLAND_CONF_OPTS += -Dsecure-rpc=true
+XWAYLAND_DEPENDENCIES += libtirpc
+else
+XWAYLAND_CONF_OPTS += -Dsecure-rpc=false
+endif
+
+ifeq ($(BR2_PACKAGE_LIBSELINUX)$(BR2_PACKAGE_AUDIT),yy)
+XWAYLAND_CONF_OPTS += -Dxselinux=true
+XWAYLAND_DEPENDENCIES += libselinux audit
+else
+XWAYLAND_CONF_OPTS += -Dxselinux=false
+endif
+
+ifeq ($(BR2_PACKAGE_OPENSSL),y)
+XWAYLAND_CONF_OPTS += -Dsha1=libcrypto
+XWAYLAND_DEPENDENCIES += openssl
+else ifeq ($(BR2_PACKAGE_LIBGCRYPT),y)
+XWAYLAND_CONF_OPTS += -Dsha1=libgcrypt
+XWAYLAND_DEPENDENCIES += libgcrypt
+else
+XWAYLAND_CONF_OPTS += -Dsha1=libsha1
+XWAYLAND_DEPENDENCIES += libsha1
+endif
+
+ifeq ($(BR2_PACKAGE_XLIB_LIBXSHMFENCE)$(BR2_PACKAGE_LIBDRM),yy)
+XWAYLAND_CONF_OPTS += -Ddri3=true
+XWAYLAND_DEPENDENCIES += xlib_libxshmfence libdrm
+else
+XWAYLAND_CONF_OPTS += -Ddri3=false
+endif
+
+ifeq ($(BR2_PACKAGE_LIBUNWIND),y)
+XWAYLAND_CONF_OPTS += -Dlibunwind=true
+XWAYLAND_DEPENDENCIES += libunwind
+else
+XWAYLAND_CONF_OPTS += -Dlibunwind=false
+endif
+
+$(eval $(meson-package))