Merge pull request #3412 from Ericson2314/rust-master

Add alternative rustc package for master tip
This commit is contained in:
Austin Seipp 2014-07-31 21:51:21 -05:00
commit 181cdb7cc8
6 changed files with 132 additions and 27 deletions

View File

@ -14,23 +14,25 @@
*/
with if stdenv.system == "i686-linux" then {
platform = "linux-i386";
snapshot = "84339ea0f796ae468ef86797ef4587274bec19ea";
target = "i686-unknown-linux-gnu";
} else if stdenv.system == "x86_64-linux" then {
platform = "linux-x86_64";
snapshot = "bd8a6bc1f28845b7f4b768f6bfa06e7fbdcfcaae";
target = "x86_64-unknown-linux-gnu";
} else if stdenv.system == "x86_64-darwin" then {
platform = "macos-x86_64";
snapshot = "4a8c2e1b7634d73406bac32a1a97893ec3ed818d";
} else {};
let snapshotDate = "2014-06-21";
with ((import ./common.nix) {inherit stdenv; version = "0.11.0"; });
let snapshot = if stdenv.system == "i686-linux"
then "84339ea0f796ae468ef86797ef4587274bec19ea"
else if stdenv.system == "x86_64-linux"
then "bd8a6bc1f28845b7f4b768f6bfa06e7fbdcfcaae"
else if stdenv.system == "i686-darwin"
then "3f25b2680efbab16ad074477a19d49dcce475977"
else if stdenv.system == "x86_64-darwin"
then "4a8c2e1b7634d73406bac32a1a97893ec3ed818d"
else abort "no-snapshot for platform ${stdenv.system}";
snapshotDate = "2014-06-21";
snapshotRev = "db9af1d";
snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshot}.tar.bz2"; in
stdenv.mkDerivation {
name = "rust-0.11.0";
snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshot}.tar.bz2";
in stdenv.mkDerivation {
inherit name;
inherit version;
inherit meta;
src = fetchurl {
url = http://static.rust-lang.org/dist/rust-0.11.0.tar.gz;
@ -67,14 +69,4 @@ stdenv.mkDerivation {
buildInputs = [ which file perl curl python27 makeWrapper ];
enableParallelBuilding = true;
meta = with stdenv.lib; {
homepage = http://www.rust-lang.org/;
description = "A safe, concurrent, practical language";
maintainers = with maintainers; [ madjar cstrahan ];
license = map (builtins.getAttr "shortName") [ licenses.mit licenses.asl20 ];
# platforms as per http://static.rust-lang.org/doc/master/tutorial.html#getting-started
platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
};
}

View File

@ -0,0 +1,36 @@
{stdenv, version}:
{
inherit version;
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 boostrap for this platform (missing platform url suffix)";
target = if stdenv.system == "i686-linux"
then "i686-unknown-linux-gnu"
else if stdenv.system == "x86_64-linux"
then "x86_64-unknown-linux-gnu"
else if stdenv.system == "i686-darwin"
then "i686-apple-darwin"
else if stdenv.system == "x86_64-darwin"
then "x86_64-apple-darwin"
else abort "no snapshot to boostrap for this platform (missing target triple";
meta = with stdenv.lib; {
homepage = http://www.rust-lang.org/;
description = "A safe, concurrent, practical language";
maintainers = with maintainers; [ madjar cstrahan ];
license = map (builtins.getAttr "shortName") [ licenses.mit licenses.asl20 ];
# platforms as per http://static.rust-lang.org/doc/master/tutorial.html#getting-started
platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ];
};
name = "rustc-${version}";
}

View File

@ -0,0 +1,73 @@
{stdenv, fetchurl, fetchgit, which, file, perl, curl, python27, makeWrapper}:
/* Rust's build process has a few quirks :
- It requires some patched in llvm that haven't landed upstream, so it
compiles its own llvm. This might change in the future, so at some
point we may be able to switch to nix's llvm.
- The Rust compiler is written is Rust, so it requires a bootstrap
compiler, which is downloaded during the build. To make the build
pure, we download it ourself before and put it where it is
expected. Once the language is stable (1.0) , we might want to
switch it to use nix's packaged rust compiler.
*/
with ((import ./common.nix) {inherit stdenv; version = "0.12.0-pre-7a25cf3f3"; });
let snapshot = if stdenv.system == "i686-linux"
then "a5e1bb723020ac35173d49600e76b0935e257a6a"
else if stdenv.system == "x86_64-linux"
then "1a2407df17442d93d1c34c916269a345658045d7"
else if stdenv.system == "i686-darwin"
then "6648fa88e41ad7c0991a085366e36d56005873ca"
else if stdenv.system == "x86_64-darwin"
then "71b2d1dfd0abe1052908dc091e098ed22cf272c6"
else abort "no-snapshot for platform ${stdenv.system}";
snapshotDate = "2014-07-17";
snapshotRev = "9fc8394";
snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshot}.tar.bz2";
in stdenv.mkDerivation {
inherit name;
inherit version;
inherit meta;
src = fetchgit {
url = https://github.com/rust-lang/rust;
rev = "7a25cf3f30fa5fae2e868fa910ecc850f5e9ee65";
sha256 = "1hx8vd4gn5plbdvr0zvdvqyw9x9r2vbmh112h2f5d2xxsf9p7rf1";
};
# We need rust to build rust. If we don't provide it, configure will try to download it.
snapshot = stdenv.mkDerivation {
name = "rust-stage0";
src = fetchurl {
url = "http://static.rust-lang.org/stage0-snapshots/${snapshotName}";
sha1 = snapshot;
};
dontStrip = true;
installPhase = ''
mkdir -p "$out"
cp -r bin "$out/bin"
'' + (if stdenv.isLinux then ''
patchelf --interpreter "${stdenv.glibc}/lib/${stdenv.gcc.dynamicLinker}" \
--set-rpath "${stdenv.gcc.gcc}/lib/:${stdenv.gcc.gcc}/lib64/" \
"$out/bin/rustc"
'' else "");
};
configureFlags = [ "--enable-local-rust" "--local-rust-root=$snapshot" ];
# The compiler requires cc, so we patch the source to tell it where to find it
patches = [ ./hardcode_paths.patch ./local_stage0.patch ];
postPatch = ''
substituteInPlace src/librustc/back/link.rs \
--subst-var-by "ccPath" "${stdenv.gcc}/bin/cc" \
--subst-var-by "arPath" "${stdenv.gcc.binutils}/bin/ar"
'';
buildInputs = [ which file perl curl python27 makeWrapper ];
enableParallelBuilding = true;
}

View File

@ -3304,7 +3304,11 @@ let
roadsend = callPackage ../development/compilers/roadsend { };
rust = callPackage ../development/compilers/rust {};
rustc = callPackage ../development/compilers/rustc/0.11.nix {};
rustcMaster = callPackage ../development/compilers/rustc/head.nix {};
rust = rustc;
sbclBootstrap = callPackage ../development/compilers/sbcl/bootstrap.nix {};
sbcl = callPackage ../development/compilers/sbcl {