meson.build: let meson handle the prefix + bindir concatination

For bindir, libdir and datadir, meson enforces that either
- the value is an absolute path that is a subdir of $prefix
- the value is a relative path that is then made a subdir of $prefix

Example meson error message:
ERROR: The value of the 'bindir' option is '/usr/foobar' which must be a subdir of the prefix '/usr/local'.
Note that if you pass a relative path, it is assumed to be a subdir of prefix.

And meson handles absolute paths for those directories correctly (ignoring
$prefix), so we don't need to manually compose those.

Only exception is sysconfdir which may be outside the prefix but there too
meson handles an absolute path correctly.
This commit is contained in:
Peter Hutterer 2021-07-06 09:40:39 +10:00
parent d8365fe33e
commit fd37c0cd2e

View file

@ -13,29 +13,10 @@ wireplumber_so_version = '0'
wireplumber_headers_dir = get_option('includedir') / 'wireplumber-' + wireplumber_api_version / 'wp'
if get_option('bindir').startswith('/')
wireplumber_bin_dir = get_option('bindir')
else
wireplumber_bin_dir = get_option('prefix') / get_option('bindir')
endif
if get_option('libdir').startswith('/')
wireplumber_module_dir = get_option('libdir') / 'wireplumber-' + wireplumber_api_version
else
wireplumber_module_dir = get_option('prefix') / get_option('libdir') / 'wireplumber-' + wireplumber_api_version
endif
if get_option('sysconfdir').startswith('/')
wireplumber_config_dir = get_option('sysconfdir') / 'wireplumber'
else
wireplumber_config_dir = get_option('prefix') / get_option('sysconfdir') / 'wireplumber'
endif
if get_option('datadir').startswith('/')
wireplumber_data_dir = get_option('datadir') / 'wireplumber'
else
wireplumber_data_dir = get_option('prefix') / get_option('datadir') / 'wireplumber'
endif
wireplumber_bin_dir = get_option('prefix') / get_option('bindir')
wireplumber_module_dir = get_option('prefix') / get_option('libdir') / 'wireplumber-' + wireplumber_api_version
wireplumber_data_dir = get_option('prefix') / get_option('datadir') / 'wireplumber'
wireplumber_config_dir = get_option('prefix') / get_option('sysconfdir') / 'wireplumber'
cc = meson.get_compiler('c')