Skip to content

Commit

Permalink
rust: 1.15.0 -> 1.17.0
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
anderspapitto committed Jun 1, 2017
1 parent 53835c9 commit 85cecd1
Show file tree
Hide file tree
Showing 10 changed files with 226 additions and 278 deletions.
71 changes: 25 additions & 46 deletions pkgs/development/compilers/rust/beta.nix
@@ -1,56 +1,35 @@
{ stdenv, callPackage, rustPlatform, cacert, gdb,
targets ? [], targetToolchains ? [], targetPatches ? [] }:
{ stdenv, callPackage, recurseIntoAttrs, makeRustPlatform, llvm, fetchurl
, targets ? []
, targetToolchains ? []
, targetPatches ? []
}:

let
rustPlatform = recurseIntoAttrs (makeRustPlatform (callPackage ./bootstrap.nix {}));
in
rec {
rustc = stdenv.lib.overrideDerivation (callPackage ./rustc.nix {
shortVersion = "beta-2017-01-07";
forceBundledLLVM = true; # TODO: figure out why linking fails without this
rustc = callPackage ./rustc.nix {
inherit llvm targets targetPatches targetToolchains rustPlatform;

version = "beta-2017-01-07";

configureFlags = [ "--release-channel=beta" ];
srcRev = "a035041ba450ce3061d78a2bdb9c446eb5321d0d";
srcSha = "12xsm0yp1y39fvf9j218gxv73j8hhahc53jyv3q58kiriyqvfc1s";
patches = [
./patches/disable-lockfile-check-nightly.patch
] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
inherit targets;
inherit targetPatches;
inherit targetToolchains;
inherit rustPlatform;
}) (oldAttrs: {
nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ gdb rustPlatform.rust.cargo ];
postUnpack = ''
export CARGO_HOME="$(realpath deps)"
export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
'';
postPatch = ''
${oldAttrs.postPatch}

# Remove failing debuginfo tests because of old gdb version: https://github.com/rust-lang/rust/issues/38948#issuecomment-271443596
rm -vr src/test/debuginfo/borrowed-enum.rs || true
rm -vr src/test/debuginfo/generic-struct-style-enum.rs || true
rm -vr src/test/debuginfo/generic-tuple-style-enum.rs || true
rm -vr src/test/debuginfo/packed-struct.rs || true
rm -vr src/test/debuginfo/recursive-struct.rs || true
rm -vr src/test/debuginfo/struct-in-enum.rs || true
rm -vr src/test/debuginfo/struct-style-enum.rs || true
rm -vr src/test/debuginfo/tuple-style-enum.rs || true
rm -vr src/test/debuginfo/union-smoke.rs || true
rm -vr src/test/debuginfo/unique-enum.rs || true
src = fetchurl {
url = "https://static.rust-lang.org/dist/2017-05-27/rustc-beta-src.tar.gz";
sha256 = "9f3f92efef7fb2b4bf38e57e4ff1f416dc221880b90841c4bdaee350801c0b57";
};

# make external cargo work until https://github.com/rust-lang/rust/issues/38950 is fixed
sed -i "s# def cargo(self):# def cargo(self):\n return \"${rustPlatform.rust.cargo}/bin/cargo\"#g" src/bootstrap/bootstrap.py
substituteInPlace \
src/bootstrap/config.rs \
--replace \
'self.cargo = Some(push_exe_path(path, &["bin", "cargo"]));' \
''$'self.cargo = Some(\n "${rustPlatform.rust.cargo}\\\n /bin/cargo".into());'
'';
});
patches = [
./patches/darwin-disable-fragile-tcp-tests.patch
] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
};

