rustc: Set TMPDIR on Darwin to fix build.
This commit is contained in:
parent
3dc73927fe
commit
2b806e9b71
@ -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";
|
||||||
|
@ -14,26 +14,28 @@
|
|||||||
} @ args:
|
} @ args:
|
||||||
|
|
||||||
let
|
let
|
||||||
version = if isRelease then
|
inherit (stdenv.lib) optional optionalString;
|
||||||
"${shortVersion}"
|
|
||||||
else
|
|
||||||
"${shortVersion}-g${builtins.substring 0 7 srcRev}";
|
|
||||||
|
|
||||||
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; {
|
target = builtins.replaceStrings [" "] [","] (builtins.toString targets);
|
||||||
homepage = http://www.rust-lang.org/;
|
|
||||||
description = "A safe, concurrent, practical language";
|
meta = with stdenv.lib; {
|
||||||
maintainers = with maintainers; [ madjar cstrahan wizeman globin havvy wkennington retrry ];
|
homepage = http://www.rust-lang.org/;
|
||||||
license = [ licenses.mit licenses.asl20 ];
|
description = "A safe, concurrent, practical language";
|
||||||
platforms = platforms.linux ++ platforms.darwin;
|
maintainers = with maintainers; [ madjar cstrahan wizeman globin havvy wkennington retrry ];
|
||||||
};
|
license = [ licenses.mit licenses.asl20 ];
|
||||||
|
platforms = platforms.linux ++ platforms.darwin;
|
||||||
|
};
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user