rust: use upstream patches to fix build with 1.17

No rebuild required.
This commit is contained in:
Leah Neukirchen 2017-06-21 14:04:21 +02:00
parent 22fd831787
commit efa97dfb90
3 changed files with 113 additions and 11 deletions

View File

@ -0,0 +1,65 @@
From 4caa0b020f146e4504ab8ffdd52df29deaa49a09 Mon Sep 17 00:00:00 2001
From: Mark Simulacrum <mark.simulacrum@gmail.com>
Date: Tue, 20 Jun 2017 18:04:36 -0600
Subject: [PATCH] Fixes bootstrapping with custom cargo/rustc.
config.mk is now always read when parsing the configuration to prevent
this from reoccurring in the future, hopefully.
---
src/bootstrap/bin/main.rs | 8 +-------
src/bootstrap/config.rs | 10 ++++++++--
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/src/bootstrap/bin/main.rs b/src/bootstrap/bin/main.rs
index 5ca5ce1648f2..5ef18b89841f 100644
--- a/src/bootstrap/bin/main.rs
+++ b/src/bootstrap/bin/main.rs
@@ -26,12 +26,6 @@ use bootstrap::{Flags, Config, Build};
fn main() {
let args = env::args().skip(1).collect::<Vec<_>>();
let flags = Flags::parse(&args);
- let mut config = Config::parse(&flags.build, flags.config.clone());
-
- // compat with `./configure` while we're still using that
- if std::fs::metadata("config.mk").is_ok() {
- config.update_with_config_mk();
- }
-
+ let config = Config::parse(&flags.build, flags.config.clone());
Build::new(flags, config).build();
}
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index fd8aa320fb3d..902cd0997a8e 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -15,7 +15,7 @@
use std::collections::HashMap;
use std::env;
-use std::fs::File;
+use std::fs::{self, File};
use std::io::prelude::*;
use std::path::PathBuf;
use std::process;
@@ -410,6 +410,12 @@ impl Config {
set(&mut config.rust_dist_src, t.src_tarball);
}
+
+ // compat with `./configure` while we're still using that
+ if fs::metadata("config.mk").is_ok() {
+ config.update_with_config_mk();
+ }
+
return config
}
@@ -418,7 +424,7 @@ impl Config {
/// While we still have `./configure` this implements the ability to decode
/// that configuration into this. This isn't exactly a full-blown makefile
/// parser, but hey it gets the job done!
- pub fn update_with_config_mk(&mut self) {
+ fn update_with_config_mk(&mut self) {
let mut config = String::new();
File::open("config.mk").unwrap().read_to_string(&mut config).unwrap();
for line in config.lines() {

View File

@ -0,0 +1,48 @@
From 73267374d4176ac1c5d685ff2bac36556cfa4730 Mon Sep 17 00:00:00 2001
From: Mark Simulacrum <mark.simulacrum@gmail.com>
Date: Fri, 16 Jun 2017 07:44:09 -0600
Subject: [PATCH] Use custom cargo/rustc paths when parsing flags.
---
src/bootstrap/flags.rs | 17 ++++++++---------
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs
index 56cbb4cecf2a..dc9dac736278 100644
--- a/src/bootstrap/flags.rs
+++ b/src/bootstrap/flags.rs
@@ -242,11 +242,18 @@ Arguments:
let cwd = t!(env::current_dir());
let paths = matches.free[1..].iter().map(|p| cwd.join(p)).collect::<Vec<_>>();
+ let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
+ if fs::metadata("config.toml").is_ok() {
+ Some(PathBuf::from("config.toml"))
+ } else {
+ None
+ }
+ });
// All subcommands can have an optional "Available paths" section
if matches.opt_present("verbose") {
let flags = Flags::parse(&["build".to_string()]);
- let mut config = Config::default();
+ let mut config = Config::parse(&flags.build, cfg_file.clone());
config.build = flags.build.clone();
let mut build = Build::new(flags, config);
metadata::build(&mut build);
@@ -307,14 +314,6 @@ Arguments:
};
- let cfg_file = matches.opt_str("config").map(PathBuf::from).or_else(|| {
- if fs::metadata("config.toml").is_ok() {
- Some(PathBuf::from("config.toml"))
- } else {
- None
- }
- });
-
let mut stage = matches.opt_str("stage").map(|j| j.parse().unwrap());
if matches.opt_present("incremental") {

View File

@ -1,11 +0,0 @@
--- rustc-1.18.0-src/src/bootstrap/lib.rs.orig
+++ rustc-1.18.0-src/src/bootstrap/lib.rs
@@ -220,7 +220,7 @@
};
let cargo = match config.cargo {
Some(ref s) => PathBuf::from(s),
- None => stage0_root.join(exe("cargo", &config.build)),
+ None => PathBuf::from("cargo")
};
let local_rebuild = config.local_rebuild;