summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2016-08-07 23:43:54 +0200
committerMoritz Ulrich <moritz@tarn-vedra.de>2016-08-10 21:16:48 +0200
commit2b806e9b7129a66cf34664e220cf2ecd08371549 (patch)
treefcbb01680304cfeaad431512a3879a7227cf9a1c /pkgs
parent3dc73927fe41eb6812f8de375ee5ab89e9a81777 (diff)
downloadnixpkgs-2b806e9b7129a66cf34664e220cf2ecd08371549.tar
nixpkgs-2b806e9b7129a66cf34664e220cf2ecd08371549.tar.gz
nixpkgs-2b806e9b7129a66cf34664e220cf2ecd08371549.tar.bz2
nixpkgs-2b806e9b7129a66cf34664e220cf2ecd08371549.tar.lz
nixpkgs-2b806e9b7129a66cf34664e220cf2ecd08371549.tar.xz
nixpkgs-2b806e9b7129a66cf34664e220cf2ecd08371549.tar.zst
nixpkgs-2b806e9b7129a66cf34664e220cf2ecd08371549.zip
rustc: Set TMPDIR on Darwin to fix build.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/compilers/rust/bootstrap.nix4
-rw-r--r--pkgs/development/compilers/rust/rustc.nix49
2 files changed, 30 insertions, 23 deletions
diff --git a/pkgs/development/compilers/rust/bootstrap.nix b/pkgs/development/compilers/rust/bootstrap.nix
index 56e19650579..7bbae9273b5 100644
--- a/pkgs/development/compilers/rust/bootstrap.nix
+++ b/pkgs/development/compilers/rust/bootstrap.nix
@@ -1,6 +1,8 @@
 { stdenv, fetchurl, makeWrapper, cacert, zlib }:
 
 let
+  inherit (stdenv.lib) optionalString;
+
   platform =
     if stdenv.system == "i686-linux"
     then "i686-unknown-linux-gnu"
@@ -24,7 +26,7 @@ let
     then "d59b5509e69c1cace20a57072e3b3ecefdbfd8c7e95657b0ff2ac10aa1dfebe6"
     else throw "missing boostrap hash for platform ${stdenv.system}";
 
-  needsPatchelf = (stdenv.system == "i686-linux") || (stdenv.system == "x86_64-linux");
+  needsPatchelf = stdenv.isLinux;
 
   src = fetchurl {
      url = "https://static.rust-lang.org/dist/rust-${version}-${platform}.tar.gz";
diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix
index e98333d4d74..f67444eba62 100644
--- a/pkgs/development/compilers/rust/rustc.nix
+++ b/pkgs/development/compilers/rust/rustc.nix
@@ -14,26 +14,28 @@
 } @ args:
 
 let
-    version = if isRelease then
-        "${shortVersion}"
-      else
-        "${shortVersion}-g${builtins.substring 0 7 srcRev}";
+  inherit (stdenv.lib) optional optionalString;
 
-    name = "rustc-${version}";
+  version = if isRelease then
+      "${shortVersion}"
+    else
+      "${shortVersion}-g${builtins.substring 0 7 srcRev}";
 
-    procps = if stdenv.isDarwin then darwin.ps else args.procps;
+  name = "rustc-${version}";
 
-    llvmShared = llvm.override { enableSharedLibraries = true; };
+  procps = if stdenv.isDarwin then darwin.ps else args.procps;
 
-    target = builtins.replaceStrings [" "] [","] (builtins.toString targets);
+  llvmShared = llvm.override { enableSharedLibraries = 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;
-    };
+  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 {
@@ -43,7 +45,7 @@ stdenv.mkDerivation {
 
   __impureHostDeps = [ "/usr/lib/libedit.3.dylib" ];
 
-  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-rpath ${llvmShared}/lib";
+  NIX_LDFLAGS = optionalString stdenv.isDarwin "-rpath ${llvmShared}/lib";
 
   src = fetchgit {
     url = https://github.com/rust-lang/rust;
@@ -56,9 +58,9 @@ stdenv.mkDerivation {
                 ++ [ "--enable-local-rust" "--local-rust-root=${rustPlatform.rust.rustc}" "--enable-rpath" ]
                 # ++ [ "--jemalloc-root=${jemalloc}/lib"
                 ++ [ "--default-linker=${stdenv.cc}/bin/cc" "--default-ar=${binutils.out}/bin/ar" ]
-                ++ stdenv.lib.optional (stdenv.cc.cc ? isClang) "--enable-clang"
-                ++ stdenv.lib.optional (targets != []) "--target=${target}"
-                ++ stdenv.lib.optional (!forceBundledLLVM) "--llvm-root=${llvmShared}";
+                ++ optional (stdenv.cc.cc ? isClang) "--enable-clang"
+                ++ optional (targets != []) "--target=${target}"
+                ++ optional (!forceBundledLLVM) "--llvm-root=${llvmShared}";
 
   patches = patches ++ targetPatches;
   passthru.target = target;
@@ -74,7 +76,7 @@ stdenv.mkDerivation {
       --replace "\$\$(subst  /,//," "\$\$(subst /,/,"
 
     # Fix dynamic linking against llvm
-    ${stdenv.lib.optionalString (!forceBundledLLVM) ''sed -i 's/, kind = \\"static\\"//g' src/etc/mklldeps.py''}
+    ${optionalString (!forceBundledLLVM) ''sed -i 's/, kind = \\"static\\"//g' src/etc/mklldeps.py''}
 
     # Fix the configure script to not require curl as we won't use it
     sed -i configure \
@@ -105,7 +107,7 @@ stdenv.mkDerivation {
     ++ stdenv.lib.optional needsCmake [ cmake curl ];
 
   buildInputs = [ ncurses ] ++ targetToolchains
-    ++ stdenv.lib.optional (!forceBundledLLVM) llvmShared;
+    ++ optional (!forceBundledLLVM) llvmShared;
 
   # https://github.com/rust-lang/rust/issues/30181
   # enableParallelBuilding = false; # missing files during linking, occasionally
@@ -113,7 +115,10 @@ stdenv.mkDerivation {
   outputs = [ "out" "doc" ];
   setOutputFlags = false;
 
-  preCheck = "export TZDIR=${tzdata}/share/zoneinfo";
+  preCheck = ''
+    export TZDIR=${tzdata}/share/zoneinfo
+    ${optionalString stdenv.isDarwin "export TMPDIR=/tmp"}
+  '';
 
   # Disable doCheck on Darwin to work around upstream issue
   doCheck = !stdenv.isDarwin;