about summary refs log tree commit diff
path: root/pkgs/development/tools/build-managers
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2020-05-06 08:12:40 +0200
committerVladimír Čunát <v@cunat.cz>2020-05-06 08:20:05 +0200
commit54eb2d10184124a8bd6cc01ff815c30aa8aebf35 (patch)
tree2152ad58471446689a35e1466ef865baac1f8964 /pkgs/development/tools/build-managers
parentee8cde8d1cc4faea6502ffac90af20bfe86328a2 (diff)
parent1906fc5bd10a7bbab35136325fa3251a043361b2 (diff)
downloadnixlib-54eb2d10184124a8bd6cc01ff815c30aa8aebf35.tar
nixlib-54eb2d10184124a8bd6cc01ff815c30aa8aebf35.tar.gz
nixlib-54eb2d10184124a8bd6cc01ff815c30aa8aebf35.tar.bz2
nixlib-54eb2d10184124a8bd6cc01ff815c30aa8aebf35.tar.lz
nixlib-54eb2d10184124a8bd6cc01ff815c30aa8aebf35.tar.xz
nixlib-54eb2d10184124a8bd6cc01ff815c30aa8aebf35.tar.zst
nixlib-54eb2d10184124a8bd6cc01ff815c30aa8aebf35.zip
Merge branch 'staging-next'
Status on Hydra for linuxes seems good enough:
https://hydra.nixos.org/eval/1585703?filter=linux&compare=1585482&full=#tabs-now-fail
Diffstat (limited to 'pkgs/development/tools/build-managers')
-rw-r--r--pkgs/development/tools/build-managers/meson/default.nix44
-rw-r--r--pkgs/development/tools/build-managers/meson/more-env-vars.patch16
-rw-r--r--pkgs/development/tools/build-managers/meson/setup-hook.sh7
3 files changed, 26 insertions, 41 deletions
diff --git a/pkgs/development/tools/build-managers/meson/default.nix b/pkgs/development/tools/build-managers/meson/default.nix
index 0dbe9ec78420..6c882b27896a 100644
--- a/pkgs/development/tools/build-managers/meson/default.nix
+++ b/pkgs/development/tools/build-managers/meson/default.nix
@@ -3,20 +3,9 @@
 , stdenv
 , writeTextDir
 , substituteAll
-, targetPackages
+, pkgsHostHost
 }:
 
-let
-  # See https://mesonbuild.com/Reference-tables.html#cpu-families
-  cpuFamilies = {
-    aarch64  = "aarch64";
-    armv5tel = "arm";
-    armv6l   = "arm";
-    armv7l   = "arm";
-    i686     = "x86";
-    x86_64   = "x86_64";
-  };
-in
 python3Packages.buildPythonApplication rec {
   pname = "meson";
   version = "0.54.0";
@@ -45,6 +34,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.
@@ -65,35 +59,15 @@ python3Packages.buildPythonApplication rec {
 
   setupHook = ./setup-hook.sh;
 
-  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
-
-    [host_machine]
-    system = '${targetPackages.stdenv.targetPlatform.parsed.kernel.name}'
-    cpu_family = '${cpuFamilies.${targetPackages.stdenv.targetPlatform.parsed.cpu.name}}'
-    cpu = '${targetPackages.stdenv.targetPlatform.parsed.cpu.name}'
-    endian = ${if targetPackages.stdenv.targetPlatform.isLittleEndian then "'little'" else "'big'"}
-  '';
+  # Ensure there will always be a native C compiler when meson is used, as a
+  # workaround until https://github.com/mesonbuild/meson/pull/6512 lands.
+  depsHostHostPropagated = [ pkgsHostHost.stdenv.cc ];
 
   # 0.45 update enabled tests but they are failing
   doCheck = false;
   # checkInputs = [ ninja pkgconfig ];
   # checkPhase = "python ./run_project_tests.py";
 
-  inherit (stdenv) cc;
-
-  isCross = stdenv.targetPlatform != stdenv.hostPlatform;
-
   meta = with lib; {
     homepage = "https://mesonbuild.com";
     description = "SCons-like build system that use python as a front-end language and Ninja as a building backend";
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)
diff --git a/pkgs/development/tools/build-managers/meson/setup-hook.sh b/pkgs/development/tools/build-managers/meson/setup-hook.sh
index 8d76ecdaf32b..3d946fcffd52 100644
--- a/pkgs/development/tools/build-managers/meson/setup-hook.sh
+++ b/pkgs/development/tools/build-managers/meson/setup-hook.sh
@@ -5,11 +5,6 @@ mesonConfigurePhase() {
         mesonFlags="--prefix=$prefix $mesonFlags"
     fi
 
-    # Build release by default.
-    if [ -n "@isCross@" ]; then
-      crossMesonFlags="--cross-file=@crossFile@/cross-file.conf"
-    fi
-
     # See multiple-outputs.sh and meson’s coredata.py
     mesonFlags="\
         --libdir=${!outputLib}/lib --libexecdir=${!outputLib}/libexec \
@@ -25,7 +20,7 @@ mesonConfigurePhase() {
 
     echo "meson flags: $mesonFlags ${mesonFlagsArray[@]}"
 
-    CC=@cc@/bin/cc CXX=@cc@/bin/c++ meson build $mesonFlags "${mesonFlagsArray[@]}"
+    meson build $mesonFlags "${mesonFlagsArray[@]}"
     cd build
 
     if ! [[ -v enableParallelBuilding ]]; then