From b68847a8bc8f73e5518285d927e7426005eeaaad Mon Sep 17 00:00:00 2001
From: Philipp Zabel
Date: Wed, 13 Feb 2019 15:59:59 +0100
Subject: [PATCH] meson: fix compositor build with xwayland disabled
If xwayland is disabled, compositor/weston is built without
compositor/xwayland.c, which defines wet_load_xwayland.
compositor/fb12c4d@@weston@exe/main.c.o: In function `main':
../weston-5.0.0-169-g2d4cc4f4dd6a/compositor/main.c:3103: undefined reference to `wet_load_xwayland'
Provide an empty stub for wet_load_xwayland if xwayland is disabled.
With that we also have to remove xwayland.c from the autotools build
if xwayland is disabled, to avoid a multiple definition error.
Signed-off-by: Philipp Zabel
---
Makefile.am | 5 ++++-
compositor/main.c | 12 ++++++++++++
compositor/meson.build | 2 ++
3 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index 1f78d0a7..b2bb61f6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -210,8 +210,11 @@ weston_LDADD = libshared.la libweston-@LIBWESTON_MAJOR@.la \
weston_SOURCES = \
compositor/main.c \
compositor/weston-screenshooter.c \
- compositor/text-backend.c \
+ compositor/text-backend.c
+if ENABLE_XWAYLAND
+weston_SOURCES += \
compositor/xwayland.c
+endif
# Track this dependency explicitly instead of using BUILT_SOURCES. We
# add BUILT_SOURCES to CLEANFILES, but we want to keep git-version.h
diff --git a/compositor/main.c b/compositor/main.c
index 34d2e715..19a920e1 100644
--- a/compositor/main.c
+++ b/compositor/main.c
@@ -646,7 +646,9 @@ usage(int error_code)
" --shell=MODULE\tShell module, defaults to desktop-shell.so\n"
" -S, --socket=NAME\tName of socket to listen on\n"
" -i, --idle-time=SECS\tIdle time in seconds\n"
+#if defined(BUILD_XWAYLAND)
" --xwayland\t\tLoad the xwayland module\n"
+#endif
" --modules\t\tLoad the comma-separated list of modules\n"
" --log=FILE\t\tLog to the given file\n"
" -c, --config=FILE\tConfig file to load, defaults to weston.ini\n"
@@ -2876,6 +2878,14 @@ copy_command_line(int argc, char * const argv[])
return str;
}
+#if !defined(BUILD_XWAYLAND)
+int
+wet_load_xwayland(struct weston_compositor *comp)
+{
+ return -1;
+}
+#endif
+
int main(int argc, char *argv[])
{
int ret = EXIT_FAILURE;
@@ -2916,7 +2926,9 @@ int main(int argc, char *argv[])
{ WESTON_OPTION_STRING, "shell", 0, &shell },
{ WESTON_OPTION_STRING, "socket", 'S', &socket_name },
{ WESTON_OPTION_INTEGER, "idle-time", 'i', &idle_time },
+#if defined(BUILD_XWAYLAND)
{ WESTON_OPTION_BOOLEAN, "xwayland", 0, &xwayland },
+#endif
{ WESTON_OPTION_STRING, "modules", 0, &option_modules },
{ WESTON_OPTION_STRING, "log", 0, &log },
{ WESTON_OPTION_BOOLEAN, "help", 'h', &help },
diff --git a/compositor/meson.build b/compositor/meson.build
index 994b5877..420a9605 100644
--- a/compositor/meson.build
+++ b/compositor/meson.build
@@ -20,6 +20,8 @@ deps_weston = [
]
if get_option('xwayland')
+ config_h.set('BUILD_XWAYLAND', '1')
+
srcs_weston += 'xwayland.c'
config_h.set_quoted('XSERVER_PATH', get_option('xwayland-path'))
endif