Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: add ability to cross-compile cmake #56021

Merged
merged 1 commit into from
Feb 20, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pkgs/development/tools/build-managers/cmake/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{ stdenv, fetchurl, fetchpatch, pkgconfig
, bzip2, curl, expat, libarchive, xz, zlib, libuv, rhash
, buildPackages
# darwin attributes
, ps
, isBootstrap ? false
Expand Down Expand Up @@ -61,6 +62,8 @@ stdenv.mkDerivation rec {
++ optional useQt4 qt4
++ optional withQt5 qtbase;

depsBuildBuild = [ buildPackages.stdenv.cc ];

propagatedBuildInputs = optional stdenv.isDarwin ps;

preConfigure = ''
Expand All @@ -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 = [
Expand All @@ -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;

Expand Down