From 7a82181004729b02752ad36046b1738cab07a264 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Mon, 5 Jun 2023 10:35:16 +0000 Subject: [PATCH] x11-wm/mutter: expose standalone Wayland support PR: 271836 Tested by: ? Approved by: ? --- x11-wm/mutter/Makefile | 16 ++-- x11-wm/mutter/files/patch-meson.build | 9 +++ ...-src_backends_native_meta-backend-native.c | 35 ++++++++ ...tch-src_backends_native_meta-device-pool.c | 16 ++++ .../patch-src_backends_native_meta-launcher.c | 81 +++++++++++++++++++ .../files/patch-src_core_meta-context-main.c | 18 ++++- 6 files changed, 169 insertions(+), 6 deletions(-) create mode 100644 x11-wm/mutter/files/patch-src_backends_native_meta-backend-native.c create mode 100644 x11-wm/mutter/files/patch-src_backends_native_meta-device-pool.c create mode 100644 x11-wm/mutter/files/patch-src_backends_native_meta-launcher.c diff --git a/x11-wm/mutter/Makefile b/x11-wm/mutter/Makefile index e988c2143e5b..ae67654326a3 100644 --- a/x11-wm/mutter/Makefile +++ b/x11-wm/mutter/Makefile @@ -1,6 +1,6 @@ PORTNAME= mutter PORTVERSION= 42.4 -PORTREVISION= 5 +PORTREVISION= 6 CATEGORIES= x11-wm MASTER_SITES= GNOME/sources/${PORTNAME}/${PORTVERSION:C/^([0-9]+)\..*/\1/} DIST_SUBDIR= gnome @@ -39,16 +39,16 @@ RUN_DEPENDS= gnome-settings-daemon>0:sysutils/gnome-settings-daemon \ PORTSCOUT= limitw:1,even USES= compiler:c++0x gettext gl gnome localbase meson pkgconfig \ - tar:xz xorg + python:build shebangfix tar:xz xorg USE_GL= egl gbm USE_GNOME= cairo gdkpixbuf2 gnomedesktop3 introspection USE_XORG= ice sm x11 xcb xcomposite xcursor xdamage xext xfixes xi \ xinerama xrandr xrender xtst USE_LDCONFIG= yes +SHEBANG_FILES= src/backends/native/gen-default-modes.py CFLAGS+= -Wno-unknown-warning-option -Wno-format-nonliteral CPPFLAGS+= -fno-omit-frame-pointer MESON_ARGS= -Dlibwacom=false \ - -Dnative_backend=false \ -Dprofiler=false \ -Dsm=true \ -Dsystemd=false \ @@ -64,10 +64,16 @@ MESON_ARGS+= -Dremote_desktop=false GLIB_SCHEMAS= org.gnome.mutter.gschema.xml \ org.gnome.mutter.wayland.gschema.xml -OPTIONS_DEFINE= WAYLAND -OPTIONS_DEFAULT=WAYLAND +OPTIONS_DEFINE= DRM WAYLAND +OPTIONS_DEFAULT=DRM WAYLAND OPTIONS_SUB= yes +DRM_DESC= KMS console support +DRM_LIB_DEPENDS= libudev.so:devel/libudev-devd \ + libconsolekit.so:sysutils/consolekit2 \ + libinput.so:x11/libinput +DRM_MESON_TRUE= native_backend + WAYLAND_BUILD_DEPENDS= wayland-protocols>=1.25:graphics/wayland-protocols \ xwayland-devel>0:x11-servers/xwayland-devel WAYLAND_LIB_DEPENDS= libwayland-server.so:graphics/wayland diff --git a/x11-wm/mutter/files/patch-meson.build b/x11-wm/mutter/files/patch-meson.build index 55560ac3e736..528570d298bc 100644 --- a/x11-wm/mutter/files/patch-meson.build +++ b/x11-wm/mutter/files/patch-meson.build @@ -25,3 +25,12 @@ endif endif +@@ -219,7 +224,7 @@ if have_native_backend + if libsystemd_dep.found() + logind_provider_dep = libsystemd_dep + else +- logind_provider_dep = dependency('libelogind') ++ logind_provider_dep = dependency(['libelogind', 'libconsolekit']) + endif + + if not have_egl diff --git a/x11-wm/mutter/files/patch-src_backends_native_meta-backend-native.c b/x11-wm/mutter/files/patch-src_backends_native_meta-backend-native.c new file mode 100644 index 000000000000..0478f8a57e0a --- /dev/null +++ b/x11-wm/mutter/files/patch-src_backends_native_meta-backend-native.c @@ -0,0 +1,35 @@ +../src/backends/native/meta-backend-native.c:234:67: error: implicit declaration of function 'gettid' is invalid in C99 [-Werror,-Wimplicit-function-declaration] + gettid (), + ^ + +--- src/backends/native/meta-backend-native.c.orig 2022-08-11 15:46:26 UTC ++++ src/backends/native/meta-backend-native.c +@@ -68,6 +68,28 @@ + + #include "meta-private-enum-types.h" + ++#if defined(__DragonFly__) || defined(__FreeBSD__) ++#include ++#elif defined(__NetBSD__) ++#include ++#endif ++ ++#if !defined(__linux__) ++static pid_t ++gettid(void) ++{ ++#if defined(__DragonFly__) || defined(__FreeBSD__) ++ return pthread_getthreadid_np(); ++#elif defined(__NetBSD__) ++ return _lwp_self(); ++#elif defined(__OpenBSD__) ++ return getthrid(); ++#else ++ return (pid_t)pthread_self(); ++#endif ++} ++#endif /* !defined(__linux__) */ ++ + enum + { + PROP_0, diff --git a/x11-wm/mutter/files/patch-src_backends_native_meta-device-pool.c b/x11-wm/mutter/files/patch-src_backends_native_meta-device-pool.c new file mode 100644 index 000000000000..14e8419c732d --- /dev/null +++ b/x11-wm/mutter/files/patch-src_backends_native_meta-device-pool.c @@ -0,0 +1,16 @@ +../src/backends/native/meta-device-pool.c:27:10: fatal error: 'sys/sysmacros.h' file not found +#include + ^~~~~~~~~~~~~~~~~ + +--- src/backends/native/meta-device-pool.c.orig 2022-08-11 15:46:26 UTC ++++ src/backends/native/meta-device-pool.c +@@ -24,7 +24,9 @@ + #include + #include + #include ++#ifdef __linux__ + #include ++#endif + #include + + #include "backends/native/meta-launcher.h" diff --git a/x11-wm/mutter/files/patch-src_backends_native_meta-launcher.c b/x11-wm/mutter/files/patch-src_backends_native_meta-launcher.c new file mode 100644 index 000000000000..47270bac6559 --- /dev/null +++ b/x11-wm/mutter/files/patch-src_backends_native_meta-launcher.c @@ -0,0 +1,81 @@ +../src/backends/native/meta-launcher.c:27:10: fatal error: 'sys/sysmacros.h' file not found +#include + ^~~~~~~~~~~~~~~~~ + +../src/backends/native/meta-launcher.c:34:10: fatal error: 'systemd/sd-login.h' file not found +#include + ^~~~~~~~~~~~~~~~~~~~ + +../src/backends/native/meta-launcher.c:83:21: error: implicit declaration of function 'sd_session_is_active' is invalid in C99 [-Werror,-Wimplicit-function-declaration] + saved_errno = sd_session_is_active (xdg_session_id); + ^ +../src/backends/native/meta-launcher.c:104:27: error: use of undeclared identifier 'ENODATA' + if (saved_errno != -ENODATA) + ^ +../src/backends/native/meta-launcher.c:121:17: error: implicit declaration of function 'sd_uid_get_display' is invalid in C99 [-Werror,-Wimplicit-function-declaration] + saved_errno = sd_uid_get_display (getuid (), &local_session_id); + ^ +../src/backends/native/meta-launcher.c:125:27: error: use of undeclared identifier 'ENODATA' + if (saved_errno == -ENODATA) + ^ + +--- src/backends/native/meta-launcher.c.orig 2022-08-11 15:46:26 UTC ++++ src/backends/native/meta-launcher.c +@@ -24,14 +24,57 @@ + #include + #include + #include ++#ifdef __linux__ + #include ++#endif + #include + #include + #include + #include + #include + #include ++#ifdef HAVE_LIBSYSTEMD + #include ++#else ++#include ++ ++#ifndef ENODATA ++#define ENODATA ENXIO ++#endif ++ ++/* Extend libsystemd compatibility */ ++#include ++ ++static int ++sd_session_is_active(const char *session) ++{ ++ LibConsoleKit *ck = NULL; ++ GError *error = NULL; ++ int ret = 0; ++ ++ ck = lib_consolekit_new (); ++ ++ ret = lib_consolekit_session_is_active (ck, session, &error); ++ if (error) { ++ g_warning ("Unable to determine if session is active: %s", ++ error ? error->message : ""); ++ g_error_free (error); ++ g_object_unref (ck); ++ return -ENXIO; ++ } ++ ++ g_object_unref (ck); ++ ++ return ret; ++} ++ ++static int ++sd_uid_get_display(uid_t uid, char **session) ++{ ++ // XXX ++ return -ENODATA; ++} ++#endif + + #include "backends/meta-backend-private.h" + #include "backends/native/dbus-utils.h" diff --git a/x11-wm/mutter/files/patch-src_core_meta-context-main.c b/x11-wm/mutter/files/patch-src_core_meta-context-main.c index 773b81cea09b..a3e1903958b9 100644 --- a/x11-wm/mutter/files/patch-src_core_meta-context-main.c +++ b/x11-wm/mutter/files/patch-src_core_meta-context-main.c @@ -1,10 +1,26 @@ +../src/core/meta-context-main.c:31:10: fatal error: 'systemd/sd-login.h' file not found +#include + ^~~~~~~~~~~~~~~~~~~~ + ld: error: undefined symbol: sd_pid_get_user_unit >>> referenced by meta-context-main.c >>> src/libmutter-9.so.0.0.0.p/core_meta-context-main.c.o:(meta_context_main_get_x11_display_policy) --- src/core/meta-context-main.c.orig 2021-09-19 13:37:45 UTC +++ src/core/meta-context-main.c -@@ -318,8 +318,10 @@ meta_context_main_get_x11_display_policy (MetaContext +@@ -28,7 +28,11 @@ + #include + + #if defined(HAVE_NATIVE_BACKEND) && defined(HAVE_WAYLAND) ++# ifdef HAVE_LIBSYSTEMD + #include ++# else ++#include ++# endif + #endif /* HAVE_WAYLAND && HAVE_NATIVE_BACKEND */ + + #include "backends/meta-monitor-manager-private.h" +@@ -318,8 +322,10 @@ meta_context_main_get_x11_display_policy (MetaContext #ifdef HAVE_WAYLAND if (context_main->options.no_x11) return META_X11_DISPLAY_POLICY_DISABLED;