Merge pull request #5636 from Ericson2314/master

Misc cleanups of rustc and cargo packaging
This commit is contained in:
Georges Dubus 2015-01-08 13:17:07 +01:00
commit a9dc59992d
5 changed files with 62 additions and 48 deletions

View File

@ -18,7 +18,7 @@ assert !stdenv.isFreeBSD;
with ((import ./common.nix) {inherit stdenv; version = "0.12.0"; }); with ((import ./common.nix) {inherit stdenv; version = "0.12.0"; });
let snapshot = if stdenv.system == "i686-linux" let snapshotHash = if stdenv.system == "i686-linux"
then "555aca74f9a268f80cab2df1147dc6406403e9e4" then "555aca74f9a268f80cab2df1147dc6406403e9e4"
else if stdenv.system == "x86_64-linux" else if stdenv.system == "x86_64-linux"
then "6a43c2f6c8ba2cbbcb9da1f7b58f748aef99f431" then "6a43c2f6c8ba2cbbcb9da1f7b58f748aef99f431"
@ -29,7 +29,7 @@ let snapshot = if stdenv.system == "i686-linux"
else abort "no-snapshot for platform ${stdenv.system}"; else abort "no-snapshot for platform ${stdenv.system}";
snapshotDate = "2014-10-04"; snapshotDate = "2014-10-04";
snapshotRev = "749ff5e"; snapshotRev = "749ff5e";
snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshot}.tar.bz2"; snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshotHash}.tar.bz2";
in stdenv.mkDerivation { in stdenv.mkDerivation {
inherit name; inherit name;
@ -37,7 +37,7 @@ in stdenv.mkDerivation {
inherit meta; inherit meta;
src = fetchurl { src = fetchurl {
url = http://static.rust-lang.org/dist/rust-0.12.0.tar.gz; url = "http://static.rust-lang.org/dist/rust-${version}.tar.gz";
sha256 = "1dv9wxh41230zknbwj34zgjnh1kgvvy6k12kbiy9bnch9nr6cgl8"; sha256 = "1dv9wxh41230zknbwj34zgjnh1kgvvy6k12kbiy9bnch9nr6cgl8";
}; };
@ -46,7 +46,7 @@ in stdenv.mkDerivation {
name = "rust-stage0"; name = "rust-stage0";
src = fetchurl { src = fetchurl {
url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}"; url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}";
sha1 = snapshot; sha1 = snapshotHash;
}; };
dontStrip = true; dontStrip = true;
installPhase = '' installPhase = ''

View File

@ -21,7 +21,7 @@
then "i686-apple-darwin" then "i686-apple-darwin"
else if stdenv.system == "x86_64-darwin" else if stdenv.system == "x86_64-darwin"
then "x86_64-apple-darwin" then "x86_64-apple-darwin"
else abort "no snapshot to bootstrap for this platform (missing target triple"; else abort "no snapshot to bootstrap for this platform (missing target triple)";
meta = with stdenv.lib; { meta = with stdenv.lib; {
homepage = http://www.rust-lang.org/; homepage = http://www.rust-lang.org/;

View File

@ -18,9 +18,14 @@ assert !stdenv.isFreeBSD;
*/ */
with ((import ./common.nix) {inherit stdenv; version = "0.13.0-pre-3497-g6539cb4";}); let shortVersion = "0.13-dev";
rev = "6539cb417f4a7c2d9d1afce44c196578d2b67f38";
revShort = builtins.substring 0 7 rev;
in
let snapshot = if stdenv.system == "i686-linux" with ((import ./common.nix) {inherit stdenv; version = "${shortVersion}-g${revShort}"; });
let snapshotHash = if stdenv.system == "i686-linux"
then "b880b98d832c9a049b8ef6a50df50061e363de5a" then "b880b98d832c9a049b8ef6a50df50061e363de5a"
else if stdenv.system == "x86_64-linux" else if stdenv.system == "x86_64-linux"
then "82a09c162474b69d2d1e4e8399086f3f0f4e31c3" then "82a09c162474b69d2d1e4e8399086f3f0f4e31c3"
@ -28,19 +33,20 @@ let snapshot = if stdenv.system == "i686-linux"
then "569055bb10d96ab25f78ecf2c80ffbccd5e69b8d" then "569055bb10d96ab25f78ecf2c80ffbccd5e69b8d"
else if stdenv.system == "x86_64-darwin" else if stdenv.system == "x86_64-darwin"
then "cff1f9ebd63dae6890359b7d353bd9486d8ecdfc" then "cff1f9ebd63dae6890359b7d353bd9486d8ecdfc"
else abort "no-snapshot for platform ${stdenv.system}"; else abort "no snapshot for platform ${stdenv.system}";
snapshotDate = "2015-01-04"; snapshotDate = "2015-01-04";
snapshotRev = "b2085d9"; snapshotRev = "b2085d9";
snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshot}.tar.bz2"; snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshotHash}.tar.bz2";
in
in stdenv.mkDerivation { stdenv.mkDerivation {
inherit name; inherit name;
inherit version; inherit version;
inherit meta; inherit meta;
src = fetchgit { src = fetchgit {
url = https://github.com/rust-lang/rust; url = https://github.com/rust-lang/rust;
rev = "6539cb417f4a7c2d9d1afce44c196578d2b67f38"; inherit rev;
sha256 = "14nc42j46hvlqms77245vil2wplmvci3ramxrmjyjqg0bql1w28m"; sha256 = "14nc42j46hvlqms77245vil2wplmvci3ramxrmjyjqg0bql1w28m";
}; };
@ -49,7 +55,7 @@ in stdenv.mkDerivation {
name = "rust-stage0"; name = "rust-stage0";
src = fetchurl { src = fetchurl {
url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}"; url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}";
sha1 = snapshot; sha1 = snapshotHash;
}; };
dontStrip = true; dontStrip = true;
installPhase = '' installPhase = ''

View File

@ -1,8 +1,8 @@
{stdenv, fetchurl, zlib}: {stdenv, version}:
with stdenv.lib; {
inherit version;
rec {
platform = if stdenv.system == "i686-linux" platform = if stdenv.system == "i686-linux"
then "i686-unknown-linux-gnu" then "i686-unknown-linux-gnu"
else if stdenv.system == "x86_64-linux" else if stdenv.system == "x86_64-linux"
@ -13,40 +13,12 @@ rec {
then "x86_64-apple-darwin" then "x86_64-apple-darwin"
else throw "no snapshot to bootstrap for this platform (missing platform url suffix)"; else throw "no snapshot to bootstrap for this platform (missing platform url suffix)";
snapshotHash = if stdenv.system == "i686-linux" meta = with stdenv.lib; {
then "ab8bba0918d3d2ddbd7fd21f147e223dbf04cece"
else if stdenv.system == "x86_64-linux"
then "0efe0f7bcbcbeb5494affcc8a2207db448a08c45"
else if stdenv.system == "i686-darwin"
then "e5097005b0a27c186b8edee24982fd4c3ebba81e"
else if stdenv.system == "x86_64-darwin"
then "6c0bb776e5645fb93b67341b111c715f39b25511"
else throw "no snapshot for platform ${stdenv.system}";
snapshotDate = "2014-12-30";
snapshotName = "cargo-nightly-${platform}.tar.gz";
snapshot = stdenv.mkDerivation {
name = "cargo-snapshot-${snapshotDate}";
src = fetchurl {
url = "https://static-rust-lang-org.s3.amazonaws.com/cargo-dist/${snapshotDate}/${snapshotName}";
sha1 = snapshotHash;
};
dontStrip = true;
installPhase = ''
mkdir -p "$out"
cp -r bin "$out/bin"
'' + (if stdenv.isLinux then ''
patchelf --interpreter "${stdenv.glibc}/lib/${stdenv.cc.dynamicLinker}" \
--set-rpath "${stdenv.cc.gcc}/lib/:${stdenv.cc.gcc}/lib64/:${zlib}/lib" \
"$out/bin/cargo"
'' else "");
};
meta = {
homepage = http://crates.io; homepage = http://crates.io;
description = "Downloads your Rust project's dependencies and builds your project"; description = "Downloads your Rust project's dependencies and builds your project";
license = [ licenses.mit licenses.asl20 ]; license = [ licenses.mit licenses.asl20 ];
platforms = platforms.linux; platforms = platforms.linux;
}; };
name = "cargo-${version}";
} }

View File

@ -2,6 +2,42 @@
/* Cargo binary snapshot */ /* Cargo binary snapshot */
with ((import ./common.nix) { inherit stdenv fetchurl zlib; }); let snapshotDate = "2014-12-30";
in
snapshot // { inherit meta; } with ((import ./common.nix) { inherit stdenv; version = "snapshot-${snapshotDate}"; });
let snapshotHash = if stdenv.system == "i686-linux"
then "ab8bba0918d3d2ddbd7fd21f147e223dbf04cece"
else if stdenv.system == "x86_64-linux"
then "0efe0f7bcbcbeb5494affcc8a2207db448a08c45"
else if stdenv.system == "i686-darwin"
then "e5097005b0a27c186b8edee24982fd4c3ebba81e"
else if stdenv.system == "x86_64-darwin"
then "6c0bb776e5645fb93b67341b111c715f39b25511"
else throw "no snapshot for platform ${stdenv.system}";
snapshotName = "cargo-nightly-${platform}.tar.gz";
in
stdenv.mkDerivation {
inherit name;
inherit version;
inherit meta;
src = fetchurl {
url = "https://static-rust-lang-org.s3.amazonaws.com/cargo-dist/${snapshotDate}/${snapshotName}";
sha1 = snapshotHash;
};
dontStrip = true;
installPhase = ''
mkdir -p "$out"
cp -r bin "$out/bin"
'' + (if stdenv.isLinux then ''
patchelf --interpreter "${stdenv.glibc}/lib/${stdenv.cc.dynamicLinker}" \
--set-rpath "${stdenv.cc.gcc}/lib/:${stdenv.cc.gcc}/lib64/:${zlib}/lib" \
"$out/bin/cargo"
'' else "");
}