rust: Refactoring of rust and cargo packages
This commit is contained in:
27
pkgs/development/compilers/rust/beta.nix
Normal file
27
pkgs/development/compilers/rust/beta.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{ stdenv, callPackage, rustPlatform,
|
||||
targets ? [], targetToolchains ? [], targetPatches ? [] }:
|
||||
|
||||
rec {
|
||||
rustc = callPackage ./rustc.nix {
|
||||
shortVersion = "beta-1.10.0";
|
||||
forceBundledLLVM = false;
|
||||
configureFlags = [ "--release-channel=beta" ];
|
||||
srcRev = "d18e321abeecc69e4d1bf9cafba4fba53ddf267d";
|
||||
srcSha = "1ck8mbjrq0bzq5xzwgaqdilakwm2ab0xpzqibjycds62ad4yw774";
|
||||
patches = [ ./patches/disable-lockfile-check.patch ]
|
||||
++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
|
||||
inherit targets;
|
||||
inherit targetPatches;
|
||||
inherit targetToolchains;
|
||||
inherit rustPlatform;
|
||||
};
|
||||
|
||||
cargo = callPackage ./cargo.nix rec {
|
||||
version = "0.10.0";
|
||||
srcRev = "refs/tags/${version}";
|
||||
srcSha = "06scvx5qh60mgvlpvri9ig4np2fsnicsfd452fi9w983dkxnz4l2";
|
||||
depsSha256 = "0js4697n7v93wnqnpvamhp446w58llj66za5hkd6wannmc0gsy3b";
|
||||
inherit rustc; # the rustc that will be wrapped by cargo
|
||||
inherit rustPlatform; # used to build cargo
|
||||
};
|
||||
}
|
||||
78
pkgs/development/compilers/rust/bootstrap.nix
Normal file
78
pkgs/development/compilers/rust/bootstrap.nix
Normal file
@@ -0,0 +1,78 @@
|
||||
{ stdenv, fetchurl, makeWrapper, cacert, zlib }:
|
||||
|
||||
let
|
||||
platform =
|
||||
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 "missing boostrap url for platform ${stdenv.system}";
|
||||
|
||||
# fetch hashes by running `print-hashes.sh 1.9.0`
|
||||
bootstrapHash =
|
||||
if stdenv.system == "i686-linux"
|
||||
then "dd4d9bf1b9393867eb18d00431e8fb733894984f2c7b5154bc1b64d045077b45"
|
||||
else if stdenv.system == "x86_64-linux"
|
||||
then "288ff13efa2577e81c77fc2cb6e2b49b1ed0ceab51b4fa12f7efb87039ac49b7"
|
||||
else if stdenv.system == "i686-darwin"
|
||||
then "4d4d4b256d6bd6ae2527cf61007b2553de200f0a1910b7ad41e4f51d2b21e536"
|
||||
else if stdenv.system == "x86_64-darwin"
|
||||
then "d59b5509e69c1cace20a57072e3b3ecefdbfd8c7e95657b0ff2ac10aa1dfebe6"
|
||||
else throw "missing boostrap hash for platform ${stdenv.system}";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://static.rust-lang.org/dist/rust-${version}-${platform}.tar.gz";
|
||||
sha256 = bootstrapHash;
|
||||
};
|
||||
|
||||
version = "1.9.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
|
||||
|
||||
patchelf \
|
||||
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
||||
"$out/bin/rustc"
|
||||
|
||||
wrapProgram "$out/bin/rustc"
|
||||
'';
|
||||
};
|
||||
|
||||
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
|
||||
|
||||
patchelf \
|
||||
--set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) \
|
||||
"$out/bin/cargo"
|
||||
|
||||
wrapProgram "$out/bin/cargo" \
|
||||
--suffix PATH : "${rustc}/bin"
|
||||
'';
|
||||
};
|
||||
}
|
||||
64
pkgs/development/compilers/rust/cargo.nix
Normal file
64
pkgs/development/compilers/rust/cargo.nix
Normal file
@@ -0,0 +1,64 @@
|
||||
{ stdenv, fetchgit, file, curl, pkgconfig, python, openssl, cmake, zlib
|
||||
, makeWrapper, libiconv, cacert, rustPlatform, rustc
|
||||
, version, srcRev, srcSha, depsSha256 }:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
name = "cargo-${version}";
|
||||
inherit version;
|
||||
|
||||
src = fetchgit {
|
||||
url = "https://github.com/rust-lang/cargo";
|
||||
rev = srcRev;
|
||||
sha256 = srcSha;
|
||||
};
|
||||
|
||||
inherit depsSha256;
|
||||
|
||||
passthru.rustc = rustc;
|
||||
|
||||
buildInputs = [ file curl pkgconfig python openssl cmake zlib makeWrapper ]
|
||||
++ stdenv.lib.optional stdenv.isDarwin libiconv;
|
||||
|
||||
configurePhase = ''
|
||||
./configure --enable-optimize --prefix=$out --local-cargo=${rustPlatform.rust.cargo}/bin/cargo
|
||||
'';
|
||||
|
||||
buildPhase = "make";
|
||||
|
||||
installPhase = ''
|
||||
make install
|
||||
${postInstall}
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
rm "$out/lib/rustlib/components" \
|
||||
"$out/lib/rustlib/install.log" \
|
||||
"$out/lib/rustlib/rust-installer-version" \
|
||||
"$out/lib/rustlib/uninstall.sh" \
|
||||
"$out/lib/rustlib/manifest-cargo"
|
||||
|
||||
wrapProgram "$out/bin/cargo" \
|
||||
--suffix PATH : "${rustc}/bin" \
|
||||
--run "export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt" \
|
||||
${stdenv.lib.optionalString stdenv.isDarwin ''--suffix DYLD_LIBRARY_PATH : "${rustc}/lib"''}
|
||||
'';
|
||||
|
||||
checkPhase = ''
|
||||
# Export SSL_CERT_FILE as without it one test fails with SSL verification error
|
||||
export SSL_CERT_FILE=${cacert}/etc/ssl/certs/ca-bundle.crt
|
||||
# Disable cross compilation tests
|
||||
export CFG_DISABLE_CROSS_TESTS=1
|
||||
cargo test
|
||||
'';
|
||||
|
||||
# Disable check phase as there are failures (author_prefers_cargo test fails)
|
||||
doCheck = false;
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = http://crates.io;
|
||||
description = "Downloads your Rust project's dependencies and builds your project";
|
||||
maintainers = with maintainers; [ wizeman retrry ];
|
||||
license = [ licenses.mit licenses.asl20 ];
|
||||
platforms = platforms.linux ++ platforms.darwin;
|
||||
};
|
||||
}
|
||||
33
pkgs/development/compilers/rust/default.nix
Normal file
33
pkgs/development/compilers/rust/default.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{ stdenv, callPackage, recurseIntoAttrs, makeRustPlatform,
|
||||
targets ? [], targetToolchains ? [], targetPatches ? [] }:
|
||||
|
||||
let
|
||||
rustPlatform = recurseIntoAttrs (makeRustPlatform (callPackage ./bootstrap.nix {}) rustPlatform);
|
||||
rustSnapshotPlatform = recurseIntoAttrs (makeRustPlatform (callPackage ./snapshot.nix {}) rustPlatform);
|
||||
in
|
||||
|
||||
rec {
|
||||
rustc = callPackage ./rustc.nix {
|
||||
shortVersion = "1.9.0";
|
||||
isRelease = true;
|
||||
forceBundledLLVM = false;
|
||||
configureFlags = [ "--release-channel=stable" ];
|
||||
srcRev = "e4e8b666850a763fdf1c3c2c142856ab51e32779";
|
||||
srcSha = "1pz4qx70mqv78fxm4w1mq7csk5pssq4qmr2vwwb5v8hyx03caff8";
|
||||
patches = [ ./patches/remove-uneeded-git.patch ]
|
||||
++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
|
||||
inherit targets;
|
||||
inherit targetPatches;
|
||||
inherit targetToolchains;
|
||||
rustPlatform = rustSnapshotPlatform;
|
||||
};
|
||||
|
||||
cargo = callPackage ./cargo.nix rec {
|
||||
version = "0.10.0";
|
||||
srcRev = "refs/tags/${version}";
|
||||
srcSha = "06scvx5qh60mgvlpvri9ig4np2fsnicsfd452fi9w983dkxnz4l2";
|
||||
depsSha256 = "0js4697n7v93wnqnpvamhp446w58llj66za5hkd6wannmc0gsy3b";
|
||||
inherit rustc; # the rustc that will be wrapped by cargo
|
||||
inherit rustPlatform; # used to build cargo
|
||||
};
|
||||
}
|
||||
27
pkgs/development/compilers/rust/head.nix
Normal file
27
pkgs/development/compilers/rust/head.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{ stdenv, callPackage, rustPlatform,
|
||||
targets ? [], targetToolchains ? [], targetPatches ? [] }:
|
||||
|
||||
rec {
|
||||
rustc = callPackage ./rustc.nix {
|
||||
shortVersion = "master-1.11.0";
|
||||
forceBundledLLVM = false;
|
||||
srcRev = "298730e7032cd55809423773da397cd5c7d827d4";
|
||||
srcSha = "0hyz5j1z75sjkgsifzgxviv3b1lhgaz8wqwvmq80xx5vd78yd0c1";
|
||||
patches = [ ./patches/disable-lockfile-check.patch
|
||||
./patches/use-rustc-1.9.0.patch ]
|
||||
++ stdenv.lib.optional stdenv.needsPax ./patches/grsec.patch;
|
||||
inherit targets;
|
||||
inherit targetPatches;
|
||||
inherit targetToolchains;
|
||||
inherit rustPlatform;
|
||||
};
|
||||
|
||||
cargo = callPackage ./cargo.nix rec {
|
||||
version = "2016.06.07";
|
||||
srcRev = "3e70312a2a4ebedace131fc63bb8f27463c5db28";
|
||||
srcSha = "0nibzyfjkiqfnq0c00hhqvs856l5qls8wds252p97q5q92yvp40f";
|
||||
depsSha256 = "1xbb33aqnf5yyws6gjys9w8kznbh9rh6hw8mpg1hhq1ahipc2j1f";
|
||||
inherit rustc; # the rustc that will be wrapped by cargo
|
||||
inherit rustPlatform; # used to build cargo
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
From e7378e267bba203bd593b49705c24303b0a46cb7 Mon Sep 17 00:00:00 2001
|
||||
From: David Craven <david@craven.ch>
|
||||
Date: Wed, 1 Jun 2016 01:41:35 +0200
|
||||
Subject: [PATCH] disable-lockfile-check
|
||||
|
||||
---
|
||||
src/tools/tidy/src/main.rs | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs
|
||||
index 2839bbd..50142ff 100644
|
||||
--- a/src/tools/tidy/src/main.rs
|
||||
+++ b/src/tools/tidy/src/main.rs
|
||||
@@ -47,7 +47,7 @@ fn main() {
|
||||
errors::check(&path, &mut bad);
|
||||
cargo::check(&path, &mut bad);
|
||||
features::check(&path, &mut bad);
|
||||
- cargo_lock::check(&path, &mut bad);
|
||||
+ //cargo_lock::check(&path, &mut bad);
|
||||
|
||||
if bad {
|
||||
panic!("some tidy checks failed");
|
||||
--
|
||||
2.8.3
|
||||
|
||||
24
pkgs/development/compilers/rust/patches/grsec.patch
Normal file
24
pkgs/development/compilers/rust/patches/grsec.patch
Normal file
@@ -0,0 +1,24 @@
|
||||
diff --git a/src/test/run-make/relocation-model/Makefile b/src/test/run-make/relocation-model/Makefile
|
||||
index b22f34f..c6489bd 100644
|
||||
--- a/src/test/run-make/relocation-model/Makefile
|
||||
+++ b/src/test/run-make/relocation-model/Makefile
|
||||
@@ -2,9 +2,11 @@
|
||||
|
||||
all: others
|
||||
$(RUSTC) -C relocation-model=dynamic-no-pic foo.rs
|
||||
+ paxctl -czexm $(TMPDIR)/foo
|
||||
$(call RUN,foo)
|
||||
|
||||
$(RUSTC) -C relocation-model=default foo.rs
|
||||
+ paxctl -czexm $(TMPDIR)/foo
|
||||
$(call RUN,foo)
|
||||
|
||||
$(RUSTC) -C relocation-model=default --crate-type=dylib foo.rs
|
||||
@@ -16,6 +18,7 @@ others:
|
||||
else
|
||||
others:
|
||||
$(RUSTC) -C relocation-model=static foo.rs
|
||||
+ paxctl -czexm $(TMPDIR)/foo
|
||||
$(call RUN,foo)
|
||||
$(RUSTC) -C relocation-model=static --crate-type=dylib foo.rs
|
||||
endif
|
||||
@@ -0,0 +1,19 @@
|
||||
diff --git a/src/etc/tidy.py b/src/etc/tidy.py
|
||||
index 9f5f919..a607180 100644
|
||||
--- a/src/etc/tidy.py
|
||||
+++ b/src/etc/tidy.py
|
||||
@@ -66,13 +66,9 @@ def interesting_file(f):
|
||||
return any(os.path.splitext(f)[1] == ext for ext in interesting_files)
|
||||
|
||||
|
||||
-# Be careful to support Python 2.4, 2.6, and 3.x here!
|
||||
-config_proc = subprocess.Popen(["git", "config", "core.autocrlf"],
|
||||
- stdout=subprocess.PIPE)
|
||||
-result = config_proc.communicate()[0]
|
||||
|
||||
true = "true".encode('utf8')
|
||||
-autocrlf = result.strip() == true if result is not None else False
|
||||
+autocrlf = False
|
||||
|
||||
current_name = ""
|
||||
current_contents = ""
|
||||
@@ -0,0 +1,25 @@
|
||||
From 2710f3c8ae142abe1720b3476cd1ca60cee0c077 Mon Sep 17 00:00:00 2001
|
||||
From: David Craven <david@craven.ch>
|
||||
Date: Wed, 1 Jun 2016 00:12:35 +0200
|
||||
Subject: [PATCH] Patch stage0.txt to use rustc 1.9.0
|
||||
|
||||
---
|
||||
src/stage0.txt | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/stage0.txt b/src/stage0.txt
|
||||
index 58b7f8f..3c84cab 100644
|
||||
--- a/src/stage0.txt
|
||||
+++ b/src/stage0.txt
|
||||
@@ -12,6 +12,6 @@
|
||||
# tarball for a stable release you'll likely see `1.x.0-$date` where `1.x.0` was
|
||||
# released on `$date`
|
||||
|
||||
-rustc: beta-2016-04-13
|
||||
-rustc_key: c2743eb4
|
||||
+rustc: 1.9.0-2016-05-24
|
||||
+rustc_key: d16b8f0e
|
||||
cargo: nightly-2016-04-10
|
||||
--
|
||||
2.8.3
|
||||
|
||||
17
pkgs/development/compilers/rust/print-hashes.sh
Executable file
17
pkgs/development/compilers/rust/print-hashes.sh
Executable file
@@ -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/rust-$VERSION-$PLATFORM.tar.gz.sha256"
|
||||
curl $URL
|
||||
done
|
||||
112
pkgs/development/compilers/rust/rustc.nix
Normal file
112
pkgs/development/compilers/rust/rustc.nix
Normal file
@@ -0,0 +1,112 @@
|
||||
{ stdenv, fetchurl, fetchgit, fetchzip, file, python2, tzdata, procps
|
||||
, llvm, jemalloc, ncurses, darwin, binutils, rustPlatform, git
|
||||
|
||||
, isRelease ? false
|
||||
, shortVersion
|
||||
, forceBundledLLVM ? false
|
||||
, srcSha, srcRev
|
||||
, configureFlags ? []
|
||||
, patches
|
||||
, targets
|
||||
, targetPatches
|
||||
, targetToolchains
|
||||
} @ args:
|
||||
|
||||
let
|
||||
version = if isRelease then
|
||||
"${shortVersion}"
|
||||
else
|
||||
"${shortVersion}-g${builtins.substring 0 7 srcRev}";
|
||||
|
||||
name = "rustc-${version}";
|
||||
|
||||
procps = if stdenv.isDarwin then darwin.ps else args.procps;
|
||||
|
||||
llvmShared = llvm.override { enableSharedLibraries = true; };
|
||||
|
||||
target = builtins.replaceStrings [" "] [","] (builtins.toString targets);
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
homepage = http://www.rust-lang.org/;
|
||||
description = "A safe, concurrent, practical language";
|
||||
maintainers = with maintainers; [ madjar cstrahan wizeman globin havvy wkennington retrry ];
|
||||
license = [ licenses.mit licenses.asl20 ];
|
||||
platforms = platforms.linux ++ platforms.darwin;
|
||||
};
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
inherit name;
|
||||
inherit version;
|
||||
inherit meta;
|
||||
|
||||
__impureHostDeps = [ "/usr/lib/libedit.3.dylib" ];
|
||||
|
||||
NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-rpath ${llvmShared}/lib";
|
||||
|
||||
src = fetchgit {
|
||||
url = https://github.com/rust-lang/rust;
|
||||
rev = srcRev;
|
||||
sha256 = srcSha;
|
||||
};
|
||||
|
||||
# We need rust to build rust. If we don't provide it, configure will try to download it.
|
||||
configureFlags = configureFlags
|
||||
++ [ "--enable-local-rust" "--local-rust-root=${rustPlatform.rust.rustc}" "--enable-rpath" ]
|
||||
# ++ [ "--jemalloc-root=${jemalloc}/lib"
|
||||
++ [ "--default-linker=${stdenv.cc}/bin/cc" "--default-ar=${binutils.out}/bin/ar" ]
|
||||
++ stdenv.lib.optional (stdenv.cc.cc ? isClang) "--enable-clang"
|
||||
++ stdenv.lib.optional (targets != []) "--target=${target}"
|
||||
++ stdenv.lib.optional (!forceBundledLLVM) "--llvm-root=${llvmShared}";
|
||||
|
||||
patches = patches ++ targetPatches;
|
||||
passthru.target = target;
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace src/rust-installer/gen-install-script.sh \
|
||||
--replace /bin/echo "$(type -P echo)"
|
||||
substituteInPlace src/rust-installer/gen-installer.sh \
|
||||
--replace /bin/echo "$(type -P echo)"
|
||||
|
||||
# Workaround for NixOS/nixpkgs#8676
|
||||
substituteInPlace mk/rustllvm.mk \
|
||||
--replace "\$\$(subst /,//," "\$\$(subst /,/,"
|
||||
|
||||
# Fix dynamic linking against llvm
|
||||
${stdenv.lib.optionalString (!forceBundledLLVM) ''sed -i 's/, kind = \\"static\\"//g' src/etc/mklldeps.py''}
|
||||
|
||||
# Fix the configure script to not require curl as we won't use it
|
||||
sed -i configure \
|
||||
-e '/probe_need CFG_CURLORWGET/d'
|
||||
|
||||
# Fix the use of jemalloc prefixes which our jemalloc doesn't have
|
||||
# TODO: reenable if we can figure out how to get our jemalloc to work
|
||||
#[ -f src/liballoc_jemalloc/lib.rs ] && sed -i 's,je_,,g' src/liballoc_jemalloc/lib.rs
|
||||
#[ -f src/liballoc/heap.rs ] && sed -i 's,je_,,g' src/liballoc/heap.rs # Remove for 1.4.0+
|
||||
|
||||
# Useful debugging parameter
|
||||
#export VERBOSE=1
|
||||
'';
|
||||
|
||||
preConfigure = ''
|
||||
# Needed flags as the upstream configure script has a broken prefix substitution
|
||||
configureFlagsArray+=("--datadir=$out/share")
|
||||
configureFlagsArray+=("--infodir=$out/share/info")
|
||||
'';
|
||||
|
||||
# ps is needed for one of the test cases
|
||||
nativeBuildInputs = [ file python2 procps rustPlatform.rust.rustc git ];
|
||||
buildInputs = [ ncurses ] ++ targetToolchains
|
||||
++ stdenv.lib.optional (!forceBundledLLVM) llvmShared;
|
||||
|
||||
# https://github.com/rust-lang/rust/issues/30181
|
||||
# enableParallelBuilding = false; # missing files during linking, occasionally
|
||||
|
||||
outputs = [ "out" "doc" ];
|
||||
setOutputFlags = false;
|
||||
|
||||
preCheck = "export TZDIR=${tzdata}/share/zoneinfo";
|
||||
|
||||
doCheck = true;
|
||||
dontSetConfigureCross = true;
|
||||
}
|
||||
65
pkgs/development/compilers/rust/snapshot.nix
Normal file
65
pkgs/development/compilers/rust/snapshot.nix
Normal file
@@ -0,0 +1,65 @@
|
||||
/* 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, callPackage }:
|
||||
|
||||
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
|
||||
|
||||
rec {
|
||||
rustc = stdenv.mkDerivation {
|
||||
name = "rustc-snapshot";
|
||||
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"
|
||||
'';
|
||||
};
|
||||
|
||||
cargo = null;
|
||||
}
|
||||
Reference in New Issue
Block a user