diff --git a/data/meson.build b/data/meson.build index cbd845b..29ab7b0 100644 --- a/data/meson.build +++ b/data/meson.build @@ -14,18 +14,22 @@ config_example = run_command( data_conf.set('GAMEMODE_EXAMPLE_CONFIG', config_example) if sd_bus_provider == 'systemd' - # Install systemd user unit - configure_file( - input: 'gamemoded.service.in', - output: 'gamemoded.service', - configuration: data_conf, - install_dir: path_systemd_unit_dir, - ) - # Install the sysusers.d file - install_data( - files('gamemode.conf'), - install_dir: path_systemd_group_dir, - ) + if with_systemd_unit + # Install systemd user unit + configure_file( + input: 'gamemoded.service.in', + output: 'gamemoded.service', + configuration: data_conf, + install_dir: path_systemd_unit_dir, + ) + endif + if with_systemd_group + # Install the sysusers.d file + install_data( + files('gamemode.conf'), + install_dir: path_systemd_group_dir, + ) + endif endif # Install the D-BUS service file diff --git a/meson.build b/meson.build index 09a73c7..2d0a419 100644 --- a/meson.build +++ b/meson.build @@ -104,17 +104,23 @@ libdl = cc.find_library('dl', required: false) # Determine the location for the systemd unit if sd_bus_provider == 'systemd' - path_systemd_unit_dir = get_option('with-systemd-user-unit-dir') - if path_systemd_unit_dir == '' - message('Asking pkg-config for systemd\'s \'systemduserunitdir\' directory') - pkgconfig_systemd = dependency('systemd') - path_systemd_unit_dir = pkgconfig_systemd.get_pkgconfig_variable('systemduserunitdir') + with_systemd_unit = get_option('with-systemd-user-unit') + if with_systemd_unit + path_systemd_unit_dir = get_option('with-systemd-user-unit-dir') + if path_systemd_unit_dir == '' + message('Asking pkg-config for systemd\'s \'systemduserunitdir\' directory') + pkgconfig_systemd = dependency('systemd') + path_systemd_unit_dir = pkgconfig_systemd.get_pkgconfig_variable('systemduserunitdir') + endif endif - path_systemd_group_dir = get_option('with-systemd-group-dir') - if path_systemd_group_dir == '' - message('Asking pkg-config for systemd\'s \'sysusersdir\' directory') - pkgconfig_systemd = dependency('systemd') - path_systemd_group_dir = pkgconfig_systemd.get_pkgconfig_variable('sysusersdir') + with_systemd_group = get_option('with-systemd-group') + if with_systemd_group + path_systemd_group_dir = get_option('with-systemd-group-dir') + if path_systemd_group_dir == '' + message('Asking pkg-config for systemd\'s \'sysusersdir\' directory') + pkgconfig_systemd = dependency('systemd') + path_systemd_group_dir = pkgconfig_systemd.get_pkgconfig_variable('sysusersdir') + endif endif endif @@ -203,13 +209,17 @@ report = [ ] if sd_bus_provider == 'systemd' +if with_systemd_unit report += [ ' systemd user unit directory: @0@'.format(path_systemd_unit_dir), ] +endif +if with_systemd_group report += [ ' systemd group directory: @0@'.format(path_systemd_group_dir), ] endif +endif report += [ ' D-BUS service directory: @0@'.format(path_dbus_service_dir), ] diff --git a/meson_options.txt b/meson_options.txt index 2d2746d..b9c35a3 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -5,7 +5,9 @@ option('with-pam-group', type: 'string', description: 'Install the limits.d conf option('with-sd-bus-provider', type: 'combo', choices: ['systemd', 'elogind', 'no-daemon'], value: 'systemd') # systemd specific +option('with-systemd-user-unit', type: 'boolean', description: 'Install systemd user unit', value: 'true') option('with-systemd-user-unit-dir', type: 'string', description: 'Explicitly set the systemd user unit directory') +option('with-systemd-group', type: 'boolean', description: 'Install systemd group', value: 'true') option('with-systemd-group-dir', type: 'string', description: 'Explicitly set the systemd group directory') # Not using systemd