summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorDavid Craven <david@craven.ch>2016-06-07 20:55:14 +0200
committerDavid Craven <david@craven.ch>2016-06-14 23:09:21 +0200
commitd8a7aaf179cfad732720b996c76c55488b8d6d20 (patch)
tree92c1533c09ac33992a4395a92f2e99b88e9eb5d9 /pkgs/development
parent447dce99da1a92c0efa2810ae9e9d592152a7586 (diff)
downloadnixlib-d8a7aaf179cfad732720b996c76c55488b8d6d20.tar
nixlib-d8a7aaf179cfad732720b996c76c55488b8d6d20.tar.gz
nixlib-d8a7aaf179cfad732720b996c76c55488b8d6d20.tar.bz2
nixlib-d8a7aaf179cfad732720b996c76c55488b8d6d20.tar.lz
nixlib-d8a7aaf179cfad732720b996c76c55488b8d6d20.tar.xz
nixlib-d8a7aaf179cfad732720b996c76c55488b8d6d20.tar.zst
nixlib-d8a7aaf179cfad732720b996c76c55488b8d6d20.zip
rustc: Prepare for 1.10.0 release
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/compilers/rustc/bootstrap.nix73
-rwxr-xr-xpkgs/development/compilers/rustc/print-hashes.sh17
-rw-r--r--pkgs/development/compilers/rustc/snapshot.nix61
3 files changed, 109 insertions, 42 deletions
diff --git a/pkgs/development/compilers/rustc/bootstrap.nix b/pkgs/development/compilers/rustc/bootstrap.nix
index 8bff511459dc..0361bb78a9ce 100644
--- a/pkgs/development/compilers/rustc/bootstrap.nix
+++ b/pkgs/development/compilers/rustc/bootstrap.nix
@@ -1,58 +1,47 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, makeWrapper }:
 
 let
-  platform = if stdenv.system == "i686-linux"
-    then "linux-i386"
+  platform =
+    if stdenv.system == "i686-linux"
+    then "i686-unknown-linux-gnu"
     else if stdenv.system == "x86_64-linux"
-    then "linux-x86_64"
+    then "x86_64-unknown-linux-gnu"
     else if stdenv.system == "i686-darwin"
-    then "macos-i386"
+    then "i686-apple-darwin"
     else if stdenv.system == "x86_64-darwin"
-    then "macos-x86_64"
-    else abort "no snapshot to bootstrap for this platform (missing platform url suffix)";
+    then "x86_64-apple-darwin"
+    else abort "missing boostrap url for platform ${stdenv.system}";
 
-  /* Rust is bootstrapped from an earlier built version. We need
-    to fetch these earlier versions, which vary per platform.
-    The shapshot info you want can be found at
-    https://github.com/rust-lang/rust/blob/{$shortVersion}/src/snapshots.txt
-    with the set you want at the top. Make sure this is the latest snapshot
-    for the tagged release and not a snapshot in the current HEAD.
-    NOTE: Rust 1.9.0 is the last version that uses snapshots
-  */
-
-  snapshotHashLinux686 = "0e0e4448b80d0a12b75485795244bb3857a0a7ef";
-  snapshotHashLinux64 = "1273b6b6aed421c9e40c59f366d0df6092ec0397";
-  snapshotHashDarwin686 = "9f9c0b4a2db09acbce54b792fb8839a735585565";
-  snapshotHashDarwin64 = "52570f6fd915b0210a9be98cfc933148e16a75f8";
-  snapshotDate = "2016-03-18";
-  snapshotRev = "235d774";
-
-  snapshotHash = if stdenv.system == "i686-linux"
-    then snapshotHashLinux686
+  # fetch hashes by running `print-hashes.sh 1.9.0`
+  bootstrapHash =
+    if stdenv.system == "i686-linux"
+    then "2951dec835827974d03c7aafbf2c969f39bb530e1c200fd46f90bc01772fae39"
     else if stdenv.system == "x86_64-linux"
-    then snapshotHashLinux64
+    then "d0704d10237c66c3efafa6f7e5570c59a1d3fe5c6d99487540f90ebb37cd84c4"
     else if stdenv.system == "i686-darwin"
-    then snapshotHashDarwin686
+    then "c7aa93e2475aa8e65259f606ca70e98da41cf5d2b20f91703b98f9572a84f7e6"
     else if stdenv.system == "x86_64-darwin"
-    then snapshotHashDarwin64
-    else abort "no snapshot for platform ${stdenv.system}";
-
-  snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshotHash}.tar.bz2";
+    then "7204226b42e9c380d44e722efd4a886178a1867a064c90f12e0553a21a4184c6"
+    else throw "missing boostrap hash for platform ${stdenv.system}";
 in
