aboutsummaryrefslogtreecommitdiffstats
path: root/meson.build
diff options
context:
space:
mode:
authorLibravatar sghctoma <sghctoma@gmail.com>2018-10-17 15:06:55 +0200
committerLibravatar sghctoma <sghctoma@gmail.com>2018-10-17 15:28:18 +0200
commitaf2cfa52211d59ecfb6e3ccd9be4c7ccbd920268 (patch)
tree2dbac738bd437d5f5fd81734494f87397da3debb /meson.build
parentIncrease _POSIX_C_SOURCE to 200112L (diff)
downloadsway-af2cfa52211d59ecfb6e3ccd9be4c7ccbd920268.tar.gz
sway-af2cfa52211d59ecfb6e3ccd9be4c7ccbd920268.tar.zst
sway-af2cfa52211d59ecfb6e3ccd9be4c7ccbd920268.zip
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.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build17
1 files changed, 15 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index 3fb1e81e..1e2b53fa 100644
--- a/meson.build
+++ b/meson.build
@@ -114,7 +114,13 @@ if scdoc.found()
114 endforeach 114 endforeach
115endif 115endif
116 116
117add_project_arguments('-DSYSCONFDIR="/@0@"'.format(sysconfdir), language : 'c') 117# If prefix is '/usr', sysconfdir will be explicitly set to '/etc' by Meson to
118# enforce FHS compliance, so we should look for configs there as well.
119if prefix == '/usr'
120 add_project_arguments('-DSYSCONFDIR="/@0@"'.format(sysconfdir), language : 'c')
121else
122 add_project_arguments('-DSYSCONFDIR="/@0@/@1@"'.format(prefix, sysconfdir), language : 'c')
123endif
118 124
119version = get_option('sway-version') 125version = get_option('sway-version')
120if version != '' 126if version != ''
@@ -157,10 +163,17 @@ subdir('swaynag')
157subdir('swaylock') 163subdir('swaylock')
158 164
159config = configuration_data() 165config = configuration_data()
160config.set('sysconfdir', sysconfdir)
161config.set('datadir', join_paths(prefix, datadir)) 166config.set('datadir', join_paths(prefix, datadir))
162config.set('prefix', prefix) 167config.set('prefix', prefix)
163 168
169# If prefix is '/usr', sysconfdir will be explicitly set to '/etc' by Meson to
170# enforce FHS compliance, so we should look for configs there as well.
171if prefix == '/usr'
172 config.set('sysconfdir', sysconfdir)
173else
174 config.set('sysconfdir', join_paths(prefix, sysconfdir))
175endif
176
164configure_file( 177configure_file(
165 configuration: config, 178 configuration: config,
166 input: 'config.in', 179 input: 'config.in',