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

Fix cross compilation of LLVM-3.9 #25218

Merged
merged 7 commits into from
May 2, 2017
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion pkgs/development/compilers/llvm/3.9/clang/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ let
mv clang-tools-extra-* $sourceRoot/tools/extra
'';

buildInputs = [ cmake libedit libxml2 llvm python ];
nativeBuildInputs = [ cmake ];

buildInputs = [ libedit libxml2 llvm python ];

cmakeFlags = [
"-DCMAKE_CXX_FLAGS=-std=c++11"
Expand Down
23 changes: 20 additions & 3 deletions pkgs/development/compilers/llvm/3.9/llvm.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@
, compiler-rt_src
, libcxxabi
, debugVersion ? false
, enableSharedLibraries ? true
, enableSharedLibraries ? (buildPlatform == hostPlatform)
, darwin
, buildPackages
, buildPlatform
, hostPlatform
}:

assert (hostPlatform != buildPlatform) -> !enableSharedLibraries;

let
src = fetch "llvm" "1vi9sf7rx1q04wj479rsvxayb6z740iaz3qniwp266fgp5a07n8z";
shlib = if stdenv.isDarwin then "dylib" else "so";
Expand All @@ -39,8 +44,17 @@ in stdenv.mkDerivation rec {

outputs = [ "out" ] ++ stdenv.lib.optional enableSharedLibraries "lib";

buildInputs = [ perl groff cmake libxml2 python libffi ]
++ stdenv.lib.optionals stdenv.isDarwin [ libcxxabi ];
nativeBuildInputs = [
perl
cmake
python
];

buildInputs = [
groff
libxml2
libffi
] ++ stdenv.lib.optionals stdenv.isDarwin [ libcxxabi ];

propagatedBuildInputs = [ ncurses zlib ];

Expand Down Expand Up @@ -88,6 +102,9 @@ in stdenv.mkDerivation rec {
++ stdenv.lib.optionals (isDarwin) [
"-DLLVM_ENABLE_LIBCXX=ON"
"-DCAN_TARGET_i386=false"
] ++ stdenv.lib.optionals (buildPlatform != hostPlatform) [
"-DCMAKE_CROSSCOMPILING=True"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, this is a general cmake thing? This could be generalized to be so added for all derivations with cmakeFlags I suppose.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"-DLLVM_TABLEGEN=${buildPackages.llvmPackages_39.llvm}/bin/llvm-tblgen"
];

postBuild = ''
Expand Down
3 changes: 2 additions & 1 deletion pkgs/tools/text/groff/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ stdenv, fetchurl, perl, groff
, ghostscript #for postscript and html output
, psutils, netpbm #for html output
, buildPackages
}:

stdenv.mkDerivation rec {
Expand Down Expand Up @@ -49,7 +50,7 @@ stdenv.mkDerivation rec {
# Trick to get the build system find the proper 'native' groff
# http://www.mail-archive.com/bug-groff@gnu.org/msg01335.html
preBuild = ''
makeFlags="GROFF_BIN_PATH=${groff}/bin GROFFBIN=${groff}/bin/groff"
makeFlags="GROFF_BIN_PATH=${buildPackages.groff}/bin GROFFBIN=${buildPackages.groff}/bin/groff"
'';
};

Expand Down