Merge pull request #25218 from expipiplus1/cross-llvm

Fix cross compilation of LLVM-3.9
This commit is contained in:
Michael Raskin 2017-05-02 22:24:41 +02:00 committed by GitHub
commit 7527355840
3 changed files with 25 additions and 5 deletions

View File

@ -13,7 +13,9 @@ let
mv clang-tools-extra-* $sourceRoot/tools/extra mv clang-tools-extra-* $sourceRoot/tools/extra
''; '';
buildInputs = [ cmake libedit libxml2 llvm python ]; nativeBuildInputs = [ cmake ];
buildInputs = [ libedit libxml2 llvm python ];
cmakeFlags = [ cmakeFlags = [
"-DCMAKE_CXX_FLAGS=-std=c++11" "-DCMAKE_CXX_FLAGS=-std=c++11"

View File

@ -15,10 +15,15 @@
, compiler-rt_src , compiler-rt_src
, libcxxabi , libcxxabi
, debugVersion ? false , debugVersion ? false
, enableSharedLibraries ? true , enableSharedLibraries ? (buildPlatform == hostPlatform)
, darwin , darwin
, buildPackages
, buildPlatform
, hostPlatform
}: }:
assert (hostPlatform != buildPlatform) -> !enableSharedLibraries;
let let
src = fetch "llvm" "1vi9sf7rx1q04wj479rsvxayb6z740iaz3qniwp266fgp5a07n8z"; src = fetch "llvm" "1vi9sf7rx1q04wj479rsvxayb6z740iaz3qniwp266fgp5a07n8z";
shlib = if stdenv.isDarwin then "dylib" else "so"; shlib = if stdenv.isDarwin then "dylib" else "so";
@ -39,8 +44,17 @@ in stdenv.mkDerivation rec {
outputs = [ "out" ] ++ stdenv.lib.optional enableSharedLibraries "lib"; outputs = [ "out" ] ++ stdenv.lib.optional enableSharedLibraries "lib";
buildInputs = [ perl groff cmake libxml2 python libffi ] nativeBuildInputs = [
++ stdenv.lib.optionals stdenv.isDarwin [ libcxxabi ]; perl
cmake
python
];
buildInputs = [
groff
libxml2
libffi
] ++ stdenv.lib.optionals stdenv.isDarwin [ libcxxabi ];
propagatedBuildInputs = [ ncurses zlib ]; propagatedBuildInputs = [ ncurses zlib ];
@ -88,6 +102,9 @@ in stdenv.mkDerivation rec {
++ stdenv.lib.optionals (isDarwin) [ ++ stdenv.lib.optionals (isDarwin) [
"-DLLVM_ENABLE_LIBCXX=ON" "-DLLVM_ENABLE_LIBCXX=ON"
"-DCAN_TARGET_i386=false" "-DCAN_TARGET_i386=false"
] ++ stdenv.lib.optionals (buildPlatform != hostPlatform) [
"-DCMAKE_CROSSCOMPILING=True"
"-DLLVM_TABLEGEN=${buildPackages.llvmPackages_39.llvm}/bin/llvm-tblgen"
]; ];
postBuild = '' postBuild = ''

View File

@ -1,6 +1,7 @@
{ stdenv, fetchurl, perl, groff { stdenv, fetchurl, perl, groff
, ghostscript #for postscript and html output , ghostscript #for postscript and html output
, psutils, netpbm #for html output , psutils, netpbm #for html output
, buildPackages
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
@ -49,7 +50,7 @@ stdenv.mkDerivation rec {
# Trick to get the build system find the proper 'native' groff # Trick to get the build system find the proper 'native' groff
# http://www.mail-archive.com/bug-groff@gnu.org/msg01335.html # http://www.mail-archive.com/bug-groff@gnu.org/msg01335.html
preBuild = '' preBuild = ''
makeFlags="GROFF_BIN_PATH=${groff}/bin GROFFBIN=${groff}/bin/groff" makeFlags="GROFF_BIN_PATH=${buildPackages.groff}/bin GROFFBIN=${buildPackages.groff}/bin/groff"
''; '';
}; };