]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: Convert dbus to meson feature
authorJan Janssen <medhefgo@web.de>
Thu, 10 Aug 2023 13:16:56 +0000 (15:16 +0200)
committerJan Janssen <medhefgo@web.de>
Wed, 23 Aug 2023 12:45:02 +0000 (14:45 +0200)
Also, there is no need to conditionalize the get_variable() calls
because not-found dependencies will just return the passed default value
if provided.

meson.build
meson_options.txt
mkosi.presets/base/mkosi.build

index 507c9e2a1e84ea40387e057caceeda86bf171763..3ba2448f772c742f523fd03efa4d2cc9864c2d30 100644 (file)
@@ -1448,22 +1448,12 @@ libgio =     dependency('gio-2.0',
                         required : get_option('glib'))
 conf.set10('HAVE_GLIB', libglib.found() and libgobject.found() and libgio.found())
 
-want_dbus = get_option('dbus')
-if want_dbus != 'false' and not skip_deps
-        libdbus = dependency('dbus-1',
-                             version : '>= 1.3.2',
-                             required : want_dbus == 'true')
-        have = libdbus.found()
-else
-        have = false
-        libdbus = []
-endif
-conf.set10('HAVE_DBUS', have)
+libdbus = dependency('dbus-1',
+                     version : '>= 1.3.2',
+                     required : get_option('dbus'))
+conf.set10('HAVE_DBUS', libdbus.found())
 
-dbusdatadir = datadir / 'dbus-1'
-if conf.get('HAVE_DBUS') == 1
-        dbusdatadir = libdbus.get_variable(pkgconfig: 'datadir', default_value: datadir) / 'dbus-1'
-endif
+dbusdatadir = libdbus.get_variable(pkgconfig: 'datadir', default_value: datadir) / 'dbus-1'
 
 dbuspolicydir = get_option('dbuspolicydir')
 if dbuspolicydir == ''
@@ -1472,18 +1462,12 @@ endif
 
 dbussessionservicedir = get_option('dbussessionservicedir')
 if dbussessionservicedir == ''
-        dbussessionservicedir = dbusdatadir / 'services'
-        if conf.get('HAVE_DBUS') == 1
-                dbussessionservicedir = libdbus.get_variable(pkgconfig: 'session_bus_services_dir', default_value: dbussessionservicedir)
-        endif
+        dbussessionservicedir = libdbus.get_variable(pkgconfig: 'session_bus_services_dir', default_value: dbusdatadir / 'services')
 endif
 
 dbussystemservicedir = get_option('dbussystemservicedir')
 if dbussystemservicedir == ''
-        dbussystemservicedir = dbusdatadir / 'system-services'
-        if conf.get('HAVE_DBUS') == 1
-                dbussystemservicedir = libdbus.get_variable(pkgconfig: 'system_bus_services_dir', default_value: dbussystemservicedir)
-        endif
+        dbussystemservicedir = libdbus.get_variable(pkgconfig: 'system_bus_services_dir', default_value: dbusdatadir / 'system-services')
 endif
 
 dbus_interfaces_dir = get_option('dbus-interfaces-dir')
@@ -1492,10 +1476,7 @@ if dbus_interfaces_dir == '' or dbus_interfaces_dir == 'yes'
                 dbus_interfaces_dir = 'no'
                 warning('Exporting D-Bus interface XML files is disabled during cross build. Pass path or "yes" to force enable.')
         else
-                dbus_interfaces_dir = dbusdatadir / 'interfaces'
-                if conf.get('HAVE_DBUS') == 1
-                        dbus_interfaces_dir = libdbus.get_variable(pkgconfig: 'interfaces_dir', default_value: dbus_interfaces_dir)
-                endif
+                dbus_interfaces_dir = libdbus.get_variable(pkgconfig: 'interfaces_dir', default_value: dbusdatadir / 'interfaces')
         endif
 endif
 
index 9d73203da6a1890d54c6ac7a5dc713579359de1b..3c99af27fca4dc584c16c8d91551a7250bc965c4 100644 (file)
@@ -437,7 +437,7 @@ option('pcre2', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : '
        description : 'regexp matching support using pcre2')
 option('glib', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
        description : 'libglib support (for tests only)')
-option('dbus', type : 'combo', choices : ['auto', 'true', 'false'],
+option('dbus', type : 'feature', deprecated : { 'true' : 'enabled', 'false' : 'disabled' },
        description : 'libdbus support (for tests only)')
 
 option('bootloader', type : 'combo', choices : ['auto', 'true', 'false'],
index 02769bac0059c66203439e4588eee17d55748cf4..d261f3b540a6cd8cca831975b0f20aec126a53cf 100755 (executable)
@@ -142,7 +142,7 @@ if [ ! -f "$BUILDDIR"/build.ninja ]; then
         -D xkbcommon=enabled
         -D pcre2=enabled
         -D glib=enabled
-        -D dbus=true
+        -D dbus=enabled
         -D bootloader=true
         -D kernel-install=true
         -D analyze=true