diff --git a/recipes/rust/files/0001-platform.mk-avoid-choking-on-i586.patch b/recipes/rust/files/rust-1.1.0/0001-platform.mk-avoid-choking-on-i586.patch similarity index 80% rename from recipes/rust/files/0001-platform.mk-avoid-choking-on-i586.patch rename to recipes/rust/files/rust-1.1.0/0001-platform.mk-avoid-choking-on-i586.patch index a560e66..ba8fc82 100644 --- a/recipes/rust/files/0001-platform.mk-avoid-choking-on-i586.patch +++ b/recipes/rust/files/rust-1.1.0/0001-platform.mk-avoid-choking-on-i586.patch @@ -1,14 +1,14 @@ -From 5132c9c4056ce5837f82b0a68da38d3895710355 Mon Sep 17 00:00:00 2001 +From 89bd1de30bad2e6bee062f287c454e4a87e11056 Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Sat, 15 Nov 2014 20:12:48 -0500 -Subject: [PATCH 1/9] platform.mk: avoid choking on i586 +Subject: [PATCH 1/8] platform.mk: avoid choking on i586 --- mk/platform.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mk/platform.mk b/mk/platform.mk -index 26a6db1..72f2b4a 100644 +index 9545a1f..80fb0bb 100644 --- a/mk/platform.mk +++ b/mk/platform.mk @@ -14,7 +14,9 @@ @@ -23,5 +23,5 @@ index 26a6db1..72f2b4a 100644 $(foreach t,$(CFG_TARGET),$(eval $(call DEF_HOST_VAR,$(t)))) $(foreach t,$(CFG_TARGET),$(info cfg: host for $(t) is $(HOST_$(t)))) -- -2.4.1 +2.4.3 diff --git a/recipes/rust/files/rust-1.1.0/0002-Target-add-default-target.json-path-libdir-rust-targ.patch b/recipes/rust/files/rust-1.1.0/0002-Target-add-default-target.json-path-libdir-rust-targ.patch new file mode 100644 index 0000000..85bb45e --- /dev/null +++ b/recipes/rust/files/rust-1.1.0/0002-Target-add-default-target.json-path-libdir-rust-targ.patch @@ -0,0 +1,109 @@ +From 6ed2ad4e243f31e5d9e9fb49e2ce16d2920884c5 Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Tue, 18 Nov 2014 01:40:21 -0500 +Subject: [PATCH 2/8] Target: add default target.json path: + $libdir/rust/targets + +--- + src/librustc/session/config.rs | 6 +++--- + src/librustc/session/mod.rs | 8 ++++++-- + src/librustc_back/target/mod.rs | 14 +++++++++++--- + 3 files changed, 20 insertions(+), 8 deletions(-) + +diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs +index b999929..3e9743e 100644 +--- a/src/librustc/session/config.rs ++++ b/src/librustc/session/config.rs +@@ -37,7 +37,7 @@ use getopts; + use std::collections::HashMap; + use std::env; + use std::fmt; +-use std::path::PathBuf; ++use std::path::{Path, PathBuf}; + + use llvm; + +@@ -665,8 +665,8 @@ pub fn build_configuration(sess: &Session) -> ast::CrateConfig { + v + } + +-pub fn build_target_config(opts: &Options, sp: &SpanHandler) -> Config { +- let target = match Target::search(&opts.target_triple) { ++pub fn build_target_config(sysroot: &Path, opts: &Options, sp: &SpanHandler) -> Config { ++ let target = match Target::search(sysroot, &opts.target_triple[..]) { + Ok(t) => t, + Err(e) => { + sp.handler().fatal(&format!("Error loading target specification: {}", e)); +diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs +index 7a8ce1b..cb85d2e 100644 +--- a/src/librustc/session/mod.rs ++++ b/src/librustc/session/mod.rs +@@ -370,14 +370,18 @@ pub fn build_session_(sopts: config::Options, + local_crate_source_file: Option, + span_diagnostic: diagnostic::SpanHandler) + -> Session { +- let host = match Target::search(config::host_triple()) { ++ let sysroot = match sopts.maybe_sysroot { ++ Some(ref x) => PathBuf::from(x), ++ None => filesearch::get_or_default_sysroot() ++ }; ++ let host = match Target::search(&sysroot, config::host_triple()) { + Ok(t) => t, + Err(e) => { + span_diagnostic.handler() + .fatal(&format!("Error loading host specification: {}", e)); + } + }; +- let target_cfg = config::build_target_config(&sopts, &span_diagnostic); ++ let target_cfg = config::build_target_config(&sysroot, &sopts, &span_diagnostic); + let p_s = parse::new_parse_sess_special_handler(span_diagnostic); + let default_sysroot = match sopts.maybe_sysroot { + Some(_) => None, +diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs +index c5f1882..1888fbd 100644 +--- a/src/librustc_back/target/mod.rs ++++ b/src/librustc_back/target/mod.rs +@@ -49,6 +49,8 @@ use serialize::json::Json; + use std::default::Default; + use std::io::prelude::*; + use syntax::{diagnostic, abi}; ++use std::borrow::ToOwned; ++use std::path::Path; + + mod android_base; + mod apple_base; +@@ -298,12 +300,13 @@ impl Target { + /// + /// The error string could come from any of the APIs called, including + /// filesystem access and JSON decoding. +- pub fn search(target: &str) -> Result { ++ pub fn search(sysroot: &Path, target: &str) -> Result { + use std::env; + use std::ffi::OsString; + use std::fs::File; + use std::path::{Path, PathBuf}; + use serialize::json; ++ use std::iter::IntoIterator; + + fn load_file(path: &Path) -> Result { + let mut f = try!(File::open(path).map_err(|e| e.to_string())); +@@ -390,9 +393,14 @@ impl Target { + let target_path = env::var_os("RUST_TARGET_PATH") + .unwrap_or(OsString::new()); + +- // FIXME 16351: add a sane default search path? ++ let mut default_path = sysroot.to_owned(); ++ default_path.push(env!("CFG_LIBDIR_RELATIVE")); ++ default_path.push("rustlib"); + +- for dir in env::split_paths(&target_path) { ++ let paths = env::split_paths(&target_path) ++ .chain(Some(default_path).into_iter()); ++ ++ for dir in paths { + let p = dir.join(&path); + if p.is_file() { + return load_file(&p); +-- +2.4.3 + diff --git a/recipes/rust/files/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch b/recipes/rust/files/rust-1.1.0/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch similarity index 87% rename from recipes/rust/files/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch rename to recipes/rust/files/rust-1.1.0/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch index 2b5a42e..b033506 100644 --- a/recipes/rust/files/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch +++ b/recipes/rust/files/rust-1.1.0/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch @@ -1,7 +1,7 @@ -From 614552b0678ffe0e07282dd18e7c6b8ef5c4043c Mon Sep 17 00:00:00 2001 +From 0e78aab532c652b6ee8f8929d7d25de5d7c0d2e9 Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Tue, 18 Nov 2014 14:52:56 -0500 -Subject: [PATCH 3/9] mk: for stage0, use RUSTFLAGS to override target libs dir +Subject: [PATCH 3/8] mk: for stage0, use RUSTFLAGS to override target libs dir Setting HLIB specially for stage0 (and even more specially for windows) also affects the location we place TLIB. To keep the TLIBs we build in @@ -12,10 +12,10 @@ stage0-rustc at the appropriate location. 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/mk/main.mk b/mk/main.mk -index de5adfd..13bed1b 100644 +index 4aa8d7f..af2ddf0 100644 --- a/mk/main.mk +++ b/mk/main.mk -@@ -375,21 +375,22 @@ define SREQ +@@ -370,21 +370,22 @@ define SREQ # Destinations of artifacts for the host compiler HROOT$(1)_H_$(3) = $(3)/stage$(1) HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin @@ -46,7 +46,7 @@ index de5adfd..13bed1b 100644 # Preqrequisites for using the stageN compiler ifeq ($(1),0) HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) -@@ -501,6 +502,7 @@ STAGE$(1)_T_$(2)_H_$(3) := \ +@@ -498,6 +499,7 @@ STAGE$(1)_T_$(2)_H_$(3) := \ $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \ --cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \ $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \ @@ -54,7 +54,7 @@ index de5adfd..13bed1b 100644 $$(RUSTC_FLAGS_$(2)) PERF_STAGE$(1)_T_$(2)_H_$(3) := \ -@@ -509,6 +511,7 @@ PERF_STAGE$(1)_T_$(2)_H_$(3) := \ +@@ -506,6 +508,7 @@ PERF_STAGE$(1)_T_$(2)_H_$(3) := \ $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \ --cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \ $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \ @@ -63,5 +63,5 @@ index de5adfd..13bed1b 100644 endef -- -2.4.1 +2.4.3 diff --git a/recipes/rust/files/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch b/recipes/rust/files/rust-1.1.0/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch similarity index 85% rename from recipes/rust/files/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch rename to recipes/rust/files/rust-1.1.0/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch index e6fb6d4..3fe3d2b 100644 --- a/recipes/rust/files/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch +++ b/recipes/rust/files/rust-1.1.0/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch @@ -1,7 +1,7 @@ -From 331bf90f1a59e96749d17b005dd84cf7bd3c785a Mon Sep 17 00:00:00 2001 +From 54abdace19bc6a855ae122bd16a5eb82d2f223ee Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Tue, 18 Nov 2014 13:48:14 -0500 -Subject: [PATCH 4/9] mk: add missing CFG_LIBDIR_RELATIVE +Subject: [PATCH 4/8] mk: add missing CFG_LIBDIR_RELATIVE --- mk/grammar.mk | 4 ++-- @@ -23,5 +23,5 @@ index d9c66e2..585206d 100644 ifeq ($(CFG_OSTYPE),apple-darwin) FLEX_LDFLAGS=-ll -- -2.4.1 +2.4.3 diff --git a/recipes/rust/files/rust-1.1.0/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch b/recipes/rust/files/rust-1.1.0/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch new file mode 100644 index 0000000..92f28bf --- /dev/null +++ b/recipes/rust/files/rust-1.1.0/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch @@ -0,0 +1,362 @@ +From 2fa205f59bd2ab4f9a2356073b18b8a8f0ee6787 Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Mon, 24 Nov 2014 13:10:15 -0500 +Subject: [PATCH 5/8] configure: support --bindir, and extend libdir to + non-blessed dirs + +Adds --bindir, and: + +Allows --bindir and --libdir to have multiple elements in their paths +relative to sysroot, and allows libdir to end in an arbitrary directory +(previously it was limited to lib, lib32, and lib64). + +Note that this assumes absolute paths start with '/', which may break +windows platforms +--- + configure | 50 ++++++++++++++++------ + mk/host.mk | 6 ++- + mk/main.mk | 11 +++++ + mk/perf.mk | 4 +- + mk/prepare.mk | 4 +- + src/librustc/metadata/filesearch.rs | 84 ++++++++++++++----------------------- + src/librustc_trans/back/link.rs | 3 +- + 7 files changed, 91 insertions(+), 71 deletions(-) + +diff --git a/configure b/configure +index 5e02d07..287d066 100755 +--- a/configure ++++ b/configure +@@ -323,6 +323,31 @@ envopt() { + fi + } + ++abspath () { ++ case "$1" in ++ /*) echo "$1" ;; ++ *) echo "$PWD/$1" ;; ++ esac ++} ++ ++relpath () { ++ local src=$(abspath "$1") ++ local dst=$(abspath "$2") ++ local common=$src ++ local result= ++ ++ # Start by checking if the whole src is common, then strip off pack ++ # components until we find the common element. ++ while [ "${dst#"$common"}" = "$dst" ]; do ++ common=$(dirname "$common") ++ result="../$result" ++ done ++ ++ local down="${dst#"$common"}" ++ result="${result}${down#/}" ++ echo "$result" ++} ++ + to_llvm_triple() { + case $1 in + i686-w64-mingw32) echo i686-pc-windows-gnu ;; +@@ -607,6 +632,8 @@ putvar CFG_BUILD # Yes, this creates a duplicate entry, but the last one wins. + CFG_HOST=$(to_llvm_triple $CFG_HOST) + CFG_TARGET=$(to_llvm_triple $CFG_TARGET) + ++CFG_LIBDIR_RELATIVE=lib ++ + # On windows we just store the libraries in the bin directory because + # there's no rpath. This is where the build system itself puts libraries; + # --libdir is used to configure the installation directory. +@@ -614,23 +641,21 @@ CFG_TARGET=$(to_llvm_triple $CFG_TARGET) + if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] + then + CFG_LIBDIR_RELATIVE=bin +-else +- CFG_LIBDIR_RELATIVE=lib + fi + +-valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries (do not set it on windows platform)" ++valopt libdir "${CFG_PREFIX}/${CFG_LIBDIR_RELATIVE}" "install libraries" + +-case "$CFG_LIBDIR" in +- "$CFG_PREFIX"/*) CAT_INC=2;; +- "$CFG_PREFIX"*) CAT_INC=1;; +- *) +- err "libdir must begin with the prefix. Use --prefix to set it accordingly.";; +-esac ++CFG_BINDIR_RELATIVE=bin ++valopt bindir "${CFG_PREFIX}/${CFG_BINDIR_RELATIVE}" "install binaries" + +-CFG_LIBDIR_RELATIVE=`echo ${CFG_LIBDIR} | cut -c$((${#CFG_PREFIX}+${CAT_INC}))-` ++# Determine libdir and bindir relative to prefix ++step_msg "calculating relative paths to prefix = ${CFG_PREFIX}" ++CFG_BINDIR_RELATIVE=$(relpath "${CFG_PREFIX}" "${CFG_BINDIR}") ++CFG_LIBDIR_RELATIVE=$(relpath "${CFG_PREFIX}" "${CFG_LIBDIR}") + +-if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] && [ "$CFG_LIBDIR_RELATIVE" != "bin" ]; then +- err "libdir on windows should be set to 'bin'" ++if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] \ ++ && [ "$CFG_LIBDIR_RELATIVE" != "$CFG_BINDIR_RELATIVE" ]; then ++ err "Windows builds currently require that LIBDIR == BINDIR (we have libdir{$CFG_LIBDIR_RELATIVE} != bindir{$CFG_BINDIR_RELATIVE} )" + fi + + if [ $HELP -eq 1 ] +@@ -1475,6 +1500,7 @@ putvar CFG_PREFIX + putvar CFG_HOST + putvar CFG_TARGET + putvar CFG_LIBDIR_RELATIVE ++putvar CFG_BINDIR_RELATIVE + putvar CFG_DISABLE_MANAGE_SUBMODULES + putvar CFG_ANDROID_CROSS_PATH + putvar CFG_MANDIR +diff --git a/mk/host.mk b/mk/host.mk +index 59a0095..b8e8345 100644 +--- a/mk/host.mk ++++ b/mk/host.mk +@@ -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 $$@ ++ ++# Avoid redefinition warnings if libdir==bindir ++ifneq ($(HBIN$(2)_H_$(4)),$(HLIB$(2)_H_$(4))) ++$$(HBIN$(2)_H_$(4))/: ++ @mkdir -p $$@ + endif + + endef +diff --git a/mk/main.mk b/mk/main.mk +index af2ddf0..15a59be 100644 +--- a/mk/main.mk ++++ b/mk/main.mk +@@ -339,7 +339,9 @@ export CFG_RELEASE_CHANNEL + export CFG_LLVM_ROOT + export CFG_PREFIX + export CFG_LIBDIR ++export CFG_BINDIR + export CFG_LIBDIR_RELATIVE ++export CFG_BINDIR_RELATIVE + export CFG_DISABLE_INJECT_STD_VERSION + ifdef CFG_DISABLE_UNSTABLE_FEATURES + CFG_INFO := $(info cfg: disabling unstable features (CFG_DISABLE_UNSTABLE_FEATURES)) +@@ -369,7 +371,16 @@ 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 so we can bootstrap from snapshots ++# (downloaded snapshots drop their rustc in HROOT/bin) ++# libdir discrepancy is worked around with RUSTFLAGS below. + HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin ++else ++HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_BINDIR_RELATIVE) ++endif ++ + HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE) + + # Destinations of artifacts for target architectures +diff --git a/mk/perf.mk b/mk/perf.mk +index 16cbaab..f8a354c 100644 +--- a/mk/perf.mk ++++ b/mk/perf.mk +@@ -10,13 +10,13 @@ + + + ifdef CFG_PERF_TOOL +-rustc-perf$(X): $(CFG_BUILD)/stage2/bin/rustc$(X_$(CFG_BUILD)) ++rustc-perf$(X): $(CFG_BUILD)/stage2/$(CFG_BINDIR_RELATIVE)/rustc$(X_$(CFG_BUILD)) + @$(call E, perf compile: $@) + $(PERF_STAGE2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) \ + -o $@ $(COMPILER_CRATE) >rustc-perf.err 2>&1 + $(Q)rm -f $(LIBRUSTC_GLOB) + else +-rustc-perf$(X): $(CFG_BUILD)/stage2/bin/rustc$(X_$(CFG_BUILD)) ++rustc-perf$(X): $(CFG_BUILD)/stage2/$(CFG_BINDIR_RELATIVE)/rustc$(X_$(CFG_BUILD)) + $(Q)touch $@ + endif + +diff --git a/mk/prepare.mk b/mk/prepare.mk +index 1ae6a61..e463727 100644 +--- a/mk/prepare.mk ++++ b/mk/prepare.mk +@@ -168,10 +168,10 @@ INSTALL_DEBUGGER_SCRIPT_COMMANDS=$(if $(findstring windows,$(1)),\ + define DEF_PREPARE + + prepare-base-$(1): PREPARE_SOURCE_DIR=$$(PREPARE_HOST)/stage$$(PREPARE_STAGE) +-prepare-base-$(1): PREPARE_SOURCE_BIN_DIR=$$(PREPARE_SOURCE_DIR)/bin ++prepare-base-$(1): PREPARE_SOURCE_BIN_DIR=$$(PREPARE_SOURCE_DIR)/$$(CFG_BINDIR_RELATIVE) + prepare-base-$(1): PREPARE_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_DIR)/$$(CFG_LIBDIR_RELATIVE) + prepare-base-$(1): PREPARE_SOURCE_MAN_DIR=$$(S)/man +-prepare-base-$(1): PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_DIR)/bin ++prepare-base-$(1): PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_DIR)/$$(CFG_BINDIR_RELATIVE) + prepare-base-$(1): PREPARE_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELATIVE) + prepare-base-$(1): PREPARE_DEST_MAN_DIR=$$(PREPARE_DEST_DIR)/share/man/man1 + prepare-base-$(1): prepare-everything-$(1) +diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs +index 311ab1c..1b03b1a 100644 +--- a/src/librustc/metadata/filesearch.rs ++++ b/src/librustc/metadata/filesearch.rs +@@ -68,8 +68,7 @@ impl<'a> FileSearch<'a> { + if !found { + let rustpath = rust_path(); + for path in &rustpath { +- let tlib_path = make_rustpkg_lib_path( +- self.sysroot, path, self.triple); ++ let tlib_path = make_rustpkg_lib_path(path, self.triple); + debug!("is {} in visited_dirs? {}", tlib_path.display(), + visited_dirs.contains(&tlib_path)); + +@@ -96,7 +95,7 @@ impl<'a> FileSearch<'a> { + where F: FnMut(&Path, PathKind) -> FileMatch + { + self.for_each_lib_search_path(|lib_search_path, kind| { +- debug!("searching {}", lib_search_path.display()); ++ info!("searching {}", lib_search_path.display()); + match fs::read_dir(lib_search_path) { + Ok(files) => { + let files = files.filter_map(|p| p.ok().map(|s| s.path())) +@@ -157,7 +156,7 @@ impl<'a> FileSearch<'a> { + // Returns a list of directories where target-specific tool binaries are located. + pub fn get_tools_search_paths(&self) -> Vec { + let mut p = PathBuf::from(self.sysroot); +- p.push(&find_libdir(self.sysroot)); ++ p.push(libdir_str()); + p.push(&rustlibdir()); + p.push(&self.triple); + p.push("bin"); +@@ -165,8 +164,8 @@ impl<'a> FileSearch<'a> { + } + } + +-pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf { +- let mut p = PathBuf::from(&find_libdir(sysroot)); ++pub fn relative_target_lib_path(target_triple: &str) -> PathBuf { ++ let mut p = PathBuf::from(&libdir_str()); + assert!(p.is_relative()); + p.push(&rustlibdir()); + p.push(target_triple); +@@ -176,17 +175,28 @@ pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf + + fn make_target_lib_path(sysroot: &Path, + target_triple: &str) -> PathBuf { +- sysroot.join(&relative_target_lib_path(sysroot, target_triple)) ++ sysroot.join(&relative_target_lib_path(target_triple)) + } + +-fn make_rustpkg_lib_path(sysroot: &Path, +- dir: &Path, ++fn make_rustpkg_lib_path(dir: &Path, + triple: &str) -> PathBuf { +- let mut p = dir.join(&find_libdir(sysroot)); ++ let mut p = dir.join(libdir_str()); + p.push(triple); + p + } + ++pub fn bindir_relative_str() -> &'static str { ++ env!("CFG_BINDIR_RELATIVE") ++} ++ ++pub fn bindir_relative_path() -> PathBuf { ++ PathBuf::from(bindir_relative_str()) ++} ++ ++pub fn libdir_str() -> &'static str { ++ env!("CFG_LIBDIR_RELATIVE") ++} ++ + pub fn get_or_default_sysroot() -> PathBuf { + // Follow symlinks. If the resolved path is relative, make it absolute. + fn canonicalize(path: Option) -> Option { +@@ -202,7 +212,18 @@ pub fn get_or_default_sysroot() -> PathBuf { + } + + match canonicalize(env::current_exe().ok()) { +- Some(mut p) => { p.pop(); p.pop(); p } ++ Some(mut p) => { ++ // Remove the exe name ++ p.pop(); ++ let mut rel = bindir_relative_path(); ++ ++ // Remove a number of elements equal to the number of elements in the bindir relative ++ // path ++ while rel.pop() { ++ p.pop(); ++ } ++ p ++ } + None => panic!("can't determine value for sysroot") + } + } +@@ -257,47 +278,6 @@ pub fn rust_path() -> Vec { + env_rust_path + } + +-// The name of the directory rustc expects libraries to be located. +-// On Unix should be "lib", on windows "bin" +-#[cfg(unix)] +-fn find_libdir(sysroot: &Path) -> String { +- // FIXME: This is a quick hack to make the rustc binary able to locate +- // Rust libraries in Linux environments where libraries might be installed +- // to lib64/lib32. This would be more foolproof by basing the sysroot off +- // of the directory where librustc is located, rather than where the rustc +- // binary is. +- //If --libdir is set during configuration to the value other than +- // "lib" (i.e. non-default), this value is used (see issue #16552). +- +- match option_env!("CFG_LIBDIR_RELATIVE") { +- Some(libdir) if libdir != "lib" => return libdir.to_string(), +- _ => if sysroot.join(&primary_libdir_name()).join(&rustlibdir()).exists() { +- return primary_libdir_name(); +- } else { +- return secondary_libdir_name(); +- } +- } +- +- #[cfg(target_pointer_width = "64")] +- fn primary_libdir_name() -> String { +- "lib64".to_string() +- } +- +- #[cfg(target_pointer_width = "32")] +- fn primary_libdir_name() -> String { +- "lib32".to_string() +- } +- +- fn secondary_libdir_name() -> String { +- "lib".to_string() +- } +-} +- +-#[cfg(windows)] +-fn find_libdir(_sysroot: &Path) -> String { +- "bin".to_string() +-} +- + // The name of rustc's own place to organize libraries. + // Used to be "rustc", now the default is "rustlib" + pub fn rustlibdir() -> String { +diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs +index 38ad909..2f2ba16 100644 +--- a/src/librustc_trans/back/link.rs ++++ b/src/librustc_trans/back/link.rs +@@ -1037,11 +1037,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; + let mut 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 = PathBuf::from(install_prefix); + path.push(&tlib); + +-- +2.4.3 + diff --git a/recipes/rust/files/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch b/recipes/rust/files/rust-1.1.0/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch similarity index 79% rename from recipes/rust/files/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch rename to recipes/rust/files/rust-1.1.0/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch index b4f57aa..8f5e3df 100644 --- a/recipes/rust/files/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch +++ b/recipes/rust/files/rust-1.1.0/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch @@ -1,17 +1,17 @@ -From 739f9cd792311c4a6c1bf5ad2b99a29e44d3aebf Mon Sep 17 00:00:00 2001 +From 5364ecd0cdf0bcc815d89180d525b4b60a47219e Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Wed, 3 Dec 2014 19:15:19 -0500 -Subject: [PATCH 6/9] std/thread_local: workaround for NULL __dso_handle +Subject: [PATCH 6/8] std/thread_local: workaround for NULL __dso_handle --- src/libstd/thread/local.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs -index 2e043c5..add3e51 100644 +index f2435b6..4261387 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs -@@ -363,7 +363,7 @@ mod imp { +@@ -397,7 +397,7 @@ mod imp { #[linkage = "extern_weak"] static __cxa_thread_atexit_impl: *const (); } @@ -21,5 +21,5 @@ index 2e043c5..add3e51 100644 arg: *mut u8, dso_handle: *mut u8) -> libc::c_int; -- -2.4.1 +2.4.3 diff --git a/recipes/rust/files/0007-mk-install-use-disable-rewrite-paths.patch b/recipes/rust/files/rust-1.1.0/0007-mk-install-use-disable-rewrite-paths.patch similarity index 95% rename from recipes/rust/files/0007-mk-install-use-disable-rewrite-paths.patch rename to recipes/rust/files/rust-1.1.0/0007-mk-install-use-disable-rewrite-paths.patch index 360c6bd..67393af 100644 --- a/recipes/rust/files/0007-mk-install-use-disable-rewrite-paths.patch +++ b/recipes/rust/files/rust-1.1.0/0007-mk-install-use-disable-rewrite-paths.patch @@ -1,7 +1,7 @@ -From a4fd94b8986d8a05e76f86f3fd661dc1f9259b28 Mon Sep 17 00:00:00 2001 +From 378cc683eb8012dc847dc581b57fd10c84a37ae2 Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Mon, 2 Mar 2015 13:34:59 -0500 -Subject: [PATCH 7/9] mk/install: use disable-rewrite-paths +Subject: [PATCH 7/8] mk/install: use disable-rewrite-paths This stops the install scripts from doing work we've already handled. @@ -39,5 +39,5 @@ index cabc97a..273bb0e 100644 $(Q)rm -R tmp/dist -- -2.4.1 +2.4.3 diff --git a/recipes/rust/files/0008-install-disable-ldconfig.patch b/recipes/rust/files/rust-1.1.0/0008-install-disable-ldconfig.patch similarity index 95% rename from recipes/rust/files/0008-install-disable-ldconfig.patch rename to recipes/rust/files/rust-1.1.0/0008-install-disable-ldconfig.patch index 9b0184f..612236b 100644 --- a/recipes/rust/files/0008-install-disable-ldconfig.patch +++ b/recipes/rust/files/rust-1.1.0/0008-install-disable-ldconfig.patch @@ -1,7 +1,7 @@ -From 5bf79280fddac29f5ebd3055a3bfedc094448004 Mon Sep 17 00:00:00 2001 +From 79db300ba81f7f8deccd1c2627cd5a25f11d4b82 Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Tue, 26 May 2015 12:09:36 -0400 -Subject: [PATCH 8/9] install: disable ldconfig +Subject: [PATCH 8/8] install: disable ldconfig --- mk/install.mk | 8 ++++---- @@ -36,5 +36,5 @@ index 273bb0e..58cfc99 100644 $(Q)rm -R tmp/dist -- -2.4.1 +2.4.3 diff --git a/recipes/rust/files/rust-git/0001-platform.mk-avoid-choking-on-i586.patch b/recipes/rust/files/rust-git/0001-platform.mk-avoid-choking-on-i586.patch new file mode 100644 index 0000000..2f4f706 --- /dev/null +++ b/recipes/rust/files/rust-git/0001-platform.mk-avoid-choking-on-i586.patch @@ -0,0 +1,27 @@ +From 237f665afaf7ec35f067ede4c09a013e86ad12c4 Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Sat, 15 Nov 2014 20:12:48 -0500 +Subject: [PATCH 1/8] platform.mk: avoid choking on i586 + +--- + mk/platform.mk | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/mk/platform.mk b/mk/platform.mk +index 8a5e58c..e2c3d8f 100644 +--- a/mk/platform.mk ++++ b/mk/platform.mk +@@ -14,7 +14,9 @@ + # would create a variable HOST_i686-darwin-macos with the value + # i386. + define DEF_HOST_VAR +- HOST_$(1) = $(subst i686,i386,$(word 1,$(subst -, ,$(1)))) ++ HOST_$(1) = $(subst i686,i386,\ ++ $(subst i586,i386,\ ++ $(word 1,$(subst -, ,$(1))))) + endef + $(foreach t,$(CFG_TARGET),$(eval $(call DEF_HOST_VAR,$(t)))) + $(foreach t,$(CFG_TARGET),$(info cfg: host for $(t) is $(HOST_$(t)))) +-- +2.4.3 + diff --git a/recipes/rust/files/0002-Target-add-default-target.json-path-libdir-rust-targ.patch b/recipes/rust/files/rust-git/0002-Target-add-default-target.json-path-libdir-rust-targ.patch similarity index 91% rename from recipes/rust/files/0002-Target-add-default-target.json-path-libdir-rust-targ.patch rename to recipes/rust/files/rust-git/0002-Target-add-default-target.json-path-libdir-rust-targ.patch index aeabaaa..7c0aee1 100644 --- a/recipes/rust/files/0002-Target-add-default-target.json-path-libdir-rust-targ.patch +++ b/recipes/rust/files/rust-git/0002-Target-add-default-target.json-path-libdir-rust-targ.patch @@ -1,7 +1,7 @@ -From a728ae609845a3ae7ee74f8de8c92bf086674237 Mon Sep 17 00:00:00 2001 +From 221ff5acf7b3b176882908d2f7010784614005e8 Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Tue, 18 Nov 2014 01:40:21 -0500 -Subject: [PATCH 2/9] Target: add default target.json path: +Subject: [PATCH 2/8] Target: add default target.json path: $libdir/rust/targets --- @@ -11,10 +11,10 @@ Subject: [PATCH 2/9] Target: add default target.json path: 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs -index 48fe574..78919ba 100644 +index c6ce3a2..51152c7 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs -@@ -37,7 +37,7 @@ use getopts; +@@ -38,7 +38,7 @@ use getopts; use std::collections::HashMap; use std::env; use std::fmt; @@ -23,7 +23,7 @@ index 48fe574..78919ba 100644 use llvm; -@@ -665,8 +665,8 @@ pub fn build_configuration(sess: &Session) -> ast::CrateConfig { +@@ -651,8 +651,8 @@ pub fn build_configuration(sess: &Session) -> ast::CrateConfig { v } @@ -60,7 +60,7 @@ index 6b5f587..4432440 100644 let default_sysroot = match sopts.maybe_sysroot { Some(_) => None, diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs -index 22d9660..ed98477 100644 +index 402fbcd..a211b84 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs @@ -49,6 +49,8 @@ use serialize::json::Json; @@ -72,7 +72,7 @@ index 22d9660..ed98477 100644 mod android_base; mod apple_base; -@@ -305,12 +307,13 @@ impl Target { +@@ -306,12 +308,13 @@ impl Target { /// /// The error string could come from any of the APIs called, including /// filesystem access and JSON decoding. @@ -87,7 +87,7 @@ index 22d9660..ed98477 100644 fn load_file(path: &Path) -> Result { let mut f = try!(File::open(path).map_err(|e| e.to_string())); -@@ -399,9 +402,14 @@ impl Target { +@@ -400,9 +403,14 @@ impl Target { let target_path = env::var_os("RUST_TARGET_PATH") .unwrap_or(OsString::new()); @@ -105,5 +105,5 @@ index 22d9660..ed98477 100644 if p.is_file() { return load_file(&p); -- -2.4.1 +2.4.3 diff --git a/recipes/rust/files/rust-git/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch b/recipes/rust/files/rust-git/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch new file mode 100644 index 0000000..82e78f9 --- /dev/null +++ b/recipes/rust/files/rust-git/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch @@ -0,0 +1,67 @@ +From 057d6be30ff1437a53132175720c96fa93826a08 Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Tue, 18 Nov 2014 14:52:56 -0500 +Subject: [PATCH 3/8] mk: for stage0, use RUSTFLAGS to override target libs dir + +Setting HLIB specially for stage0 (and even more specially for windows) +also affects the location we place TLIB. To keep the TLIBs we build in +the place requested by configure, use '-L' and '--sysroot' to point +stage0-rustc at the appropriate location. +--- + mk/main.mk | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) + +diff --git a/mk/main.mk b/mk/main.mk +index 3926119..165afc3 100644 +--- a/mk/main.mk ++++ b/mk/main.mk +@@ -370,21 +370,22 @@ define SREQ + # Destinations of artifacts for the host compiler + HROOT$(1)_H_$(3) = $(3)/stage$(1) + HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin +-ifeq ($$(CFG_WINDOWSY_$(3)),1) +-HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE) +-else +-ifeq ($(1),0) +-HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/lib +-else + HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE) +-endif +-endif + + # Destinations of artifacts for target architectures + TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(2) + TBIN$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/bin + TLIB$(1)_T_$(2)_H_$(3) = $$(TROOT$(1)_T_$(2)_H_$(3))/lib + ++# Don't trust stage0, be explicit about libraries ++# TODO: rather than specifying sysroot, we really want to tell which libdir to ++# use (ie: the dir containing 'rustlib'). This would allow us to avoid ++# passing the '-L' options. ++ifeq ($(1),0) ++RUSTFLAGS_S_$(1)_T_$(2)_H_$(3) += --sysroot "$$(HROOT$(1)_H_$(3))" \ ++ -L "$$(TLIB$(1)_T_$(2)_H_$(3))" ++endif ++ + # Preqrequisites for using the stageN compiler + ifeq ($(1),0) + HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) +@@ -496,6 +497,7 @@ STAGE$(1)_T_$(2)_H_$(3) := \ + $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \ + --cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \ + $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \ ++ $$(RUSTFLAGS_S_$(1)_T_$(2)_H_$(3)) \ + $$(RUSTC_FLAGS_$(2)) + + PERF_STAGE$(1)_T_$(2)_H_$(3) := \ +@@ -504,6 +506,7 @@ PERF_STAGE$(1)_T_$(2)_H_$(3) := \ + $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \ + --cfg $$(CFGFLAG$(1)_T_$(2)_H_$(3)) \ + $$(CFG_RUSTC_FLAGS) $$(EXTRAFLAGS_STAGE$(1)) --target=$(2)) \ ++ $$(RUSTFLAGS_S_$(1)_T_$(2)_H_$(3)) \ + $$(RUSTC_FLAGS_$(2)) + + endef +-- +2.4.3 + diff --git a/recipes/rust/files/rust-git/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch b/recipes/rust/files/rust-git/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch new file mode 100644 index 0000000..b14c735 --- /dev/null +++ b/recipes/rust/files/rust-git/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch @@ -0,0 +1,27 @@ +From af95f47a39a91a3e4a58b1df6c48bc4e010520c6 Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Tue, 18 Nov 2014 13:48:14 -0500 +Subject: [PATCH 4/8] mk: add missing CFG_LIBDIR_RELATIVE + +--- + mk/grammar.mk | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/mk/grammar.mk b/mk/grammar.mk +index d9c66e2..585206d 100644 +--- a/mk/grammar.mk ++++ b/mk/grammar.mk +@@ -11,8 +11,8 @@ + BG = $(CFG_BUILD_DIR)/grammar/ + SG = $(S)src/grammar/ + B = $(CFG_BUILD_DIR)/$(CFG_BUILD)/stage2/ +-L = $(B)lib/rustlib/$(CFG_BUILD)/lib +-LD = $(CFG_BUILD)/stage2/lib/rustlib/$(CFG_BUILD)/lib/ ++L = $(B)$(CFG_LIBDIR_RELATIVE)/rustlib/$(CFG_BUILD)/lib ++LD = $(CFG_BUILD)/stage2/$(CFG_LIBDIR_RELATIVE)/rustlib/$(CFG_BUILD)/lib/ + RUSTC = $(STAGE2_T_$(CFG_BUILD)_H_$(CFG_BUILD)) + ifeq ($(CFG_OSTYPE),apple-darwin) + FLEX_LDFLAGS=-ll +-- +2.4.3 + diff --git a/recipes/rust/files/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch b/recipes/rust/files/rust-git/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch similarity index 95% rename from recipes/rust/files/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch rename to recipes/rust/files/rust-git/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch index 324f8fa..0002ef8 100644 --- a/recipes/rust/files/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch +++ b/recipes/rust/files/rust-git/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch @@ -1,7 +1,7 @@ -From 66dbf7c11151c2c3419786161233576f07c850b0 Mon Sep 17 00:00:00 2001 +From 64dcf50a8a0f3aaf37ec6e4fe6143d0832592c05 Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Mon, 24 Nov 2014 13:10:15 -0500 -Subject: [PATCH 5/9] configure: support --bindir, and extend libdir to +Subject: [PATCH 5/8] configure: support --bindir, and extend libdir to non-blessed dirs Adds --bindir, and: @@ -23,7 +23,7 @@ windows platforms 7 files changed, 90 insertions(+), 71 deletions(-) diff --git a/configure b/configure -index efa836c..368bc50 100755 +index 891f524..441793c 100755 --- a/configure +++ b/configure @@ -323,6 +323,31 @@ envopt() { @@ -58,7 +58,7 @@ index efa836c..368bc50 100755 to_llvm_triple() { case $1 in i686-w64-mingw32) echo i686-pc-windows-gnu ;; -@@ -606,6 +631,8 @@ putvar CFG_BUILD # Yes, this creates a duplicate entry, but the last one wins. +@@ -609,6 +634,8 @@ putvar CFG_BUILD # Yes, this creates a duplicate entry, but the last one wins. CFG_HOST=$(to_llvm_triple $CFG_HOST) CFG_TARGET=$(to_llvm_triple $CFG_TARGET) @@ -67,7 +67,7 @@ index efa836c..368bc50 100755 # On windows we just store the libraries in the bin directory because # there's no rpath. This is where the build system itself puts libraries; # --libdir is used to configure the installation directory. -@@ -613,24 +640,21 @@ CFG_TARGET=$(to_llvm_triple $CFG_TARGET) +@@ -616,24 +643,21 @@ CFG_TARGET=$(to_llvm_triple $CFG_TARGET) if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] || [ "$CFG_OSTYPE" = "pc-windows-msvc" ] then CFG_LIBDIR_RELATIVE=bin @@ -101,7 +101,7 @@ index efa836c..368bc50 100755 fi if [ $HELP -eq 1 ] -@@ -1567,6 +1591,7 @@ putvar CFG_PREFIX +@@ -1588,6 +1612,7 @@ putvar CFG_PREFIX putvar CFG_HOST putvar CFG_TARGET putvar CFG_LIBDIR_RELATIVE @@ -129,10 +129,10 @@ index 59a0095..b8e8345 100644 endef diff --git a/mk/main.mk b/mk/main.mk -index 13bed1b..aa2d4ba 100644 +index 165afc3..33f9545 100644 --- a/mk/main.mk +++ b/mk/main.mk -@@ -344,7 +344,9 @@ export CFG_RELEASE_CHANNEL +@@ -339,7 +339,9 @@ export CFG_RELEASE_CHANNEL export CFG_LLVM_ROOT export CFG_PREFIX export CFG_LIBDIR @@ -142,7 +142,7 @@ index 13bed1b..aa2d4ba 100644 export CFG_DISABLE_INJECT_STD_VERSION ifdef CFG_DISABLE_UNSTABLE_FEATURES CFG_INFO := $(info cfg: disabling unstable features (CFG_DISABLE_UNSTABLE_FEATURES)) -@@ -374,7 +376,16 @@ define SREQ +@@ -369,7 +371,16 @@ define SREQ # Destinations of artifacts for the host compiler HROOT$(1)_H_$(3) = $(3)/stage$(1) @@ -180,10 +180,10 @@ index 16cbaab..f8a354c 100644 endif diff --git a/mk/prepare.mk b/mk/prepare.mk -index 573b7ac..c8085bd 100644 +index fe619cc..b8aa0cb 100644 --- a/mk/prepare.mk +++ b/mk/prepare.mk -@@ -177,10 +177,10 @@ INSTALL_DEBUGGER_SCRIPT_COMMANDS=$(if $(findstring windows,$(1)),\ +@@ -186,10 +186,10 @@ INSTALL_DEBUGGER_SCRIPT_COMMANDS=$(if $(findstring windows,$(1)),\ define DEF_PREPARE prepare-base-$(1): PREPARE_SOURCE_DIR=$$(PREPARE_HOST)/stage$$(PREPARE_STAGE) @@ -341,10 +341,10 @@ index 311ab1c..1b03b1a 100644 // Used to be "rustc", now the default is "rustlib" pub fn rustlibdir() -> String { diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs -index 844a0a6..9f5b12c 100644 +index 6b8b59d..6e03f3c 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs -@@ -984,11 +984,10 @@ fn link_args(cmd: &mut Linker, +@@ -997,11 +997,10 @@ fn link_args(cmd: &mut Linker, // where extern libraries might live, based on the // addl_lib_search_paths if sess.opts.cg.rpath { @@ -358,5 +358,5 @@ index 844a0a6..9f5b12c 100644 path.push(&tlib); -- -2.4.1 +2.4.3 diff --git a/recipes/rust/files/rust-git/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch b/recipes/rust/files/rust-git/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch new file mode 100644 index 0000000..531fe57 --- /dev/null +++ b/recipes/rust/files/rust-git/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch @@ -0,0 +1,25 @@ +From fb56f1fa6d0bdc62f7fd0c480446255698dc1635 Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Wed, 3 Dec 2014 19:15:19 -0500 +Subject: [PATCH 6/8] std/thread_local: workaround for NULL __dso_handle + +--- + src/libstd/thread/local.rs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs +index 6056334..e79bd8b 100644 +--- a/src/libstd/thread/local.rs ++++ b/src/libstd/thread/local.rs +@@ -337,7 +337,7 @@ mod imp { + #[linkage = "extern_weak"] + static __cxa_thread_atexit_impl: *const (); + } +- if !__cxa_thread_atexit_impl.is_null() { ++ if !__cxa_thread_atexit_impl.is_null() && !__dso_handle.is_null() { + type F = unsafe extern fn(dtor: unsafe extern fn(*mut u8), + arg: *mut u8, + dso_handle: *mut u8) -> libc::c_int; +-- +2.4.3 + diff --git a/recipes/rust/files/rust-git/0007-mk-install-use-disable-rewrite-paths.patch b/recipes/rust/files/rust-git/0007-mk-install-use-disable-rewrite-paths.patch new file mode 100644 index 0000000..5d4939a --- /dev/null +++ b/recipes/rust/files/rust-git/0007-mk-install-use-disable-rewrite-paths.patch @@ -0,0 +1,43 @@ +From de01acf6395a4c7f7d5c9d7ba251d9f2af570127 Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Mon, 2 Mar 2015 13:34:59 -0500 +Subject: [PATCH 7/8] mk/install: use disable-rewrite-paths + +This stops the install scripts from doing work we've already handled. + +Path rewriting is only useful for prepackaged binary installers. +--- + mk/install.mk | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/mk/install.mk b/mk/install.mk +index cabc97a..273bb0e 100644 +--- a/mk/install.mk ++++ b/mk/install.mk +@@ -16,9 +16,9 @@ else + $(Q)$(MAKE) prepare_install + endif + ifeq ($(CFG_DISABLE_DOCS),) +- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" ++ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)" --disable-rewrite-paths + endif +- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" ++ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)" --disable-rewrite-paths + # Remove tmp files because it's a decent amount of disk space + $(Q)rm -R tmp/dist + +@@ -32,9 +32,9 @@ else + $(Q)$(MAKE) prepare_uninstall + endif + ifeq ($(CFG_DISABLE_DOCS),) +- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" ++ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" --disable-rewrite-paths + endif +- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" ++ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" --disable-rewrite-paths + # Remove tmp files because it's a decent amount of disk space + $(Q)rm -R tmp/dist + +-- +2.4.3 + diff --git a/recipes/rust/files/rust-git/0008-install-disable-ldconfig.patch b/recipes/rust/files/rust-git/0008-install-disable-ldconfig.patch new file mode 100644 index 0000000..0dbab24 --- /dev/null +++ b/recipes/rust/files/rust-git/0008-install-disable-ldconfig.patch @@ -0,0 +1,40 @@ +From 8b87c3e5a7181f828dee1c8c0598b1bafa9dd4cc Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Tue, 26 May 2015 12:09:36 -0400 +Subject: [PATCH 8/8] install: disable ldconfig + +--- + mk/install.mk | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/mk/install.mk b/mk/install.mk +index 273bb0e..58cfc99 100644 +--- a/mk/install.mk ++++ b/mk/install.mk +@@ -16,9 +16,9 @@ else + $(Q)$(MAKE) prepare_install + endif + ifeq ($(CFG_DISABLE_DOCS),) +- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)" --disable-rewrite-paths ++ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)" --disable-rewrite-paths --disable-ldconfig + endif +- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)" --disable-rewrite-paths ++ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)" --disable-rewrite-paths --disable-ldconfig + # Remove tmp files because it's a decent amount of disk space + $(Q)rm -R tmp/dist + +@@ -32,9 +32,9 @@ else + $(Q)$(MAKE) prepare_uninstall + endif + ifeq ($(CFG_DISABLE_DOCS),) +- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" --disable-rewrite-paths ++ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(DOC_PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" --disable-rewrite-paths --disable-ldconfig + endif +- $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" --disable-rewrite-paths ++ $(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" --disable-rewrite-paths --disable-ldconfig + # Remove tmp files because it's a decent amount of disk space + $(Q)rm -R tmp/dist + +-- +2.4.3 + diff --git a/recipes/rust/rust-release.inc b/recipes/rust/rust-release.inc index db83c4e..f2a69d0 100644 --- a/recipes/rust/rust-release.inc +++ b/recipes/rust/rust-release.inc @@ -1,5 +1,5 @@ SRC_URI = "\ - https://static.rust-lang.org/dist/rust-${PV}.tar.gz \ + https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ " require rust.inc diff --git a/recipes/rust/rust.inc b/recipes/rust/rust.inc index 09a0469..19e3548 100644 --- a/recipes/rust/rust.inc +++ b/recipes/rust/rust.inc @@ -22,7 +22,7 @@ LIC_FILES_CHKSUM ="\ ## stage0 (format_args!() change) USE_LOCAL_RUST ??= "0" -SRC_URI += "${@base_conditional('USE_LOCAL_RUST', '1', '', 'https://static.rust-lang.org/stage0-snapshots/${RUST_SNAPSHOT};unpack=0', d)}" +SRC_URI += "${@base_conditional('USE_LOCAL_RUST', '1', '', 'https://static.rust-lang.org/stage0-snapshots/${RUST_SNAPSHOT};unpack=0;name=rust-snapshot', d)}" # We generate local targets, and need to be able to locate them export RUST_TARGET_PATH="${WORKDIR}/targets/" diff --git a/recipes/rust/rust_1.1.0.bb b/recipes/rust/rust_1.1.0.bb new file mode 100644 index 0000000..b368ec0 --- /dev/null +++ b/recipes/rust/rust_1.1.0.bb @@ -0,0 +1,31 @@ +# 1.1.0 +require rust-release.inc +SRC_URI[rust.md5sum] = "5f2f923f8d1c77a55721d1f0813a158a" +SRC_URI[rust.sha256sum] = "cb09f443b37ec1b81fe73c04eb413f9f656859cf7d00bc5088008cbc2a63fa8a" + +## snapshot info taken from rust/src/snapshots.txt +## TODO: find a way to add aditional SRC_URIs based on the contents of an +## earlier SRC_URI. +RS_DATE = "2015-04-27" +RS_SRCHASH = "857ef6e" +# linux-x86_64 +RS_HASH = "94089740e48167c5975c92c139ae9c286764012f" +RUST_SNAPSHOT = "rust-stage0-${RS_DATE}-${RS_SRCHASH}-linux-x86_64-${RS_HASH}.tar.bz2" + +SRC_URI[rust-snapshot.md5sum] = "e0d49475a787aaa9481ec0b1a28d1f7a" +SRC_URI[rust-snapshot.sha256sum] = "e7858a90c2c6c35299ebe2cb6425f3f84d0ba171dcbce20ff68295a1ff75c7e5" + +# "patch-prefix" +PP = "${BPN}-${PV}" +SRC_URI_append = "\ + file://${PP}/0001-platform.mk-avoid-choking-on-i586.patch \ + file://${PP}/0002-Target-add-default-target.json-path-libdir-rust-targ.patch \ + file://${PP}/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch \ + file://${PP}/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \ + file://${PP}/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch \ + file://${PP}/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch \ + file://${PP}/0007-mk-install-use-disable-rewrite-paths.patch \ + file://${PP}/0008-install-disable-ldconfig.patch \ +\ + file://rust-installer/0001-add-option-to-disable-rewriting-of-install-paths.patch;patchdir=src/rust-installer \ +" diff --git a/recipes/rust/rust_git.bb b/recipes/rust/rust_git.bb index 067caaf..3c7fe3e 100644 --- a/recipes/rust/rust_git.bb +++ b/recipes/rust/rust_git.bb @@ -1,19 +1,29 @@ -# 2015-05-26 -SRCREV = "c654a07d29c77b5a023cb9d36dfc61811349f64e" +# 2015-06-26 +SRCREV = "378a370ff2057afeb1eae86eb6e78c476866a4a6" require rust-git.inc -RUST_SNAPSHOT = "rust-stage0-2015-04-27-857ef6e-linux-x86_64-94089740e48167c5975c92c139ae9c286764012f.tar.bz2" -SRC_URI[md5sum] = "e0d49475a787aaa9481ec0b1a28d1f7a" -SRC_URI[sha256sum] = "e7858a90c2c6c35299ebe2cb6425f3f84d0ba171dcbce20ff68295a1ff75c7e5" +RS_DATE = "2015-05-24" +RS_SRCHASH = "ba0e1cd" +# linux-x86_64 +RS_HASH = "5fd8698fdfe953e6c4d86cf4fa1d5f3a0053248c" +RUST_SNAPSHOT = "rust-stage0-${RS_DATE}-${RS_SRCHASH}-linux-x86_64-${RS_HASH}.tar.bz2" +SRC_URI[md5sum] += "e0d49475a787aaa9481ec0b1a28d1f7a" +SRC_URI[sha256sum] += "e7858a90c2c6c35299ebe2cb6425f3f84d0ba171dcbce20ff68295a1ff75c7e5" + +# "patch-prefix" +PP = "${BPN}-git" SRC_URI_append = "\ - file://0001-platform.mk-avoid-choking-on-i586.patch \ - file://0002-Target-add-default-target.json-path-libdir-rust-targ.patch \ - file://0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch \ - file://0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \ - file://0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch \ - file://0006-std-thread_local-workaround-for-NULL-__dso_handle.patch \ - file://0007-mk-install-use-disable-rewrite-paths.patch \ + file://${PP}/0001-platform.mk-avoid-choking-on-i586.patch \ + file://${PP}/0002-Target-add-default-target.json-path-libdir-rust-targ.patch \ + file://${PP}/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch \ + file://${PP}/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \ + file://${PP}/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch \ + file://${PP}/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch \ + file://${PP}/0007-mk-install-use-disable-rewrite-paths.patch \ + file://${PP}/0008-install-disable-ldconfig.patch \ \ file://rust-installer/0001-add-option-to-disable-rewriting-of-install-paths.patch;patchdir=src/rust-installer \ " + +DEFAULT_PREFERENCE = "-1"