rust: patches update

This commit is contained in:
Cody P Schafer
2014-11-18 21:52:41 -05:00
parent 2353f29971
commit d5a659413e
13 changed files with 180 additions and 132 deletions
@@ -1,24 +0,0 @@
From 33ed066e368b4d87bfabbfdb64f4fbcd8821a2ff Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Sat, 15 Nov 2014 14:16:39 -0500
Subject: [PATCH] get-snapshot-debug
---
src/etc/get-snapshot.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/etc/get-snapshot.py b/src/etc/get-snapshot.py
index 886a84b..6043ee2 100755
--- a/src/etc/get-snapshot.py
+++ b/src/etc/get-snapshot.py
@@ -35,6 +35,7 @@ def unpack_snapshot(triple, dl_path):
print("extracting " + p)
tar.extract(p, download_unpack_base)
tp = os.path.join(download_unpack_base, p)
+ print("Path is " + tp + "; fp = " + fp)
if os.path.isdir(tp) and os.path.exists(fp):
continue
shutil.move(tp, fp)
--
2.0.4
@@ -1,28 +0,0 @@
From a8137a8bab79b7052e30b10b26ee9f67790160dd Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 13:07:46 -0500
Subject: [PATCH] rustc_back/target: add debug output for target search
---
src/librustc_back/target/mod.rs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs
index 27ad897..682c4fe 100644
--- a/src/librustc_back/target/mod.rs
+++ b/src/librustc_back/target/mod.rs
@@ -369,9 +369,11 @@ impl Target {
let mut paths = os::split_paths(target_path.as_slice());
paths.push(sysroot.join_many([env!("CFG_LIBDIR_RELATIVE"), "rust", "targets"]));
+ debug!("RUST_TARGET_PATH={}", paths.map(|x| x.display()));
for dir in paths.iter() {
let p = dir.join(path.clone());
if p.is_file() {
+ debug!("Selected target={}", p.display());
return load_file(&p);
}
}
--
2.1.3
@@ -1,27 +0,0 @@
From c18e65a1b96d12e88bb9068f5ca25c335a910ab2 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 14:02:36 -0500
Subject: [PATCH] configure: CFG_*DIR_RELATIVE: avoid requiring existence
---
configure | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index c9bec44..7914601 100755
--- a/configure
+++ b/configure
@@ -566,8 +566,8 @@ fi
# Determine libdir and bindir relative to prefix
step_msg "calculating relative paths to prefix = ${CFG_PREFIX}"
-CFG_BINDIR_RELATIVE=$(realpath --relative-to="${CFG_PREFIX}" "${CFG_BINDIR}")
-CFG_LIBDIR_RELATIVE=$(realpath --relative-to="${CFG_PREFIX}" "${CFG_LIBDIR}")
+CFG_BINDIR_RELATIVE=$(realpath -m --relative-to="${CFG_PREFIX}" "${CFG_BINDIR}")
+CFG_LIBDIR_RELATIVE=$(realpath -m --relative-to="${CFG_PREFIX}" "${CFG_LIBDIR}")
# Validate Options
step_msg "validating $CFG_SELF args"
--
2.1.3
@@ -1,7 +1,7 @@
From 8502ded50381200386c52a9c66e77ac3f3ca7188 Mon Sep 17 00:00:00 2001
From e9a22fbdb8e938bd10a7af6972386dfb29f359f0 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Mon, 17 Nov 2014 19:44:58 -0500
Subject: [PATCH 8/9] Support --bindir
Subject: [PATCH 20/28] Support --bindir
---
configure | 4 ++++
@@ -1,17 +1,17 @@
From 0285e9ebaea38ccb436e8b7b64a0bac232a89935 Mon Sep 17 00:00:00 2001
From a8bb6cf82242c69b20390c7ae32d865341b286a7 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Mon, 17 Nov 2014 20:10:42 -0500
Subject: [PATCH 9/9] Remember relative libdir and bindir from build time
Subject: [PATCH 21/28] Remember relative libdir and bindir from build time
---
configure | 6 +++
mk/install.mk | 2 +-
src/librustc/back/link.rs | 3 +-
src/librustc/metadata/filesearch.rs | 73 +++++++++++++++----------------------
src/librustc_trans/back/link.rs | 3 +-
4 files changed, 37 insertions(+), 47 deletions(-)
diff --git a/configure b/configure
index bdfeedd..c9bec44 100755
index bdfeedd..7914601 100755
--- a/configure
+++ b/configure
@@ -340,6 +340,7 @@ need_cmd date
@@ -28,8 +28,8 @@ index bdfeedd..c9bec44 100755
+# Determine libdir and bindir relative to prefix
+step_msg "calculating relative paths to prefix = ${CFG_PREFIX}"
+CFG_BINDIR_RELATIVE=$(realpath --relative-to="${CFG_PREFIX}" "${CFG_BINDIR}")
+CFG_LIBDIR_RELATIVE=$(realpath --relative-to="${CFG_PREFIX}" "${CFG_LIBDIR}")
+CFG_BINDIR_RELATIVE=$(realpath -m --relative-to="${CFG_PREFIX}" "${CFG_BINDIR}")
+CFG_LIBDIR_RELATIVE=$(realpath -m --relative-to="${CFG_PREFIX}" "${CFG_LIBDIR}")
+
# Validate Options
step_msg "validating $CFG_SELF args"
@@ -47,25 +47,8 @@ index 4588e83..0fba6ee 100644
# Remove tmp files because it's a decent amount of disk space
$(Q)rm -R tmp/dist
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs
index 766715f..306e074 100644
--- a/src/librustc/back/link.rs
+++ b/src/librustc/back/link.rs
@@ -1015,11 +1015,10 @@ fn link_args(cmd: &mut Command,
// where extern libraries might live, based on the
// addl_lib_search_paths
if sess.opts.cg.rpath {
- let sysroot = sess.sysroot();
let target_triple = sess.opts.target_triple.as_slice();
let get_install_prefix_lib_path = || {
let install_prefix = option_env!("CFG_PREFIX").expect("CFG_PREFIX");
- let tlib = filesearch::relative_target_lib_path(sysroot, target_triple);
+ let tlib = filesearch::relative_target_lib_path(target_triple);
let mut path = Path::new(install_prefix);
path.push(&tlib);
diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs
index f7d666e..6db56ef 100644
index fee289d..b626308 100644
--- a/src/librustc/metadata/filesearch.rs
+++ b/src/librustc/metadata/filesearch.rs
@@ -66,8 +66,7 @@ impl<'a> FileSearch<'a> {
@@ -190,6 +173,23 @@ index f7d666e..6db56ef 100644
}
// The name of rustc's own place to organize libraries.
diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
index d5d488e..cddf970 100644
--- a/src/librustc_trans/back/link.rs
+++ b/src/librustc_trans/back/link.rs
@@ -1015,11 +1015,10 @@ fn link_args(cmd: &mut Command,
// where extern libraries might live, based on the
// addl_lib_search_paths
if sess.opts.cg.rpath {
- let sysroot = sess.sysroot();
let target_triple = sess.opts.target_triple.as_slice();
let get_install_prefix_lib_path = || {
let install_prefix = option_env!("CFG_PREFIX").expect("CFG_PREFIX");
- let tlib = filesearch::relative_target_lib_path(sysroot, target_triple);
+ let tlib = filesearch::relative_target_lib_path(target_triple);
let mut path = Path::new(install_prefix);
path.push(&tlib);
--
2.0.4
@@ -1,7 +1,7 @@
From c2981f76da9514262289662585acfcdd5925b761 Mon Sep 17 00:00:00 2001
From 846a56728ba8b7ba64b12c2969bd133a384fc474 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 13:44:13 -0500
Subject: [PATCH] mk: add missing CFG_BINDIR_RELATIVE uses
Subject: [PATCH 22/28] mk: add missing CFG_BINDIR_RELATIVE uses
---
mk/main.mk | 2 +-
@@ -60,5 +60,5 @@ index 7df2489..842078f 100644
prepare-base-$(1): PREPARE_DEST_MAN_DIR=$$(PREPARE_DEST_DIR)/share/man/man1
prepare-base-$(1): prepare-everything-$(1)
--
2.1.3
2.0.4
@@ -1,7 +1,7 @@
From e7698f1b26120737e7807a4b3d4f4367ffd6a830 Mon Sep 17 00:00:00 2001
From 0612ce2204bc9376a7fc187700b04c4e3f42e875 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 13:48:14 -0500
Subject: [PATCH] mk: add missing CFG_LIBDIR_RELATIVE
Subject: [PATCH 23/28] mk: add missing CFG_LIBDIR_RELATIVE
---
mk/grammar.mk | 4 ++--
@@ -23,5 +23,5 @@ index 12190fb..dcebabf 100644
# Run the reference lexer against libsyntax and compare the tokens and spans.
--
2.1.3
2.0.4
@@ -1,33 +1,32 @@
From 367597c0504a8ee4758eb2ccaef760c02b483e46 Mon Sep 17 00:00:00 2001
From 0cd38a8844e7511f5db4ab14ec6fa80a2f9a63ec Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 14:07:37 -0500
Subject: [PATCH] mk: add rule to create bindir, unconditionalize rule to
create libdir
Subject: [PATCH 24/28] mk: add rule to create bindir
Without this make fails due to not finding a way to create the bindir target.
Not clear that having the libdir rule be unconditional, so supply it all the time to avoid issues in the future
---
mk/host.mk | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
mk/host.mk | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mk/host.mk b/mk/host.mk
index 59a0095..9f8d5c4 100644
index 59a0095..b8e8345 100644
--- a/mk/host.mk
+++ b/mk/host.mk
@@ -59,10 +59,10 @@ endef
@@ -59,9 +59,13 @@ endef
# $(4) - the host triple (same as $(3))
define CP_HOST_STAGE_N
-ifneq ($(CFG_LIBDIR_RELATIVE),bin)
$$(HLIB$(2)_H_$(4))/:
@mkdir -p $$@
-endif
+
+# Avoid redefinition warnings if libdir==bindir
+ifneq ($(HBIN$(2)_H_$(4)),$(HLIB$(2)_H_$(4)))
+$$(HBIN$(2)_H_$(4))/:
+ @mkdir -p $$@
endif
endef
--
2.1.3
2.0.4
@@ -0,0 +1,36 @@
From 1e2044eb7a251d850ac01793a6e3d1ccd6171c9d Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 14:52:56 -0500
Subject: [PATCH 25/28] mk: always use bin and lib as bindir and libdir for
stage0 CFG_BUILD
---
mk/main.mk | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/mk/main.mk b/mk/main.mk
index 0fb6f5f..676ea21 100644
--- a/mk/main.mk
+++ b/mk/main.mk
@@ -333,8 +333,18 @@ define SREQ
# Destinations of artifacts for the host compiler
HROOT$(1)_H_$(3) = $(3)/stage$(1)
+
+ifeq ($(1)-$(3),0-$$(CFG_BUILD))
+# stage0 relative paths are fixed. This is done because we don't have control
+# over where the bootstrap (snapshot or local) rustc looks to locate it's
+# libdir. At the moment, this assumes the relative paths (from sysroot aka
+# prefix) are 'lib' and 'bin'.
+HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin
+HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/lib
+else
HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_BINDIR_RELATIVE)
HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)
+endif
# Destinations of artifacts for target architectures
TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(2)
--
2.0.4
@@ -0,0 +1,28 @@
From 09fdc1a963093e3b1b3eecb98393dc8a0e933020 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 14:53:39 -0500
Subject: [PATCH 26/28] mk/stage0: complain instead of creating an empty file
If the expected rustc snapshot is not where we expect it to be,
complain and fail at that point rather than creating a empty rustc file
and continuing until we try to run it.
---
mk/stage0.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mk/stage0.mk b/mk/stage0.mk
index e028bba..460a4a7 100644
--- a/mk/stage0.mk
+++ b/mk/stage0.mk
@@ -22,7 +22,7 @@ ifdef CFG_ENABLE_LOCAL_RUST
else
$(Q)$(CFG_PYTHON) $(S)src/etc/get-snapshot.py $(CFG_BUILD) $(SNAPSHOT_FILE)
endif
- $(Q)touch $@
+ $(Q)if [ -e "$@" ]; then touch "$@"; else echo "ERROR: snapshot $@ not found"; exit 1; fi
# For other targets, let the host build the target:
--
2.0.4
@@ -0,0 +1,29 @@
From 8a273a8bb1a2f6f5499b6e79a0894581a1284183 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 16:32:03 -0500
Subject: [PATCH 27/28] mk/target: fix typo so we depend on the correct
directory
Without this, if we we're using a non-standard host libdir, the target
bindir would not exist (and rustc would fail to write to the
non-existent directory).
---
mk/target.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mk/target.mk b/mk/target.mk
index ed7d8bb..acdf780 100644
--- a/mk/target.mk
+++ b/mk/target.mk
@@ -116,7 +116,7 @@ $$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
$$(foreach dep,$$(TOOL_DEPS_$(4)), \
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
- | $$(TBIN$(1)_T_$(4)_H_$(3))/
+ | $$(TBIN$(1)_T_$(2)_H_$(3))/
@$$(call E, rustc: $$@)
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --cfg $(4)
--
2.0.4
@@ -0,0 +1,34 @@
From 370101c62c740c4ef86453277b9cd39561095c54 Mon Sep 17 00:00:00 2001
From: Cody P Schafer <dev@codyps.com>
Date: Tue, 18 Nov 2014 18:56:12 -0500
Subject: [PATCH 28/28] rustdoc: avoid supplying a bad default sysroot so the
librustc code can calculate it properly
---
src/librustdoc/core.rs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index 21242e6..b040a4b 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -18,7 +18,6 @@ use rustc_trans::back::link;
use syntax::{ast, ast_map, codemap, diagnostic};
use std::cell::RefCell;
-use std::os;
use std::collections::{HashMap, HashSet};
use arena::TypedArena;
@@ -89,7 +88,7 @@ pub fn run_core(libs: Vec<Path>, cfgs: Vec<String>, externs: Externs,
let warning_lint = lint::builtin::WARNINGS.name_lower();
let sessopts = config::Options {
- maybe_sysroot: Some(os::self_exe_path().unwrap().dir_path()),
+ maybe_sysroot: None,
addl_lib_search_paths: RefCell::new(libs),
crate_types: vec!(config::CrateTypeRlib),
lint_opts: vec!((warning_lint, lint::Allow)),
--
2.0.4
+10 -9
View File
@@ -2,18 +2,19 @@ SRCREV = "1e4e55aebc1a71b6674c00b8604efa6b1e2e52cd"
require rust-git.inc
SRC_URI_append = "\
file://0001-src-etc-snapshot-support-triples-lacking-a-vendor.patch \
file://0001-get-snapshot-debug.patch \
file://0001-platform.mk-avoid-choking-on-i586.patch \
file://0001-src-etc-snapshot-support-triples-lacking-a-vendor.patch \
file://0005-CFG_CFLAGS-is-only-used-for-jemalloc-rename-all-uses.patch \
file://0006-mk-rt-jemalloc-pass-CFG_GCCISH_CFLAGS-inside-CC-inst.patch \
file://0007-mk-rt-compiler_rt-pass-LDFLAGS-from-CFG_GCCISH_LINK_.patch \
file://0008-Support-bindir.patch \
file://0009-Remember-relative-libdir-and-bindir-from-build-time.patch \
file://0010-Target-add-default-target.json-path-libdir-rust-targ.patch \
file://0011-rustc_back-target-add-debug-output-for-target-search.patch \
file://0012-mk-add-missing-CFG_BINDIR_RELATIVE-uses.patch \
file://0013-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \
file://0014-configure-CFG_-DIR_RELATIVE-avoid-requiring-existenc.patch \
file://0015-mk-add-rule-to-create-bindir-unconditionalize-rule-t.patch \
file://0020-Support-bindir.patch \
file://0021-Remember-relative-libdir-and-bindir-from-build-time.patch \
file://0022-mk-add-missing-CFG_BINDIR_RELATIVE-uses.patch \
file://0023-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \
file://0024-mk-add-rule-to-create-bindir.patch \
file://0025-mk-always-use-bin-and-lib-as-bindir-and-libdir-for-s.patch \
file://0026-mk-stage0-complain-instead-of-creating-an-empty-file.patch \
file://0027-mk-target-fix-typo-so-we-depend-on-the-correct-direc.patch \
file://0028-rustdoc-avoid-supplying-a-bad-default-sysroot-so-the.patch \
"