cmake: add ability to cross-compile cmake
This commit is contained in:
parent
f7c6e6bbe3
commit
cbbde55382
1 changed files with 10 additions and 1 deletions
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue