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: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2317>
This commit is contained in:
Bilal Elmoussaoui 2022-03-03 11:51:00 +01:00 committed by Marge Bot
parent daaeadcf4f
commit 7717383deb
6 changed files with 32 additions and 2 deletions

View File

@ -46,6 +46,9 @@
/* Defined if screen cast and remote desktop support is enabled */ /* Defined if screen cast and remote desktop support is enabled */
#mesondefine HAVE_REMOTE_DESKTOP #mesondefine HAVE_REMOTE_DESKTOP
/* Defined if gnome-desktop is enabled */
#mesondefine HAVE_GNOME_DESKTOP
/* Building with SM support */ /* Building with SM support */
#mesondefine HAVE_SM #mesondefine HAVE_SM

View File

@ -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) gmodule_no_export_dep = dependency('gmodule-no-export-2.0', version: glib_req)
gnome_settings_daemon_dep = dependency('gnome-settings-daemon') gnome_settings_daemon_dep = dependency('gnome-settings-daemon')
json_glib_dep = dependency('json-glib-1.0', version: json_glib_req) 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) xcomposite_dep = dependency('xcomposite', version: xcomposite_req)
xcursor_dep = dependency('xcursor') xcursor_dep = dependency('xcursor')
xdamage_dep = dependency('xdamage') xdamage_dep = dependency('xdamage')
@ -133,6 +132,12 @@ dbus_dep = dependency('dbus-1')
# For now always require X11 support # For now always require X11 support
have_x11 = true 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') have_gl = get_option('opengl')
if have_gl if have_gl
gl_dep = dependency('gl') gl_dep = dependency('gl')
@ -436,6 +441,7 @@ cdata.set('HAVE_WAYLAND', have_wayland)
cdata.set('HAVE_LIBSYSTEMD', have_libsystemd) cdata.set('HAVE_LIBSYSTEMD', have_libsystemd)
cdata.set('HAVE_NATIVE_BACKEND', have_native_backend) cdata.set('HAVE_NATIVE_BACKEND', have_native_backend)
cdata.set('HAVE_REMOTE_DESKTOP', have_remote_desktop) 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_EGL_DEVICE', have_egl_device)
cdata.set('HAVE_WAYLAND_EGLSTREAM', have_wayland_eglstream) cdata.set('HAVE_WAYLAND_EGLSTREAM', have_wayland_eglstream)
cdata.set('HAVE_LIBGUDEV', have_libgudev) 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('Native Backend', have_native_backend, section: 'Options')
summary('EGL Device', have_egl_device, section: 'Options') summary('EGL Device', have_egl_device, section: 'Options')
summary('Remote desktop', have_remote_desktop, 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('gudev', have_libgudev, section: 'Options')
summary('Wacom', have_libwacom, section: 'Options') summary('Wacom', have_libwacom, section: 'Options')
summary('SM', have_sm, section: 'Options') summary('SM', have_sm, section: 'Options')

View File

@ -57,6 +57,12 @@ option('remote_desktop',
description: 'Enable remote desktop and screen cast support' 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', option('egl_device',
type: 'boolean', type: 'boolean',
value: false, value: false,

View File

@ -26,7 +26,10 @@
#include <cogl/cogl.h> #include <cogl/cogl.h>
#include <graphene.h> #include <graphene.h>
#ifdef HAVE_GNOME_DESKTOP
#include <libgnome-desktop/gnome-pnp-ids.h> #include <libgnome-desktop/gnome-pnp-ids.h>
#endif
#include "backends/meta-backend-private.h" #include "backends/meta-backend-private.h"
#include "backends/meta-cursor.h" #include "backends/meta-cursor.h"
@ -155,7 +158,9 @@ struct _MetaMonitorManager
MetaMonitorConfigManager *config_manager; MetaMonitorConfigManager *config_manager;
#ifdef HAVE_GNOME_DESKTOP
GnomePnpIds *pnp_ids; GnomePnpIds *pnp_ids;
#endif
MetaMonitorSwitchConfigType current_switch_config; MetaMonitorSwitchConfigType current_switch_config;

View File

@ -3816,10 +3816,14 @@ char *
meta_monitor_manager_get_vendor_name (MetaMonitorManager *manager, meta_monitor_manager_get_vendor_name (MetaMonitorManager *manager,
const char *vendor) const char *vendor)
{ {
#ifdef HAVE_GNOME_DESKTOP
if (!manager->pnp_ids) if (!manager->pnp_ids)
manager->pnp_ids = gnome_pnp_ids_new (); manager->pnp_ids = gnome_pnp_ids_new ();
return gnome_pnp_ids_get_pnp_id (manager->pnp_ids, vendor); return gnome_pnp_ids_get_pnp_id (manager->pnp_ids, vendor);
#else
return g_strdup (vendor);
#endif
} }
gboolean gboolean

View File

@ -23,13 +23,18 @@ mutter_pkg_deps = [
mutter_pkg_private_deps = [ mutter_pkg_private_deps = [
gmodule_no_export_dep, gmodule_no_export_dep,
gnome_desktop_dep,
gnome_settings_daemon_dep, gnome_settings_daemon_dep,
json_glib_dep, json_glib_dep,
libcanberra_dep, libcanberra_dep,
xkbcommon_dep, xkbcommon_dep,
] ]
if have_gnome_desktop
mutter_pkg_private_deps += [
gnome_desktop_dep,
]
endif
if have_gl if have_gl
mutter_pkg_deps += [ mutter_pkg_deps += [
gl_dep, gl_dep,