Document and test env vars a bit better

pull/10152/head
John Ericson 5 years ago committed by Dylan Baker
parent 4dd6cb8469
commit 01a7aa0a4d
  1. 12
      docs/markdown/howtox.md
  2. 6
      unittests/linuxliketests.py

@ -12,12 +12,12 @@ When first running Meson, set it in an environment variable.
$ CC=mycc meson <options> $ CC=mycc meson <options>
``` ```
Note that environment variables like `CC` only works in native builds. Note that environment variables like `CC` only refer to the host
The `CC` refers to the compiler for the host platform, that is the platform in cross builds. That is, `CC` refers to the compiler used to
compiler used to compile programs that run on the machine we will compile programs that run on the machine we will eventually install the
eventually install the project on. The compiler used to build things project on. The compiler used to build things that run on the machine we
that run on the machine we do the building can be specified with do the building can be specified with `CC_FOR_BUILD`. You can use it in
`CC_FOR_BUILD`. You can use it in cross builds. cross builds.
Note that environment variables are never the idiomatic way to do Note that environment variables are never the idiomatic way to do
anything with Meson, however. It is better to use the native and cross anything with Meson, however. It is better to use the native and cross

@ -1545,12 +1545,10 @@ class LinuxlikeTests(BasePlatformTests):
testdir = os.path.join(self.unit_test_dir, '60 identity cross') testdir = os.path.join(self.unit_test_dir, '60 identity cross')
env = { env = {
'CC_FOR_BUILD': '"' + os.path.join(testdir, 'build_wrapper.py') + '"', 'CC_FOR_BUILD': '"' + os.path.join(testdir, 'build_wrapper.py') + '"',
'CC': '"' + os.path.join(testdir, 'host_wrapper.py') + '"',
} }
crossfile = tempfile.NamedTemporaryFile(mode='w') crossfile = tempfile.NamedTemporaryFile(mode='w')
crossfile.write(textwrap.dedent('''\ crossfile.write('')
[binaries]
c = ['{}']
'''.format(os.path.join(testdir, 'host_wrapper.py'))))
crossfile.flush() crossfile.flush()
self.meson_cross_files = [crossfile.name] self.meson_cross_files = [crossfile.name]
# TODO should someday be explicit about build platform only here # TODO should someday be explicit about build platform only here

Loading…
Cancel
Save