systemd: Use pkgconfig variable systemduserunitdir as unit install directory

This commit is contained in:
Colin Kinloch 2021-12-28 14:52:23 +00:00 committed by Christoph Haag
parent 1b3dadbec5
commit 0a783ca208
4 changed files with 17 additions and 7 deletions

View file

@ -77,7 +77,8 @@ vulkan = dependency('vulkan', required: true)
zlib = dependency('zlib', required: false)
survive = dependency('survive', required: false)
dbus = dependency('dbus-1', required: get_option('dbus'))
systemd = dependency('libsystemd', required: get_option('systemd'))
systemd = dependency('systemd', required: get_option('systemd'))
systemd_dep = dependency('libsystemd', required: get_option('systemd'))
libbsd = dependency('libbsd', required: get_option('libbsd'))
gst = dependency('gstreamer-1.0', required: false)
gst_app = dependency('gstreamer-app-1.0', required: false)

View file

@ -163,3 +163,8 @@ option('color_log',
value: true,
description: 'Log in color'
)
option('systemd-user-unit-dir',
type: 'string',
description: 'Directory for user systemd units (defaults to /usr/lib/systemd/user)'
)

View file

@ -76,7 +76,7 @@ if dbus.found() and not get_option('dbus').disabled()
have_conf.set('XRT_HAVE_DBUS', true)
endif
if systemd.found() and not get_option('systemd').disabled()
if systemd_dep.found() and not get_option('systemd').disabled()
have_conf.set('XRT_HAVE_SYSTEMD', true)
endif

View file

@ -2,8 +2,8 @@
# SPDX-License-Identifier: BSL-1.0
service_deps = [pthreads, libjpeg]
if systemd.found() and not get_option('systemd').disabled()
service_deps += systemd
if systemd_dep.found() and not get_option('systemd').disabled()
service_deps += systemd_dep
endif
hack_deps = []
@ -52,7 +52,11 @@ service = executable(
)
service_install_path = join_paths(get_option('prefix'), 'bin', 'monado-service')
systemd_dir = join_paths(get_option('prefix'), get_option('libdir'), 'systemd', 'user')
systemd_user_services_dir = systemd.get_pkgconfig_variable('systemduserunitdir', define_variable : [ 'prefix', get_option('prefix')])
if get_option('systemd-user-unit-dir') != ''
systemd_user_services_dir = get_option('systemd-user-unit-dir')
endif
service_conf_data = configuration_data()
service_conf_data.set('UNIT_NAME', 'monado')
@ -64,7 +68,7 @@ configure_file(
input: 'monado.in.service',
output: 'monado.service',
configuration: service_conf_data,
install_dir: systemd_dir
install_dir: systemd_user_services_dir
)
socket_conf_data = configuration_data()
@ -74,5 +78,5 @@ configure_file(
input: 'monado.in.socket',
output: 'monado.socket',
configuration: socket_conf_data,
install_dir: systemd_dir
install_dir: systemd_user_services_dir
)