daemon: add systemd unit files

see also pipewire/pipewire!481
This commit is contained in:
George Kiagiadakis 2021-02-23 18:47:50 +02:00
parent 51e24c58b5
commit 56f8a82ad7
8 changed files with 103 additions and 0 deletions

View file

@ -13,6 +13,12 @@ wireplumber_so_version = '0'
wireplumber_headers_dir = join_paths(get_option('includedir'), 'wireplumber-' + wireplumber_api_version, 'wp')
if get_option('bindir').startswith('/')
wireplumber_bin_dir = get_option('bindir')
else
wireplumber_bin_dir = join_paths(get_option('prefix'), get_option('bindir'))
endif
if get_option('libdir').startswith('/')
wireplumber_module_dir = join_paths(get_option('libdir'), 'wireplumber-' + wireplumber_api_version)
else

View file

@ -4,3 +4,18 @@ option('doc', type : 'feature', value : 'auto',
description: 'Enable documentation.')
option('system-lua', type : 'boolean', value : 'false',
description : 'Use lua from the system instead of the bundled one')
option('systemd',
type: 'feature', value: 'auto',
description: 'Enable installing systemd units')
option('systemd-system-service',
type : 'boolean', value : false,
description: 'Install systemd system service file')
option('systemd-user-service',
type : 'boolean', value : true,
description: 'Install systemd user service file')
option('systemd-system-unit-dir',
type : 'string',
description : 'Directory for system systemd units')
option('systemd-user-unit-dir',
type : 'string',
description : 'Directory for user systemd units')

View file

@ -11,6 +11,8 @@ install_subdir('scripts',
strip_directory : false
)
subdir('systemd')
executable('wireplumber',
wp_sources,
c_args : [

32
src/systemd/meson.build Normal file
View file

@ -0,0 +1,32 @@
systemd = dependency('systemd', required: get_option('systemd'))
if systemd.found()
systemd_config = configuration_data()
systemd_config.set('WP_BINARY', join_paths(wireplumber_bin_dir, 'wireplumber'))
# system service
if get_option('systemd-system-service')
systemd_system_unit_dir = systemd.get_pkgconfig_variable(
'systemd_system_unit_dir',
define_variable : ['prefix', get_option('prefix')])
if get_option('systemd-system-unit-dir') != ''
systemd_system_unit_dir = get_option('systemd-system-unit-dir')
endif
subdir('system')
endif
# user service
if get_option('systemd-user-service')
systemd_user_unit_dir = systemd.get_pkgconfig_variable(
'systemd_user_unit_dir',
define_variable : ['prefix', get_option('prefix')])
if get_option('systemd-user-unit-dir') != ''
systemd_user_unit_dir = get_option('systemd-user-unit-dir')
endif
subdir('user')
endif
endif

View file

@ -0,0 +1,4 @@
configure_file(input : 'wireplumber.service.in',
output : 'wireplumber.service',
configuration : systemd_config,
install_dir : systemd_system_unit_dir)

View file

@ -0,0 +1,21 @@
[Unit]
Description=Multimedia Service Session Manager
After=pipewire.service
BindsTo=pipewire.service
[Service]
LockPersonality=yes
MemoryDenyWriteExecute=yes
NoNewPrivileges=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
SystemCallFilter=@system-service
Type=simple
ExecStart=@WP_BINARY@
Restart=on-failure
RuntimeDirectory=pipewire
User=pipewire
Environment=PIPEWIRE_RUNTIME_DIR=%t/pipewire
[Install]
WantedBy=pipewire.service

View file

@ -0,0 +1,4 @@
configure_file(input : 'wireplumber.service.in',
output : 'wireplumber.service',
configuration : systemd_config,
install_dir : systemd_user_unit_dir)

View file

@ -0,0 +1,19 @@
[Unit]
Description=Multimedia Service Session Manager
After=pipewire.service
BindsTo=pipewire.service
[Service]
LockPersonality=yes
MemoryDenyWriteExecute=yes
NoNewPrivileges=yes
RestrictNamespaces=yes
SystemCallArchitectures=native
SystemCallFilter=@system-service
Type=simple
ExecStart=@WP_BINARY@
Restart=on-failure
Slice=session.slice
[Install]
WantedBy=pipewire.service