diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2020-03-23 18:07:24 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-03-23 18:07:24 +0200 |
commit | 7924e5f9c20017a0ad7df6ee1cdb540d8a98dff7 (patch) | |
tree | 8f0637e630777cc4a5707c16a30c4d980b888371 | |
parent | 097dfc085e6a1bb3c670880134a52dcfca504be7 (diff) | |
download | meson-7924e5f9c20017a0ad7df6ee1cdb540d8a98dff7.zip meson-7924e5f9c20017a0ad7df6ee1cdb540d8a98dff7.tar.gz meson-7924e5f9c20017a0ad7df6ee1cdb540d8a98dff7.tar.bz2 |
Revert "Naturally use env vars a bit more to match Autoconf"
This reverts commit 097dfc085e6a1bb3c670880134a52dcfca504be7.
-rw-r--r-- | docs/markdown/howtox.md | 15 | ||||
-rw-r--r-- | docs/markdown/snippets/env_vars_and_cross.md | 10 | ||||
-rw-r--r-- | mesonbuild/envconfig.py | 4 | ||||
-rwxr-xr-x | run_unittests.py | 5 |
4 files changed, 17 insertions, 17 deletions
diff --git a/docs/markdown/howtox.md b/docs/markdown/howtox.md index ee7fc9c..8231d3d 100644 --- a/docs/markdown/howtox.md +++ b/docs/markdown/howtox.md @@ -12,16 +12,15 @@ When first running Meson, set it in an environment variable. $ CC=mycc meson <options> ``` -Note that environment variables like `CC` only refer to the host platform in -cross builds. That is, the `CC` refers compiler used to compile programs that -run on the machine we will eventually install the project on. The compiler used -to build things that run on the machine we do the building can be specified -with `CC_FOR_BUILD`. You can always used `CC_FOR_BUILD`, but for native builds -it is less well known because Meson (and Autotools) will default `CC_FOR_BUILD` -with `CC`. +Note that environment variables like `CC` only works in native builds. The `CC` +refers to the compiler for the host platform, that is the compiler used to +compile programs that run on the machine we will eventually install the project +on. The compiler used to build things that run on the machine we do the +building can be specified with `CC_FOR_BUILD`. You can use it in cross builds. Note that environment variables are never the idiomatic way to do anything with -Meson, however. It is better to use the native and cross files. +Meson, however. It is better to use the native and cross files. And the tools +for the host platform in cross builds can only be specified with a cross file. There is a table of all environment variables supported [Here](Reference-tables.md#compiler-and-linker-selection-variables) diff --git a/docs/markdown/snippets/env_vars_and_cross.md b/docs/markdown/snippets/env_vars_and_cross.md index f4340de..61a63f3 100644 --- a/docs/markdown/snippets/env_vars_and_cross.md +++ b/docs/markdown/snippets/env_vars_and_cross.md @@ -2,11 +2,11 @@ Previously in Meson, variables like `CC` effected both the host and build platforms for native builds, but the just the build platform for cross builds. -Now `CC` always effects the host platform, and `CC_FOR_BUILD` always affects -the build platform, with `CC` also effecting the build platform for native -builds only when `CC_FOR_BUILD` is not defined. +Now `CC_FOR_BUILD` is used for the build platform in cross builds. This old behavior is inconsistent with the way Autotools works, which undermines the purpose of distro-integration that is the only reason -environment variables are supported at all in Meson. The new behavior is -consistent. +environment variables are supported at all in Meson. The new behavior is not +quite the same, but doesn't conflict: meson doesn't always repond to an +environment when Autoconf would, but when it does it interprets it as Autotools +would. diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py index e0d07c5..ac13a71 100644 --- a/mesonbuild/envconfig.py +++ b/mesonbuild/envconfig.py @@ -119,9 +119,9 @@ def get_env_var_pair(for_machine: MachineChoice, # compiling we fall back on the unprefixed host version. This # allows native builds to never need to worry about the 'BUILD_*' # ones. - [var_name + '_FOR_BUILD'] + ([] if is_cross else [var_name]), + ([var_name + '_FOR_BUILD'] if is_cross else [var_name]), # Always just the unprefixed host verions - [var_name], + ([] if is_cross else [var_name]), )[for_machine] for var in candidates: value = os.environ.get(var) diff --git a/run_unittests.py b/run_unittests.py index 4ae1728..d1c10f5 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -6338,10 +6338,11 @@ c = ['{0}'] testdir = os.path.join(self.unit_test_dir, '61 identity cross') env = { 'CC_FOR_BUILD': '"' + os.path.join(testdir, 'build_wrapper.py') + '"', - 'CC': '"' + os.path.join(testdir, 'host_wrapper.py') + '"', } crossfile = tempfile.NamedTemporaryFile(mode='w') - crossfile.write('') + crossfile.write('''[binaries] +c = ['{0}'] +'''.format(os.path.join(testdir, 'host_wrapper.py'))) crossfile.flush() self.meson_cross_file = crossfile.name # TODO should someday be explicit about build platform only here |