about summary refs log tree commit diff
path: root/pkgs/build-support/lib
diff options
context:
space:
mode:
authorRaito Bezarius <masterancpp@gmail.com>2024-05-10 01:37:09 +0200
committerRaito Bezarius <masterancpp@gmail.com>2024-05-11 13:32:14 +0200
commitd4c673a92bf722a783bf515b692eb05cc0088b7a (patch)
tree28e44ec47d879e8f5d121e913dc92777a21b1ff2 /pkgs/build-support/lib
parent4f554f0ff09c4cd34ca201c759c29008d1010eac (diff)
build-support/meson: explicitly use ambiant CMake during cross compilation
Thanks to Qyriad, it was found out that Nixpkgs was unable to cross
compile when CMake was needed at cross compilation time with Meson
because Meson refuse to use the ambiant CMake.

A simple fix is to always provide the ambiant CMake and trust the
packager to pass the right CMake, otherwise the rest of the build would
probably fail in mysterious ways.

An example of package that required this fix is the Lix, a Nix
implementation, that uses `toml11` discovered via CMake during the Meson
configure phase.

Co-authored-by: Qyriad <qyriad@qyriad.me>
Signed-off-by: Raito Bezarius <masterancpp@gmail.com>
Diffstat (limited to 'pkgs/build-support/lib')
-rw-r--r--pkgs/build-support/lib/meson.nix4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkgs/build-support/lib/meson.nix b/pkgs/build-support/lib/meson.nix
index 456c10fcb8eeb..9ffc5b8c1710f 100644
--- a/pkgs/build-support/lib/meson.nix
+++ b/pkgs/build-support/lib/meson.nix
@@ -23,6 +23,10 @@ let
     [binaries]
     llvm-config = 'llvm-config-native'
     rust = ['rustc', '--target', '${stdenv.targetPlatform.rust.rustcTargetSpec}']
+    # Meson refuses to consider any CMake binary during cross compilation if it's
+    # not explicitly specified here, in the cross file.
+    # https://github.com/mesonbuild/meson/blob/0ed78cf6fa6d87c0738f67ae43525e661b50a8a2/mesonbuild/cmake/executor.py#L72
+    cmake = 'cmake'
   '';
 
   crossFlags = optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ "--cross-file=${crossFile}" ];