rust: 1.15.0 -> 1.17.0

Also updates beta, nightly, nightlyBin, and bootstrap compilers.
Also updates the registry.
Also consolidates logic between bootstrap and nightlyBin compilers.
Also contains some miscellaneous cleanups.
Also patches firefox to build with the newer cargo
This commit is contained in:
Anders Papitto
2017-06-10 15:15:50 -07:00
parent 53835c93cb
commit 1e0866e064
12 changed files with 277 additions and 288 deletions
+31 -37
View File
@@ -1,25 +1,20 @@
{ stdenv, fetchurl, fetchgit, fetchzip, file, python2, tzdata, procps
, llvm, jemalloc, ncurses, darwin, binutils, rustPlatform, git, cmake, curl
, isRelease ? false
, shortVersion
, which, libffi, gdb
, version
, forceBundledLLVM ? false
, srcSha, srcRev
, src
, configureFlags ? []
, patches
, targets
, targetPatches
, targetToolchains
, doCheck ? true
} @ args:
let
inherit (stdenv.lib) optional optionalString;
version = if isRelease then
"${shortVersion}"
else
"${shortVersion}-g${builtins.substring 0 7 srcRev}";
procps = if stdenv.isDarwin then darwin.ps else args.procps;
llvmShared = llvm.override { enableSharedLibraries = true; };
@@ -32,6 +27,8 @@ stdenv.mkDerivation {
name = "rustc-${version}";
inherit version;
inherit src;
__impureHostDeps = [ "/usr/lib/libedit.3.dylib" ];
NIX_LDFLAGS = optionalString stdenv.isDarwin "-rpath ${llvmShared}/lib";
@@ -45,19 +42,13 @@ stdenv.mkDerivation {
# Increase codegen units to introduce parallelism within the compiler.
RUSTFLAGS = "-Ccodegen-units=10";
src = fetchgit {
url = https://github.com/rust-lang/rust;
rev = srcRev;
sha256 = srcSha;
};
# We need rust to build rust. If we don't provide it, configure will try to download it.
configureFlags = configureFlags
++ [ "--enable-local-rust" "--local-rust-root=${rustPlatform.rust.rustc}" "--enable-rpath" ]
++ [ "--enable-vendor" "--disable-locked-deps" ]
++ [ "--enable-llvm-link-shared" ]
# ++ [ "--jemalloc-root=${jemalloc}/lib"
++ [ "--default-linker=${stdenv.cc}/bin/cc" "--default-ar=${binutils.out}/bin/ar" ]
# TODO: Remove when fixed build with rustbuild
++ [ "--disable-rustbuild" ]
++ optional (stdenv.cc.cc ? isClang) "--enable-clang"
++ optional (targets != []) "--target=${target}"
++ optional (!forceBundledLLVM) "--llvm-root=${llvmShared}";
@@ -67,17 +58,8 @@ stdenv.mkDerivation {
passthru.target = target;
postPatch = ''
substituteInPlace src/rust-installer/gen-install-script.sh \
--replace /bin/echo "$(type -P echo)"
substituteInPlace src/rust-installer/gen-installer.sh \
--replace /bin/echo "$(type -P echo)"
# Workaround for NixOS/nixpkgs#8676
substituteInPlace mk/rustllvm.mk \
--replace "\$\$(subst /,//," "\$\$(subst /,/,"
# Fix dynamic linking against llvm
${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 \
@@ -98,15 +80,25 @@ stdenv.mkDerivation {
# https://reviews.llvm.org/rL281650
rm -vr src/test/run-pass/issue-36474.rs || true
# Disable some failing gdb tests. Try re-enabling these when gdb
# is updated past version 7.12.
rm src/test/debuginfo/basic-types-globals.rs
rm src/test/debuginfo/basic-types-mut-globals.rs
rm src/test/debuginfo/c-style-enum.rs
rm src/test/debuginfo/lexical-scopes-in-block-expression.rs
rm src/test/debuginfo/limited-debuginfo.rs
rm src/test/debuginfo/simple-struct.rs
rm src/test/debuginfo/simple-tuple.rs
rm src/test/debuginfo/vec-slices.rs
rm src/test/debuginfo/vec.rs
# this can probably be removed when rust is updated beyond 1.17
# fixes a warning in the test harness (I think?) which fails the build due
# to strict warnings
sed -i '/static_in_const/d' src/tools/compiletest/src/main.rs
# Useful debugging parameter
# export VERBOSE=1
'' +
# In src/compiler-rt/cmake/config-ix.cmake, the cmake build falls
# back to darwin 10.4. This causes the OS name to be recorded as
# "10.4" rather than the expected "osx". But mk/rt.mk expects the
# built library name to have an "_osx" suffix on darwin.
optionalString stdenv.isDarwin ''
substituteInPlace mk/rt.mk --replace "_osx" "_10.4"
'';
preConfigure = ''
@@ -120,7 +112,8 @@ stdenv.mkDerivation {
dontUseCmakeConfigure = true;
# ps is needed for one of the test cases
nativeBuildInputs = [ file python2 procps rustPlatform.rust.rustc git cmake ];
nativeBuildInputs = [ file python2 procps rustPlatform.rust.rustc git cmake
which libffi gdb ];
buildInputs = [ ncurses ] ++ targetToolchains
++ optional (!forceBundledLLVM) llvmShared;
@@ -141,7 +134,8 @@ stdenv.mkDerivation {
sed -i '28s/home_dir().is_some()/true/' ./src/test/run-pass/env-home-dir.rs
'';
doCheck = true;
inherit doCheck;
dontSetConfigureCross = true;
# https://github.com/NixOS/nixpkgs/pull/21742#issuecomment-272305764
@@ -151,7 +145,7 @@ stdenv.mkDerivation {
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 ];
maintainers = with maintainers; [ madjar cstrahan wizeman globin havvy wkennington ];
license = [ licenses.mit licenses.asl20 ];
platforms = platforms.linux ++ platforms.darwin;
};