From 01a7aa0a4d7314e2e007f04baf9f06f6ae52a5ec Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 19 Mar 2020 18:05:31 -0400 Subject: [PATCH] Document and test env vars a bit better --- docs/markdown/howtox.md | 12 ++++++------ unittests/linuxliketests.py | 6 ++---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/docs/markdown/howtox.md b/docs/markdown/howtox.md index 9945a6cf9..651f0899b 100644 --- a/docs/markdown/howtox.md +++ b/docs/markdown/howtox.md @@ -12,12 +12,12 @@ When first running Meson, set it in an environment variable. $ CC=mycc meson ``` -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 like `CC` only refer to the host +platform in cross builds. That is, `CC` refers to 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 diff --git a/unittests/linuxliketests.py b/unittests/linuxliketests.py index a942df195..406950e89 100644 --- a/unittests/linuxliketests.py +++ b/unittests/linuxliketests.py @@ -1545,12 +1545,10 @@ class LinuxlikeTests(BasePlatformTests): testdir = os.path.join(self.unit_test_dir, '60 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(textwrap.dedent('''\ - [binaries] - c = ['{}'] - '''.format(os.path.join(testdir, 'host_wrapper.py')))) + crossfile.write('') crossfile.flush() self.meson_cross_files = [crossfile.name] # TODO should someday be explicit about build platform only here