From 7717383deb58fdd25aa648932995b43a31148f80 Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Thu, 3 Mar 2022 11:51:00 +0100 Subject: [PATCH] meson: Allow to build without gnome-desktop gnome-desktop is used to retrieve the monitor vendor name which in some use cases is not needed as it brings a bunch of gnome-desktop unwanted dependencies. The change makes mutter fallback to an "Undefined" vendor name if it is built without gnome-desktop Part-of: --- config.h.meson | 3 +++ meson.build | 9 ++++++++- meson_options.txt | 6 ++++++ src/backends/meta-monitor-manager-private.h | 5 +++++ src/backends/meta-monitor-manager.c | 4 ++++ src/meson.build | 7 ++++++- 6 files changed, 32 insertions(+), 2 deletions(-) diff --git a/config.h.meson b/config.h.meson index 027ebc5b2..9119ad864 100644 --- a/config.h.meson +++ b/config.h.meson @@ -46,6 +46,9 @@ /* Defined if screen cast and remote desktop support is enabled */ #mesondefine HAVE_REMOTE_DESKTOP +/* Defined if gnome-desktop is enabled */ +#mesondefine HAVE_GNOME_DESKTOP + /* Building with SM support */ #mesondefine HAVE_SM diff --git a/meson.build b/meson.build index b6522f93d..2f7e40c6b 100644 --- a/meson.build +++ b/meson.build @@ -106,7 +106,6 @@ gthread_dep = dependency('gobject-2.0', version: glib_req) gmodule_no_export_dep = dependency('gmodule-no-export-2.0', version: glib_req) gnome_settings_daemon_dep = dependency('gnome-settings-daemon') json_glib_dep = dependency('json-glib-1.0', version: json_glib_req) -gnome_desktop_dep = dependency('gnome-desktop-3.0') xcomposite_dep = dependency('xcomposite', version: xcomposite_req) xcursor_dep = dependency('xcursor') xdamage_dep = dependency('xdamage') @@ -133,6 +132,12 @@ dbus_dep = dependency('dbus-1') # For now always require X11 support have_x11 = true + +have_gnome_desktop = get_option('libgnome_desktop') +if have_gnome_desktop + gnome_desktop_dep = dependency('gnome-desktop-3.0') +endif + have_gl = get_option('opengl') if have_gl gl_dep = dependency('gl') @@ -436,6 +441,7 @@ cdata.set('HAVE_WAYLAND', have_wayland) cdata.set('HAVE_LIBSYSTEMD', have_libsystemd) cdata.set('HAVE_NATIVE_BACKEND', have_native_backend) cdata.set('HAVE_REMOTE_DESKTOP', have_remote_desktop) +cdata.set('HAVE_GNOME_DESKTOP', have_gnome_desktop) cdata.set('HAVE_EGL_DEVICE', have_egl_device) cdata.set('HAVE_WAYLAND_EGLSTREAM', have_wayland_eglstream) cdata.set('HAVE_LIBGUDEV', have_libgudev) @@ -586,6 +592,7 @@ summary('Wayland EGLStream', have_wayland_eglstream, section: 'Options') summary('Native Backend', have_native_backend, section: 'Options') summary('EGL Device', have_egl_device, section: 'Options') summary('Remote desktop', have_remote_desktop, section: 'Options') +summary('libgnome-desktop', have_gnome_desktop, section: 'Options') summary('gudev', have_libgudev, section: 'Options') summary('Wacom', have_libwacom, section: 'Options') summary('SM', have_sm, section: 'Options') diff --git a/meson_options.txt b/meson_options.txt index 986199ce6..da755393c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -57,6 +57,12 @@ option('remote_desktop', description: 'Enable remote desktop and screen cast support' ) +option('libgnome_desktop', + type: 'boolean', + value: true, + description: 'Build with or without gnome-desktop' +) + option('egl_device', type: 'boolean', value: false, diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h index 443ad14cd..da85e5531 100644 --- a/src/backends/meta-monitor-manager-private.h +++ b/src/backends/meta-monitor-manager-private.h @@ -26,7 +26,10 @@ #include #include + +#ifdef HAVE_GNOME_DESKTOP #include +#endif #include "backends/meta-backend-private.h" #include "backends/meta-cursor.h" @@ -155,7 +158,9 @@ struct _MetaMonitorManager MetaMonitorConfigManager *config_manager; +#ifdef HAVE_GNOME_DESKTOP GnomePnpIds *pnp_ids; +#endif MetaMonitorSwitchConfigType current_switch_config; diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c index 2f7cfe237..83fe10780 100644 --- a/src/backends/meta-monitor-manager.c +++ b/src/backends/meta-monitor-manager.c @@ -3816,10 +3816,14 @@ char * meta_monitor_manager_get_vendor_name (MetaMonitorManager *manager, const char *vendor) { +#ifdef HAVE_GNOME_DESKTOP if (!manager->pnp_ids) manager->pnp_ids = gnome_pnp_ids_new (); return gnome_pnp_ids_get_pnp_id (manager->pnp_ids, vendor); +#else + return g_strdup (vendor); +#endif } gboolean diff --git a/src/meson.build b/src/meson.build index 43b28dc09..7b456f524 100644 --- a/src/meson.build +++ b/src/meson.build @@ -23,13 +23,18 @@ mutter_pkg_deps = [ mutter_pkg_private_deps = [ gmodule_no_export_dep, - gnome_desktop_dep, gnome_settings_daemon_dep, json_glib_dep, libcanberra_dep, xkbcommon_dep, ] +if have_gnome_desktop + mutter_pkg_private_deps += [ + gnome_desktop_dep, + ] +endif + if have_gl mutter_pkg_deps += [ gl_dep,