From 29e7dc642831801d14480cf7e4bb19f6ffb118e9 Mon Sep 17 00:00:00 2001 From: Pavel Solovev Date: Fri, 1 Nov 2024 13:54:17 +0000 Subject: [PATCH] Systemd fixes Fix installation path, install the service only if the systemd option is enabled --- meson.build | 3 ++- systemd/meson.build | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index d0ba9a5c..76765645 100644 --- a/meson.build +++ b/meson.build @@ -53,7 +53,9 @@ epoll_dep = dependency('epoll-shim', required: false) # timerfd on BSDs # Handle options if get_option('systemd').enabled() + systemd = dependency('systemd') add_project_arguments('-DUSES_SYSTEMD', language: 'cpp') + subdir('systemd') endif if get_option('legacy_renderer').enabled() @@ -89,7 +91,6 @@ subdir('hyprpm/src') subdir('assets') subdir('example') subdir('docs') -subdir('systemd') # Generate hyprland.pc pkg_install_dir = join_paths(get_option('datadir'), 'pkgconfig') diff --git a/systemd/meson.build b/systemd/meson.build index 497e64f4..2cd5312a 100644 --- a/systemd/meson.build +++ b/systemd/meson.build @@ -7,9 +7,11 @@ install_data( conf_data = configuration_data() conf_data.set('PREFIX', get_option('prefix')) conf_data.set('BINDIR', get_option('bindir')) +user_unit_dir = systemd.get_variable(pkgconfig: 'systemduserunitdir', + pkgconfig_define: ['prefix', get_option('prefix')]) configure_file( configuration: conf_data, input: 'hyprland-session.service.in', output: '@BASENAME@', - install_dir: join_paths(get_option('libdir'), 'systemd/user') ) + install_dir: user_unit_dir )