mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 16:03:23 +00:00
cmake: fix cross
TODO: toolchain file instead?
This commit is contained in:
parent
b9b57dada7
commit
37c2ac90e6
@ -83,11 +83,25 @@ stdenv.mkDerivation rec {
|
||||
configureFlags = [ "--docdir=share/doc/${name}" ]
|
||||
++ (if useSharedLibraries then [ "--no-system-jsoncpp" "--system-libs" ] else [ "--no-system-libs" ]) # FIXME: cleanup
|
||||
++ optional (useQt4 || withQt5) "--qt-gui"
|
||||
++ optionals (!useNcurses) [ "--" "-DBUILD_CursesDialog=OFF" ];
|
||||
++ ["--"]
|
||||
++ optionals (!useNcurses) [ "-DBUILD_CursesDialog=OFF" ]
|
||||
++ optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
|
||||
"-DCMAKE_CXX_COMPILER=${stdenv.cc.targetPrefix}g++"
|
||||
"-DCMAKE_C_COMPILER=${stdenv.cc.targetPrefix}gcc"
|
||||
"-DCMAKE_AR=${getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ar"
|
||||
"-DCMAKE_RANLIB=${getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}ranlib"
|
||||
"-DCMAKE_STRIP=${getBin stdenv.cc.bintools.bintools}/bin/${stdenv.cc.targetPrefix}strip"
|
||||
# TODO: Why are ar and friends not provided by the bintools wrapper?
|
||||
];
|
||||
|
||||
dontUseCmakeConfigure = true;
|
||||
enableParallelBuilding = true;
|
||||
|
||||
# This isn't an autoconf configure script; triples are passed via
|
||||
# CMAKE_SYSTEM_NAME, etc.
|
||||
configurePlatforms = [ ];
|
||||
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = http://www.cmake.org/;
|
||||
description = "Cross-Platform Makefile Generator";
|
||||
|
@ -33,7 +33,15 @@ cmakeConfigurePhase() {
|
||||
# By now it supports linux builds only. We should set the proper
|
||||
# CMAKE_SYSTEM_NAME otherwise.
|
||||
# http://www.cmake.org/Wiki/CMake_Cross_Compiling
|
||||
cmakeFlags="-DCMAKE_CXX_COMPILER=$crossConfig-g++ -DCMAKE_C_COMPILER=$crossConfig-gcc $cmakeFlags"
|
||||
#
|
||||
# Unfortunately cmake seems to expect absolute paths for ar, ranlib, and
|
||||
# strip. Otherwise they are taken to be relative to the source root of
|
||||
# the package being built.
|
||||
cmakeFlags="-DCMAKE_CXX_COMPILER=$crossConfig-g++ $cmakeFlags"
|
||||
cmakeFlags="-DCMAKE_C_COMPILER=$crossConfig-gcc $cmakeFlags"
|
||||
cmakeFlags="-DCMAKE_AR=$(command -v $crossConfig-ar) $cmakeFlags"
|
||||
cmakeFlags="-DCMAKE_RANLIB=$(command -v $crossConfig-ranlib) $cmakeFlags"
|
||||
cmakeFlags="-DCMAKE_STRIP=$(command -v $crossConfig-strip) $cmakeFlags"
|
||||
fi
|
||||
|
||||
# This installs shared libraries with a fully-specified install
|
||||
|
Loading…
Reference in New Issue
Block a user