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.
master
nirenjan 2026-03-12 13:21:59 -07:00
parent e9a806a6a2
commit 33bbafe970
2 changed files with 26 additions and 0 deletions

View File

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

View File

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