From 4ec6d0555abbf11a94e4e9145713e932bda34728 Mon Sep 17 00:00:00 2001 From: kaliko Date: Tue, 11 Apr 2023 21:06:53 +0200 Subject: [PATCH] check systemd unit dir from systemd.pc in meson --- NEWS | 1 + systemd/system/meson.build | 6 ++++++ systemd/user/meson.build | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/NEWS b/NEWS index 0cc0a8d93..2b14f80f2 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ ver 0.23.13 (not yet released) - pipewire: fix corruption bug due to missing lock * Linux - shut down if parent process dies in --no-daemon mode + - determine systemd unit directories via pkg-config ver 0.23.12 (2023/01/17) * input diff --git a/systemd/system/meson.build b/systemd/system/meson.build index 96e6a219b..b4b4d523c 100644 --- a/systemd/system/meson.build +++ b/systemd/system/meson.build @@ -1,4 +1,10 @@ systemd_system_unit_dir = get_option('systemd_system_unit_dir') +if systemd_system_unit_dir == '' + systemd = dependency('systemd', required: false) + if systemd.found() + systemd_system_unit_dir = systemd.get_pkgconfig_variable('systemdsystemunitdir') + endif +endif if systemd_system_unit_dir == '' systemd_system_unit_dir = join_paths(get_option('prefix'), 'lib', 'systemd', 'system') endif diff --git a/systemd/user/meson.build b/systemd/user/meson.build index fdce339e4..8411f0856 100644 --- a/systemd/user/meson.build +++ b/systemd/user/meson.build @@ -1,4 +1,10 @@ systemd_user_unit_dir = get_option('systemd_user_unit_dir') +if systemd_user_unit_dir == '' + systemd = dependency('systemd', required: false) + if systemd.found() + systemd_user_unit_dir = systemd.get_pkgconfig_variable('systemduserunitdir') + endif +endif if systemd_user_unit_dir == '' systemd_user_unit_dir = join_paths(get_option('prefix'), 'lib', 'systemd', 'user') endif