rustc: Set TMPDIR on Darwin to fix build.

This commit is contained in:
Daiderd Jordan 2016-08-07 23:43:54 +02:00 committed by Moritz Ulrich
parent 3dc73927fe
commit 2b806e9b71
2 changed files with 30 additions and 23 deletions

View File

@ -1,6 +1,8 @@
{ stdenv, fetchurl, makeWrapper, cacert, zlib }: { stdenv, fetchurl, makeWrapper, cacert, zlib }:
let let
inherit (stdenv.lib) optionalString;
platform = platform =
if stdenv.system == "i686-linux" if stdenv.system == "i686-linux"
then "i686-unknown-linux-gnu" then "i686-unknown-linux-gnu"
@ -24,7 +26,7 @@ let
then "d59b5509e69c1cace20a57072e3b3ecefdbfd8c7e95657b0ff2ac10aa1dfebe6" then "d59b5509e69c1cace20a57072e3b3ecefdbfd8c7e95657b0ff2ac10aa1dfebe6"
else throw "missing boostrap hash for platform ${stdenv.system}"; else throw "missing boostrap hash for platform ${stdenv.system}";
needsPatchelf = (stdenv.system == "i686-linux") || (stdenv.system == "x86_64-linux"); needsPatchelf = stdenv.isLinux;
src = fetchurl { src = fetchurl {
url = "https://static.rust-lang.org/dist/rust-${version}-${platform}.tar.gz"; url = "https://static.rust-lang.org/dist/rust-${version}-${platform}.tar.gz";

View File

@ -14,6 +14,8 @@
} @ args: } @ args:
let let
inherit (stdenv.lib) optional optionalString;
version = if isRelease then version = if isRelease then
"${shortVersion}" "${shortVersion}"
else else
@ -43,7 +45,7 @@ stdenv.mkDerivation {
__impureHostDeps = [ "/usr/lib/libedit.3.dylib" ]; __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 { src = fetchgit {
url = https://github.com/rust-lang/rust; url = https://github.com/rust-lang/rust;
@ -56,9 +58,9 @@ stdenv.mkDerivation {
++ [ "--enable-local-rust" "--local-rust-root=${rustPlatform.rust.rustc}" "--enable-rpath" ] ++ [ "--enable-local-rust" "--local-rust-root=${rustPlatform.rust.rustc}" "--enable-rpath" ]
# ++ [ "--jemalloc-root=${jemalloc}/lib" # ++ [ "--jemalloc-root=${jemalloc}/lib"
++ [ "--default-linker=${stdenv.cc}/bin/cc" "--default-ar=${binutils.out}/bin/ar" ] ++ [ "--default-linker=${stdenv.cc}/bin/cc" "--default-ar=${binutils.out}/bin/ar" ]
++ stdenv.lib.optional (stdenv.cc.cc ? isClang) "--enable-clang" ++ optional (stdenv.cc.cc ? isClang) "--enable-clang"
++ stdenv.lib.optional (targets != []) "--target=${target}" ++ optional (targets != []) "--target=${target}"
++ stdenv.lib.optional (!forceBundledLLVM) "--llvm-root=${llvmShared}"; ++ optional (!forceBundledLLVM) "--llvm-root=${llvmShared}";
patches = patches ++ targetPatches; patches = patches ++ targetPatches;
passthru.target = target; passthru.target = target;
@ -74,7 +76,7 @@ stdenv.mkDerivation {
--replace "\$\$(subst /,//," "\$\$(subst /,/," --replace "\$\$(subst /,//," "\$\$(subst /,/,"
# Fix dynamic linking against llvm # 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 # Fix the configure script to not require curl as we won't use it
sed -i configure \ sed -i configure \
@ -105,7 +107,7 @@ stdenv.mkDerivation {
++ stdenv.lib.optional needsCmake [ cmake curl ]; ++ stdenv.lib.optional needsCmake [ cmake curl ];
buildInputs = [ ncurses ] ++ targetToolchains buildInputs = [ ncurses ] ++ targetToolchains
++ stdenv.lib.optional (!forceBundledLLVM) llvmShared; ++ optional (!forceBundledLLVM) llvmShared;
# https://github.com/rust-lang/rust/issues/30181 # https://github.com/rust-lang/rust/issues/30181
# enableParallelBuilding = false; # missing files during linking, occasionally # enableParallelBuilding = false; # missing files during linking, occasionally
@ -113,7 +115,10 @@ stdenv.mkDerivation {
outputs = [ "out" "doc" ]; outputs = [ "out" "doc" ];
setOutputFlags = false; 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 # Disable doCheck on Darwin to work around upstream issue
doCheck = !stdenv.isDarwin; doCheck = !stdenv.isDarwin;