[tracker/wip/carlosg/portal: 25/41] build: restore dbus/systemd options



commit a4e15707d67a33c9f3a867918b2a47a497d60f5d
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Mar 5 12:58:26 2020 +0100

    build: restore dbus/systemd options
    
    These options were cleaned up but will be good to have again for
    the portal service. While at it, split the systemd setting into
    a boolean to enable or disable the feature, and a string option
    to specify the user units path.

 meson.build       | 33 +++++++++++++++++++++++++++++++++
 meson_options.txt |  6 ++++++
 2 files changed, 39 insertions(+)
---
diff --git a/meson.build b/meson.build
index de6e61be5..8aa5ba814 100644
--- a/meson.build
+++ b/meson.build
@@ -50,6 +50,7 @@ json_glib = dependency('json-glib-1.0', version: '>= 1.0', required: true)
 libsoup = dependency('libsoup-2.4', version: '> 2.40', required: true)
 libxml2 = dependency('libxml-2.0', version: '> 2.6')
 sqlite = dependency('sqlite3', version: '>' + sqlite_required)
+dbus = dependency('dbus-1')
 
 libmath = cc.find_library('m', required: false)
 
@@ -182,6 +183,38 @@ if unicode_library_name == ''
   endif
 endif
 
+####################################################################
+# D-Bus service files
+####################################################################
+
+if get_option('dbus_services_dir') == ''
+  dbus_services_dir = dbus.get_pkgconfig_variable('session_bus_services_dir',
+                                                  define_variable: [ 'datadir', datadir ])
+else
+  dbus_services_dir = get_option('dbus_services_dir')
+endif
+
+####################################################################
+# systemd user services
+####################################################################
+
+install_systemd_user_services = get_option('systemd_user_services')
+if install_systemd_user_services
+  systemd_user_services_dir = get_option('systemd_user_services_dir')
+
+  if systemd_user_services_dir == ''
+    systemd = dependency('systemd', version: '>= 242', required: false)
+    if systemd.found()
+      systemd_user_services_dir = systemd.get_pkgconfig_variable('systemduserunitdir',
+                                                                 define_variable: ['prefix', 
get_option('prefix')])
+    else
+      error('systemd user services were enabled, but systemd was not found. ' +
+            'Please set the systemd_user_services_dir option if you want to ' +
+            'install them, or set systemd_user_services=false to disable.')
+    endif
+  endif
+endif
+
 ####################################################################
 # bash-completion
 ####################################################################
diff --git a/meson_options.txt b/meson_options.txt
index 0cdab073f..1c3372966 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -16,6 +16,12 @@ option('bash_completion', type: 'boolean', value: true,
        description: 'Whether to install Bash completion files')
 option('bash_completion_dir', type: 'string',
        description: 'Directory to install Bash completion files')
+option('dbus_services_dir', type: 'string', value: '',
+       description: 'Directory to install D-Bus .service files (or empty to use default)')
+option('systemd_user_services', type: 'boolean', value: true,
+       description: 'Whether to install systemd user .service files')
+option('systemd_user_services_dir', type: 'string', value: '',
+       description: 'Directory to install systemd user unit files (or empty to use default)')
 option('test_utils', type: 'boolean', value: true,
        description: 'Whether to install the trackertestutils Python package')
 option('test_utils_dir', type: 'string', value: '',


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