[gnome-disk-utility] build: Define logind as combo option of 'libsystemd', 'libelogind', 'none'



commit 13c2aa011ca34dc5aea88d4d77ad1dc851c1ed70
Author: Kai Lüke <kailueke riseup net>
Date:   Sat Jun 1 23:28:04 2019 +0200

    build: Define logind as combo option of 'libsystemd', 'libelogind', 'none'
    
    When build with auto_features=enabled, both libelogind and libsystemd
    were enabled, thus failing the build.
    
    Use a single combo option for logind defaulting to 'libsystemd' with the
    choice for 'libelogind' and 'none' to build without seat support.

 meson.build            | 16 ++++++++--------
 meson_options.txt      |  3 +--
 src/libgdu/meson.build |  5 ++++-
 3 files changed, 13 insertions(+), 11 deletions(-)
---
diff --git a/meson.build b/meson.build
index ac641928..4ded2ab1 100644
--- a/meson.build
+++ b/meson.build
@@ -76,14 +76,14 @@ liblzma_dep = dependency('liblzma', version: '>= 5.0.5')
 m_dep = cc.find_library('m')
 
 # *** Check for logind ***
-assert(not (get_option('libsystemd').enabled() and get_option('libelogind').enabled()), 'Can not support 
systemd and elogind at once')
-if not get_option('libelogind').enabled()
-  logind_dep = dependency('libsystemd', version: '>= 209', required: get_option('libsystemd'))
+if get_option('logind') == 'libsystemd'
+  logind_dep = dependency('libsystemd', version: '>= 209')
 endif
-if get_option('libelogind').enabled() or not logind_dep.found()
-  logind_dep = dependency('libelogind', version: '>= 209', required: get_option('libelogind'))
+if get_option('logind') == 'libelogind'
+  logind_dep = dependency('libelogind', version: '>= 209')
 endif
-config_h.set('HAVE_LOGIND', logind_dep.found(),
+enable_logind = get_option('logind') != 'none'
+config_h.set('HAVE_LOGIND', enable_logind,
              description: 'Define to 1 if logind API is available')
 
 gnome = import('gnome')
@@ -126,9 +126,9 @@ output += '        libexecdir:                 ' + gdu_libexecdir + '\n'
 output += '        localedir:                  ' + gdu_localedir + '\n'
 output += '        mandir:                     ' + gdu_mandir + '\n'
 output += '        sysconfdir:                 ' + gdu_sysconfdir + '\n\n'
-output += '        Use logind:                 ' + logind_dep.found().to_string() + '\n'
+output += '        Use logind:                 ' + enable_logind.to_string() + '\n'
 output += '        Build g-s-d plug-in:        ' + enable_gsd_plugin.to_string() + '\n\n'
 output += '        compiler:                   ' + cc.get_id() + '\n'
 output += '        cflags:                     ' + ' '.join(compiler_flags) + '\n\n'
-output += '        (Change with: meson configure BUILDDIR -D libelogind=auto|enabled|disabled -D 
libsystemd=auto|enabled|disabled -D gsd_plugin=true|false)\n\n'
+output += '        (Change with: meson configure BUILDDIR -D logind=libsystemd|libelogind|none -D 
gsd_plugin=true|false)\n\n'
 message(output)
diff --git a/meson_options.txt b/meson_options.txt
index 895fc115..37bf112b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,3 +1,2 @@
-option('libelogind', type: 'feature', value: 'auto', description: 'build with libelogind')
-option('libsystemd', type: 'feature', value: 'auto', description: 'build with libsystemd')
+option('logind', type: 'combo', choices: ['libsystemd', 'libelogind', 'none'], value: 'libsystemd', 
description: 'build with logind')
 option('gsd_plugin', type: 'boolean', value: true, description: 'build gnome-settings-daemon plug-in')
diff --git a/src/libgdu/meson.build b/src/libgdu/meson.build
index 0693b229..6ebe5744 100644
--- a/src/libgdu/meson.build
+++ b/src/libgdu/meson.build
@@ -17,11 +17,14 @@ deps = [
   udisk_dep,
   gtk_dep,
   libsecret_dep,
-  logind_dep,
   pwquality_dep,
   m_dep
 ]
 
+if enable_logind
+  deps += logind_dep
+endif
+
 cflags = [
   '-DPACKAGE_DATA_DIR="@0@"'.format(gdu_datadir),
   '-DG_LOG_DOMAIN="libgdu"',


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