Set sysconfdir to /etc only if prefix is /usr

PR #2855 basically hardcodes the config file path to /etc, which is a
problem on e.g. FreeBSD, where the expected path for config files of
non-base software is '/usr/local/etc'.
Meson sets sysconfdir to '/etc' explicitly only when prefix is '/usr',
so it is still possible to use '/usr/local' as prefix, and install the
config files under '/usr/local/etc'. This commit allows to do that by
setting sysconfdir based on the value of prefix.
master
sghctoma 6 years ago
parent 2694fd72b6
commit af2cfa5221

@ -114,7 +114,13 @@ if scdoc.found()
endforeach
endif
add_project_arguments('-DSYSCONFDIR="/@0@"'.format(sysconfdir), language : 'c')
# If prefix is '/usr', sysconfdir will be explicitly set to '/etc' by Meson to
# enforce FHS compliance, so we should look for configs there as well.
if prefix == '/usr'
add_project_arguments('-DSYSCONFDIR="/@0@"'.format(sysconfdir), language : 'c')
else
add_project_arguments('-DSYSCONFDIR="/@0@/@1@"'.format(prefix, sysconfdir), language : 'c')
endif
version = get_option('sway-version')
if version != ''
@ -157,10 +163,17 @@ subdir('swaynag')
subdir('swaylock')
config = configuration_data()
config.set('sysconfdir', sysconfdir)
config.set('datadir', join_paths(prefix, datadir))
config.set('prefix', prefix)
# If prefix is '/usr', sysconfdir will be explicitly set to '/etc' by Meson to
# enforce FHS compliance, so we should look for configs there as well.
if prefix == '/usr'
config.set('sysconfdir', sysconfdir)
else
config.set('sysconfdir', join_paths(prefix, sysconfdir))
endif
configure_file(
configuration: config,
input: 'config.in',

Loading…
Cancel
Save