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
This commit is contained in:
Achill Gilgenast 2026-02-03 22:49:16 +01:00
parent 8ceb671cc8
commit ad12a4ae6e
No known key found for this signature in database
GPG key ID: BB8C8A81C6452A88
2 changed files with 24 additions and 6 deletions

View file

@ -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)