From c3c7c6a007f1c758ec6c9fe2b9ecd73bb7be6129 Mon Sep 17 00:00:00 2001 From: Achill Gilgenast Date: Mon, 29 Jun 2026 15:56:42 +0200 Subject: [PATCH] services: add fallback systemd unitdir if systemd is not available Allows building the service files without a systemd dependency by defining a default systemd user unit directory. Relevant in Alpine, where we can package the service files in a subpackage without having systemd in Alpine. Addresses feedback of https://github.com/linux-speakup/espeakup/pull/64, therefore superseeds it. --- services/meson.build | 4 ++-- services/systemd/meson.build | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/services/meson.build b/services/meson.build index 0be40f1..5eadcac 100644 --- a/services/meson.build +++ b/services/meson.build @@ -1,4 +1,4 @@ -systemd = dependency('systemd', required: get_option('systemd')) -if systemd.found() +systemd = dependency('systemd') +if (systemd.found() and get_option('systemd').allowed()) or get_option('systemd').enabled() subdir('systemd') endif diff --git a/services/systemd/meson.build b/services/systemd/meson.build index eccbde7..1a15303 100644 --- a/services/systemd/meson.build +++ b/services/systemd/meson.build @@ -1,4 +1,8 @@ -unitdir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir') +if systemd.found() + unitdir = systemd.get_variable(pkgconfig: 'systemdsystemunitdir') +else + unitdir = join_paths(prefixdir, get_option('libdir'), 'systemd', 'system') +endif prefixdir = get_option('prefix') bindir = join_paths(prefixdir, get_option('bindir'))