rustc: Update from 0.12 -> 1.0.0-alpha

This commit is contained in:
Ricardo M. Correia 2015-01-19 18:41:28 +01:00
parent 550124c126
commit 9526284cfe
3 changed files with 63 additions and 42 deletions

View file

@ -1,4 +1,6 @@
{stdenv, fetchurl, which, file, perl, curl, python27, makeWrapper}:
{stdenv, fetchurl, which, file, perl, curl, python27, makeWrapper
, tzdata, git, valgrind, procps, coreutils
}:
assert !stdenv.isFreeBSD;
@ -16,19 +18,19 @@ assert !stdenv.isFreeBSD;
*/
with ((import ./common.nix) {inherit stdenv; version = "0.12.0"; });
with ((import ./common.nix) {inherit stdenv; version = "1.0.0-alpha"; });
let snapshotHash = if stdenv.system == "i686-linux"
then "555aca74f9a268f80cab2df1147dc6406403e9e4"
then "d8b73fc9aa3ad72ce1408a41e35d78dba10eb4d4"
else if stdenv.system == "x86_64-linux"
then "6a43c2f6c8ba2cbbcb9da1f7b58f748aef99f431"
then "697880d3640e981bbbf23284363e8e9a158b588d"
else if stdenv.system == "i686-darwin"
then "331bd7ef519cbb424188c546273e8c7d738f0894"
then "a73b1fc03e8cac747aab0aa186292bb4332a7a98"
else if stdenv.system == "x86_64-darwin"
then "2c83a79a9febfe1d326acb17c3af76ba053c6ca9"
then "e4ae2670ea4ba5c2e5b4245409c9cab45c9eeb5b"
else abort "no-snapshot for platform ${stdenv.system}";
snapshotDate = "2014-10-04";
snapshotRev = "749ff5e";
snapshotDate = "2015-01-07";
snapshotRev = "9e4e524";
snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshotHash}.tar.bz2";
in stdenv.mkDerivation {
@ -37,8 +39,8 @@ in stdenv.mkDerivation {
inherit meta;
src = fetchurl {
url = "http://static.rust-lang.org/dist/rust-${version}.tar.gz";
sha256 = "1dv9wxh41230zknbwj34zgjnh1kgvvy6k12kbiy9bnch9nr6cgl8";
url = "http://static.rust-lang.org/dist/rustc-${version}-src.tar.gz";
sha256 = "0p62gx3s087n09d2v3l9iyfx5cmsa1x91n4ysixcb7w3drr8a8is";
};
# We need rust to build rust. If we don't provide it, configure will try to download it.
@ -63,14 +65,26 @@ in stdenv.mkDerivation {
++ stdenv.lib.optional (stdenv.cc ? clang) "--enable-clang";
# The compiler requires cc, so we patch the source to tell it where to find it
patches = [ ./hardcode_paths.patch ./local_stage0.patch ];
patches = [ ./hardcode_paths.patch ./local_stage0.patch ]
++ stdenv.lib.optional stdenv.needsPax ./grsec.patch;
postPatch = ''
substituteInPlace src/librustc/back/link.rs \
substituteInPlace src/librustc_trans/back/link.rs \
--subst-var-by "ccPath" "${stdenv.cc}/bin/cc"
substituteInPlace src/librustc_back/archive.rs \
--subst-var-by "arPath" "${stdenv.cc.binutils}/bin/ar"
substituteInPlace src/rust-installer/gen-install-script.sh \
--replace /bin/echo "${coreutils}/bin/echo"
substituteInPlace src/rust-installer/gen-installer.sh \
--replace /bin/echo "${coreutils}/bin/echo"
'';
buildInputs = [ which file perl curl python27 makeWrapper ];
enableParallelBuilding = true;
buildInputs = [ which file perl curl python27 makeWrapper git valgrind procps ];
enableParallelBuilding = false; # disabled due to rust-lang/rust#16305
preCheck = "export TZDIR=${tzdata}/share/zoneinfo";
doCheck = true;
}

View file

@ -0,0 +1,16 @@
diff --git a/src/test/run-make/relocation-model/Makefile b/src/test/run-make/relocation-model/Makefile
index 2fcdd32..2d9ddb0 100644
--- a/src/test/run-make/relocation-model/Makefile
+++ b/src/test/run-make/relocation-model/Makefile
@@ -5,9 +5,11 @@ all:
$(call RUN,foo)
$(RUSTC) -C relocation-model=default foo.rs
+ paxctl -czexm $(TMPDIR)/foo
$(call RUN,foo)
$(RUSTC) -C relocation-model=static foo.rs
+ paxctl -czexm $(TMPDIR)/foo
$(call RUN,foo)
$(RUSTC) -C relocation-model=default --crate-type=dylib foo.rs

View file

@ -1,37 +1,28 @@
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index 1cc60fc..2e94b99 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -383,18 +383,9 @@ pub fn mangle_internal_name_by_path_and_seq(path: PathElems, flav: &str) -> Stri
pub fn get_cc_prog(sess: &Session) -> String {
match sess.opts.cg.linker {
- Some(ref linker) => return linker.to_string(),
- None => {}
+ Some(ref linker) => linker.to_string(),
+ None => "@ccPath@".to_string()
}
-
- // In the future, FreeBSD will use clang as default compiler.
- // It would be flexible to use cc (system's default C compiler)
- // instead of hard-coded gcc.
- // For Windows, there is no cc command, so we add a condition to make it use gcc.
- match sess.targ_cfg.os {
- abi::OsWindows => "gcc",
- _ => "cc",
- }.to_string()
}
pub fn remove(sess: &Session, path: &Path) {
diff --git a/src/librustc_back/archive.rs b/src/librustc_back/archive.rs
index 060dda5..fecf76b 100644
index 7ea192b..cd5d01b 100644
--- a/src/librustc_back/archive.rs
+++ b/src/librustc_back/archive.rs
@@ -53,7 +53,7 @@ fn run_ar(handler: &ErrorHandler, maybe_ar_prog: &Option<String>,
@@ -54,7 +54,7 @@ fn run_ar(handler: &ErrorHandler, maybe_ar_prog: &Option<String>,
paths: &[&Path]) -> ProcessOutput {
let ar = match *maybe_ar_prog {
Some(ref ar) => ar.as_slice(),
Some(ref ar) => &ar[],
- None => "ar"
+ None => "@arPath@"
};
let mut cmd = Command::new(ar);
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index dacf620..815ce60 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -348,8 +348,8 @@ pub fn mangle_internal_name_by_path_and_seq(path: PathElems, flav: &str) -> Stri
pub fn get_cc_prog(sess: &Session) -> String {
match sess.opts.cg.linker {
- Some(ref linker) => return linker.to_string(),
- None => sess.target.target.options.linker.clone(),
+ Some(ref linker) => linker.to_string(),
+ None => "@ccPath@".to_string(),
}
}