summary refs log tree commit diff
path: root/pkgs/development/compilers/rust
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2017-01-12 14:25:20 +0100
committerMoritz U <moritz@tarn-vedra.de>2017-01-12 14:25:20 +0100
commite91840cfb6b7778f8c29d455a2f24cffa1b4e43e (patch)
tree85e4e448ad84958c9001ae3af335f18b04fd40d1 /pkgs/development/compilers/rust
parentce26a4d3d43fb9b7677003f7c157de152b456bcd (diff)
rustc: enable codegen units and parallel building (#21742)
Diffstat (limited to 'pkgs/development/compilers/rust')
-rw-r--r--pkgs/development/compilers/rust/rustc.nix31
1 files changed, 16 insertions, 15 deletions
diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix
index 04543f17ec983..190bb1a69fda2 100644
--- a/pkgs/development/compilers/rust/rustc.nix
+++ b/pkgs/development/compilers/rust/rustc.nix
@@ -20,27 +20,17 @@ let
     else
       "${shortVersion}-g${builtins.substring 0 7 srcRev}";
 
-  name = "rustc-${version}";
-
   procps = if stdenv.isDarwin then darwin.ps else args.procps;
 
   llvmShared = llvm.override { enableSharedLibraries = true; };
 
   target = builtins.replaceStrings [" "] [","] (builtins.toString targets);
 
-  meta = with stdenv.lib; {
-    homepage = http://www.rust-lang.org/;
-    description = "A safe, concurrent, practical language";
-    maintainers = with maintainers; [ madjar cstrahan wizeman globin havvy wkennington retrry ];
-    license = [ licenses.mit licenses.asl20 ];
-    platforms = platforms.linux ++ platforms.darwin;
-  };
 in
 
 stdenv.mkDerivation {
-  inherit name;
+  name = "rustc-${version}";
   inherit version;
-  inherit meta;
 
   __impureHostDeps = [ "/usr/lib/libedit.3.dylib" ];
 
@@ -52,6 +42,9 @@ stdenv.mkDerivation {
   # versions.
   RUSTC_BOOTSTRAP = "1";
 
+  # Increase codegen units to introduce parallelism within the compiler.
+  RUSTFLAGS = "-Ccodegen-units=10";
+
   src = fetchgit {
     url = https://github.com/rust-lang/rust;
     rev = srcRev;
@@ -130,13 +123,12 @@ stdenv.mkDerivation {
   buildInputs = [ ncurses ] ++ targetToolchains
     ++ optional (!forceBundledLLVM) llvmShared;
 
-  # https://github.com/rust-lang/rust/issues/30181
-  # enableParallelBuilding = false; # missing files during linking, occasionally
-
   outputs = [ "out" "doc" ];
   setOutputFlags = false;
 
+  # Disable codegen units for the tests.
   preCheck = ''
+    export RUSTFLAGS=
     export TZDIR=${tzdata}/share/zoneinfo
   '' +
   # Ensure TMPDIR is set, and disable a test that removing the HOME
@@ -147,7 +139,16 @@ stdenv.mkDerivation {
     sed -i '28s/home_dir().is_some()/true/' ./src/test/run-pass/env-home-dir.rs
   '';
 
-  # Disable doCheck on Darwin to work around upstream issue
   doCheck = true;
   dontSetConfigureCross = true;
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = http://www.rust-lang.org/;
+    description = "A safe, concurrent, practical language";
+    maintainers = with maintainers; [ madjar cstrahan wizeman globin havvy wkennington retrry ];
+    license = [ licenses.mit licenses.asl20 ];
+    platforms = platforms.linux ++ platforms.darwin;
+  };
 }