diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2021-04-03 20:42:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-03 20:42:21 +0300 |
commit | 7ec9e81e6f6e0bebdc0b10b0f513768ff94dec37 (patch) | |
tree | 8899829a2520f622fc53f46dff01fadec8f13a87 /mesonbuild/compilers/compilers.py | |
parent | 558a7bc6ff875f233b2ab7531e59e296b98032bd (diff) | |
parent | d569d0bb3cf54620ddbd56485ebb700be8ffcf94 (diff) | |
download | meson-7ec9e81e6f6e0bebdc0b10b0f513768ff94dec37.zip meson-7ec9e81e6f6e0bebdc0b10b0f513768ff94dec37.tar.gz meson-7ec9e81e6f6e0bebdc0b10b0f513768ff94dec37.tar.bz2 |
Merge pull request #8606 from dcbaker/submit/fix-for-build-env-variables
Fix _FOR_BUILD env variables
Diffstat (limited to 'mesonbuild/compilers/compilers.py')
-rw-r--r-- | mesonbuild/compilers/compilers.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index b06f6a5..9b4418b 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1236,19 +1236,26 @@ def get_global_options(lang: str, largkey = argkey.evolve('link_args') envkey = argkey.evolve('env_args') + comp_key = argkey if argkey in env.options else envkey + + comp_options = env.options.get(comp_key, []) + link_options = env.options.get(largkey, []) + cargs = coredata.UserArrayOption( description + ' compiler', - env.options.get(argkey, []), split_args=True, user_input=True, allow_dups=True) - # the compiler args always gets the environemtn variable arguments - cargs.extend_value(env.options.get(envkey, [])) + comp_options, split_args=True, user_input=True, allow_dups=True) largs = coredata.UserArrayOption( description + ' linker', - env.options.get(largkey, []), split_args=True, user_input=True, allow_dups=True) - # The linker gets the compiler environment variable only if the comiler - # acts as the linker - if comp.INVOKES_LINKER: - largs.extend_value(env.options.get(envkey, [])) + link_options, split_args=True, user_input=True, allow_dups=True) + + if comp.INVOKES_LINKER and comp_key == envkey: + # If the compiler acts as a linker driver, and we're using the + # environment variable flags for both the compiler and linker + # arguments, then put the compiler flags in the linker flags as well. + # This is how autotools works, and the env vars freature is for + # autotools compatibility. + largs.extend_value(comp_options) opts: 'KeyedOptionDictType' = {argkey: cargs, largkey: largs} |