-
-stdenv.mkDerivation {
-  name = "rust-bootstrap";
+stdenv.mkDerivation rec {
+  name = "rustc-bootstrap-${version}";
+  version = "1.9.0";
   src = fetchurl {
-    url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}";
-    sha1 = snapshotHash;
+     url = "https://static.rust-lang.org/dist/rustc-${version}-${platform}.tar.gz";
+     sha256 = bootstrapHash;
   };
-  dontStrip = true;
+  buildInputs = [makeWrapper];
+  phases = ["unpackPhase" "installPhase"];
+
   installPhase = ''
     mkdir -p "$out"
-    cp -r bin "$out/bin"
-  '' + stdenv.lib.optionalString stdenv.isLinux ''
-    patchelf --interpreter "${stdenv.glibc.out}/lib/${stdenv.cc.dynamicLinker}" \
-             --set-rpath "${stdenv.cc.cc.lib}/lib/:${stdenv.cc.cc.lib}/lib64/" \
-             "$out/bin/rustc"
+    ./install.sh "--prefix=$out"
+
+    patchelf \
+      --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
+      "$out/bin/rustc"
+
+    wrapProgram "$out/bin/rustc"
   '';
 }
diff --git a/pkgs/development/compilers/rustc/print-hashes.sh b/pkgs/development/compilers/rustc/print-hashes.sh
new file mode 100755
index 000000000000..710d4c0b585c
--- /dev/null
+++ b/pkgs/development/compilers/rustc/print-hashes.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+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
+
+if [[ -z  $VERSION ]]
+then
+    echo "No version supplied"
+    exit -1
+fi
+
+for PLATFORM in $PLATFORMS
+do
+    URL="$BASEURL/rustc-$VERSION-$PLATFORM.tar.gz.sha256"
+    curl $URL
+done
diff --git a/pkgs/development/compilers/rustc/snapshot.nix b/pkgs/development/compilers/rustc/snapshot.nix
new file mode 100644
index 000000000000..8f7005dc0d76
--- /dev/null
+++ b/pkgs/development/compilers/rustc/snapshot.nix
@@ -0,0 +1,61 @@
+/* NOTE: Rust 1.9.0 is the last version that uses snapshots
+         This file can be deleted after the 1.10.0 release and bootstrap.nix
+         can be used instead
+*/
+{ stdenv, fetchurl }:
+
+let
+  platform = if stdenv.system == "i686-linux"
+    then "linux-i386"
+    else if stdenv.system == "x86_64-linux"
+    then "linux-x86_64"
+    else if stdenv.system == "i686-darwin"
+    then "macos-i386"
+    else if stdenv.system == "x86_64-darwin"
+    then "macos-x86_64"
+    else abort "no snapshot to bootstrap for this platform (missing platform url suffix)";
+
+  /* Rust is bootstrapped from an earlier built version. We need
+    to fetch these earlier versions, which vary per platform.
+    The shapshot info you want can be found at
+    https://github.com/rust-lang/rust/blob/{$shortVersion}/src/snapshots.txt
+    with the set you want at the top. Make sure this is the latest snapshot
+    for the tagged release and not a snapshot in the current HEAD.
+  */
+
+  snapshotHashLinux686 = "0e0e4448b80d0a12b75485795244bb3857a0a7ef";
+  snapshotHashLinux64 = "1273b6b6aed421c9e40c59f366d0df6092ec0397";
+  snapshotHashDarwin686 = "9f9c0b4a2db09acbce54b792fb8839a735585565";
+  snapshotHashDarwin64 = "52570f6fd915b0210a9be98cfc933148e16a75f8";
+  snapshotDate = "2016-03-18";
+  snapshotRev = "235d774";
+
+  snapshotHash = if stdenv.system == "i686-linux"
+    then snapshotHashLinux686
+    else if stdenv.system == "x86_64-linux"
+    then snapshotHashLinux64
+    else if stdenv.system == "i686-darwin"
+    then snapshotHashDarwin686
+    else if stdenv.system == "x86_64-darwin"
+    then snapshotHashDarwin64
+    else abort "no snapshot for platform ${stdenv.system}";
+
+  snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshotHash}.tar.bz2";
+in
+
+stdenv.mkDerivation {
+  name = "rust-bootstrap";
+  src = fetchurl {
+    url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}";
+    sha1 = snapshotHash;
+  };
+  dontStrip = true;
+  installPhase = ''
+    mkdir -p "$out"
+    cp -r bin "$out/bin"
+  '' + stdenv.lib.optionalString stdenv.isLinux ''
+    patchelf --interpreter "${stdenv.glibc.out}/lib/${stdenv.cc.dynamicLinker}" \
+             --set-rpath "${stdenv.cc.cc.lib}/lib/:${stdenv.cc.cc.lib}/lib64/" \
+             "$out/bin/rustc"
+  '';
+}