Skip to content
Snippets Groups Projects
Commit 56f8a82a authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

daemon: add systemd unit files

see also pipewire/pipewire!481
parent 51e24c58
No related merge requests found
......@@ -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
......
......@@ -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')
......@@ -11,6 +11,8 @@ install_subdir('scripts',
strip_directory : false
)
subdir('systemd')
executable('wireplumber',
wp_sources,
c_args : [
......
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
configure_file(input : 'wireplumber.service.in',
output : 'wireplumber.service',
configuration : systemd_config,
install_dir : systemd_system_unit_dir)
[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
configure_file(input : 'wireplumber.service.in',
output : 'wireplumber.service',
configuration : systemd_config,
install_dir : systemd_user_unit_dir)
[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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment