From 33bbafe970d768c674f606d35d0d74c66e399851 Mon Sep 17 00:00:00 2001 From: nirenjan Date: Thu, 12 Mar 2026 13:21:59 -0700 Subject: [PATCH] fix: Fix systemd service installation in Meson The Meson build change broke the systemd service file installation. This commit fixes that, while retaining Autotools support. --- daemon/meson.build | 21 +++++++++++++++++++++ meson_options.txt | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/daemon/meson.build b/daemon/meson.build index 88cd27e..44d14c1 100644 --- a/daemon/meson.build +++ b/daemon/meson.build @@ -62,3 +62,24 @@ x52d_mouse_test = executable('x52d-mouse-test', x52d_mouse_test_sources, test('x52d-mouse-test', x52d_mouse_test, protocol: 'tap') +# Install service file +if dep_systemd.found() + systemd_system_unit_dir = get_option('systemd-unit-dir') + if systemd_system_unit_dir == '' + systemd_system_unit_dir = dep_systemd.get_variable( + pkgconfig: 'systemd_system_unit_dir', + default_value: '/lib/systemd/system') + endif + sed = find_program('sed') + bindir_path = get_option('prefix') / get_option('bindir') + sed_script = 's|%bindir%|' + bindir_path + '|g' + + systemd_service_file = configure_file( + input: 'x52d.service.in', + output: 'x52d.service', + command: [sed, sed_script, '@INPUT@'], + capture: true, + install: true, + install_dir: systemd_system_unit_dir + ) +endif diff --git a/meson_options.txt b/meson_options.txt index fe747e1..48bb33b 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -2,6 +2,11 @@ option('systemd-logs', type: 'feature', description: 'Hide timestamps in log messages, needed for systemd') +option('systemd-unit-dir', + type: 'string', + value: '', + description: 'Directory for systemd service files (leave empty for auto-detection)') + option('nls', type: 'feature', description: 'Enable message translations')