[rygel/wip/meson] meson: Add option for systemd unit dir



commit d73d2293b5b45ccc34f2796bc6574cd408cd17dc
Author: Jens Georg <mail jensge org>
Date:   Fri Oct 12 16:28:17 2018 +0200

    meson: Add option for systemd unit dir

 data/meson.build  | 20 ++++++++++++++++----
 meson.build       |  3 +--
 meson_options.txt |  1 +
 3 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/data/meson.build b/data/meson.build
index 65994350..f686c1ce 100644
--- a/data/meson.build
+++ b/data/meson.build
@@ -20,10 +20,22 @@ configure_file(input: 'org.gnome.Rygel1.service.in',
                configuration: data_conf,
                install_dir : join_paths(rygel_datadir, 'dbus-1', 'services'))
 
-configure_file(input: 'rygel.service.in',
-               output: 'rygel.service',
-               configuration: data_conf,
-               install_dir : rygel_systemduserdir)
+systemd = dependency('systemd', required : false)
+systemd_user_unit_dir = join_paths(get_option('prefix'), 'lib/systemd/user/')
+if systemd.found()
+    systemd_user_unit_dir = systemd.get_pkgconfig_variable('systemduserunitdir')
+endif
+
+if not (get_option('systemd-user-units-dir') == 'off')
+    if not (get_option('systemd-user-units-dir') == 'auto')
+        systemd_user_unit_dir = get_option('systemd-user-units-dir')
+    endif
+
+    configure_file(input: 'rygel.service.in',
+                   output: 'rygel.service',
+                   configuration: data_conf,
+                   install_dir : systemd_user_unit_dir)
+endif
 
 rygel_desktop_preferences_in = configure_file(input: 'rygel-preferences.desktop.in.in',
                output : 'rygel-preferences.desktop.in',
diff --git a/meson.build b/meson.build
index 700ba6a0..8e852670 100644
--- a/meson.build
+++ b/meson.build
@@ -6,7 +6,7 @@ i18n = import('i18n')
 rygel_libdir = join_paths(get_option('prefix'), get_option('libdir'))
 rygel_includedir = join_paths(get_option('includedir'), 'rygel-2.6')
 rygel_vapidir = join_paths(get_option('prefix'), get_option('datadir'), 'vala/vapi')
-rygel_systemduserdir = join_paths(get_option('prefix'), 'lib', 'systemd', 'user')
+
 if not get_option('uninstalled')
 rygel_datadir = join_paths(get_option('prefix'), get_option('datadir'))
 rygel_libexecdir = join_paths(get_option('prefix'), get_option('libexecdir'),
@@ -20,7 +20,6 @@ rygel_bigicondir = join_paths(rygel_datadir, 'rygel', 'icons', '120x120')
 rygel_smallicondir = join_paths(rygel_datadir, 'rygel', 'icons', '48x48')
 rygel_includedir = join_paths(get_option('includedir'), 'rygel-2.6')
 rygel_vapidir = join_paths(rygel_datadir, 'vala', 'vapi')
-rygel_systemduserdir = join_paths(get_option('prefix'), 'lib', 'systemd', 'user')
 else
 rygel_datadir = join_paths(meson.current_build_dir(), 'data')
 rygel_libexecdir = join_paths(meson.current_build_dir(), 'src/plugins/media-export')
diff --git a/meson_options.txt b/meson_options.txt
index b9e0f837..e74eadd7 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,2 +1,3 @@
 option('uninstalled', type: 'boolean', value: 'false', description: 'Run Rygel from build directory only')
 option('api-docs', type: 'boolean', value: 'false', description: 'Build the API documentation')
+option('systemd-user-units-dir', type : 'string', value : 'auto', description : 'Where to install the 
systemd user unit (use special values "auto" or "none", or pass a path')


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