meson: Patch to ingest env vars like autoconf

See comment in code and the PR it references,
https://github.com/mesonbuild/meson/pull/6827, for details.

We can remove entries from the cross file because they will be gotten
from env vars now.
This commit is contained in:
John Ericson 2020-04-26 16:32:56 -04:00
parent 3c00ca03a2
commit 128b93e061
2 changed files with 21 additions and 6 deletions

View File

@ -45,6 +45,11 @@ python3Packages.buildPythonApplication rec {
# We remove the check so multiple outputs can work sanely.
./allow-dirs-outside-of-prefix.patch
# Meson is currently inspecting fewer variables than autoconf does, which
# makes it harder for us to use setup hooks, etc. Taken from
# https://github.com/mesonbuild/meson/pull/6827
./more-env-vars.patch
# Unlike libtool, vanilla Meson does not pass any information
# about the path library will be installed to to g-ir-scanner,
# breaking the GIR when path other than ${!outputLib}/lib is used.
@ -67,13 +72,7 @@ python3Packages.buildPythonApplication rec {
crossFile = writeTextDir "cross-file.conf" ''
[binaries]
c = '${targetPackages.stdenv.cc.targetPrefix}cc'
cpp = '${targetPackages.stdenv.cc.targetPrefix}c++'
ar = '${targetPackages.stdenv.cc.bintools.targetPrefix}ar'
strip = '${targetPackages.stdenv.cc.bintools.targetPrefix}strip'
pkgconfig = 'pkg-config'
ld = '${targetPackages.stdenv.cc.targetPrefix}ld'
objcopy = '${targetPackages.stdenv.cc.targetPrefix}objcopy'
[properties]
needs_exe_wrapper = true

View File

@ -0,0 +1,16 @@
diff --git a/mesonbuild/envconfig.py b/mesonbuild/envconfig.py
index ac13a710..e0d07c51 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
- ([] if is_cross else [var_name]),
+ [var_name],
)[for_machine]
for var in candidates:
value = os.environ.get(var)