[tracker/wip/carlosg/portal: 283/298] build: restore dbus/systemd options



commit b9b48e6d645ffa043d93fc1a450234d942110c7c
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       | 29 +++++++++++++++++++++++++++++
 meson_options.txt |  6 ++++++
 2 files changed, 35 insertions(+)
---
diff --git a/meson.build b/meson.build
index 8150c944f..6a003715b 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,34 @@ 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')
+if install_systemd_user_services
+  systemd = dependency('systemd', required: true)
+
+  if get_option('systemd_user_services_dir') == ''
+    # FIXME: this would ideally use the systemduserunitdir pkgconfig variable, but
+    # it does not depend on variables we can override to install within prefix.
+    systemd_user_services_dir = join_paths(libdir, 'systemd', 'user')
+  else
+    systemd_user_services_dir = get_option('systemd_user_services_dir')
+  endif
+endif
+
 ####################################################################
 # bash-completion
 ####################################################################
diff --git a/meson_options.txt b/meson_options.txt
index 0cdab073f..bc1b950c3 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', type: 'boolean', value: 'true',
+       description: 'Whether to install systemd unit 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]