about summary refs log tree commit diff
path: root/pkgs/development/tools/build-managers
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-04-26 16:32:56 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-04-28 10:11:41 -0400
commit128b93e06142914a88c91f3c9f03ce52f6cb569e (patch)
tree087931211119831e9f90c68de68997a0627d756f /pkgs/development/tools/build-managers
parent3c00ca03a251693e58eb4e3c247ee1f640215783 (diff)
downloadnixlib-128b93e06142914a88c91f3c9f03ce52f6cb569e.tar
nixlib-128b93e06142914a88c91f3c9f03ce52f6cb569e.tar.gz
nixlib-128b93e06142914a88c91f3c9f03ce52f6cb569e.tar.bz2
nixlib-128b93e06142914a88c91f3c9f03ce52f6cb569e.tar.lz
nixlib-128b93e06142914a88c91f3c9f03ce52f6cb569e.tar.xz
nixlib-128b93e06142914a88c91f3c9f03ce52f6cb569e.tar.zst
nixlib-128b93e06142914a88c91f3c9f03ce52f6cb569e.zip
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.
Diffstat (limited to 'pkgs/development/tools/build-managers')
-rw-r--r--pkgs/development/tools/build-managers/meson/default.nix11
-rw-r--r--pkgs/development/tools/build-managers/meson/more-env-vars.patch16
2 files changed, 21 insertions, 6 deletions
diff --git a/pkgs/development/tools/build-managers/meson/default.nix b/pkgs/development/tools/build-managers/meson/default.nix
index 977ffe837ec8..3fb435c5c2b2 100644
--- a/pkgs/development/tools/build-managers/meson/default.nix
+++ b/pkgs/development/tools/build-managers/meson/default.nix
@@ -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
diff --git a/pkgs/development/tools/build-managers/meson/more-env-vars.patch b/pkgs/development/tools/build-managers/meson/more-env-vars.patch
new file mode 100644
index 000000000000..a8f860f03cc7
--- /dev/null
+++ b/pkgs/development/tools/build-managers/meson/more-env-vars.patch
@@ -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)