diff --git a/pkgs/development/tools/build-managers/cmake/default.nix b/pkgs/development/tools/build-managers/cmake/default.nix index 68d4118f0491c..c9efefbc33088 100644 --- a/pkgs/development/tools/build-managers/cmake/default.nix +++ b/pkgs/development/tools/build-managers/cmake/default.nix @@ -1,5 +1,6 @@ { stdenv, fetchurl, fetchpatch, pkgconfig , bzip2, curl, expat, libarchive, xz, zlib, libuv, rhash +, buildPackages # darwin attributes , ps , isBootstrap ? false @@ -61,6 +62,8 @@ stdenv.mkDerivation rec { ++ optional useQt4 qt4 ++ optional withQt5 qtbase; + depsBuildBuild = [ buildPackages.stdenv.cc ]; + propagatedBuildInputs = optional stdenv.isDarwin ps; preConfigure = '' @@ -71,7 +74,8 @@ stdenv.mkDerivation rec { --subst-var-by libc_lib ${getLib stdenv.cc.libc} substituteInPlace Modules/FindCxxTest.cmake \ --replace "$""{PYTHON_EXECUTABLE}" ${stdenv.shell} - configureFlags="--parallel=''${NIX_BUILD_CORES:-1} $configureFlags" + # BUILD_CC and BUILD_CXX are used to bootstrap cmake + configureFlags="--parallel=''${NIX_BUILD_CORES:-1} CC=$BUILD_CC CXX=$BUILD_CXX $configureFlags" ''; configureFlags = [ @@ -95,6 +99,11 @@ stdenv.mkDerivation rec { # Avoid depending on frameworks. ++ optional (!useNcurses) "-DBUILD_CursesDialog=OFF"; + # make install attempts to use the just-built cmake + preInstall = optional (stdenv.hostPlatform != stdenv.buildPlatform) '' + sed -i 's|bin/cmake|${buildPackages.cmake}/bin/cmake|g' Makefile + ''; + dontUseCmakeConfigure = true; enableParallelBuilding = true;