Skip to content

Commit

Permalink
rust: 1.17.0 -> 1.20.0
Browse files Browse the repository at this point in the history
simplify the boostrap hashes a bit

build with bundled llvm:

the rust project has forked the llvm compiler to solve some
issues.
With pkgs.llvm the test suite fails.

See rust-lang/rust#43026

And PR #30088
  • Loading branch information
zimbatm committed Oct 22, 2017
1 parent e30e201 commit 7bd191d
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 37 deletions.
30 changes: 13 additions & 17 deletions pkgs/development/compilers/rust/bootstrap.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
{ stdenv, fetchurl, makeWrapper, cacert, zlib, curl }:

let
# Note: the version MUST be one version prior to the version we're
# building
version = "1.19.0";

# fetch hashes by running `print-hashes.sh 1.19.0`
hashes = {
i686-unknown-linux-gnu = "657b78f3c1a1b4412e12f7278e20cc318022fa276a58f0d38a0d15b515e39713";
x86_64-unknown-linux-gnu = "30ff67884464d32f6bbbde4387e7557db98868e87fb2afbb77c9b7716e3bff09";
i686-apple-darwin = "bdfd2189245dc5764c9f26bdba1429c2bf9d57477d8e6e3f0ba42ea0dc63edeb";
x86_64-apple-darwin = "5c668fb60a3ba3e97dc2cb8967fc4bb9422b629155284dcb89f94d116bb17820";
};

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

# fetch hashes by patching print-hashes.sh to not use the "$DATE" variable
# then running `print-hashes.sh 1.16.0`
bootstrapHash =
if stdenv.system == "i686-linux"
then "b5859161ebb182d3b75fa14a5741e5de87b088146fb0ef4a30f3b2439c6179c5"
else if stdenv.system == "x86_64-linux"
then "48621912c242753ba37cad5145df375eeba41c81079df46f93ffb4896542e8fd"
else if stdenv.system == "i686-darwin"
then "26356b14164354725bd0351e8084f9b164abab134fb05cddb7758af35aad2065"
else if stdenv.system == "x86_64-darwin"
then "2d08259ee038d3a2c77a93f1a31fc59e7a1d6d1bbfcba3dba3c8213b2e5d1926"
else throw "missing bootstrap hash for platform ${stdenv.system}";

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

# Note: the version MUST be one version prior to the version we're
# building
version = "1.16.0";
in import ./binaryBuild.nix
{ inherit stdenv fetchurl makeWrapper cacert zlib curl;
buildRustPackage = null;
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/compilers/rust/cargo.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ stdenv, fetchgit, file, curl, pkgconfig, python, openssl, cmake, zlib
, makeWrapper, libiconv, cacert, rustPlatform, rustc, libgit2
, version, srcRev, srcSha, depsSha256
, version, srcSha, depsSha256
, patches ? []}:

rustPlatform.buildRustPackage rec {
Expand All @@ -9,7 +9,7 @@ rustPlatform.buildRustPackage rec {

src = fetchgit {
url = "https://github.com/rust-lang/cargo";
rev = srcRev;
rev = version;
sha256 = srcSha;
};

Expand Down
13 changes: 7 additions & 6 deletions pkgs/development/compilers/rust/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@

let
rustPlatform = recurseIntoAttrs (makeRustPlatform (callPackage ./bootstrap.nix {}));
version = "1.17.0";
version = "1.20.0";
in
rec {
rustc = callPackage ./rustc.nix {
inherit llvm targets targetPatches targetToolchains rustPlatform version;

forceBundledLLVM = true;

configureFlags = [ "--release-channel=stable" ];

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

patches = [
Expand All @@ -26,10 +28,9 @@ rec {
};

cargo = callPackage ./cargo.nix rec {
version = "0.18.0";
srcRev = "fe7b0cdcf5ca7aab81630706ce40b70f6aa2e666";
srcSha = "164iywv1l3v87b0pznf5kkzxigd6w19myv9d7ka4c65zgrk9n9px";
depsSha256 = "1mrgd8ib48vxxbhkvsqqq4p19sc6b74x3cd8p6lhhlm6plrajrvm";
version = "0.21.1";
srcSha = "a64iywv1l3v87b0pznf5kkzxigd6w19myv9d7ka4c65zgrk9n9px";
depsSha256 = "amrgd8ib48vxxbhkvsqqq4p19sc6b74x3cd8p6lhhlm6plrajrvm";

inherit rustc; # the rustc that will be wrapped by cargo
inherit rustPlatform; # used to build cargo
Expand Down
30 changes: 18 additions & 12 deletions pkgs/development/compilers/rust/print-hashes.sh
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
#!/usr/bin/env bash
set -euo pipefail

# All rust-related downloads can be found at
# https://static.rust-lang.org/dist/index.html. To find the date on
# which a particular thing was last updated, look for the *-date.txt
# file, e.g.
# https://static.rust-lang.org/dist/channel-rust-beta-date.txt

PLATFORMS="i686-unknown-linux-gnu x86_64-unknown-linux-gnu i686-apple-darwin x86_64-apple-darwin"
BASEURL="https://static.rust-lang.org/dist"
DATE=$1
VERSION=$2
PLATFORMS=(
i686-unknown-linux-gnu
x86_64-unknown-linux-gnu
i686-apple-darwin
x86_64-apple-darwin
)
BASEURL=https://static.rust-lang.org/dist
VERSION=${1:-}
DATE=${2:-}

if [[ -z $DATE ]]
if [[ -z $VERSION ]]
then
echo "No date supplied"
echo "No version supplied"
exit -1
fi

if [[ -z $VERSION ]]
if [[ -n $DATE ]]
then
echo "No version supplied"
exit -1
BASEURL=$BASEURL/$DATE
fi

for PLATFORM in $PLATFORMS
for PLATFORM in "${PLATFORMS[@]}"
do
URL="$BASEURL/$DATE/rust-$VERSION-$PLATFORM.tar.gz.sha256"
curl $URL
URL="$BASEURL/rust-$VERSION-$PLATFORM.tar.gz.sha256"
SHA256=$(curl -sSfL $URL | cut -d ' ' -f 1)
echo "$PLATFORM = \"$SHA256\";"
done

0 comments on commit 7bd191d

Please sign in to comment.