cargo = callPackage ./cargo.nix rec {
version = "beta-2017-01-10";
srcRev = "6dd4ff0f5b59fff524762c4a7b65882adda713c0";
srcSha = "1x6d42qq2zhr1iaw0m0nslhv6c1w6x6schmd96max0p9xb47l9zj";
depsSha256 = "1sywnhzgambmqsjs2xlnzracfv7vjljha55hgf8wca2marafr5dp";
version = "0.18.0";
srcRev = "fe7b0cdcf5ca7aab81630706ce40b70f6aa2e666";
srcSha = "164iywv1l3v87b0pznf5kkzxigd6w19myv9d7ka4c65zgrk9n9px";
depsSha256 = "1mrgd8ib48vxxbhkvsqqq4p19sc6b74x3cd8p6lhhlm6plrajrvm";

inherit rustc; # the rustc that will be wrapped by cargo
inherit rustPlatform; # used to build cargo
Expand Down
99 changes: 99 additions & 0 deletions pkgs/development/compilers/rust/binaryBuild.nix
@@ -0,0 +1,99 @@
{ stdenv, fetchurl, makeWrapper, cacert, zlib, buildRustPackage, curl
, version
, src
, platform
, versionType
}:

let
inherit (stdenv.lib) optionalString;

needsPatchelf = stdenv.isLinux;

bootstrapping = versionType == "bootstrap";

installComponents
= "rustc,rust-std-${platform}"
+ (optionalString bootstrapping ",rust-docs,cargo")
;
in

rec {
inherit buildRustPackage;

rustc = stdenv.mkDerivation rec {
name = "rustc-${versionType}-${version}";

inherit version;
inherit src;

meta = with stdenv.lib; {
homepage = http://www.rust-lang.org/;
description = "A safe, concurrent, practical language";
maintainers = with maintainers; [ qknight ];
license = [ licenses.mit licenses.asl20 ];
};

phases = ["unpackPhase" "installPhase"];

installPhase = ''
./install.sh --prefix=$out \
--components=${installComponents}
${optionalString (needsPatchelf && bootstrapping) ''
patchelf \
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
"$out/bin/rustdoc"
patchelf \
--set-rpath "${stdenv.lib.makeLibraryPath [ curl zlib ]}" \
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
"$out/bin/cargo"
''}
${optionalString needsPatchelf ''
patchelf \
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
"$out/bin/rustc"
# Do NOT, I repeat, DO NOT use `wrapProgram` on $out/bin/rustc
# (or similar) here. It causes strange effects where rustc loads
# the wrong libraries in a bootstrap-build causing failures that
# are very hard to track dow. For details, see
# https://github.com/rust-lang/rust/issues/34722#issuecomment-232164943
''}
'';

};

cargo = stdenv.mkDerivation rec {
name = "cargo-${versionType}-${version}";

inherit version;
inherit src;

meta = with stdenv.lib; {
homepage = http://www.rust-lang.org/;
description = "A safe, concurrent, practical language";
maintainers = with maintainers; [ qknight ];
license = [ licenses.mit licenses.asl20 ];
};

buildInputs = [ makeWrapper ];
phases = ["unpackPhase" "installPhase"];

installPhase = ''
./install.sh --prefix=$out \
--components=cargo
${optionalString needsPatchelf ''
patchelf \
--set-rpath "${stdenv.lib.makeLibraryPath [ curl zlib ]}" \
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
"$out/bin/cargo"
''}
wrapProgram "$out/bin/cargo" \
--suffix PATH : "${rustc}/bin"
'';
};
}
78 changes: 13 additions & 65 deletions pkgs/development/compilers/rust/bootstrap.nix
@@ -1,8 +1,6 @@
{ stdenv, fetchurl, makeWrapper, cacert, zlib }:
{ stdenv, fetchurl, makeWrapper, cacert, zlib, curl }:

let
inherit (stdenv.lib) optionalString;

platform =
if stdenv.system == "i686-linux"
then "i686-unknown-linux-gnu"
Expand All @@ -14,77 +12,27 @@ let
then "x86_64-apple-darwin"
else throw "missing bootstrap url for platform ${stdenv.system}";

# fetch hashes by running `print-hashes.sh 1.14.0`
# fetch hashes by running `print-hashes.sh 1.17.0`
bootstrapHash =
if stdenv.system == "i686-linux"
then "8d5c75728b44468216f99651dfae9d60ae0696a77105dd2b02942d75f3256840"
then "39d16ce0f618ba37ee1024b83e4822a2d38e6ba9f341ff2020d34df94c7a6beb"
else if stdenv.system == "x86_64-linux"
then "c71325cfea1b6f0bdc5189fa4c50ff96f828096ff3f7b5056367f9685d6a4d04"
then "bbb0e249a7a3e8143b569706c7d2e7e5f51932c753b7fd26c58ccd2015b02c6b"
else if stdenv.system == "i686-darwin"
then "fe1b3d67329a22d67e3b8db8858a43022e2e746dde60ef4a2db3f2cac16ea9bd"
then "308132b33d4002f95a725c2d31b975ff37905e3644894ed86e614b03ded70265"
else if stdenv.system == "x86_64-darwin"
then "3381341524b0184da5ed2cdcddc2a25e2e335e87f1cf676f64d98ee5e6479f20"
then "1689060c07ec727e9756f19c9373045668471ab56fd8f53e92701150bbe2032b"
else throw "missing bootstrap hash for platform ${stdenv.system}";

needsPatchelf = stdenv.isLinux;

src = fetchurl {
url = "https://static.rust-lang.org/dist/rust-${version}-${platform}.tar.gz";
sha256 = bootstrapHash;
};

version = "1.14.0";
in

rec {
rustc = stdenv.mkDerivation rec {
name = "rustc-bootstrap-${version}";

inherit version;
inherit src;

buildInputs = [ makeWrapper ];
phases = ["unpackPhase" "installPhase"];

installPhase = ''
./install.sh --prefix=$out \
--components=rustc,rust-std-${platform},rust-docs
${optionalString needsPatchelf ''
patchelf \
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
"$out/bin/rustc"
''}
# Do NOT, I repeat, DO NOT use `wrapProgram` on $out/bin/rustc
# (or similar) here. It causes strange effects where rustc loads
# the wrong libraries in a bootstrap-build causing failures that
# are very hard to track dow. For details, see
# https://github.com/rust-lang/rust/issues/34722#issuecomment-232164943
'';
};

cargo = stdenv.mkDerivation rec {
name = "cargo-bootstrap-${version}";

inherit version;
inherit src;

buildInputs = [ makeWrapper zlib rustc ];
phases = ["unpackPhase" "installPhase"];

installPhase = ''
./install.sh --prefix=$out \
--components=cargo
${optionalString needsPatchelf ''
patchelf \
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
"$out/bin/cargo"
''}
wrapProgram "$out/bin/cargo" \
--suffix PATH : "${rustc}/bin"
'';
};
}
version = "1.17.0";
in import ./binaryBuild.nix
{ inherit stdenv fetchurl makeWrapper cacert zlib curl;
buildRustPackage = null;
inherit version src platform;
versionType = "bootstrap";
}
28 changes: 13 additions & 15 deletions pkgs/development/compilers/rust/default.nix
@@ -1,37 +1,35 @@
{ stdenv, callPackage, recurseIntoAttrs, makeRustPlatform, llvm
{ stdenv, callPackage, recurseIntoAttrs, makeRustPlatform, llvm, fetchurl
, targets ? []
, targetToolchains ? []
, targetPatches ? []
}:

let
rustPlatform = recurseIntoAttrs (makeRustPlatform (callPackage ./bootstrap.nix {}));
version = "1.17.0";
in
rec {
rustc = callPackage ./rustc.nix {
shortVersion = "1.15.1";
isRelease = true;
forceBundledLLVM = false;
inherit llvm targets targetPatches targetToolchains rustPlatform version;

configureFlags = [ "--release-channel=stable" ];
srcRev = "021bd294c039bd54aa5c4aa85bcdffb0d24bc892";
srcSha = "1dp7cjxj8nv960jxkq3p18agh9bpfb69ac14x284jmhwyksim3y7";

src = fetchurl {
url = "https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz";
sha256 = "4baba3895b75f2492df6ce5a28a916307ecd1c088dc1fd02dbfa8a8e86174f87";
};

patches = [
./patches/darwin-disable-fragile-tcp-tests.patch
] ++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;

inherit llvm;
inherit targets;
inherit targetPatches;
inherit targetToolchains;
inherit rustPlatform;
};

cargo = callPackage ./cargo.nix rec {
version = "0.16.0";
srcRev = "6e0c18cccc8b0c06fba8a8d76486f81a792fb420";
srcSha = "117ivvs9wz848mwf8bw797n10qpn77agd353z8b0hxgbxhpribya";
depsSha256 = "11s2xpgfhl4mb4wa2nk4mzsypr7m9daxxc7l0vraiz5cr77gk7qq";
version = "0.18.0";
srcRev = "fe7b0cdcf5ca7aab81630706ce40b70f6aa2e666";
srcSha = "164iywv1l3v87b0pznf5kkzxigd6w19myv9d7ka4c65zgrk9n9px";
depsSha256 = "1mrgd8ib48vxxbhkvsqqq4p19sc6b74x3cd8p6lhhlm6plrajrvm";

inherit rustc; # the rustc that will be wrapped by cargo
inherit rustPlatform; # used to build cargo
Expand Down

0 comments on commit 85cecd1

Please sign in to comment.