From 8c74d4ce6fbee7b20ae0f748912ced839979b85e Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Sun, 13 Dec 2015 01:08:00 -0500 Subject: [PATCH] rust: update to 1.5.0 --- ...01-platform.mk-avoid-choking-on-i586.patch | 27 ++ ...lt-target.json-path-libdir-rust-targ.patch | 109 ++++++ ...e-RUSTFLAGS-to-override-target-libs-.patch | 67 ++++ ...4-mk-add-missing-CFG_LIBDIR_RELATIVE.patch | 27 ++ ...t-bindir-and-extend-libdir-to-non-bl.patch | 362 ++++++++++++++++++ ...cal-workaround-for-NULL-__dso_handle.patch | 25 ++ ...mk-install-use-disable-rewrite-paths.patch | 30 ++ .../0008-install-disable-ldconfig.patch | 28 ++ ...e-crate-metadata-from-symbol-hashing.patch | 28 ++ recipes/rust/rust-1.5.0.inc | 5 + recipes/rust/rust-llvm_1.5.0.bb | 11 + recipes/rust/rust-snapshot-2015-08-11.inc | 14 + recipes/rust/rust_1.5.0.bb | 19 + 13 files changed, 752 insertions(+) create mode 100644 recipes/rust/files/rust-1.5.0/0001-platform.mk-avoid-choking-on-i586.patch create mode 100644 recipes/rust/files/rust-1.5.0/0002-Target-add-default-target.json-path-libdir-rust-targ.patch create mode 100644 recipes/rust/files/rust-1.5.0/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch create mode 100644 recipes/rust/files/rust-1.5.0/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch create mode 100644 recipes/rust/files/rust-1.5.0/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch create mode 100644 recipes/rust/files/rust-1.5.0/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch create mode 100644 recipes/rust/files/rust-1.5.0/0007-mk-install-use-disable-rewrite-paths.patch create mode 100644 recipes/rust/files/rust-1.5.0/0008-install-disable-ldconfig.patch create mode 100644 recipes/rust/files/rust-1.5.0/0009-Remove-crate-metadata-from-symbol-hashing.patch create mode 100644 recipes/rust/rust-1.5.0.inc create mode 100644 recipes/rust/rust-llvm_1.5.0.bb create mode 100644 recipes/rust/rust-snapshot-2015-08-11.inc create mode 100644 recipes/rust/rust_1.5.0.bb diff --git a/recipes/rust/files/rust-1.5.0/0001-platform.mk-avoid-choking-on-i586.patch b/recipes/rust/files/rust-1.5.0/0001-platform.mk-avoid-choking-on-i586.patch new file mode 100644 index 0000000..bc4f61b --- /dev/null +++ b/recipes/rust/files/rust-1.5.0/0001-platform.mk-avoid-choking-on-i586.patch @@ -0,0 +1,27 @@ +From af2eaed835d3b717552ea83e75f4c5e86e614979 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 + +--- + mk/platform.mk | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/mk/platform.mk b/mk/platform.mk +index 856a22d..0c90632 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.10 + diff --git a/recipes/rust/files/rust-1.5.0/0002-Target-add-default-target.json-path-libdir-rust-targ.patch b/recipes/rust/files/rust-1.5.0/0002-Target-add-default-target.json-path-libdir-rust-targ.patch new file mode 100644 index 0000000..199fe94 --- /dev/null +++ b/recipes/rust/files/rust-1.5.0/0002-Target-add-default-target.json-path-libdir-rust-targ.patch @@ -0,0 +1,109 @@ +From 632d71477fdecb18852812d86b8e2ee1e33c521b 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: + $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 7e8104d..ecb38d4 100644 +--- a/src/librustc/session/config.rs ++++ b/src/librustc/session/config.rs +@@ -36,7 +36,7 @@ use getopts; + use std::collections::HashMap; + use std::env; + use std::fmt; +-use std::path::PathBuf; ++use std::path::{Path, PathBuf}; + + use llvm; + +@@ -653,8 +653,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 0a1df25..ad223d5 100644 +--- a/src/librustc/session/mod.rs ++++ b/src/librustc/session/mod.rs +@@ -412,14 +412,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::ParseSess::with_span_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 6ae7435..3ffa484 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; +@@ -346,12 +348,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())); +@@ -447,9 +450,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.10 + diff --git a/recipes/rust/files/rust-1.5.0/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch b/recipes/rust/files/rust-1.5.0/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch new file mode 100644 index 0000000..a1a4b36 --- /dev/null +++ b/recipes/rust/files/rust-1.5.0/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch @@ -0,0 +1,67 @@ +From b544f5bfa38d5932db23214e168988d05cbc5620 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 + +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 34f8247..896c1df 100644 +--- a/mk/main.mk ++++ b/mk/main.mk +@@ -376,21 +376,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)) +@@ -502,6 +503,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) := \ +@@ -510,6 +512,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.10 + diff --git a/recipes/rust/files/rust-1.5.0/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch b/recipes/rust/files/rust-1.5.0/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch new file mode 100644 index 0000000..8985bd1 --- /dev/null +++ b/recipes/rust/files/rust-1.5.0/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch @@ -0,0 +1,27 @@ +From 004ddead436887fe99bfa9d0d25f6cdaf9f6148b 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 + +--- + mk/grammar.mk | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/mk/grammar.mk b/mk/grammar.mk +index 0d527bd..926f247 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.10 + diff --git a/recipes/rust/files/rust-1.5.0/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch b/recipes/rust/files/rust-1.5.0/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch new file mode 100644 index 0000000..5e771f6 --- /dev/null +++ b/recipes/rust/files/rust-1.5.0/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch @@ -0,0 +1,362 @@ +From 1197d6ec82df147e8bbe0d42017fe1ee75804369 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 + 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 | 49 ++++++++++++++++------ + 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, 90 insertions(+), 71 deletions(-) + +diff --git a/configure b/configure +index 60d3661..01c447b 100755 +--- a/configure ++++ b/configure +@@ -334,6 +334,31 @@ enable_if_not_disabled() { + 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 ;; +@@ -632,6 +657,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. +@@ -639,24 +666,21 @@ CFG_TARGET=$(to_llvm_triple $CFG_TARGET) + if [ "$CFG_OSTYPE" = "pc-windows-gnu" ] || [ "$CFG_OSTYPE" = "pc-windows-msvc" ] + 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_OSTYPE" = "pc-windows-msvc" ] ) \ +- && [ "$CFG_LIBDIR_RELATIVE" != "bin" ]; then +- err "libdir on windows should be set to 'bin'" ++ && [ "$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 ] +@@ -1733,6 +1757,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_AARCH64_LINUX_ANDROID_NDK + putvar CFG_ARM_LINUX_ANDROIDEABI_NDK +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 896c1df..ab12166 100644 +--- a/mk/main.mk ++++ b/mk/main.mk +@@ -345,7 +345,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)) +@@ -375,7 +377,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 e263a6d..45590ab 100644 +--- a/mk/prepare.mk ++++ b/mk/prepare.mk +@@ -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) +-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 + +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 6171ff1..32f41ff 100644 +--- a/src/librustc_trans/back/link.rs ++++ b/src/librustc_trans/back/link.rs +@@ -1033,11 +1033,10 @@ fn link_args(cmd: &mut Linker, + // 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.10 + diff --git a/recipes/rust/files/rust-1.5.0/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch b/recipes/rust/files/rust-1.5.0/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch new file mode 100644 index 0000000..86112e5 --- /dev/null +++ b/recipes/rust/files/rust-1.5.0/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch @@ -0,0 +1,25 @@ +From 68662f758244a476b64b0772d93c7a1731e9d1ad 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 + +--- + 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 c204f79..b2f6f1d 100644 +--- a/src/libstd/thread/local.rs ++++ b/src/libstd/thread/local.rs +@@ -338,7 +338,7 @@ mod imp { + #[linkage = "extern_weak"] + static __cxa_thread_atexit_impl: *const libc::c_void; + } +- 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.10 + diff --git a/recipes/rust/files/rust-1.5.0/0007-mk-install-use-disable-rewrite-paths.patch b/recipes/rust/files/rust-1.5.0/0007-mk-install-use-disable-rewrite-paths.patch new file mode 100644 index 0000000..94cf932 --- /dev/null +++ b/recipes/rust/files/rust-1.5.0/0007-mk-install-use-disable-rewrite-paths.patch @@ -0,0 +1,30 @@ +From be3663fcd9ae11a207b3c1649917bfff3c69b1c4 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 + +This stops the install scripts from doing work we've already handled. + +Path rewriting is only useful for prepackaged binary installers. +--- + mk/install.mk | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/mk/install.mk b/mk/install.mk +index 8b81702..4fed072 100644 +--- a/mk/install.mk ++++ b/mk/install.mk +@@ -12,7 +12,9 @@ RUN_INSALLER = cd tmp/empty_dir && \ + sh ../../tmp/dist/$(1)/install.sh \ + --prefix="$(DESTDIR)$(CFG_PREFIX)" \ + --libdir="$(DESTDIR)$(CFG_LIBDIR)" \ +- --mandir="$(DESTDIR)$(CFG_MANDIR)" ++ --mandir="$(DESTDIR)$(CFG_MANDIR)" \ ++ "$(MAYBE_DISABLE_VERIFY)" ++ --disable-rewrite-paths + + install: + ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER))) +-- +2.4.10 + diff --git a/recipes/rust/files/rust-1.5.0/0008-install-disable-ldconfig.patch b/recipes/rust/files/rust-1.5.0/0008-install-disable-ldconfig.patch new file mode 100644 index 0000000..e5cb052 --- /dev/null +++ b/recipes/rust/files/rust-1.5.0/0008-install-disable-ldconfig.patch @@ -0,0 +1,28 @@ +From d7aa5e6824e8658c01f702259eebac02553fb7b8 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 + +--- + mk/install.mk | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/mk/install.mk b/mk/install.mk +index 4fed072..92e66cd 100644 +--- a/mk/install.mk ++++ b/mk/install.mk +@@ -13,8 +13,9 @@ RUN_INSALLER = cd tmp/empty_dir && \ + --prefix="$(DESTDIR)$(CFG_PREFIX)" \ + --libdir="$(DESTDIR)$(CFG_LIBDIR)" \ + --mandir="$(DESTDIR)$(CFG_MANDIR)" \ +- "$(MAYBE_DISABLE_VERIFY)" +- --disable-rewrite-paths ++ "$(MAYBE_DISABLE_VERIFY)" \ ++ --disable-rewrite-paths \ ++ --disable-ldconfig + + install: + ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER))) +-- +2.4.10 + diff --git a/recipes/rust/files/rust-1.5.0/0009-Remove-crate-metadata-from-symbol-hashing.patch b/recipes/rust/files/rust-1.5.0/0009-Remove-crate-metadata-from-symbol-hashing.patch new file mode 100644 index 0000000..d1d798b --- /dev/null +++ b/recipes/rust/files/rust-1.5.0/0009-Remove-crate-metadata-from-symbol-hashing.patch @@ -0,0 +1,28 @@ +From e6888f9b888911bdbd52e2ee7c37914ee4cee0e2 Mon Sep 17 00:00:00 2001 +From: Steven Walter +Date: Tue, 7 Jul 2015 14:57:42 -0400 +Subject: [PATCH 9/9] Remove crate metadata from symbol hashing + +--- + src/librustc_trans/back/link.rs | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs +index 32f41ff..2a87cd7 100644 +--- a/src/librustc_trans/back/link.rs ++++ b/src/librustc_trans/back/link.rs +@@ -212,11 +212,6 @@ fn symbol_hash<'tcx>(tcx: &ty::ctxt<'tcx>, + symbol_hasher.reset(); + symbol_hasher.input_str(&link_meta.crate_name); + symbol_hasher.input_str("-"); +- symbol_hasher.input_str(link_meta.crate_hash.as_str()); +- for meta in tcx.sess.crate_metadata.borrow().iter() { +- symbol_hasher.input_str(&meta[..]); +- } +- symbol_hasher.input_str("-"); + symbol_hasher.input(&encoder::encoded_ty(tcx, t)); + // Prefix with 'h' so that it never blends into adjacent digits + let mut hash = String::from("h"); +-- +2.4.10 + diff --git a/recipes/rust/rust-1.5.0.inc b/recipes/rust/rust-1.5.0.inc new file mode 100644 index 0000000..117b8b8 --- /dev/null +++ b/recipes/rust/rust-1.5.0.inc @@ -0,0 +1,5 @@ +SRC_URI[rust.md5sum] = "234bd912481a04e93b7f2eff0d5b3485" +SRC_URI[rust.sha256sum] = "641037af7b7b6cad0b231cc20671f8a314fbf2f40fc0901d0b877c39fc8da5a0" +LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=eb87dba71cb424233bcce88db3ae2f1a" + +require rust-snapshot-2015-08-11.inc diff --git a/recipes/rust/rust-llvm_1.5.0.bb b/recipes/rust/rust-llvm_1.5.0.bb new file mode 100644 index 0000000..f1e2660 --- /dev/null +++ b/recipes/rust/rust-llvm_1.5.0.bb @@ -0,0 +1,11 @@ +require rust-release.inc +require rust-${PV}.inc +require rust-llvm.inc + +LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=4c0bc17c954e99fd547528d938832bfa" + +do_install_append () { + cd "${B}" + install -d "${D}${bindir}" + install -m755 "Release/bin/FileCheck" "${D}${bindir}" +} diff --git a/recipes/rust/rust-snapshot-2015-08-11.inc b/recipes/rust/rust-snapshot-2015-08-11.inc new file mode 100644 index 0000000..ff1c466 --- /dev/null +++ b/recipes/rust/rust-snapshot-2015-08-11.inc @@ -0,0 +1,14 @@ +## snapshot info taken from rust/src/snapshots.txt +## TODO: find a way to add additional SRC_URIs based on the contents of an +## earlier SRC_URI. +RS_DATE = "2015-08-11" +RS_SRCHASH = "1af31d4" +# linux-x86_64 +RS_ARCH = "linux-x86_64" +RS_HASH = "7df8ba9dec63ec77b857066109d4b6250f3d222f" + +RUST_SNAPSHOT = "rust-stage0-${RS_DATE}-${RS_SRCHASH}-${RS_ARCH}-${RS_HASH}.tar.bz2" + +SRC_URI[rust-snapshot.md5sum] = "53b2e1f553eaeb88e8d60d5380670283" +SRC_URI[rust-snapshot.sha256sum] = "5936f5ec4327d41f3aa9f98cbedebb6fd3d72715f8df578e0c9a669154c80bc3" + diff --git a/recipes/rust/rust_1.5.0.bb b/recipes/rust/rust_1.5.0.bb new file mode 100644 index 0000000..2a2fdca --- /dev/null +++ b/recipes/rust/rust_1.5.0.bb @@ -0,0 +1,19 @@ +require rust-release.inc +require rust.inc +require rust-${PV}.inc + +# "patch-prefix" +PP = "rust-${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://${PP}/0009-Remove-crate-metadata-from-symbol-hashing.patch \ +\ + file://rust-installer/0001-add-option-to-disable-rewriting-of-install-paths.patch;patchdir=src/rust-installer \ +"