Skip to content

Commit

Permalink
meson: Patch to ingest env vars like autoconf
Browse files Browse the repository at this point in the history
See comment in code and the PR it references,
mesonbuild/meson#6827, for details.

We can remove entries from the cross file because they will be gotten
from env vars now.
  • Loading branch information
Ericson2314 committed Apr 28, 2020
1 parent 3c00ca0 commit 128b93e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
11 changes: 5 additions & 6 deletions pkgs/development/tools/build-managers/meson/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
16 changes: 16 additions & 0 deletions pkgs/development/tools/build-managers/meson/more-env-vars.patch
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 128b93e

Please sign in to comment.