[mutter] meson: Add optional libsystemd dependency



commit 4a0c86ea4ce7c051f8bd4a8aa4df505acf50e54c
Author: Nishal Kulkarni <nishalkulkarni gmail com>
Date:   Thu Aug 5 19:37:28 2021 +0530

    meson: Add optional libsystemd dependency
    
    To utilize the API provided by libsystemd it would be better to
    create a separate HAVE_LIBSYSTEMD configuration option instead of
    having to rely on HAVE_NATIVE_BACKEND.
    
    For now this will be utilized for getting the control group of a
    MetaWindow.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1960>

 config.h.meson    | 3 +++
 meson.build       | 5 ++++-
 meson_options.txt | 6 ++++++
 src/meson.build   | 6 ++++++
 4 files changed, 19 insertions(+), 1 deletion(-)
---
diff --git a/config.h.meson b/config.h.meson
index 26e13b9ca4..b7ca736df7 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -34,6 +34,9 @@
 /* Building with libwacom for advanced tablet management */
 #mesondefine HAVE_LIBWACOM
 
+/* Building with libsystemd */
+#mesondefine HAVE_LIBSYSTEMD
+
 /* Define if you want to enable the native (KMS) backend based on systemd */
 #mesondefine HAVE_NATIVE_BACKEND
 
diff --git a/meson.build b/meson.build
index 7d44178f08..5cf57e2fa6 100644
--- a/meson.build
+++ b/meson.build
@@ -191,13 +191,15 @@ if have_libgudev
   endif
 endif
 
+have_libsystemd = get_option('systemd')
+libsystemd_dep = dependency('libsystemd', required: have_libsystemd)
+
 have_native_backend = get_option('native_backend')
 if have_native_backend
   libdrm_dep = dependency('libdrm')
   libgbm_dep = dependency('gbm', version: gbm_req)
   libinput_dep = dependency('libinput', version: libinput_req)
 
-  libsystemd_dep = dependency('libsystemd', required: false)
   if libsystemd_dep.found()
     logind_provider_dep = libsystemd_dep
   else
@@ -389,6 +391,7 @@ cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
 
 cdata.set('HAVE_EGL', have_egl)
 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_EGL_DEVICE', have_egl_device)
diff --git a/meson_options.txt b/meson_options.txt
index 61d9cb48d1..6609e43321 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -39,6 +39,12 @@ option('wayland',
   description: 'Enable Wayland support'
 )
 
+option('systemd',
+  type: 'boolean',
+  value: true,
+  description: 'Enable systemd support'
+)
+
 option('native_backend',
   type: 'boolean',
   value: true,
diff --git a/src/meson.build b/src/meson.build
index e306be4720..f3aebfb285 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -118,6 +118,12 @@ if have_wayland
   ]
 endif
 
+if have_libsystemd
+  mutter_pkg_private_deps += [
+    libsystemd_dep,
+  ]
+endif
+
 if have_native_backend
   mutter_pkg_private_deps += [
     libdrm_dep,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]