From 46194288a21147a3421510251cadecb62d9213a5 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 30 Jan 2017 09:45:55 -0600 Subject: [PATCH 1/3] rust: move versioned files into .inc This way we can bump the versions without big diffs. (cherry picked from commit 5d2e062a846d9e01cee8b5bafb0c530f5b404928) --- recipes-devtools/rust/compiler-rt.inc | 30 +++++++++++++ recipes-devtools/rust/compiler-rt_1.12.1.bb | 31 +------------ recipes-devtools/rust/libstd-rs.inc | 32 +++++++++++++ recipes-devtools/rust/libstd-rs_1.12.1.bb | 34 +------------- recipes-devtools/rust/rust-cross.inc | 49 ++++++++++++++++++++ recipes-devtools/rust/rust-cross_1.12.1.bb | 50 +-------------------- 6 files changed, 114 insertions(+), 112 deletions(-) create mode 100644 recipes-devtools/rust/compiler-rt.inc create mode 100644 recipes-devtools/rust/libstd-rs.inc create mode 100644 recipes-devtools/rust/rust-cross.inc diff --git a/recipes-devtools/rust/compiler-rt.inc b/recipes-devtools/rust/compiler-rt.inc new file mode 100644 index 0000000..59677e7 --- /dev/null +++ b/recipes-devtools/rust/compiler-rt.inc @@ -0,0 +1,30 @@ +SUMMARY = "Rust compiler run-time" +HOMEPAGE = "http://www.rust-lang.org" +SECTION = "devel" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://src/compiler-rt/LICENSE.TXT;md5=bf24bca27049b52e9738451aa55771d4" + +require rust.inc +ALLOW_EMPTY_${PN} = "1" + +DEPENDS += "rust-llvm-native (=${PV})" +# dev and staticdev should NOT depend on the binary package +RDEPENDS_${PN}-dev = "" +INSANE_SKIP_${PN}-dev = "staticdev" + +S = "${WORKDIR}/rustc-${PV}" + +DISABLE_STATIC = "" +INHIBIT_DEFAULT_RUST_DEPS = "1" + +do_compile () { + oe_runmake ${TARGET_SYS}/rt/libcompiler-rt.a +} + +do_install () { + mkdir -p ${D}${libdir} + cp ${TARGET_SYS}/rt/libcompiler-rt.a ${D}${libdir}/libcompiler-rt.a +} + +FILES_${PN}-dev = "" +FILES_${PN}-staticdev = "${libdir}/*.a" diff --git a/recipes-devtools/rust/compiler-rt_1.12.1.bb b/recipes-devtools/rust/compiler-rt_1.12.1.bb index c7ef3a0..8e08013 100644 --- a/recipes-devtools/rust/compiler-rt_1.12.1.bb +++ b/recipes-devtools/rust/compiler-rt_1.12.1.bb @@ -1,31 +1,2 @@ -SUMMARY = "Rust compiler run-time" -HOMEPAGE = "http://www.rust-lang.org" -SECTION = "devel" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://src/compiler-rt/LICENSE.TXT;md5=bf24bca27049b52e9738451aa55771d4" - -require rust.inc +require compiler-rt.inc require rust-source-${PV}.inc -ALLOW_EMPTY_${PN} = "1" - -DEPENDS += "rust-llvm-native (=${PV})" -# dev and staticdev should NOT depend on the binary package -RDEPENDS_${PN}-dev = "" -INSANE_SKIP_${PN}-dev = "staticdev" - -S = "${WORKDIR}/rustc-${PV}" - -DISABLE_STATIC = "" -INHIBIT_DEFAULT_RUST_DEPS = "1" - -do_compile () { - oe_runmake ${TARGET_SYS}/rt/libcompiler-rt.a -} - -do_install () { - mkdir -p ${D}${libdir} - cp ${TARGET_SYS}/rt/libcompiler-rt.a ${D}${libdir}/libcompiler-rt.a -} - -FILES_${PN}-dev = "" -FILES_${PN}-staticdev = "${libdir}/*.a" diff --git a/recipes-devtools/rust/libstd-rs.inc b/recipes-devtools/rust/libstd-rs.inc new file mode 100644 index 0000000..185ed63 --- /dev/null +++ b/recipes-devtools/rust/libstd-rs.inc @@ -0,0 +1,32 @@ +SUMMARY = "Rust standard libaries" +HOMEPAGE = "http://www.rust-lang.org" +SECTION = "devel" +LICENSE = "MIT | Apache-2.0" +LIC_FILES_CHKSUM ="file://COPYRIGHT;md5=43e1f1fb9c0ee3af66693d8c4fecafa8" + +S = "${WORKDIR}/rustc-${PV}" + +SRC_URI += "\ + crate://crates.io/gcc/0.3.27 \ +" + +DEPENDS += "compiler-rt (=${PV})" + +RUSTLIB_DEP = "" +inherit cargo + +# Needed so cargo can find libbacktrace +RUSTFLAGS += "-L ${STAGING_LIBDIR}" + +S = "${WORKDIR}/rustc-${PV}" + +do_compile_prepend () { + cd ${S}/src/rustc/std_shim + export CARGO_TARGET_DIR="${B}" + export RUSTC_BOOTSTRAP_KEY="${RS_KEY}" +} + +do_install () { + mkdir -p ${D}${rustlibdir} + cp ${B}/${TARGET_SYS}/release/deps/* ${D}${rustlibdir} +} diff --git a/recipes-devtools/rust/libstd-rs_1.12.1.bb b/recipes-devtools/rust/libstd-rs_1.12.1.bb index 0f2f8dc..3c12c86 100644 --- a/recipes-devtools/rust/libstd-rs_1.12.1.bb +++ b/recipes-devtools/rust/libstd-rs_1.12.1.bb @@ -1,34 +1,2 @@ -SUMMARY = "Rust standard libaries" -HOMEPAGE = "http://www.rust-lang.org" -SECTION = "devel" -LICENSE = "MIT | Apache-2.0" -LIC_FILES_CHKSUM ="file://COPYRIGHT;md5=43e1f1fb9c0ee3af66693d8c4fecafa8" - +require libstd-rs.inc require rust-source-${PV}.inc - -S = "${WORKDIR}/rustc-${PV}" - -SRC_URI += "\ - crate://crates.io/gcc/0.3.27 \ -" - -DEPENDS += "compiler-rt (=${PV})" - -RUSTLIB_DEP = "" -inherit cargo - -# Needed so cargo can find libbacktrace -RUSTFLAGS += "-L ${STAGING_LIBDIR}" - -S = "${WORKDIR}/rustc-${PV}" - -do_compile_prepend () { - cd ${S}/src/rustc/std_shim - export CARGO_TARGET_DIR="${B}" - export RUSTC_BOOTSTRAP_KEY="${RS_KEY}" -} - -do_install () { - mkdir -p ${D}${rustlibdir} - cp ${B}/${TARGET_SYS}/release/deps/* ${D}${rustlibdir} -} diff --git a/recipes-devtools/rust/rust-cross.inc b/recipes-devtools/rust/rust-cross.inc new file mode 100644 index 0000000..c350014 --- /dev/null +++ b/recipes-devtools/rust/rust-cross.inc @@ -0,0 +1,49 @@ +require rust.inc +inherit cross + +# Otherwise we'll depend on what we provide +INHIBIT_DEFAULT_RUST_DEPS = "1" + +# Unlike native (which nicely maps it's DEPENDS) cross wipes them out completely. +# Generally, we (and cross in general) need the same things that native needs, +# so it might make sense to take it's mapping. For now, though, we just mention +# the bits we need explicitly. +DEPENDS += "rust-llvm-native" +DEPENDS += "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}compilerlibs virtual/libc" +DEPENDS += "rust-native" + +PROVIDES = "virtual/${TARGET_PREFIX}rust" +PN = "rust-cross-${TARGET_ARCH}" + +# In the cross compilation case, rustc doesn't seem to get the rpath quite +# right. It manages to include '../../lib/${TARGET_PREFIX}', but doesn't +# include the '../../lib' (ie: relative path from cross_bindir to normal +# libdir. As a result, we end up not being able to properly reference files in normal ${libdir}. +# Most of the time this happens to work fine as the systems libraries are +# subsituted, but sometimes a host system will lack a library, or the right +# version of a library (libtinfo was how I noticed this). +# +# FIXME: this should really be fixed in rust itself. +# FIXME: using hard-coded relative paths is wrong, we should ask bitbake for +# the relative path between 2 of it's vars. +HOST_POST_LINK_ARGS_append = " -Wl,-rpath=../../lib" +BUILD_POST_LINK_ARGS_append = " -Wl,-rpath=../../lib" + +# We need the same thing for the calls to the compiler when building the runtime crap +TARGET_CC_ARCH_append = " --sysroot=${STAGING_DIR_TARGET}" + +do_configure () { +} + +do_compile () { +} + +do_install () { + mkdir -p ${D}${prefix}/${base_libdir_native}/rustlib + cp ${WORKDIR}/targets/${TARGET_SYS}.json ${D}${prefix}/${base_libdir_native}/rustlib +} + +rust_cross_sysroot_preprocess() { + sysroot_stage_dir ${D}${prefix}/${base_libdir_native}/rustlib ${SYSROOT_DESTDIR}${prefix}/${base_libdir_native}/rustlib +} +SYSROOT_PREPROCESS_FUNCS += "rust_cross_sysroot_preprocess" diff --git a/recipes-devtools/rust/rust-cross_1.12.1.bb b/recipes-devtools/rust/rust-cross_1.12.1.bb index 67b6f3c..ddc25d3 100644 --- a/recipes-devtools/rust/rust-cross_1.12.1.bb +++ b/recipes-devtools/rust/rust-cross_1.12.1.bb @@ -1,50 +1,2 @@ -require rust.inc -inherit cross +require rust-cross.inc require rust-source-${PV}.inc - -# Otherwise we'll depend on what we provide -INHIBIT_DEFAULT_RUST_DEPS = "1" - -# Unlike native (which nicely maps it's DEPENDS) cross wipes them out completely. -# Generally, we (and cross in general) need the same things that native needs, -# so it might make sense to take it's mapping. For now, though, we just mention -# the bits we need explicitly. -DEPENDS += "rust-llvm-native" -DEPENDS += "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}compilerlibs virtual/libc" -DEPENDS += "rust-native" - -PROVIDES = "virtual/${TARGET_PREFIX}rust" -PN = "rust-cross-${TARGET_ARCH}" - -# In the cross compilation case, rustc doesn't seem to get the rpath quite -# right. It manages to include '../../lib/${TARGET_PREFIX}', but doesn't -# include the '../../lib' (ie: relative path from cross_bindir to normal -# libdir. As a result, we end up not being able to properly reference files in normal ${libdir}. -# Most of the time this happens to work fine as the systems libraries are -# subsituted, but sometimes a host system will lack a library, or the right -# version of a library (libtinfo was how I noticed this). -# -# FIXME: this should really be fixed in rust itself. -# FIXME: using hard-coded relative paths is wrong, we should ask bitbake for -# the relative path between 2 of it's vars. -HOST_POST_LINK_ARGS_append = " -Wl,-rpath=../../lib" -BUILD_POST_LINK_ARGS_append = " -Wl,-rpath=../../lib" - -# We need the same thing for the calls to the compiler when building the runtime crap -TARGET_CC_ARCH_append = " --sysroot=${STAGING_DIR_TARGET}" - -do_configure () { -} - -do_compile () { -} - -do_install () { - mkdir -p ${D}${prefix}/${base_libdir_native}/rustlib - cp ${WORKDIR}/targets/${TARGET_SYS}.json ${D}${prefix}/${base_libdir_native}/rustlib -} - -rust_cross_sysroot_preprocess() { - sysroot_stage_dir ${D}${prefix}/${base_libdir_native}/rustlib ${SYSROOT_DESTDIR}${prefix}/${base_libdir_native}/rustlib -} -SYSROOT_PREPROCESS_FUNCS += "rust_cross_sysroot_preprocess" From fd46706b703704148b4505532fd6691b696b5ecf Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Fri, 27 Jan 2017 16:38:19 -0600 Subject: [PATCH 2/3] bump to Rust 1.14.0 (cherry picked from commit 22c971c2fa3f89cb1e752896854a92f43c71b518) --- recipes-devtools/rust/compiler-rt_1.14.0.bb | 2 + ...lt-target.json-path-libdir-rust-targ.patch | 106 ++++++++++++++++++ ...e-RUSTFLAGS-to-override-target-libs-.patch | 72 ++++++++++++ ...cal-workaround-for-NULL-__dso_handle.patch | 25 +++++ recipes-devtools/rust/libstd-rs.inc | 3 + recipes-devtools/rust/libstd-rs_1.14.0.bb | 2 + recipes-devtools/rust/rust-cross_1.14.0.bb | 2 + recipes-devtools/rust/rust-llvm_1.14.0.bb | 16 +++ recipes-devtools/rust/rust-source-1.14.0.inc | 20 ++++ recipes-devtools/rust/rust_1.14.0.bb | 17 +++ 10 files changed, 265 insertions(+) create mode 100644 recipes-devtools/rust/compiler-rt_1.14.0.bb create mode 100644 recipes-devtools/rust/files/rust-1.14.0/0001-Target-add-default-target.json-path-libdir-rust-targ.patch create mode 100644 recipes-devtools/rust/files/rust-1.14.0/0002-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch create mode 100644 recipes-devtools/rust/files/rust-1.14.0/0003-std-thread_local-workaround-for-NULL-__dso_handle.patch create mode 100644 recipes-devtools/rust/libstd-rs_1.14.0.bb create mode 100644 recipes-devtools/rust/rust-cross_1.14.0.bb create mode 100644 recipes-devtools/rust/rust-llvm_1.14.0.bb create mode 100644 recipes-devtools/rust/rust-source-1.14.0.inc create mode 100644 recipes-devtools/rust/rust_1.14.0.bb diff --git a/recipes-devtools/rust/compiler-rt_1.14.0.bb b/recipes-devtools/rust/compiler-rt_1.14.0.bb new file mode 100644 index 0000000..8e08013 --- /dev/null +++ b/recipes-devtools/rust/compiler-rt_1.14.0.bb @@ -0,0 +1,2 @@ +require compiler-rt.inc +require rust-source-${PV}.inc diff --git a/recipes-devtools/rust/files/rust-1.14.0/0001-Target-add-default-target.json-path-libdir-rust-targ.patch b/recipes-devtools/rust/files/rust-1.14.0/0001-Target-add-default-target.json-path-libdir-rust-targ.patch new file mode 100644 index 0000000..df6e0d8 --- /dev/null +++ b/recipes-devtools/rust/files/rust-1.14.0/0001-Target-add-default-target.json-path-libdir-rust-targ.patch @@ -0,0 +1,106 @@ +From 24b71f1ce87c1247d0e573d3dcba4686f237c817 Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Tue, 18 Nov 2014 01:40:21 -0500 +Subject: [PATCH 1/3] 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 | 12 ++++++++++-- + 3 files changed, 19 insertions(+), 7 deletions(-) + +diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs +index 63eabd5..6d002d0 100644 +--- a/src/librustc/session/config.rs ++++ b/src/librustc/session/config.rs +@@ -42,7 +42,7 @@ use std::fmt; + use std::hash::Hasher; + use std::collections::hash_map::DefaultHasher; + use std::iter::FromIterator; +-use std::path::PathBuf; ++use std::path::{Path, PathBuf}; + + pub struct Config { + pub target: Target, +@@ -1002,8 +1002,8 @@ pub fn build_configuration(sess: &Session, + v + } + +-pub fn build_target_config(opts: &Options, sp: &Handler) -> Config { +- let target = match Target::search(&opts.target_triple) { ++pub fn build_target_config(sysroot: &Path, opts: &Options, sp: &Handler) -> Config { ++ let target = match Target::search(sysroot, &opts.target_triple[..]) { + Ok(t) => t, + Err(e) => { + sp.struct_fatal(&format!("Error loading target specification: {}", e)) +diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs +index b4dadbf..72fa269 100644 +--- a/src/librustc/session/mod.rs ++++ b/src/librustc/session/mod.rs +@@ -564,13 +564,17 @@ pub fn build_session_(sopts: config::Options, + codemap: Rc, + cstore: Rc CrateStore<'a>>) + -> 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) => { + panic!(span_diagnostic.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, codemap); + 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 4d9315a..12aadab 100644 +--- a/src/librustc_back/target/mod.rs ++++ b/src/librustc_back/target/mod.rs +@@ -51,6 +51,7 @@ use std::io::prelude::*; + use syntax::abi::{Abi, lookup as lookup_abi}; + + use PanicStrategy; ++use std::path::Path; + + mod android_base; + mod apple_base; +@@ -604,12 +605,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 = File::open(path).map_err(|e| e.to_string())?; +@@ -640,8 +642,14 @@ impl Target { + .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.10.1 (Apple Git-78) + diff --git a/recipes-devtools/rust/files/rust-1.14.0/0002-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch b/recipes-devtools/rust/files/rust-1.14.0/0002-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch new file mode 100644 index 0000000..f4a983b --- /dev/null +++ b/recipes-devtools/rust/files/rust-1.14.0/0002-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch @@ -0,0 +1,72 @@ +From 52fa8537ae9073b81340a974c8eebb1b2fc2e1aa Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Tue, 18 Nov 2014 14:52:56 -0500 +Subject: [PATCH 2/3] 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 | 29 ++++++++++++----------------- + 1 file changed, 12 insertions(+), 17 deletions(-) + +diff --git a/mk/main.mk b/mk/main.mk +index fd0464a..755bf09 100644 +--- a/mk/main.mk ++++ b/mk/main.mk +@@ -403,32 +403,26 @@ define SREQ + HROOT$(1)_H_$(3) = $(3)/stage$(1) + HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin + +-ifeq ($$(CFG_WINDOWSY_$(3)),1) +-# On Windows we always store host runtime libraries in the 'bin' directory because +-# there's no rpath. Target libraries go under $CFG_LIBDIR_RELATIVE (usually 'lib'). +-HLIB_RELATIVE$(1)_H_$(3) = bin +-TROOT$(1)_T_$(2)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(CFG_LIBDIR_RELATIVE)/rustlib/$(2) +-# Remove the next 3 lines after a snapshot +-ifeq ($(1),0) +-RUSTFLAGS_STAGE0 += -L $$(TROOT$(1)_T_$(2)_H_$(3))/lib +-endif +- +-else +- +-ifeq ($(1),0) +-HLIB_RELATIVE$(1)_H_$(3) = lib +-else + HLIB_RELATIVE$(1)_H_$(3) = $$(CFG_LIBDIR_RELATIVE) +-endif ++ + TROOT$(1)_T_$(2)_H_$(3) = $$(HLIB$(1)_H_$(3))/rustlib/$(2) + +-endif + HLIB$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/$$(HLIB_RELATIVE$(1)_H_$(3)) + + # Destinations of artifacts for target architectures + 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)) +@@ -548,6 +542,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)) + + endef +-- +2.10.1 (Apple Git-78) + diff --git a/recipes-devtools/rust/files/rust-1.14.0/0003-std-thread_local-workaround-for-NULL-__dso_handle.patch b/recipes-devtools/rust/files/rust-1.14.0/0003-std-thread_local-workaround-for-NULL-__dso_handle.patch new file mode 100644 index 0000000..77b4054 --- /dev/null +++ b/recipes-devtools/rust/files/rust-1.14.0/0003-std-thread_local-workaround-for-NULL-__dso_handle.patch @@ -0,0 +1,25 @@ +From 719526b7227609733bc4400651e9919545934905 Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Wed, 3 Dec 2014 19:15:19 -0500 +Subject: [PATCH 3/3] std/thread_local: workaround for NULL __dso_handle + +--- + src/libstd/sys/unix/fast_thread_local.rs | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/libstd/sys/unix/fast_thread_local.rs b/src/libstd/sys/unix/fast_thread_local.rs +index 0c625e7..31e7146 100644 +--- a/src/libstd/sys/unix/fast_thread_local.rs ++++ b/src/libstd/sys/unix/fast_thread_local.rs +@@ -110,7 +110,7 @@ unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { + #[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.10.1 (Apple Git-78) + diff --git a/recipes-devtools/rust/libstd-rs.inc b/recipes-devtools/rust/libstd-rs.inc index 185ed63..0dafce5 100644 --- a/recipes-devtools/rust/libstd-rs.inc +++ b/recipes-devtools/rust/libstd-rs.inc @@ -23,7 +23,10 @@ S = "${WORKDIR}/rustc-${PV}" do_compile_prepend () { cd ${S}/src/rustc/std_shim export CARGO_TARGET_DIR="${B}" + # For Rust 1.12.1 and lower export RUSTC_BOOTSTRAP_KEY="${RS_KEY}" + # For Rust 1.13.0 and newer + export RUSTC_BOOTSTRAP="1" } do_install () { diff --git a/recipes-devtools/rust/libstd-rs_1.14.0.bb b/recipes-devtools/rust/libstd-rs_1.14.0.bb new file mode 100644 index 0000000..3c12c86 --- /dev/null +++ b/recipes-devtools/rust/libstd-rs_1.14.0.bb @@ -0,0 +1,2 @@ +require libstd-rs.inc +require rust-source-${PV}.inc diff --git a/recipes-devtools/rust/rust-cross_1.14.0.bb b/recipes-devtools/rust/rust-cross_1.14.0.bb new file mode 100644 index 0000000..ddc25d3 --- /dev/null +++ b/recipes-devtools/rust/rust-cross_1.14.0.bb @@ -0,0 +1,2 @@ +require rust-cross.inc +require rust-source-${PV}.inc diff --git a/recipes-devtools/rust/rust-llvm_1.14.0.bb b/recipes-devtools/rust/rust-llvm_1.14.0.bb new file mode 100644 index 0000000..12dd8e9 --- /dev/null +++ b/recipes-devtools/rust/rust-llvm_1.14.0.bb @@ -0,0 +1,16 @@ +require rust-llvm.inc +require rust-source-${PV}.inc + +LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=43fdaa303c1c5589ad60f4ffc6a0b9ce" + +do_install_prepend () { + # the install does a sed on this without installing the file + # we don't need it for anything + mkdir -p "${D}/usr/share/llvm/cmake" + touch "${D}/usr/share/llvm/cmake/LLVMExports-noconfig.cmake" +} + +do_install_append () { + # we don't need any of this stuff to build Rust + rm -rf "${D}/usr/lib/cmake" +} diff --git a/recipes-devtools/rust/rust-source-1.14.0.inc b/recipes-devtools/rust/rust-source-1.14.0.inc new file mode 100644 index 0000000..1a55687 --- /dev/null +++ b/recipes-devtools/rust/rust-source-1.14.0.inc @@ -0,0 +1,20 @@ +# Specifics for Rust 1.14.0 + +## This is information on the rust-snapshot (binary) used to build our current release. +## snapshot info is taken from rust/src/stage0.txt +## TODO: find a way to add additional SRC_URIs based on the contents of an +## earlier SRC_URI. +RS_VERSION = "1.13.0" + +RUST_SNAPSHOT = "rustc-${RS_VERSION}-${RUST_BUILD_SYS}" + +# These are x86_64-unknown-linux-gnu hashes, how can we add more? +SRC_URI[rust-snapshot.md5sum] = "1400262e1529f94a12d2f5c77cc67782" +SRC_URI[rust-snapshot.sha256sum] = "0b092ba6750be89aad32b231ad9c625a11b040fae3cad5aa3ef32aaf213332d4" + +SRC_URI += "\ + https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ + " +SRC_URI[rust.md5sum] = "00b6bb5b465e7bd89c541eea99876cdc" +SRC_URI[rust.sha256sum] = "c790edd2e915bd01bea46122af2942108479a2fda9a6f76d1094add520ac3b6b" + diff --git a/recipes-devtools/rust/rust_1.14.0.bb b/recipes-devtools/rust/rust_1.14.0.bb new file mode 100644 index 0000000..704f66f --- /dev/null +++ b/recipes-devtools/rust/rust_1.14.0.bb @@ -0,0 +1,17 @@ +require rust.inc +require rust-source-${PV}.inc + +SRC_URI += " \ + file://rust-${PV}/0001-Target-add-default-target.json-path-libdir-rust-targ.patch \ + file://rust-${PV}/0002-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch \ + file://rust-${PV}/0003-std-thread_local-workaround-for-NULL-__dso_handle.patch \ + " + +DEPENDS += "rust-llvm (=${PV})" + +# Otherwise we'll depend on what we provide +INHIBIT_DEFAULT_RUST_DEPS_class-native = "1" +# We don't need to depend on gcc-native because yocto assumes it exists +PROVIDES_class-native = "virtual/${TARGET_PREFIX}rust" + +BBCLASSEXTEND = "native" From 3898e8eef56bf9b74b48a3ef67acd57baf6172c4 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 30 Jan 2017 21:15:09 -0600 Subject: [PATCH 3/3] rust-llvm: fix LICENSE.TXT checksum --- recipes-devtools/rust/rust-llvm.inc | 2 +- recipes-devtools/rust/rust-llvm_1.14.0.bb | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/recipes-devtools/rust/rust-llvm.inc b/recipes-devtools/rust/rust-llvm.inc index 2706ae3..d4d9b37 100644 --- a/recipes-devtools/rust/rust-llvm.inc +++ b/recipes-devtools/rust/rust-llvm.inc @@ -3,7 +3,7 @@ LICENSE = "NCSA" S = "${WORKDIR}/rustc-${PV}/src/llvm" -LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=4c0bc17c954e99fd547528d938832bfa" +LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=b99eb43c934ceebecab85c6b9b1a08be" inherit cmake pythonnative diff --git a/recipes-devtools/rust/rust-llvm_1.14.0.bb b/recipes-devtools/rust/rust-llvm_1.14.0.bb index 12dd8e9..761ec19 100644 --- a/recipes-devtools/rust/rust-llvm_1.14.0.bb +++ b/recipes-devtools/rust/rust-llvm_1.14.0.bb @@ -1,8 +1,6 @@ require rust-llvm.inc require rust-source-${PV}.inc -LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=43fdaa303c1c5589ad60f4ffc6a0b9ce" - do_install_prepend () { # the install does a sed on this without installing the file # we don't need it for anything