From 4035d9f27e3c9d9c99b48f7e47a0e4b7e21954cf Mon Sep 17 00:00:00 2001 From: Paul Colomiets Date: Thu, 16 Oct 2014 23:24:33 +0300 Subject: [PATCH] rust: Upgrade rust stable to 0.12 --- .../compilers/rustc/{0.11.nix => 0.12.nix} | 21 +++++++------- .../compilers/rustc/hardcode_paths.patch | 29 +++++++++++-------- .../compilers/rustc/local_stage0.patch | 7 +++-- pkgs/top-level/all-packages.nix | 2 +- 4 files changed, 34 insertions(+), 25 deletions(-) rename pkgs/development/compilers/rustc/{0.11.nix => 0.12.nix} (78%) diff --git a/pkgs/development/compilers/rustc/0.11.nix b/pkgs/development/compilers/rustc/0.12.nix similarity index 78% rename from pkgs/development/compilers/rustc/0.11.nix rename to pkgs/development/compilers/rustc/0.12.nix index a7246e44a73d..d26e8ba4ddad 100644 --- a/pkgs/development/compilers/rustc/0.11.nix +++ b/pkgs/development/compilers/rustc/0.12.nix @@ -16,19 +16,19 @@ assert stdenv.gcc.gcc != null; */ -with ((import ./common.nix) {inherit stdenv; version = "0.11.0"; }); +with ((import ./common.nix) {inherit stdenv; version = "0.12.0"; }); let snapshot = if stdenv.system == "i686-linux" - then "84339ea0f796ae468ef86797ef4587274bec19ea" + then "555aca74f9a268f80cab2df1147dc6406403e9e4" else if stdenv.system == "x86_64-linux" - then "bd8a6bc1f28845b7f4b768f6bfa06e7fbdcfcaae" + then "6a43c2f6c8ba2cbbcb9da1f7b58f748aef99f431" else if stdenv.system == "i686-darwin" - then "3f25b2680efbab16ad074477a19d49dcce475977" + then "331bd7ef519cbb424188c546273e8c7d738f0894" else if stdenv.system == "x86_64-darwin" - then "4a8c2e1b7634d73406bac32a1a97893ec3ed818d" + then "2c83a79a9febfe1d326acb17c3af76ba053c6ca9" else abort "no-snapshot for platform ${stdenv.system}"; - snapshotDate = "2014-06-21"; - snapshotRev = "db9af1d"; + snapshotDate = "2014-10-04"; + snapshotRev = "749ff5e"; snapshotName = "rust-stage0-${snapshotDate}-${snapshotRev}-${platform}-${snapshot}.tar.bz2"; in stdenv.mkDerivation { @@ -37,8 +37,8 @@ in stdenv.mkDerivation { inherit meta; src = fetchurl { - url = http://static.rust-lang.org/dist/rust-0.11.0.tar.gz; - sha256 = "1fhi8iiyyj5j48fpnp93sfv781z1dm0xy94h534vh4mz91jf7cyi"; + url = http://static.rust-lang.org/dist/rust-0.12.0.tar.gz; + sha256 = "1dv9wxh41230zknbwj34zgjnh1kgvvy6k12kbiy9bnch9nr6cgl8"; }; # We need rust to build rust. If we don't provide it, configure will try to download it. @@ -65,7 +65,8 @@ in stdenv.mkDerivation { 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 "ccPath" "${stdenv.gcc}/bin/cc" + substituteInPlace src/librustc_back/archive.rs \ --subst-var-by "arPath" "${stdenv.gcc.binutils}/bin/ar" ''; diff --git a/pkgs/development/compilers/rustc/hardcode_paths.patch b/pkgs/development/compilers/rustc/hardcode_paths.patch index 77e4c3f37887..8701cd3c9829 100644 --- a/pkgs/development/compilers/rustc/hardcode_paths.patch +++ b/pkgs/development/compilers/rustc/hardcode_paths.patch @@ -1,8 +1,8 @@ diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs -index 7a3e912..ced75fa 100644 +index 1cc60fc..2e94b99 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs -@@ -766,24 +766,15 @@ pub fn output_lib_filename(id: &CrateId) -> String { +@@ -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 { @@ -15,18 +15,23 @@ index 7a3e912..ced75fa 100644 - // 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 win32, there is no cc command, so we add a condition to make it use gcc. +- // For Windows, there is no cc command, so we add a condition to make it use gcc. - match sess.targ_cfg.os { -- abi::OsWin32 => "gcc", +- abi::OsWindows => "gcc", - _ => "cc", - }.to_string() } - pub fn get_ar_prog(sess: &Session) -> String { - match sess.opts.cg.ar { - Some(ref ar) => (*ar).clone(), -- None => "ar".to_string() -+ None => "@arPath@".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 +--- 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, + paths: &[&Path]) -> ProcessOutput { + let ar = match *maybe_ar_prog { + Some(ref ar) => ar.as_slice(), +- None => "ar" ++ None => "@arPath@" + }; + let mut cmd = Command::new(ar); diff --git a/pkgs/development/compilers/rustc/local_stage0.patch b/pkgs/development/compilers/rustc/local_stage0.patch index 1261b2d458da..2f38d7c1757c 100644 --- a/pkgs/development/compilers/rustc/local_stage0.patch +++ b/pkgs/development/compilers/rustc/local_stage0.patch @@ -2,12 +2,15 @@ diff --git a/src/etc/local_stage0.sh b/src/etc/local_stage0.sh index e78f231..6b6773b 100755 --- a/src/etc/local_stage0.sh +++ b/src/etc/local_stage0.sh -@@ -53,8 +53,3 @@ if [ -z $TARG_DIR ]; then +@@ -53,11 +53,6 @@ fi - + cp ${PREFIX}/bin/rustc${BIN_SUF} ${TARG_DIR}/stage0/bin/ -cp ${PREFIX}/${LIB_DIR}/${RUSTLIBDIR}/${TARG_DIR}/${LIB_DIR}/* ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}extra*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}rust*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}std*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ -cp ${PREFIX}/${LIB_DIR}/${LIB_PREFIX}syntax*${LIB_SUF} ${TARG_DIR}/stage0/${LIB_DIR}/ + + # do not fail if one of the above fails, as all we need is a working rustc! + exit 0 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7c7863bf7ac3..17b7838f2086 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3653,7 +3653,7 @@ let roadsend = callPackage ../development/compilers/roadsend { }; - rustc = callPackage ../development/compilers/rustc/0.11.nix {}; + rustc = callPackage ../development/compilers/rustc/0.12.nix {}; rustcMaster = callPackage ../development/compilers/rustc/head.nix {}; rust = rustc;