diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2022-01-29 19:54:15 +0100 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-02-09 11:04:59 -0500 |
commit | df451f10130fc5d64cf1c65504a69bedd2fbdfdd (patch) | |
tree | efc457f194ce5312bb59da5791f5f10eaa2bbabf /docs/yaml/functions | |
parent | d2d9df3121d228797d0b3bccfd614849b637c0fe (diff) | |
download | meson-df451f10130fc5d64cf1c65504a69bedd2fbdfdd.zip meson-df451f10130fc5d64cf1c65504a69bedd2fbdfdd.tar.gz meson-df451f10130fc5d64cf1c65504a69bedd2fbdfdd.tar.bz2 |
meson: Allow directory options outside of prefix
This bring us in line with Autotools and CMake and it is useful
for platforms like Nix, which install projects
into multiple independent prefixes.
As a consequence, `get_option` might return absolute paths for some
directory options, if a directory outside of prefix is passed.
This is technically a backwards incompatible change but its effect
should be minimal, thanks to widespread use of `join_paths`/`/` operator
and pkg-config generator module. It should only cause an issue when
a path were constructed by concatenating the value of directory path option.
Also remove a comment about commonpath since we do not use that since
<https://github.com/mesonbuild/meson/commit/00f5dadd5b7d71c30bd7393d165a87f554eb92e5>.
Fixes: https://github.com/mesonbuild/meson/issues/2561
Diffstat (limited to 'docs/yaml/functions')
-rw-r--r-- | docs/yaml/functions/_build_target_base.yaml | 8 | ||||
-rw-r--r-- | docs/yaml/functions/get_option.yaml | 18 |
2 files changed, 12 insertions, 14 deletions
diff --git a/docs/yaml/functions/_build_target_base.yaml b/docs/yaml/functions/_build_target_base.yaml index 62424b6..68df5d8 100644 --- a/docs/yaml/functions/_build_target_base.yaml +++ b/docs/yaml/functions/_build_target_base.yaml @@ -161,10 +161,10 @@ kwargs: install_dir: type: str description: | - override install directory for this file. The value is - relative to the `prefix` specified. F.ex, if you want to install - plugins into a subdir, you'd use something like this: `install_dir : - get_option('libdir') / 'projectname-1.0'`. + override install directory for this file. If the value is a relative path, + it will be considered relative the `prefix` option. + For example, if you want to install plugins into a subdir, you'd use + something like this: `install_dir : get_option('libdir') / 'projectname-1.0'`. install_mode: type: list[str | int] diff --git a/docs/yaml/functions/get_option.yaml b/docs/yaml/functions/get_option.yaml index 0bf0042..7f7982e 100644 --- a/docs/yaml/functions/get_option.yaml +++ b/docs/yaml/functions/get_option.yaml @@ -5,16 +5,14 @@ description: | specified in the positional argument. Note that the value returned for built-in options that end in `dir` - such as `bindir` and `libdir` is always a path relative to (and - inside) the `prefix`. - - The only exceptions are: `sysconfdir`, `localstatedir`, and - `sharedstatedir` which will return the value passed during - configuration as-is, which may be absolute, or relative to `prefix`. - [`install_dir` arguments](Installing.md) handles that as expected, but - if you need the absolute path to one of these e.g. to use in a define - etc., you should use `get_option('prefix') / - get_option('localstatedir')` + such as `bindir` and `libdir` is usually a path relative to (and + inside) the `prefix` but you should not rely on that, as it can also + be an absolute path [in some cases](Builtin-options.md#Universal options). + [`install_dir` arguments](Installing.md) handle that as expected + but if you need an absolute path, e.g. to use in a define etc., + you should use the path concatenation operator like this: + `get_option('prefix') / get_option('localstatedir')`. + Never manually join paths as if they were strings. For options of type `feature` a [[@feature]] option object |