meta-wayland/recipes-graphics/xorg-xserver/xserver-xorg/0001-xwayland-Add-a-pkg-config-file-for-Xwayland.patch

180 lines
7.4 KiB
Diff
Raw Normal View History

2021-06-02 16:13:46 +02:00
From dffc5939a0e77eae7a183c7790dc1209881c09aa Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Mon, 20 Apr 2020 11:29:16 +0200
Subject: [PATCH] xwayland: Add a pkg-config file for Xwayland
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Xwayland is usually spawned by the Wayland compositor which sets the
command line options.
If a command line option is not supported, Xwayland will fail to start.
That somehow makes the Xwayland command line option sort of ABI, the
Wayland compositor need to know if a particular option is supported by
Xwayland at build time.
Also, currently, Xwayland is being installed along with the rest of the
common executable programs that users may run, which is sub-optimal
because, well, Xwayland is not a common executable program, it's meant
to be a proxy between the Wayland compositor and the legacy X11 clients
which wouldn't be able to run on Wayland otherwise.
Xwayland would be better installed in `libexec` but that directory is
(purposedly) not in the user `PATH` and therefore the Wayland compositor
may not be able to find Xwayland in that case.
To solve both problems (which options are supported by Xwayland and
where to look for it), add a `pkg-config` file specifically for Xwayland
which gives the full path to Xwayland (`xwayland`) and which options it
supports (using `pkg-config` variables).
The `pkg-config` file also provides the `Version` so the build scripts
can check for a particular version if necessary.
Obviously, Wayland compositors are not required to use the `pkg-config`
file and can continue to use whatever mechanism they deem preferable.
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
---
configure.ac | 12 ++++++++++++
hw/xwayland/Makefile.am | 6 +++++-
hw/xwayland/meson.build | 15 +++++++++++++++
hw/xwayland/xwayland.pc.in | 7 +++++++
meson.build | 5 +++++
5 files changed, 44 insertions(+), 1 deletion(-)
create mode 100644 hw/xwayland/xwayland.pc.in
diff --git a/configure.ac b/configure.ac
index a51a0ee..1b73e75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -591,6 +591,8 @@ AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest serv
AC_ARG_ENABLE(xquartz, AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto])
AC_ARG_ENABLE(xwayland, AS_HELP_STRING([--enable-xwayland], [Build Xwayland server (default: auto)]), [XWAYLAND=$enableval], [XWAYLAND=auto])
AC_ARG_ENABLE(xwayland-eglstream, AS_HELP_STRING([--enable-xwayland-eglstream], [Build Xwayland eglstream support (default: no)]), [XWAYLAND_EGLSTREAM=$enableval], [XWAYLAND_EGLSTREAM=no])
+AC_ARG_WITH(xwayland-path, AS_HELP_STRING([--with-xwayland-path=PATH], [Directory containing Xwayland executable (default: ${bindir})]),
+ [ xwayland_path="$withval" ], [ xwayland_path="$bindir" ])
AC_ARG_ENABLE(standalone-xpbproxy, AS_HELP_STRING([--enable-standalone-xpbproxy], [Build a standalone xpbproxy (in addition to the one integrated into Xquartz as a separate thread) (default: no)]), [STANDALONE_XPBPROXY=$enableval], [STANDALONE_XPBPROXY=no])
AC_ARG_ENABLE(xwin, AS_HELP_STRING([--enable-xwin], [Build XWin server (default: auto)]), [XWIN=$enableval], [XWIN=auto])
AC_ARG_ENABLE(glamor, AS_HELP_STRING([--enable-glamor], [Build glamor dix module (default: auto)]), [GLAMOR=$enableval], [GLAMOR=auto])
@@ -2346,6 +2348,9 @@ if test "x$XWAYLAND" = xyes; then
if test "x$GLAMOR" = xyes && test "x$GBM" = xyes; then
AC_DEFINE(XWL_HAS_GLAMOR, 1,
[Build xwayland with glamor support])
+ AC_SUBST(have_glamor, "true")
+ else
+ AC_SUBST(have_glamor, "false")
fi
PKG_CHECK_MODULES(WAYLAND_EGLSTREAM, [wayland-eglstream-protocols >= 1.0.2], [have_wl_eglstream=yes], [have_wl_eglstream=no])
@@ -2368,6 +2373,9 @@ if test "x$XWAYLAND" = xyes; then
AC_SUBST(WAYLAND_EGLSTREAM_DATADIR, `$PKG_CONFIG --variable=pkgdatadir wayland-eglstream-protocols`)
AC_DEFINE(XWL_HAS_EGLSTREAM, 1,
[Build xwayland with eglstream support])
+ AC_SUBST(have_eglstream, "true")
+ else
+ AC_SUBST(have_eglstream, "false")
fi
XWAYLAND_LIBS="$FB_LIB $FIXES_LIB $MI_LIB $XEXT_LIB $DBE_LIB $RECORD_LIB $GLX_LIBS $RANDR_LIB $RENDER_LIB $DAMAGE_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_DAMAGE_LIB $MIEXT_SHADOW_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $COMPOSITE_LIB $MAIN_LIB $DIX_LIB $OS_LIB"
@@ -2390,6 +2398,9 @@ if test "x$XWAYLAND" = xyes; then
AC_SUBST(SCANNER_ARG, 'code'))
AC_SUBST(WAYLAND_PROTOCOLS_DATADIR, `$PKG_CONFIG --variable=pkgdatadir wayland-protocols`)
+
+ AC_SUBST(xwayland_path)
+
fi
AM_CONDITIONAL(XWAYLAND_EGLSTREAM, [test "x$XWAYLAND_EGLSTREAM" = "xyes"])
@@ -2546,6 +2557,7 @@ hw/kdrive/ephyr/Makefile
hw/kdrive/ephyr/man/Makefile
hw/kdrive/src/Makefile
hw/xwayland/Makefile
+hw/xwayland/xwayland.pc
test/Makefile
xserver.ent
xorg-server.pc
diff --git a/hw/xwayland/Makefile.am b/hw/xwayland/Makefile.am
index bc1cb85..7c252db 100644
--- a/hw/xwayland/Makefile.am
+++ b/hw/xwayland/Makefile.am
@@ -1,3 +1,4 @@
+bindir = @xwayland_path@
bin_PROGRAMS = Xwayland
Xwayland_CFLAGS = \
@@ -84,7 +85,10 @@ endif
nodist_Xwayland_SOURCES = $(Xwayland_built_sources)
CLEANFILES = $(Xwayland_built_sources)
-EXTRA_DIST = drm.xml
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = xwayland.pc
+
+EXTRA_DIST = xwayland.pc.in drm.xml
$(Xwayland_SOURCES): $(Xwayland_built_sources)
diff --git a/hw/xwayland/meson.build b/hw/xwayland/meson.build
index 36bf213..40e8612 100644
--- a/hw/xwayland/meson.build
+++ b/hw/xwayland/meson.build
@@ -100,4 +100,19 @@ executable(
libglxvnd,
],
install: true,
+ install_dir: xwayland_path
+)
+
+xwayland_data = configuration_data()
+xwayland_data.set('PACKAGE_VERSION', meson.project_version())
+xwayland_data.set('xwayland_path', xwayland_path)
+xwayland_data.set('have_glamor', build_glamor ? 'true' : 'false')
+xwayland_data.set('have_eglstream', build_eglstream ? 'true' : 'false')
+configure_file(
+ input: 'xwayland.pc.in',
+ output: 'xwayland.pc',
+ configuration: xwayland_data,
+ install_dir: join_paths(get_option('prefix'),
+ get_option('libdir'),
+ 'pkgconfig'),
)
diff --git a/hw/xwayland/xwayland.pc.in b/hw/xwayland/xwayland.pc.in
new file mode 100644
index 0000000..cd28026
--- /dev/null
+++ b/hw/xwayland/xwayland.pc.in
@@ -0,0 +1,7 @@
+Name: Xwayland
+Description: X Server for Wayland
+Version: @PACKAGE_VERSION@
+xwayland=@xwayland_path@/Xwayland
+have_glamor=@have_glamor@
+have_eglstream=@have_eglstream@
+have_initfd=true
diff --git a/meson.build b/meson.build
index 0531463..c904e7f 100644
--- a/meson.build
+++ b/meson.build
@@ -169,6 +169,11 @@ if (host_machine.system() != 'darwin' and
if get_option('xwayland') != 'false'
xwayland_required = get_option('xwayland') == 'true'
+ xwayland_path = get_option('xwayland-path')
+ if (xwayland_path == '')
+ xwayland_path = join_paths(get_option('prefix'), get_option('bindir'))
+ endif
+
xwayland_dep = [
dependency('wayland-client', version: '>= 1.3.0', required: xwayland_required),
dependency('wayland-protocols', version: '>= 1.10', required: xwayland_required),