From ad12a4ae6e0446d1bb46f1c201c898937ec171df Mon Sep 17 00:00:00 2001 From: Achill Gilgenast Date: Tue, 3 Feb 2026 22:49:16 +0100 Subject: [PATCH] systemd: Allow installation of systemd services without libsystemd Allows installation of systemd services without libsystemd installed. Useful for Alpine Linux where systemd services are allowed to be subpackaged (e.g. for postmarketOS) but hasn't systemd in it's repos. The difference in behaviour now is that "systemd-{system,user}-service = disabled" now actually don't install the units. And that "systemd-{system,user}-service = enabled" and the explicitly paths set, install the units --- src/daemon/systemd/system/meson.build | 15 ++++++++++++--- src/daemon/systemd/user/meson.build | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/src/daemon/systemd/system/meson.build b/src/daemon/systemd/system/meson.build index 02efc7a41..40aa7b324 100644 --- a/src/daemon/systemd/system/meson.build +++ b/src/daemon/systemd/system/meson.build @@ -1,13 +1,22 @@ -systemd = dependency('systemd', required : get_option('systemd-system-service')) -if not systemd.found() +systemd_system_services_dir = '' + +systemd = dependency('systemd', required : false) +if systemd.found() + systemd_system_services_dir = systemd.get_variable('systemdsystemunitdir', pkgconfig_define : [ 'rootprefix', prefix]) +endif + +if get_option('systemd-system-service').disabled() or (get_option('systemd-system-service').auto() and not systemd.found()) subdir_done() endif -systemd_system_services_dir = systemd.get_variable('systemdsystemunitdir', pkgconfig_define : [ 'rootprefix', prefix]) if get_option('systemd-system-unit-dir') != '' systemd_system_services_dir = get_option('systemd-system-unit-dir') endif +if systemd_system_services_dir == '' + subdir_done() +endif + install_data(sources : ['pipewire.socket', 'pipewire-manager.socket', 'pipewire-pulse.socket' ], install_dir : systemd_system_services_dir) diff --git a/src/daemon/systemd/user/meson.build b/src/daemon/systemd/user/meson.build index 1b65d5f7a..733651402 100644 --- a/src/daemon/systemd/user/meson.build +++ b/src/daemon/systemd/user/meson.build @@ -1,13 +1,22 @@ -systemd = dependency('systemd', required : get_option('systemd-user-service')) -if not systemd.found() +systemd_user_services_dir = '' + +systemd = dependency('systemd', required : false) +if systemd.found() + systemd_user_services_dir = systemd.get_variable('systemduserunitdir', pkgconfig_define : [ 'prefix', prefix]) +endif + +if get_option('systemd-user-service').disabled() or (get_option('systemd-user-service').auto() and not systemd.found()) subdir_done() endif -systemd_user_services_dir = systemd.get_variable('systemduserunitdir', pkgconfig_define : [ 'prefix', prefix]) if get_option('systemd-user-unit-dir') != '' systemd_user_services_dir = get_option('systemd-user-unit-dir') endif +if systemd_user_services_dir == '' + subdir_done() +endif + install_data( sources : ['pipewire.socket', 'pipewire-pulse.socket'], install_dir : systemd_user_services_dir)