summary refs log tree commit diff
path: root/pkgs/development/compilers/rustc/0.12.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/rustc/0.12.nix')
-rw-r--r--pkgs/development/compilers/rustc/0.12.nix13
1 files changed, 6 insertions, 7 deletions
diff --git a/pkgs/development/compilers/rustc/0.12.nix b/pkgs/development/compilers/rustc/0.12.nix
index d26e8ba4ddad..43df15505c0d 100644
--- a/pkgs/development/compilers/rustc/0.12.nix
+++ b/pkgs/development/compilers/rustc/0.12.nix
@@ -1,7 +1,5 @@
 {stdenv, fetchurl, which, file, perl, curl, python27, makeWrapper}:
 
-assert stdenv.gcc.gcc != null;
-
 /* Rust's build process has a few quirks :
 
 - It requires some patched in llvm that haven't landed upstream, so it
@@ -53,21 +51,22 @@ in stdenv.mkDerivation {
       mkdir -p "$out"
       cp -r bin "$out/bin"
     '' + (if stdenv.isLinux then ''
-      patchelf --interpreter "${stdenv.glibc}/lib/${stdenv.gcc.dynamicLinker}" \
-               --set-rpath "${stdenv.gcc.gcc}/lib/:${stdenv.gcc.gcc}/lib64/" \
+      patchelf --interpreter "${stdenv.glibc}/lib/${stdenv.cc.dynamicLinker}" \
+               --set-rpath "${stdenv.cc.gcc}/lib/:${stdenv.cc.gcc}/lib64/" \
                "$out/bin/rustc"
     '' else "");
   };
 
-  configureFlags = [ "--enable-local-rust" "--local-rust-root=$snapshot" ];
+  configureFlags = [ "--enable-local-rust" "--local-rust-root=$snapshot" ]
+                ++ stdenv.lib.optional (stdenv.cc ? clang) "--enable-clang";
 
   # The compiler requires cc, so we patch the source to tell it where to find it
   patches = [ ./hardcode_paths.patch ./local_stage0.patch ];
   postPatch = ''
     substituteInPlace src/librustc/back/link.rs \
-      --subst-var-by "ccPath" "${stdenv.gcc}/bin/cc"
+      --subst-var-by "ccPath" "${stdenv.cc}/bin/cc"
     substituteInPlace src/librustc_back/archive.rs \
-      --subst-var-by "arPath" "${stdenv.gcc.binutils}/bin/ar"
+      --subst-var-by "arPath" "${stdenv.cc.binutils}/bin/ar"
   '';
 
   buildInputs = [ which file perl curl python27 makeWrapper ];