From b2e6f98f3e069d5e8e6294ff076bdb20a9caa752 Mon Sep 17 00:00:00 2001 From: Derek Straka Date: Mon, 22 Aug 2016 08:38:02 -0400 Subject: [PATCH 001/112] libgit2: remove recipe that is now in meta-openembedded Signed-off-by: Derek Straka --- recipes-deps/libgit2/libgit2-release.inc | 3 --- recipes-deps/libgit2/libgit2.inc | 19 ------------------- recipes-deps/libgit2/libgit2_0.24.1.bb | 4 ---- 3 files changed, 26 deletions(-) delete mode 100644 recipes-deps/libgit2/libgit2-release.inc delete mode 100644 recipes-deps/libgit2/libgit2.inc delete mode 100644 recipes-deps/libgit2/libgit2_0.24.1.bb diff --git a/recipes-deps/libgit2/libgit2-release.inc b/recipes-deps/libgit2/libgit2-release.inc deleted file mode 100644 index a1c2a19..0000000 --- a/recipes-deps/libgit2/libgit2-release.inc +++ /dev/null @@ -1,3 +0,0 @@ -require libgit2.inc -SRC_URI = "https://github.com/libgit2/libgit2/archive/v${PV}.tar.gz" - diff --git a/recipes-deps/libgit2/libgit2.inc b/recipes-deps/libgit2/libgit2.inc deleted file mode 100644 index e0ef390..0000000 --- a/recipes-deps/libgit2/libgit2.inc +++ /dev/null @@ -1,19 +0,0 @@ -SUMMARY = "the Git linkable library" -HOMEPAGE = "http://libgit2.github.com/" -LICENSE = "GPL-2.0-with-GCC-exception" - -DEPENDS = "openssl zlib" - -inherit cmake - -# CLAR = tests, needs python-native -EXTRA_OECMAKE = "\ - -DTHREADSAFE=ON \ - -DBUILD_CLAR=OFF \ - -DSHA1_TYPE="builtin" \ - -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DBUILD_SHARED_LIBS=OFF \ - -DBUILD_EXAMPLES=OFF \ -" - -BBCLASSEXTEND = "native" diff --git a/recipes-deps/libgit2/libgit2_0.24.1.bb b/recipes-deps/libgit2/libgit2_0.24.1.bb deleted file mode 100644 index 2d0c6ff..0000000 --- a/recipes-deps/libgit2/libgit2_0.24.1.bb +++ /dev/null @@ -1,4 +0,0 @@ -LIC_FILES_CHKSUM = "file://COPYING;md5=34197a479f637beb9e09e56893f48bc2" -SRC_URI[md5sum] = "3674ca2d40388b1175e25b6f5a3a82ad" -SRC_URI[sha256sum] = "60198cbb34066b9b5c1613d15c0479f6cd25f4aef42f7ec515cd1cc13a77fede" -require libgit2-release.inc From af571adabef1ff16627bfe6040125a82e77e501e Mon Sep 17 00:00:00 2001 From: Derek Straka Date: Mon, 22 Aug 2016 08:38:34 -0400 Subject: [PATCH 002/112] libssh2: remove recipe append that is now in meta-openembedded Signed-off-by: Derek Straka --- recipes-deps/libssh2/libssh2_%.bbappend | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 recipes-deps/libssh2/libssh2_%.bbappend diff --git a/recipes-deps/libssh2/libssh2_%.bbappend b/recipes-deps/libssh2/libssh2_%.bbappend deleted file mode 100644 index ce4807e..0000000 --- a/recipes-deps/libssh2/libssh2_%.bbappend +++ /dev/null @@ -1,2 +0,0 @@ -# meta-oe/recipes-support/libssh2 -BBCLASSEXTEND = "native" From ec3cbddb38313176d4be9c29f292e413a875c5f2 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Sat, 27 Aug 2016 12:18:32 -0400 Subject: [PATCH 003/112] Rebase patches for 1.10.0 --- .../0000-rust-llvm-remove-extra-slash.patch | 11 -- ...Add-config-for-musl-based-arm-builds.patch | 4 +- ...lt-target.json-path-libdir-rust-targ.patch | 30 ++-- ...e-RUSTFLAGS-to-override-target-libs-.patch | 25 +-- ...4-mk-add-missing-CFG_LIBDIR_RELATIVE.patch | 6 +- ...t-bindir-and-extend-libdir-to-non-bl.patch | 120 ++++++-------- ...cal-workaround-for-NULL-__dso_handle.patch | 10 +- ...mk-install-use-disable-rewrite-paths.patch | 8 +- ...rriding-crate_hash-with-C-crate_hash.patch | 60 +++++++ ...e-crate-metadata-from-symbol-hashing.patch | 28 ---- ...form.mk-pass-C-crate_hash-to-builds.patch} | 12 +- ...-the-platform-configuration-source-.patch} | 22 +-- ...-.note.rustc-look-more-like-debug-in.patch | 156 ------------------ ...rriding-crate_hash-with-C-crate_hash.patch | 80 --------- ...note-interpretation-of-rustc-dylib-m.patch | 96 +++++++++++ .../files/rust/fix-urandom-during-init.patch | 42 ----- recipes-devtools/rust/rust-source.bb | 17 +- recipes-devtools/rust/rust-version.inc | 2 +- recipes-devtools/rust/rust.inc | 2 +- 19 files changed, 273 insertions(+), 458 deletions(-) delete mode 100644 recipes-devtools/rust/files/rust-llvm/0000-rust-llvm-remove-extra-slash.patch create mode 100644 recipes-devtools/rust/files/rust/0008-Allow-overriding-crate_hash-with-C-crate_hash.patch delete mode 100644 recipes-devtools/rust/files/rust/0009-Remove-crate-metadata-from-symbol-hashing.patch rename recipes-devtools/rust/files/rust/{0012-mk-platform.mk-pass-C-crate_hash-to-builds.patch => 0009-mk-platform.mk-pass-C-crate_hash-to-builds.patch} (69%) rename recipes-devtools/rust/files/rust/{0013-mk-allow-changing-the-platform-configuration-source-.patch => 0010-mk-allow-changing-the-platform-configuration-source-.patch} (72%) delete mode 100644 recipes-devtools/rust/files/rust/0010-rustc_trans-make-.note.rustc-look-more-like-debug-in.patch delete mode 100644 recipes-devtools/rust/files/rust/0011-Allow-overriding-crate_hash-with-C-crate_hash.patch create mode 100644 recipes-devtools/rust/files/rust/0011-Get-rid-of-the-.note-interpretation-of-rustc-dylib-m.patch delete mode 100644 recipes-devtools/rust/files/rust/fix-urandom-during-init.patch diff --git a/recipes-devtools/rust/files/rust-llvm/0000-rust-llvm-remove-extra-slash.patch b/recipes-devtools/rust/files/rust-llvm/0000-rust-llvm-remove-extra-slash.patch deleted file mode 100644 index 66d7078..0000000 --- a/recipes-devtools/rust/files/rust-llvm/0000-rust-llvm-remove-extra-slash.patch +++ /dev/null @@ -1,11 +0,0 @@ -+++ llvm/src/llvm/include/llvm/CodeGen/CommandFlags.h.orig 2016-01-18 19:18:03.847470845 +0000 -+++ llvm/src/llvm/include/llvm/CodeGen/CommandFlags.h 2016-01-18 19:18:11.211408270 +0000 -@@ -21,7 +21,7 @@ - #include "llvm/IR/Intrinsics.h" - #include "llvm/IR/Module.h" - #include "llvm/MC/MCTargetOptionsCommandFlags.h" --#include "llvm//MC/SubtargetFeature.h" -+#include "llvm/MC/SubtargetFeature.h" - #include "llvm/Support/CodeGen.h" - #include "llvm/Support/CommandLine.h" - #include "llvm/Support/Host.h" diff --git a/recipes-devtools/rust/files/rust/0001-Add-config-for-musl-based-arm-builds.patch b/recipes-devtools/rust/files/rust/0001-Add-config-for-musl-based-arm-builds.patch index 29d896e..d8459c0 100644 --- a/recipes-devtools/rust/files/rust/0001-Add-config-for-musl-based-arm-builds.patch +++ b/recipes-devtools/rust/files/rust/0001-Add-config-for-musl-based-arm-builds.patch @@ -1,7 +1,7 @@ -From 185c77dbb5708bed7c916b8e01ff867b6c215bfb Mon Sep 17 00:00:00 2001 +From 69b65762ccdf459143fc273a39b0a0e0c6d8fe3e Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Mon, 2 May 2016 19:57:46 -0400 -Subject: [PATCH] Add config for musl-based arm builds +Subject: [PATCH 01/11] Add config for musl-based arm builds --- mk/cfg/arm-unknown-linux-musleabi.mk | 26 ++++++++++++++++++++++++++ diff --git a/recipes-devtools/rust/files/rust/0002-Target-add-default-target.json-path-libdir-rust-targ.patch b/recipes-devtools/rust/files/rust/0002-Target-add-default-target.json-path-libdir-rust-targ.patch index 14b0d65..eded81d 100644 --- a/recipes-devtools/rust/files/rust/0002-Target-add-default-target.json-path-libdir-rust-targ.patch +++ b/recipes-devtools/rust/files/rust/0002-Target-add-default-target.json-path-libdir-rust-targ.patch @@ -1,7 +1,7 @@ -From 3237afb78f960c015025186166f1c0998c00c6a6 Mon Sep 17 00:00:00 2001 +From 0535c75086a9c170d8d4d99b3030d9136ea6e2c7 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 02/11] Target: add default target.json path: $libdir/rust/targets --- @@ -11,7 +11,7 @@ Subject: [PATCH 2/9] Target: add default target.json path: 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs -index c4697eb..4cc059b 100644 +index da5555d..6cd0ea9 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -35,7 +35,7 @@ use getopts; @@ -21,9 +21,9 @@ index c4697eb..4cc059b 100644 -use std::path::PathBuf; +use std::path::{Path, PathBuf}; - use llvm; - -@@ -711,8 +711,8 @@ pub fn build_configuration(sess: &Session) -> ast::CrateConfig { + pub struct Config { + pub target: Target, +@@ -787,8 +787,8 @@ pub fn build_configuration(sess: &Session) -> ast::CrateConfig { v } @@ -35,10 +35,10 @@ index c4697eb..4cc059b 100644 Err(e) => { panic!(sp.fatal(&format!("Error loading target specification: {}", e))); diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs -index 2f3af1c..6424cff 100644 +index 907241d..d0e3743 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs -@@ -429,13 +429,17 @@ pub fn build_session_(sopts: config::Options, +@@ -470,13 +470,17 @@ pub fn build_session_(sopts: config::Options, codemap: Rc, cstore: Rc CrateStore<'a>>) -> Session { @@ -59,19 +59,19 @@ index 2f3af1c..6424cff 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 5114910..636a1aa 100644 +index 2163a8a..38607f0 100644 --- a/src/librustc_back/target/mod.rs +++ b/src/librustc_back/target/mod.rs -@@ -49,6 +49,8 @@ use serialize::json::Json; +@@ -48,6 +48,8 @@ use serialize::json::Json; use std::default::Default; use std::io::prelude::*; - use syntax::abi; + use syntax::abi::Abi; +use std::borrow::ToOwned; +use std::path::Path; mod android_base; mod apple_base; -@@ -366,12 +368,13 @@ impl Target { +@@ -477,12 +479,13 @@ impl Target { /// /// The error string could come from any of the APIs called, including /// filesystem access and JSON decoding. @@ -85,8 +85,8 @@ index 5114910..636a1aa 100644 + use std::iter::IntoIterator; fn load_file(path: &Path) -> Result { - let mut f = try!(File::open(path).map_err(|e| e.to_string())); -@@ -470,8 +473,14 @@ impl Target { + let mut f = File::open(path).map_err(|e| e.to_string())?; +@@ -513,8 +516,14 @@ impl Target { .unwrap_or(OsString::new()); // FIXME 16351: add a sane default search path? @@ -103,5 +103,5 @@ index 5114910..636a1aa 100644 if p.is_file() { return load_file(&p); -- -2.4.10 +2.7.4 diff --git a/recipes-devtools/rust/files/rust/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch b/recipes-devtools/rust/files/rust/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch index 855c90d..3eb103a 100644 --- a/recipes-devtools/rust/files/rust/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch +++ b/recipes-devtools/rust/files/rust/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch @@ -1,21 +1,22 @@ -From 3254ad1d84b177eb960219c2bce26f8980a511e1 Mon Sep 17 00:00:00 2001 +From 4290b8f28222824a558ac4471d26fe88b2889a5b 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 03/11] 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 | 30 +++++++++++++----------------- - 1 file changed, 13 insertions(+), 17 deletions(-) + mk/main.mk | 29 ++++++++++++----------------- + 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/mk/main.mk b/mk/main.mk -index 963c12f..04b3e25 100644 +index c47020c..fcf1409 100644 --- a/mk/main.mk +++ b/mk/main.mk -@@ -383,32 +383,26 @@ define SREQ +@@ -403,32 +403,26 @@ define SREQ HROOT$(1)_H_$(3) = $(3)/stage$(1) HBIN$(1)_H_$(3) = $$(HROOT$(1)_H_$(3))/bin @@ -59,15 +60,7 @@ index 963c12f..04b3e25 100644 # Preqrequisites for using the stageN compiler ifeq ($(1),0) HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) -@@ -520,6 +514,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) := \ -@@ -528,6 +523,7 @@ PERF_STAGE$(1)_T_$(2)_H_$(3) := \ +@@ -536,6 +530,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)) \ @@ -76,5 +69,5 @@ index 963c12f..04b3e25 100644 endef -- -2.4.10 +2.7.4 diff --git a/recipes-devtools/rust/files/rust/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch b/recipes-devtools/rust/files/rust/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch index 8985bd1..20f2084 100644 --- a/recipes-devtools/rust/files/rust/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch +++ b/recipes-devtools/rust/files/rust/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch @@ -1,7 +1,7 @@ -From 004ddead436887fe99bfa9d0d25f6cdaf9f6148b Mon Sep 17 00:00:00 2001 +From 06b8c4bc8f7056d604d8ef4d699273cc1dd39025 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 04/11] mk: add missing CFG_LIBDIR_RELATIVE --- mk/grammar.mk | 4 ++-- @@ -23,5 +23,5 @@ index 0d527bd..926f247 100644 ifeq ($(CFG_OSTYPE),apple-darwin) FLEX_LDFLAGS=-ll -- -2.4.10 +2.7.4 diff --git a/recipes-devtools/rust/files/rust/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch b/recipes-devtools/rust/files/rust/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch index 19aa938..6553285 100644 --- a/recipes-devtools/rust/files/rust/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch +++ b/recipes-devtools/rust/files/rust/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch @@ -1,7 +1,7 @@ -From 93ef6b8b93c7695280aba7f3541bf8f1ae18c722 Mon Sep 17 00:00:00 2001 +From 0365e3349e373b95fcf4260ba5bcf70ada6328cf 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 05/11] configure: support --bindir, and extend libdir to non-blessed dirs Adds --bindir, and: @@ -13,55 +13,61 @@ relative to sysroot, and allows libdir to end in an arbitrary directory Note that this assumes absolute paths start with '/', which may break windows platforms --- - configure | 44 ++++++++++++++++++++----- + configure | 51 ++++++++++++++++++++++++----- mk/host.mk | 6 +++- mk/main.mk | 11 +++++++ - mk/perf.mk | 4 +-- mk/prepare.mk | 27 +++++++--------- src/librustc/session/filesearch.rs | 66 ++++++++++++++++---------------------- src/librustc_trans/back/link.rs | 3 +- - 7 files changed, 94 insertions(+), 67 deletions(-) + 6 files changed, 99 insertions(+), 65 deletions(-) diff --git a/configure b/configure -index 287b7b3..7d53a66 100755 +index d417896..e3b7c20 100755 --- a/configure +++ b/configure -@@ -334,6 +334,32 @@ enable_if_not_disabled() { +@@ -342,6 +342,39 @@ enable_if_not_disabled() { fi } +abspath () { -+ case "$1" in -+ /*) echo "$1" ;; -+ *) echo "$PWD/$1" ;; -+ esac ++ case "$1" in ++ /*) echo "$1" ;; ++ *) echo "$PWD/$1" ;; ++ esac +} + +relpath () { -+ local src=$(abspath "$1") -+ local dst=$(abspath "$2") -+ local common=$src -+ local result= ++ 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 ++ # 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" ++ local down="${dst#"$common"}" ++ result="${result}${down#/}" ++ echo "$result" +} + ++to_llvm_triple() { ++ case $1 in ++ i686-w64-mingw32) echo i686-pc-windows-gnu ;; ++ x86_64-w64-mingw32) echo x86_64-pc-windows-gnu ;; ++ *) echo $1 ;; ++ esac ++} + - to_llvm_triple() { + to_gnu_triple() { case $1 in - i686-w64-mingw32) echo i686-pc-windows-gnu ;; -@@ -652,18 +678,19 @@ 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) + i686-pc-windows-gnu) echo i686-w64-mingw32 ;; +@@ -656,18 +689,19 @@ valopt_nosave host "${CFG_BUILD}" "GNUs ./configure syntax LLVM host triples" + valopt_nosave target "${CFG_HOST}" "GNUs ./configure syntax LLVM target triples" + valopt_nosave mandir "${CFG_PREFIX}/share/man" "install man pages in PATH" +CFG_LIBDIR_RELATIVE=lib + @@ -87,7 +93,7 @@ index 287b7b3..7d53a66 100755 if [ $HELP -eq 1 ] then -@@ -1760,6 +1787,7 @@ putvar CFG_PREFIX +@@ -1762,6 +1796,7 @@ putvar CFG_PREFIX putvar CFG_HOST putvar CFG_TARGET putvar CFG_LIBDIR_RELATIVE @@ -96,7 +102,7 @@ index 287b7b3..7d53a66 100755 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 +index d17479b..a95f886 100644 --- a/mk/host.mk +++ b/mk/host.mk @@ -59,9 +59,13 @@ endef @@ -115,10 +121,10 @@ index 59a0095..b8e8345 100644 endef diff --git a/mk/main.mk b/mk/main.mk -index 04b3e25..ba11e5e 100644 +index fcf1409..1c663ee 100644 --- a/mk/main.mk +++ b/mk/main.mk -@@ -351,7 +351,9 @@ export CFG_RELEASE_CHANNEL +@@ -368,7 +368,9 @@ export CFG_RELEASE_CHANNEL export CFG_LLVM_ROOT export CFG_PREFIX export CFG_LIBDIR @@ -128,7 +134,7 @@ index 04b3e25..ba11e5e 100644 export CFG_DISABLE_INJECT_STD_VERSION ifdef CFG_DISABLE_UNSTABLE_FEATURES CFG_INFO := $(info cfg: disabling unstable features (CFG_DISABLE_UNSTABLE_FEATURES)) -@@ -381,7 +383,16 @@ define SREQ +@@ -401,7 +403,16 @@ define SREQ # Destinations of artifacts for the host compiler HROOT$(1)_H_$(3) = $(3)/stage$(1) @@ -145,31 +151,11 @@ index 04b3e25..ba11e5e 100644 HLIB_RELATIVE$(1)_H_$(3) = $$(CFG_LIBDIR_RELATIVE) -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 87a4450..c358bbc 100644 +index 20e20e9..efaec75 100644 --- a/mk/prepare.mk +++ b/mk/prepare.mk -@@ -90,8 +90,6 @@ PREPARE_TOOLS = $(filter-out compiletest rustbook error-index-generator, $(TOOLS +@@ -90,8 +90,6 @@ PREPARE_TOOLS = $(filter-out compiletest rustbook error_index_generator, $(TOOLS # $(3) is host # $(4) tag define DEF_PREPARE_HOST_TOOL @@ -189,7 +175,7 @@ index 87a4450..c358bbc 100644 +prepare-host-lib-$(1)-$(2)-$(3)-$(4): PREPARE_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR) +prepare-host-lib-$(1)-$(2)-$(3)-$(4): PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR) prepare-host-lib-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \ - $$(foreach dep,$$(RUST_DEPS_$(1)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4)) \ + $$(foreach dep,$$(RUST_DEPS_$(1)_T_$(3)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4)) \ $$(HLIB$(2)_H_$(3))/stamp.$(1) \ @@ -138,14 +134,10 @@ endef # $(4) tag @@ -208,7 +194,7 @@ index 87a4450..c358bbc 100644 +prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_SOURCE_BIN_DIR=$$(PREPARE_SOURCE_LIB_DIR)/rustlib/$(3)/bin +prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(3)/bin prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \ - $$(foreach crate,$$(TARGET_CRATES), \ + $$(foreach crate,$$(TARGET_CRATES_$(2)), \ $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \ @@ -198,9 +190,12 @@ INSTALL_DEBUGGER_SCRIPT_COMMANDS=$(if $(findstring windows,$(1)),\ @@ -226,10 +212,10 @@ index 87a4450..c358bbc 100644 prepare-base-$(1)-target: prepare-target-$(1) diff --git a/src/librustc/session/filesearch.rs b/src/librustc/session/filesearch.rs -index 09c6b54..00736c6 100644 +index a3eea32..e5e449d 100644 --- a/src/librustc/session/filesearch.rs +++ b/src/librustc/session/filesearch.rs -@@ -124,7 +124,7 @@ impl<'a> FileSearch<'a> { +@@ -123,7 +123,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); @@ -238,7 +224,7 @@ index 09c6b54..00736c6 100644 p.push(&rustlibdir()); p.push(&self.triple); p.push("bin"); -@@ -132,8 +132,8 @@ impl<'a> FileSearch<'a> { +@@ -131,8 +131,8 @@ impl<'a> FileSearch<'a> { } } @@ -249,7 +235,7 @@ index 09c6b54..00736c6 100644 assert!(p.is_relative()); p.push(&rustlibdir()); p.push(target_triple); -@@ -143,7 +143,19 @@ pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf +@@ -142,7 +142,19 @@ pub fn relative_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf fn make_target_lib_path(sysroot: &Path, target_triple: &str) -> PathBuf { @@ -270,7 +256,7 @@ index 09c6b54..00736c6 100644 } pub fn get_or_default_sysroot() -> PathBuf { -@@ -161,44 +173,22 @@ pub fn get_or_default_sysroot() -> PathBuf { +@@ -160,44 +172,22 @@ pub fn get_or_default_sysroot() -> PathBuf { } match canonicalize(env::current_exe().ok()) { @@ -287,7 +273,7 @@ index 09c6b54..00736c6 100644 + } + p + } - None => panic!("can't determine value for sysroot") + None => bug!("can't determine value for sysroot") } } @@ -328,10 +314,10 @@ index 09c6b54..00736c6 100644 // The name of rustc's own place to organize libraries. // Used to be "rustc", now the default is "rustlib" diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs -index ec1383f..670d637 100644 +index 53cc031..222d447 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs -@@ -1042,11 +1042,10 @@ fn link_args(cmd: &mut Linker, +@@ -819,11 +819,10 @@ fn link_args(cmd: &mut Linker, // where extern libraries might live, based on the // addl_lib_search_paths if sess.opts.cg.rpath { @@ -345,5 +331,5 @@ index ec1383f..670d637 100644 path.push(&tlib); -- -2.4.10 +2.7.4 diff --git a/recipes-devtools/rust/files/rust/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch b/recipes-devtools/rust/files/rust/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch index bb8a16c..162404f 100644 --- a/recipes-devtools/rust/files/rust/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch +++ b/recipes-devtools/rust/files/rust/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch @@ -1,17 +1,17 @@ -From 8b088363a61a627fd8a31318d15164113f081660 Mon Sep 17 00:00:00 2001 +From f7441b3080088d8131d106c59c3543b22c9e8211 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 06/11] 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 ca0f103..5851127 100644 +index 6b54ec8..5b41b75 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs -@@ -324,7 +324,7 @@ pub mod elf { +@@ -346,7 +346,7 @@ pub mod elf { #[linkage = "extern_weak"] static __cxa_thread_atexit_impl: *const libc::c_void; } @@ -21,5 +21,5 @@ index ca0f103..5851127 100644 arg: *mut u8, dso_handle: *mut u8) -> libc::c_int; -- -2.4.10 +2.7.4 diff --git a/recipes-devtools/rust/files/rust/0007-mk-install-use-disable-rewrite-paths.patch b/recipes-devtools/rust/files/rust/0007-mk-install-use-disable-rewrite-paths.patch index 24135ec..a07d455 100644 --- a/recipes-devtools/rust/files/rust/0007-mk-install-use-disable-rewrite-paths.patch +++ b/recipes-devtools/rust/files/rust/0007-mk-install-use-disable-rewrite-paths.patch @@ -1,7 +1,7 @@ -From 1a9ada8070bb9cd293cfb93913721c68ca0b7766 Mon Sep 17 00:00:00 2001 +From a73a748cd73920380ae1f069be91ff833e99d003 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 07/11] mk/install: use disable-rewrite-paths This stops the install scripts from doing work we've already handled. @@ -11,7 +11,7 @@ Path rewriting is only useful for prepackaged binary installers. 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mk/install.mk b/mk/install.mk -index af6f3ff..430add7 100644 +index d2e5449..e67650b 100644 --- a/mk/install.mk +++ b/mk/install.mk @@ -12,7 +12,9 @@ RUN_INSTALLER = cd tmp/empty_dir && \ @@ -26,5 +26,5 @@ index af6f3ff..430add7 100644 install: ifeq (root user, $(USER) $(patsubst %,user,$(SUDO_USER))) -- -2.4.10 +2.7.4 diff --git a/recipes-devtools/rust/files/rust/0008-Allow-overriding-crate_hash-with-C-crate_hash.patch b/recipes-devtools/rust/files/rust/0008-Allow-overriding-crate_hash-with-C-crate_hash.patch new file mode 100644 index 0000000..858b440 --- /dev/null +++ b/recipes-devtools/rust/files/rust/0008-Allow-overriding-crate_hash-with-C-crate_hash.patch @@ -0,0 +1,60 @@ +From 042a5df36597c2c6c23900667ae1b4299279092f Mon Sep 17 00:00:00 2001 +From: Steven Walter +Date: Wed, 18 Nov 2015 08:33:26 -0500 +Subject: [PATCH 08/11] Allow overriding crate_hash with -C crate_hash + +The current crate hash is not stable from run-to-run. This causes +problems with bitbake; it needs a guarantee that every build with the +same input will generate compatible output, otherwise sstate won't work. +Using -C crate_hash, we can do that by using the bitbake input hash to +determine the crate hash; the bitbake input hash will be stable, but +still different for different rust recipes. +--- + src/librustc/session/config.rs | 2 ++ + src/librustc_trans/back/link.rs | 12 +++++++++++- + 2 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs +index 6cd0ea9..f90398d 100644 +--- a/src/librustc/session/config.rs ++++ b/src/librustc/session/config.rs +@@ -585,6 +585,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options, + "choose the code model to use (llc -code-model for details)"), + metadata: Vec = (Vec::new(), parse_list, + "metadata to mangle symbol names with"), ++ crate_hash: String = ("".to_string(), parse_string, ++ "override crate hash with given value"), + extra_filename: String = ("".to_string(), parse_string, + "extra data to put in each output filename"), + codegen_units: usize = (1, parse_uint, +diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs +index 222d447..e951476 100644 +--- a/src/librustc_trans/back/link.rs ++++ b/src/librustc_trans/back/link.rs +@@ -125,12 +125,22 @@ pub fn find_crate_name(sess: Option<&Session>, + + } + ++use std::hash::{Hasher, SipHasher}; ++use rustc::hir::svh::Svh; ++ + pub fn build_link_meta<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + name: &str) + -> LinkMeta { ++ let crate_hash = if tcx.sess.opts.cg.crate_hash != "" { ++ let mut state = SipHasher::new(); ++ state.write(tcx.sess.opts.cg.crate_hash.as_bytes()); ++ Svh::new(state.finish()) ++ } else { ++ tcx.calculate_krate_hash() ++ }; + let r = LinkMeta { + crate_name: name.to_owned(), +- crate_hash: tcx.calculate_krate_hash(), ++ crate_hash: crate_hash, + }; + info!("{:?}", r); + return r; +-- +2.7.4 + diff --git a/recipes-devtools/rust/files/rust/0009-Remove-crate-metadata-from-symbol-hashing.patch b/recipes-devtools/rust/files/rust/0009-Remove-crate-metadata-from-symbol-hashing.patch deleted file mode 100644 index ff7db6b..0000000 --- a/recipes-devtools/rust/files/rust/0009-Remove-crate-metadata-from-symbol-hashing.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 8e359ae2b44fe2edd863e460346554c73f460ba7 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 670d637..4e7150e 100644 ---- a/src/librustc_trans/back/link.rs -+++ b/src/librustc_trans/back/link.rs -@@ -213,11 +213,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(&tcx.sess.cstore.encode_type(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-devtools/rust/files/rust/0012-mk-platform.mk-pass-C-crate_hash-to-builds.patch b/recipes-devtools/rust/files/rust/0009-mk-platform.mk-pass-C-crate_hash-to-builds.patch similarity index 69% rename from recipes-devtools/rust/files/rust/0012-mk-platform.mk-pass-C-crate_hash-to-builds.patch rename to recipes-devtools/rust/files/rust/0009-mk-platform.mk-pass-C-crate_hash-to-builds.patch index 7e86b07..10832d0 100644 --- a/recipes-devtools/rust/files/rust/0012-mk-platform.mk-pass-C-crate_hash-to-builds.patch +++ b/recipes-devtools/rust/files/rust/0009-mk-platform.mk-pass-C-crate_hash-to-builds.patch @@ -1,7 +1,7 @@ -From 7abedc46cad6b52d44badaf88350d41ef907cd4c Mon Sep 17 00:00:00 2001 +From 44ee7a68f44132ebe32ac486355945131c7a2b83 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Wed, 18 Nov 2015 08:41:17 -0500 -Subject: [PATCH 12/12] mk/platform.mk: pass -C crate_hash to builds +Subject: [PATCH 09/11] mk/platform.mk: pass -C crate_hash to builds bitbake recipe will export FORCE_CRATE_HASH --- @@ -9,17 +9,17 @@ bitbake recipe will export FORCE_CRATE_HASH 1 file changed, 1 insertion(+) diff --git a/mk/platform.mk b/mk/platform.mk -index eb693b8..e6317b5 100644 +index c264462..b959d59 100644 --- a/mk/platform.mk +++ b/mk/platform.mk -@@ -187,6 +187,7 @@ define CFG_MAKE_TOOLCHAIN +@@ -181,6 +181,7 @@ define CFG_MAKE_TOOLCHAIN + AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1)) LINK_$(1)=$(CROSS_PREFIX_$(1))$(LINK_$(1)) RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(LINK_$(1))) \ - -C objcopy=$$(call FIND_COMPILER,$$(OBJCOPY_$(1))) \ + -C crate_hash=$(FORCE_CRATE_HASH) \ -C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1)) RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1)) -- -1.9.1 +2.7.4 diff --git a/recipes-devtools/rust/files/rust/0013-mk-allow-changing-the-platform-configuration-source-.patch b/recipes-devtools/rust/files/rust/0010-mk-allow-changing-the-platform-configuration-source-.patch similarity index 72% rename from recipes-devtools/rust/files/rust/0013-mk-allow-changing-the-platform-configuration-source-.patch rename to recipes-devtools/rust/files/rust/0010-mk-allow-changing-the-platform-configuration-source-.patch index 33b127c..e6f8f3c 100644 --- a/recipes-devtools/rust/files/rust/0013-mk-allow-changing-the-platform-configuration-source-.patch +++ b/recipes-devtools/rust/files/rust/0010-mk-allow-changing-the-platform-configuration-source-.patch @@ -1,7 +1,7 @@ -From f3e8bd9ab353d4b3d7432a02e37a22eed24b5e57 Mon Sep 17 00:00:00 2001 +From 8efc27cfdbebcfb0e544ce1b7ee242955af0f68a Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Thu, 4 Feb 2016 10:44:23 -0500 -Subject: [PATCH] mk: allow changing the platform configuration source +Subject: [PATCH 10/11] mk: allow changing the platform configuration source directory --- @@ -10,18 +10,18 @@ Subject: [PATCH] mk: allow changing the platform configuration source 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/configure b/configure -index 7d53a66..5d40516 100755 +index 7747850..f5224ca 100755 --- a/configure +++ b/configure -@@ -671,6 +671,7 @@ valopt_nosave local-rust-root "/usr/local" "set prefix for local rust binary" +@@ -663,6 +663,7 @@ valopt_nosave local-rust-root "/usr/local" "set prefix for local rust binary" valopt_nosave host "${CFG_BUILD}" "GNUs ./configure syntax LLVM host triples" valopt_nosave target "${CFG_HOST}" "GNUs ./configure syntax LLVM target triples" valopt_nosave mandir "${CFG_PREFIX}/share/man" "install man pages in PATH" +valopt_nosave platform-cfg "${CFG_SRC_DIR}/mk/cfg" "Location platform configuration for non-rust code" - # Temporarily support old triples until buildbots get updated - CFG_BUILD=$(to_llvm_triple $CFG_BUILD) -@@ -1127,7 +1128,7 @@ CFG_MANDIR=${CFG_MANDIR%/} + CFG_LIBDIR_RELATIVE=lib + +@@ -1084,7 +1085,7 @@ CFG_MANDIR=${CFG_MANDIR%/} CFG_HOST="$(echo $CFG_HOST | tr ',' ' ')" CFG_TARGET="$(echo $CFG_TARGET | tr ',' ' ')" CFG_SUPPORTED_TARGET="" @@ -30,7 +30,7 @@ index 7d53a66..5d40516 100755 CFG_SUPPORTED_TARGET="${CFG_SUPPORTED_TARGET} $(basename "$target_file" .mk)" done -@@ -1795,6 +1796,7 @@ putvar CFG_I686_LINUX_ANDROID_NDK +@@ -1780,6 +1781,7 @@ putvar CFG_I686_LINUX_ANDROID_NDK putvar CFG_NACL_CROSS_PATH putvar CFG_MANDIR putvar CFG_USING_LIBCPP @@ -39,10 +39,10 @@ index 7d53a66..5d40516 100755 # Avoid spurious warnings from clang by feeding it original source on # ccache-miss rather than preprocessed input. diff --git a/mk/platform.mk b/mk/platform.mk -index e6317b5..68a20e1 100644 +index b959d59..bddd203 100644 --- a/mk/platform.mk +++ b/mk/platform.mk -@@ -114,7 +114,7 @@ $(foreach cvar,CC CXX CPP CFLAGS CXXFLAGS CPPFLAGS, \ +@@ -97,7 +97,7 @@ $(foreach cvar,CC CXX CPP CFLAGS CXXFLAGS CPPFLAGS, \ CFG_RLIB_GLOB=lib$(1)-*.rlib @@ -52,5 +52,5 @@ index e6317b5..68a20e1 100644 define ADD_INSTALLED_OBJECTS INSTALLED_OBJECTS_$(1) += $$(CFG_INSTALLED_OBJECTS_$(1)) -- -2.7.0 +2.7.4 diff --git a/recipes-devtools/rust/files/rust/0010-rustc_trans-make-.note.rustc-look-more-like-debug-in.patch b/recipes-devtools/rust/files/rust/0010-rustc_trans-make-.note.rustc-look-more-like-debug-in.patch deleted file mode 100644 index e45d899..0000000 --- a/recipes-devtools/rust/files/rust/0010-rustc_trans-make-.note.rustc-look-more-like-debug-in.patch +++ /dev/null @@ -1,156 +0,0 @@ -From 04eee951641b9d9c580ee21c481bdf979dc2fe30 Mon Sep 17 00:00:00 2001 -From: Steven Walter -Date: Tue, 7 Jul 2015 16:49:44 -0400 -Subject: [PATCH 10/12] rustc_trans: make .note.rustc look more like debug info - -Mark the global variable as const and private so the resulting section -is not flagged as writable and to avoid putting an unnecessary symbol in -the dynamic table of shared objects. - -Unfortunately there doesn't seem to be a way to avoid the section being -marked SHF_ALLOC when declared as a variable in LLVM. Hack around that -by using objcopy to clear the flags on the section before the final -link. - -This places the section at the end of the executable so it can be -stripped later without rearranging important code/data sections. ---- - mk/platform.mk | 1 + - src/librustc/session/config.rs | 2 ++ - src/librustc_back/target/mod.rs | 4 ++++ - src/librustc_trans/back/link.rs | 36 ++++++++++++++++++++++++++++++++++++ - src/librustc_trans/trans/base.rs | 3 +++ - 5 files changed, 46 insertions(+) - -diff --git a/mk/platform.mk b/mk/platform.mk -index 5239086..eb693b8 100644 ---- a/mk/platform.mk -+++ b/mk/platform.mk -@@ -186,6 +186,7 @@ define CFG_MAKE_TOOLCHAIN - AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1)) - LINK_$(1)=$(CROSS_PREFIX_$(1))$(LINK_$(1)) - RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(LINK_$(1))) \ -+ -C objcopy=$$(call FIND_COMPILER,$$(OBJCOPY_$(1))) \ - -C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1)) - - RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1)) -diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs -index 4cc059b..600cb4b 100644 ---- a/src/librustc/session/config.rs -+++ b/src/librustc/session/config.rs -@@ -497,6 +497,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options, - CG_OPTIONS, cg_type_desc, cgsetters, - ar: Option = (None, parse_opt_string, - "tool to assemble archives with"), -+ objcopy: Option = (None, parse_opt_string, -+ "system objcopy for manipulating objects"), - linker: Option = (None, parse_opt_string, - "system linker to link outputs with"), - link_args: Option> = (None, parse_opt_list, -diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs -index 636a1aa..1b87a7a 100644 ---- a/src/librustc_back/target/mod.rs -+++ b/src/librustc_back/target/mod.rs -@@ -118,6 +118,8 @@ pub struct TargetOptions { - /// Linker arguments that are unconditionally passed *after* any - /// user-defined libraries. - pub post_link_args: Vec, -+ /// Path to objcopy. Defaults to "objcopy". -+ pub objcopy: String, - - /// Default CPU to pass to LLVM. Corresponds to `llc -mcpu=$cpu`. Defaults - /// to "default". -@@ -213,6 +215,7 @@ impl Default for TargetOptions { - ar: option_env!("CFG_DEFAULT_AR").unwrap_or("ar").to_string(), - pre_link_args: Vec::new(), - post_link_args: Vec::new(), -+ objcopy: "objcopy".to_string(), - cpu: "generic".to_string(), - features: "".to_string(), - dynamic_linking: false, -@@ -331,6 +334,7 @@ impl Target { - key!(cpu); - key!(ar); - key!(linker); -+ key!(objcopy); - key!(relocation_model); - key!(code_model); - key!(dll_prefix); -diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs -index 4e7150e..0d8a125 100644 ---- a/src/librustc_trans/back/link.rs -+++ b/src/librustc_trans/back/link.rs -@@ -394,6 +394,13 @@ fn command_path(sess: &Session) -> OsString { - env::join_paths(new_path).unwrap() - } - -+pub fn get_objcopy_prog(sess: &Session) -> String { -+ match sess.opts.cg.objcopy { -+ Some(ref objcopy) => return objcopy.to_string(), -+ None => sess.target.target.options.objcopy.clone(), -+ } -+} -+ - pub fn remove(sess: &Session, path: &Path) { - match fs::remove_file(path) { - Ok(..) => {} -@@ -928,6 +935,32 @@ fn link_natively(sess: &Session, dylib: bool, - } - } - -+fn fix_meta_section_attributes(sess: &Session, meta_name: &PathBuf) { -+ // First, fix up the note section attributes. We want the SHF_ALLOC and -+ // SHF_WRITE flags to be unset so the section will get placed near the -+ // end along with the debug info. This allows the section to be -+ // stripped later without renumbering important sections that -+ // contain code and data. -+ let objcopy = get_objcopy_prog(sess); -+ let mut o_cmd = Command::new(&objcopy); -+ o_cmd.arg("--rename-section") -+ .arg(".note.rustc=.note.rustc,contents,noload,readonly") -+ .arg(&meta_name); -+ // Invoke objcopy -+ info!("{:?}", o_cmd); -+ match o_cmd.status() { -+ Ok(exitstatus) => { -+ if !exitstatus.success() { -+ sess.err(&format!("objcopy failed with exit code {:?}", exitstatus.code())); -+ } -+ }, -+ Err(exitstatus) => { -+ sess.err(&format!("objcopy failed: {}", exitstatus)); -+ } -+ } -+ sess.abort_if_errors(); -+} -+ - fn link_args(cmd: &mut Linker, - sess: &Session, - dylib: bool, -@@ -960,6 +993,9 @@ fn link_args(cmd: &mut Linker, - // executable. This metadata is in a separate object file from the main - // object file, so we link that in here. - if dylib { -+ let meta_name = outputs.with_extension("metadata.o"); -+ -+ fix_meta_section_attributes(sess, &meta_name); - cmd.add_object(&outputs.with_extension("metadata.o")); - } - -diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs -index 4c619f8..2b68767 100644 ---- a/src/librustc_trans/trans/base.rs -+++ b/src/librustc_trans/trans/base.rs -@@ -2924,6 +2924,9 @@ pub fn write_metadata<'a, 'tcx>(cx: &SharedCrateContext<'a, 'tcx>, - }; - unsafe { - llvm::LLVMSetInitializer(llglobal, llconst); -+ llvm::LLVMSetGlobalConstant(llglobal, llvm::True); -+ llvm::LLVMSetUnnamedAddr(llglobal, llvm::True); -+ llvm::SetLinkage(llglobal, llvm::Linkage::PrivateLinkage); - let name = - cx.tcx().sess.cstore.metadata_section_name(&cx.sess().target.target); - let name = CString::new(name).unwrap(); --- -1.9.1 - diff --git a/recipes-devtools/rust/files/rust/0011-Allow-overriding-crate_hash-with-C-crate_hash.patch b/recipes-devtools/rust/files/rust/0011-Allow-overriding-crate_hash-with-C-crate_hash.patch deleted file mode 100644 index 2229bdc..0000000 --- a/recipes-devtools/rust/files/rust/0011-Allow-overriding-crate_hash-with-C-crate_hash.patch +++ /dev/null @@ -1,80 +0,0 @@ -From b6805ab1099ca824bb516da4f1825a7e4ce30153 Mon Sep 17 00:00:00 2001 -From: Steven Walter -Date: Wed, 18 Nov 2015 08:33:26 -0500 -Subject: [PATCH 11/12] Allow overriding crate_hash with -C crate_hash - -The current crate hash is not stable from run-to-run. This causes -problems with bitbake; it needs a guarantee that every build with the -same input will generate compatible output, otherwise sstate won't work. -Using -C crate_hash, we can do that by using the bitbake input hash to -determine the crate hash; the bitbake input hash will be stable, but -still different for different rust recipes. ---- - src/librustc/session/config.rs | 2 ++ - src/librustc_trans/back/link.rs | 28 ++++++++++++++++++++++++++-- - 2 files changed, 28 insertions(+), 2 deletions(-) - -diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs -index 600cb4b..3570e78 100644 ---- a/src/librustc/session/config.rs -+++ b/src/librustc/session/config.rs -@@ -537,6 +537,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options, - "choose the code model to use (llc -code-model for details)"), - metadata: Vec = (Vec::new(), parse_list, - "metadata to mangle symbol names with"), -+ crate_hash: String = ("".to_string(), parse_string, -+ "override crate hash with given value"), - extra_filename: String = ("".to_string(), parse_string, - "extra data to put in each output filename"), - codegen_units: usize = (1, parse_uint, -diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs -index 0d8a125..9917a1e 100644 ---- a/src/librustc_trans/back/link.rs -+++ b/src/librustc_trans/back/link.rs -@@ -45,7 +45,7 @@ use std::str; - use flate; - use serialize::hex::ToHex; - use syntax::ast; --use syntax::codemap::Span; -+use syntax::codemap::{Span,BytePos,NO_EXPANSION}; - use syntax::parse::token::{self, InternedString}; - use syntax::attr::AttrMetaMethods; - -@@ -186,9 +186,33 @@ pub fn build_link_meta(sess: &Session, - krate: &hir::Crate, - name: &str) - -> LinkMeta { -+ use std::collections::BTreeMap; -+ let crate_hash = if sess.opts.cg.crate_hash != "" { -+ let dummy_span = Span { -+ lo: BytePos(0), -+ hi: BytePos(0), -+ expn_id: NO_EXPANSION -+ }; -+ let dummy_module = hir::Mod { -+ inner: dummy_span, -+ item_ids: hir::HirVec::new() -+ }; -+ let dummy_krate = hir::Crate { -+ module: dummy_module, -+ attrs: hir::HirVec::new(), -+ config: hir::CrateConfig::new(), -+ span: dummy_span, -+ exported_macros: hir::HirVec::new(), -+ items: BTreeMap::new() -+ }; -+ -+ Svh::calculate(&vec!(sess.opts.cg.crate_hash.clone()), &dummy_krate) -+ } else { -+ Svh::calculate(&sess.opts.cg.metadata, krate) -+ }; - let r = LinkMeta { - crate_name: name.to_owned(), -- crate_hash: Svh::calculate(&sess.opts.cg.metadata, krate), -+ crate_hash: crate_hash, - }; - info!("{:?}", r); - return r; --- -1.9.1 - diff --git a/recipes-devtools/rust/files/rust/0011-Get-rid-of-the-.note-interpretation-of-rustc-dylib-m.patch b/recipes-devtools/rust/files/rust/0011-Get-rid-of-the-.note-interpretation-of-rustc-dylib-m.patch new file mode 100644 index 0000000..be4fe58 --- /dev/null +++ b/recipes-devtools/rust/files/rust/0011-Get-rid-of-the-.note-interpretation-of-rustc-dylib-m.patch @@ -0,0 +1,96 @@ +From 9c76c93de35fb45ed18e75827649e299d8c4e94e Mon Sep 17 00:00:00 2001 +From: Eduard Burtescu +Date: Sun, 14 Aug 2016 11:16:28 +0300 +Subject: [PATCH 11/11] Get rid of the .note interpretation of rustc dylib + metadata. + +--- + src/librustc_metadata/loader.rs | 41 ++++++++++++++++++----------------------- + src/librustc_trans/base.rs | 13 ++++++++++--- + 2 files changed, 28 insertions(+), 26 deletions(-) + +diff --git a/src/librustc_metadata/loader.rs b/src/librustc_metadata/loader.rs +index dc10391..9430b70 100644 +--- a/src/librustc_metadata/loader.rs ++++ b/src/librustc_metadata/loader.rs +@@ -875,34 +875,29 @@ fn get_metadata_section_imp(target: &Target, flavor: CrateFlavor, filename: &Pat + } + + pub fn meta_section_name(target: &Target) -> &'static str { ++ // Historical note: ++ // ++ // When using link.exe it was seen that the section name `.note.rustc` ++ // was getting shortened to `.note.ru`, and according to the PE and COFF ++ // specification: ++ // ++ // > Executable images do not use a string table and do not support ++ // > section names longer than 8 characters ++ // ++ // https://msdn.microsoft.com/en-us/library/windows/hardware/gg463119.aspx ++ // ++ // As a result, we choose a slightly shorter name! As to why ++ // `.note.rustc` works on MinGW, that's another good question... ++ + if target.options.is_like_osx { +- "__DATA,__note.rustc" +- } else if target.options.is_like_msvc { +- // When using link.exe it was seen that the section name `.note.rustc` +- // was getting shortened to `.note.ru`, and according to the PE and COFF +- // specification: +- // +- // > Executable images do not use a string table and do not support +- // > section names longer than 8 characters +- // +- // https://msdn.microsoft.com/en-us/library/windows/hardware/gg463119.aspx +- // +- // As a result, we choose a slightly shorter name! As to why +- // `.note.rustc` works on MinGW, that's another good question... +- ".rustc" ++ "__DATA,.rustc" + } else { +- ".note.rustc" ++ ".rustc" + } + } + +-pub fn read_meta_section_name(target: &Target) -> &'static str { +- if target.options.is_like_osx { +- "__note.rustc" +- } else if target.options.is_like_msvc { +- ".rustc" +- } else { +- ".note.rustc" +- } ++pub fn read_meta_section_name(_target: &Target) -> &'static str { ++ ".rustc" + } + + // A diagnostic function for dumping crate metadata to an output stream +diff --git a/src/librustc_trans/base.rs b/src/librustc_trans/base.rs +index d4f0786..93c9d1a 100644 +--- a/src/librustc_trans/base.rs ++++ b/src/librustc_trans/base.rs +@@ -2523,10 +2523,17 @@ pub fn write_metadata<'a, 'tcx>(cx: &SharedCrateContext<'a, 'tcx>, + }; + unsafe { + llvm::LLVMSetInitializer(llglobal, llconst); +- let name = ++ let section_name = + cx.tcx().sess.cstore.metadata_section_name(&cx.sess().target.target); +- let name = CString::new(name).unwrap(); +- llvm::LLVMSetSection(llglobal, name.as_ptr()) ++ let name = CString::new(section_name).unwrap(); ++ llvm::LLVMSetSection(llglobal, name.as_ptr()); ++ ++ // Also generate a .section directive to force no ++ // flags, at least for ELF outputs, so that the ++ // metadata doesn't get loaded into memory. ++ let directive = format!(".section {}", section_name); ++ let directive = CString::new(directive).unwrap(); ++ llvm::LLVMSetModuleInlineAsm(cx.metadata_llmod(), directive.as_ptr()) + } + return metadata; + } +-- +2.7.4 + diff --git a/recipes-devtools/rust/files/rust/fix-urandom-during-init.patch b/recipes-devtools/rust/files/rust/fix-urandom-during-init.patch deleted file mode 100644 index 07cc2ac..0000000 --- a/recipes-devtools/rust/files/rust/fix-urandom-during-init.patch +++ /dev/null @@ -1,42 +0,0 @@ -rust: don't block before random pool is initialized - -Upstream-Status: Backport [See https://github.com/rust-lang/rust/pull/33086] - -Signed-off-by: Derek Straka ---- ./src/libstd/rand/os.rs.orig 2016-08-18 13:14:25.908309986 -0400 -+++ ./src/libstd/rand/os.rs 2016-08-18 13:14:11.316560875 -0400 -@@ -46,8 +46,10 @@ - #[cfg(target_arch = "aarch64")] - const NR_GETRANDOM: libc::c_long = 278; - -+ const GRND_NONBLOCK: libc::c_uint = 0x0001; -+ - unsafe { -- libc::syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(), 0) -+ libc::syscall(NR_GETRANDOM, buf.as_mut_ptr(), buf.len(), GRND_NONBLOCK) - } - } - -@@ -69,7 +71,20 @@ - let err = errno() as libc::c_int; - if err == libc::EINTR { - continue; -- } else { -+ } else if err == libc::EAGAIN { -+ // if getrandom() returns EAGAIN it would have blocked -+ // because the non-blocking pool (urandom) has not -+ // initialized in the kernel yet due to a lack of entropy -+ // the fallback we do here is to avoid blocking applications -+ // which could depend on this call without ever knowing -+ // they do and don't have a work around. The PRNG of -+ // /dev/urandom will still be used but not over a completely -+ // full entropy pool -+ let reader = File::open("/dev/urandom").expect("Unable to open /dev/urandom"); -+ let mut reader_rng = ReaderRng::new(reader); -+ reader_rng.fill_bytes(& mut v[read..]); -+ read += v.len() as usize; -+ } else { - panic!("unexpected getrandom error: {}", err); - } - } else { - diff --git a/recipes-devtools/rust/rust-source.bb b/recipes-devtools/rust/rust-source.bb index 1245601..cbc3a39 100644 --- a/recipes-devtools/rust/rust-source.bb +++ b/recipes-devtools/rust/rust-source.bb @@ -8,24 +8,21 @@ inherit shared-source-provide require rust-version.inc require rust-release.inc -SRC_URI[rust.md5sum] = "15f1c204580017838301c5c8568e8f3f" -SRC_URI[rust.sha256sum] = "6df96059d87b718676d9cd879672e4e22418b6093396b4ccb5b5b66df37bf13a" +SRC_URI[rust.md5sum] = "a48fef30353fc9daa70b484b690ce5db" +SRC_URI[rust.sha256sum] = "a4015aacf4f6d8a8239253c4da46e7abaa8584f8214d1828d2ff0a8f56176869" LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=eb87dba71cb424233bcce88db3ae2f1a" SRC_URI_append = "\ + file://rust/0001-Add-config-for-musl-based-arm-builds.patch \ file://rust/0002-Target-add-default-target.json-path-libdir-rust-targ.patch \ file://rust/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch \ file://rust/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \ file://rust/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch \ file://rust/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch \ file://rust/0007-mk-install-use-disable-rewrite-paths.patch \ - file://rust/0009-Remove-crate-metadata-from-symbol-hashing.patch \ - file://rust/0010-rustc_trans-make-.note.rustc-look-more-like-debug-in.patch \ - file://rust/0011-Allow-overriding-crate_hash-with-C-crate_hash.patch \ - file://rust/0012-mk-platform.mk-pass-C-crate_hash-to-builds.patch \ - file://rust/0013-mk-allow-changing-the-platform-configuration-source-.patch \ - file://rust-llvm/0000-rust-llvm-remove-extra-slash.patch \ + file://rust/0008-Allow-overriding-crate_hash-with-C-crate_hash.patch \ + file://rust/0009-mk-platform.mk-pass-C-crate_hash-to-builds.patch \ + file://rust/0010-mk-allow-changing-the-platform-configuration-source-.patch \ + file://rust/0011-Get-rid-of-the-.note-interpretation-of-rustc-dylib-m.patch \ file://rust-installer/0001-add-option-to-disable-rewriting-of-install-paths.patch;patchdir=src/rust-installer \ - file://rust/0001-Add-config-for-musl-based-arm-builds.patch \ - file://rust/fix-urandom-during-init.patch \ " diff --git a/recipes-devtools/rust/rust-version.inc b/recipes-devtools/rust/rust-version.inc index aa9a1df..53ea335 100644 --- a/recipes-devtools/rust/rust-version.inc +++ b/recipes-devtools/rust/rust-version.inc @@ -1,6 +1,6 @@ # Note: if you adjust this, you'll also need to change the hashes in # rust-source.bb SOURCE_NAME = "rust" -PV = "1.7.0" +PV = "1.10.0" LICENSE = "MIT | Apache-2.0" diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index ddbc7ec..54727f1 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -4,7 +4,7 @@ inherit rust-installer require rust-shared-source.inc require rust-snapshot-2015-12-18.inc -LIC_FILES_CHKSUM ="file://COPYRIGHT;md5=9c5a05eab0ffc3590e50db38c51d1425" +LIC_FILES_CHKSUM ="file://COPYRIGHT;md5=43e1f1fb9c0ee3af66693d8c4fecafa8" SUMMARY = "Rust compiler and runtime libaries" HOMEPAGE = "http://www.rust-lang.org" From b708837c7c8fc2701d58d50b6a34e4c98c3280c9 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Sat, 27 Aug 2016 15:22:55 -0400 Subject: [PATCH 004/112] rust-llvm: skip unittests These fail to build, apparently because some files do not include the appropriate headers, e.g. and --- .../0001-Don-t-build-unittests.patch | 34 +++++++++++++++++++ recipes-devtools/rust/rust-source.bb | 1 + 2 files changed, 35 insertions(+) create mode 100644 recipes-devtools/rust/files/rust-llvm/0001-Don-t-build-unittests.patch diff --git a/recipes-devtools/rust/files/rust-llvm/0001-Don-t-build-unittests.patch b/recipes-devtools/rust/files/rust-llvm/0001-Don-t-build-unittests.patch new file mode 100644 index 0000000..7a297d3 --- /dev/null +++ b/recipes-devtools/rust/files/rust-llvm/0001-Don-t-build-unittests.patch @@ -0,0 +1,34 @@ +From eee79cc95f57434c4b530da96c88494e9b5d056b Mon Sep 17 00:00:00 2001 +From: Steven Walter +Date: Sat, 27 Aug 2016 13:20:48 -0400 +Subject: [PATCH] Don't build unittests + +--- + Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index 2b9468a..2bb30f6 100644 +--- a/Makefile ++++ b/Makefile +@@ -31,7 +31,7 @@ ifeq ($(BUILD_DIRS_ONLY),1) + OPTIONAL_DIRS := tools/clang/utils/TableGen + else + DIRS := lib/Support lib/TableGen utils lib/IR lib tools/llvm-shlib \ +- tools/llvm-config tools docs cmake unittests ++ tools/llvm-config tools docs cmake + OPTIONAL_DIRS := projects bindings + endif + +@@ -39,7 +39,7 @@ ifeq ($(BUILD_EXAMPLES),1) + OPTIONAL_DIRS += examples + endif + +-EXTRA_DIST := test unittests llvm.spec include win32 Xcode ++EXTRA_DIST := test llvm.spec include win32 Xcode + + include $(LEVEL)/Makefile.config + +-- +2.7.4 + diff --git a/recipes-devtools/rust/rust-source.bb b/recipes-devtools/rust/rust-source.bb index cbc3a39..ebf5eb4 100644 --- a/recipes-devtools/rust/rust-source.bb +++ b/recipes-devtools/rust/rust-source.bb @@ -24,5 +24,6 @@ SRC_URI_append = "\ file://rust/0009-mk-platform.mk-pass-C-crate_hash-to-builds.patch \ file://rust/0010-mk-allow-changing-the-platform-configuration-source-.patch \ file://rust/0011-Get-rid-of-the-.note-interpretation-of-rustc-dylib-m.patch \ + file://rust-llvm/0001-Don-t-build-unittests.patch;patchdir=src/llvm \ file://rust-installer/0001-add-option-to-disable-rewriting-of-install-paths.patch;patchdir=src/rust-installer \ " From 3d0fab8860a6a89deff24661fe0cd0e180daeac4 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Sat, 27 Aug 2016 13:31:55 -0400 Subject: [PATCH 005/112] Rework support for downloading the stage0 rustc Rust does something fairly different than in 1.7. Instead of just expecting the tarball to exist, it either expects an already extracted and ready toolchain, or else it does everything itself. To work with that, we'll always pass --use-local-rust to ./configure so that bootstrap.py doesn't try to download anything. We'll either download and setup a snapshot ourselves, or use the system rust, based on PACKAGECONFIG[local-rust] as before --- .../rust/rust-snapshot-2015-12-18.inc | 14 ----------- .../rust/rust-snapshot-2016-05-24.inc | 13 +++++++++++ recipes-devtools/rust/rust.inc | 23 +++++++++---------- 3 files changed, 24 insertions(+), 26 deletions(-) delete mode 100644 recipes-devtools/rust/rust-snapshot-2015-12-18.inc create mode 100644 recipes-devtools/rust/rust-snapshot-2016-05-24.inc diff --git a/recipes-devtools/rust/rust-snapshot-2015-12-18.inc b/recipes-devtools/rust/rust-snapshot-2015-12-18.inc deleted file mode 100644 index a970791..0000000 --- a/recipes-devtools/rust/rust-snapshot-2015-12-18.inc +++ /dev/null @@ -1,14 +0,0 @@ -## 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-12-18" -RS_SRCHASH = "3391630" -# linux-x86_64 -RS_ARCH = "linux-x86_64" -RS_HASH = "97e2a5eb8904962df8596e95d6e5d9b574d73bf4" - -RUST_SNAPSHOT = "rust-stage0-${RS_DATE}-${RS_SRCHASH}-${RS_ARCH}-${RS_HASH}.tar.bz2" - -SRC_URI[rust-snapshot.md5sum] = "5c29eb06c8b6ce6ff52f544f31efabe1" -SRC_URI[rust-snapshot.sha256sum] = "a8dc5203673ce43f47316beb02ee0c427edb7bbde2ab5fc662a06b52db2950e7" - diff --git a/recipes-devtools/rust/rust-snapshot-2016-05-24.inc b/recipes-devtools/rust/rust-snapshot-2016-05-24.inc new file mode 100644 index 0000000..765daeb --- /dev/null +++ b/recipes-devtools/rust/rust-snapshot-2016-05-24.inc @@ -0,0 +1,13 @@ +## snapshot info 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_DATE = "2016-05-24" +RS_VERSION = "1.9.0" +RS_ARCH = "x86_64-unknown-linux-gnu" + +RUST_SNAPSHOT = "rustc-${RS_VERSION}-${RS_ARCH}.tar.gz" +RUST_SNAPSHOT_URI = "https://static.rust-lang.org/dist/${RS_DATE}/${RUST_SNAPSHOT}" + +SRC_URI[rust-snapshot.md5sum] = "f1cf6d2fe15e4be18a08259f1540a4ae" +SRC_URI[rust-snapshot.sha256sum] = "d0704d10237c66c3efafa6f7e5570c59a1d3fe5c6d99487540f90ebb37cd84c4" + diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index 54727f1..8cdaeab 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -2,7 +2,7 @@ inherit rust inherit rust-installer require rust-shared-source.inc -require rust-snapshot-2015-12-18.inc +require rust-snapshot-2016-05-24.inc LIC_FILES_CHKSUM ="file://COPYRIGHT;md5=43e1f1fb9c0ee3af66693d8c4fecafa8" @@ -25,7 +25,9 @@ PACKAGECONFIG ??= "" # to have rust-cross built using rust-native. PACKAGECONFIG[local-rust] = "" -SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'local-rust', '', 'https://static.rust-lang.org/stage0-snapshots/${RUST_SNAPSHOT};unpack=0;name=rust-snapshot', d)}" +FETCH_STAGE0 = "${@bb.utils.contains('PACKAGECONFIG', 'local-rust', 'false', 'true', d)}" + +SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'local-rust', '', '${RUST_SNAPSHOT_URI};unpack=0;name=rust-snapshot', d)}" # We generate local targets, and need to be able to locate them export RUST_TARGET_PATH="${WORKDIR}/targets/" @@ -389,15 +391,16 @@ do_configure () { # where we're reinstalling the compiler. May want to try for a real # path based on bitbake vars # Also will be wrong when relative libdir and/or bindir aren't 'bin' and 'lib'. - local_maybe_enable=disable local_rust_root=/not/set/do/not/use - if which rustc >/dev/null 2>&1; then + if ${FETCH_STAGE0}; then + mkdir -p dl + tar -xf ${WORKDIR}/${RUST_SNAPSHOT} -C dl + ./dl/rustc-${RS_VERSION}-${RS_ARCH}/install.sh --prefix=$PWD/dl + local_rust_root="$PWD/dl" + elif which rustc >/dev/null 2>&1; then local_rustc=$(which rustc) if [ -n "$local_rustc" ]; then local_rust_root=$(dirname $(dirname $local_rustc)) - if [ -e "$local_rust_root/bin/rustc" ]; then - local_maybe_enable=enable - fi fi fi @@ -426,7 +429,7 @@ do_configure () { "--libdir=${libdir}" \ "--bindir=${bindir}" \ "--platform-cfg=${WORKDIR}/mk-cfg/" \ - ${@bb.utils.contains('PACKAGECONFIG', 'local-rust', '--$local_maybe_enable-local-rust --local-rust-root=$local_rust_root', '--local-rust-root=/not/a/dir', d)} \ + "--enable-local-rust --local-rust-root=$local_rust_root" \ ${EXTRA_OECONF} } @@ -446,10 +449,6 @@ rust_runmake () { } do_compile () { - if ${@bb.utils.contains('PACKAGECONFIG', 'local-rust', 'false', 'true', d)}; then - mkdir -p dl - cp -f ${WORKDIR}/${RUST_SNAPSHOT} dl - fi rust_runmake } From 0a1d85272d24266e9e575b7ab1e462e593b56768 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Sun, 28 Aug 2016 14:13:19 -0400 Subject: [PATCH 006/112] Revert "rust: drop unnecessary data layout targets" Rust 1.10.0 requires the data-layout field This reverts commit d749cbb98acc1a43cb4293536ed5cccde16893b2. --- recipes-devtools/rust/rust.inc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index 8cdaeab..3c7d7fa 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -128,31 +128,35 @@ def llvm_features_from_cc_arch(d): return ','.join(f) ## arm-unknown-linux-gnueabihf +DATA_LAYOUT[arm] = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32" LLVM_TARGET[arm] = "${RUST_TARGET_SYS}" TARGET_ENDIAN[arm] = "little" TARGET_POINTER_WIDTH[arm] = "32" FEATURES[arm] = "+v6,+vfp2" PRE_LINK_ARGS[arm] = "-Wl,--as-needed" -## aarch64-unknown-linux-gnu +DATA_LAYOUT[aarch64] = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-n32:64-S128" LLVM_TARGET[aarch64] = "aarch64-unknown-linux-gnu" TARGET_ENDIAN[aarch64] = "little" TARGET_POINTER_WIDTH[aarch64] = "64" PRE_LINK_ARGS[aarch64] = "-Wl,--as-needed" ## x86_64-unknown-linux-gnu +DATA_LAYOUT[x86_64] = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" LLVM_TARGET[x86_64] = "x86_64-unknown-linux-gnu" TARGET_ENDIAN[x86_64] = "little" TARGET_POINTER_WIDTH[x86_64] = "64" PRE_LINK_ARGS[x86_64] = "-Wl,--as-needed -m64" ## i686-unknown-linux-gnu +DATA_LAYOUT[i686] = "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32" LLVM_TARGET[i686] = "i686-unknown-linux-gnu" TARGET_ENDIAN[i686] = "little" TARGET_POINTER_WIDTH[i686] = "32" PRE_LINK_ARGS[i686] = "-Wl,--as-needed -m32" ## XXX: a bit of a hack so qemux86 builds, clone of i686-unknown-linux-gnu above +DATA_LAYOUT[i586] = "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32" LLVM_TARGET[i586] = "i586-unknown-linux-gnu" TARGET_ENDIAN[i586] = "little" TARGET_POINTER_WIDTH[i586] = "32" @@ -257,6 +261,7 @@ def rust_gen_target(d, thing, wd): # build tspec tspec = {} tspec['llvm-target'] = d.getVarFlag('LLVM_TARGET', arch, True) + tspec['data-layout'] = d.getVarFlag('DATA_LAYOUT', arch, True) tspec['target-pointer-width'] = d.getVarFlag('TARGET_POINTER_WIDTH', arch, True) tspec['target-word-size'] = tspec['target-pointer-width'] tspec['target-endian'] = d.getVarFlag('TARGET_ENDIAN', arch, True) From 02962e7c700234517baac47dce7a701856275ded Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Sun, 28 Aug 2016 14:45:02 -0400 Subject: [PATCH 007/112] rustc-serialize: upgrade to 0.3.19 Needed to build under 1.10.0 --- ...ustc-serialize-rs_0.3.15.bb => rustc-serialize-rs_0.3.19.bb} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename recipes-core/rustc-serialize/{rustc-serialize-rs_0.3.15.bb => rustc-serialize-rs_0.3.19.bb} (90%) diff --git a/recipes-core/rustc-serialize/rustc-serialize-rs_0.3.15.bb b/recipes-core/rustc-serialize/rustc-serialize-rs_0.3.19.bb similarity index 90% rename from recipes-core/rustc-serialize/rustc-serialize-rs_0.3.15.bb rename to recipes-core/rustc-serialize/rustc-serialize-rs_0.3.19.bb index 87835dc..ac0813f 100644 --- a/recipes-core/rustc-serialize/rustc-serialize-rs_0.3.15.bb +++ b/recipes-core/rustc-serialize/rustc-serialize-rs_0.3.19.bb @@ -9,7 +9,7 @@ LIC_FILES_CHKSUM = "\ inherit rust-bin SRC_URI = "git://github.com/rust-lang/rustc-serialize.git;protocol=https" -SRCREV = "376f43a4b94dbe411bd9534ab83f02fbcb5a3b04" +SRCREV = "64b38a1f31a9af6eabf2894437aa5ccc3e457e68" S = "${WORKDIR}/git" From 1df66195597175c52771e33321e71e4a1b2d6670 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Sun, 28 Aug 2016 14:47:14 -0400 Subject: [PATCH 008/112] rand: upgrade to 0.3.14 Needed to build under 1.10.0 --- recipes-core/rand/{rand-rs_0.3.8.bb => rand-rs_0.3.14.bb} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename recipes-core/rand/{rand-rs_0.3.8.bb => rand-rs_0.3.14.bb} (90%) diff --git a/recipes-core/rand/rand-rs_0.3.8.bb b/recipes-core/rand/rand-rs_0.3.14.bb similarity index 90% rename from recipes-core/rand/rand-rs_0.3.8.bb rename to recipes-core/rand/rand-rs_0.3.14.bb index 566cac9..a8c31c7 100644 --- a/recipes-core/rand/rand-rs_0.3.8.bb +++ b/recipes-core/rand/rand-rs_0.3.14.bb @@ -10,7 +10,7 @@ DEPENDS = "libc-rs" inherit rust-bin SRC_URI = "git://github.com/rust-lang/rand.git;protocol=https" -SRCREV = "164659b01e6fdb4d9a8e52b7a7451e8174e91821" +SRCREV = "f872fda5fb8fb899a837ee9eee0332076a8f5300" S = "${WORKDIR}/git" From 5eeb74ed5ee9407e98c969c11a837e24ee6dce20 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Wed, 4 May 2016 09:57:10 -0400 Subject: [PATCH 009/112] memchr-rs: upgrade to 0.1.11 The old version no longer builds against the newer libc package --- recipes-core/memchr/{memchr-rs_0.1.3.bb => memchr-rs_0.1.11.bb} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename recipes-core/memchr/{memchr-rs_0.1.3.bb => memchr-rs_0.1.11.bb} (88%) diff --git a/recipes-core/memchr/memchr-rs_0.1.3.bb b/recipes-core/memchr/memchr-rs_0.1.11.bb similarity index 88% rename from recipes-core/memchr/memchr-rs_0.1.3.bb rename to recipes-core/memchr/memchr-rs_0.1.11.bb index b216cfd..b624ff2 100644 --- a/recipes-core/memchr/memchr-rs_0.1.3.bb +++ b/recipes-core/memchr/memchr-rs_0.1.11.bb @@ -7,7 +7,7 @@ DEPENDS = "libc-rs" inherit rust-bin SRC_URI = "git://github.com/BurntSushi/rust-memchr.git;protocol=https" -SRCREV = "a91e63378bf6f4bba5c7d88f4fe98efdcb432c99" +SRCREV = "4f9a13f95e6e00f2847c093c56b41b9c1d58d3c4" S = "${WORKDIR}/git" From 44bc6fd31f2fa4bcdd928fbd62301606c8002777 Mon Sep 17 00:00:00 2001 From: Tyler Hall Date: Sun, 28 Aug 2016 23:01:42 -0400 Subject: [PATCH 010/112] cargo: update to 0.11.0 This is the compatible version shipped with Rust 1.10.0. Use the git hash from the release TOML file so there is no ambiguity. Update git2 and curl dependencies and patches to match those in Cargo.lock. --- .../{cargo_0.10.0.bb => cargo_0.11.0.bb} | 19 ++++++------- ...-avoid-explicitly-linking-in-openssl.patch | 27 ++++++++++++++----- ...emove-per-triple-deps-on-openssl-sys.patch | 25 ++++++++++++----- ...01-libgit2-sys-avoid-blessed-triples.patch | 24 ++++++++++++----- 4 files changed, 67 insertions(+), 28 deletions(-) rename recipes-devtools/cargo/{cargo_0.10.0.bb => cargo_0.11.0.bb} (76%) diff --git a/recipes-devtools/cargo/cargo_0.10.0.bb b/recipes-devtools/cargo/cargo_0.11.0.bb similarity index 76% rename from recipes-devtools/cargo/cargo_0.10.0.bb rename to recipes-devtools/cargo/cargo_0.11.0.bb index 0c57945..f977673 100644 --- a/recipes-devtools/cargo/cargo_0.10.0.bb +++ b/recipes-devtools/cargo/cargo_0.11.0.bb @@ -2,16 +2,17 @@ require cargo-snapshot.inc require cargo.inc SRC_URI += " \ - https://github.com/rust-lang/cargo/archive/${PV}.tar.gz;name=cargo \ + git://github.com/rust-lang/cargo.git;protocol=https;name=cargo \ file://0001-disable-cargo-snapshot-fetch.patch \ - git://github.com/rust-lang/rust-installer.git;protocol=https;name=rust-installer;destsuffix=${BP}/src/rust-installer \ + git://github.com/rust-lang/rust-installer.git;protocol=https;name=rust-installer;destsuffix=${S}/src/rust-installer \ " -SRC_URI[cargo.md5sum] = "98ab2a422634d447152380898a974b08" -SRC_URI[cargo.sha256sum] = "1e73c038681fe308195427b71322a6350c65d3b8cbea199e45c7b672b4754e0e" +# Compatible with Rust 1.10.0 +# https://static.rust-lang.org/dist/channel-rust-1.10.0.toml +SRCREV_cargo = "259324cd8f9bb6e1068a3a2b77685e90fda3e3b6" SRCREV_rust-installer = "c37d3747da75c280237dc2d6b925078e69555499" -S = "${WORKDIR}/${BP}" +S = "${WORKDIR}/git" LIC_FILES_CHKSUM ="\ file://LICENSE-MIT;md5=362255802eb5aa87810d12ddf3cfedb4 \ @@ -26,8 +27,8 @@ SRC_URI += "\ file://curl-rust/0002-remove-per-triple-deps-on-openssl-sys.patch;patchdir=../curl-rust \ " -# 0.2.14 / -sys 0.1.29 -SRCREV_curl-rust = "76172b3ebf958fcf0b10d400f19ee02486a80ee7" +# 0.2.19 / -sys 0.1.34 +SRCREV_curl-rust = "45b8cb56fbed45f828f96bdd8c286b2b3a8a26cb" SRCREV_FORMAT .= "_curl-rust" EXTRA_OECARGO_PATHS += "${WORKDIR}/curl-rust" @@ -50,8 +51,8 @@ SRC_URI += "\ file://git2-rs/0001-libgit2-sys-avoid-blessed-triples.patch;patchdir=../git2-rs \ " -# 0.3.3 / -sys 0.3.8 -SRCREV_git2-rs = "19b6873c1fad7dc93c9c2dac4cba339dacf16efa" +# 0.4.3 / -sys 0.4.2 +SRCREV_git2-rs = "cd14fc7801e70d3b26a4e7e5d94785af1f7e9e58" SRCREV_FORMAT .= "_git2-rs" EXTRA_OECARGO_PATHS += "${WORKDIR}/git2-rs" diff --git a/recipes-devtools/cargo/files/curl-rust/0001-curl-sys-avoid-explicitly-linking-in-openssl.patch b/recipes-devtools/cargo/files/curl-rust/0001-curl-sys-avoid-explicitly-linking-in-openssl.patch index 2e60687..63287db 100644 --- a/recipes-devtools/cargo/files/curl-rust/0001-curl-sys-avoid-explicitly-linking-in-openssl.patch +++ b/recipes-devtools/cargo/files/curl-rust/0001-curl-sys-avoid-explicitly-linking-in-openssl.patch @@ -1,4 +1,4 @@ -From 6d74b6af6a23e195fc54c81a9bbdb21e7d5b6414 Mon Sep 17 00:00:00 2001 +From 8f82cc69e50e7c8e48a2e20b7061483a28bd0d7f Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Sat, 12 Dec 2015 22:36:26 -0500 Subject: [PATCH 1/2] curl-sys: avoid explicitly linking in openssl @@ -6,22 +6,27 @@ Subject: [PATCH 1/2] curl-sys: avoid explicitly linking in openssl linking libcurl with libssl is handled by pkg-config, not us This also allows non-blessed triples to work. --- - curl-sys/Cargo.toml | 26 -------------------------- + curl-sys/Cargo.toml | 38 -------------------------------------- curl-sys/lib.rs | 2 -- - 2 files changed, 28 deletions(-) + 2 files changed, 40 deletions(-) diff --git a/curl-sys/Cargo.toml b/curl-sys/Cargo.toml -index bf994bf..f153039 100644 +index 24bc4fa..dd56209 100644 --- a/curl-sys/Cargo.toml +++ b/curl-sys/Cargo.toml -@@ -19,29 +19,3 @@ path = "lib.rs" +@@ -19,42 +19,4 @@ path = "lib.rs" [dependencies] libz-sys = ">= 0" libc = "0.2" - +-[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies] +-openssl-sys = ">= 0" +- -# Unix platforms use OpenSSL for now to provide SSL functionality -[target.i686-unknown-linux-gnu.dependencies] -openssl-sys = ">= 0" +-[target.i586-unknown-linux-gnu.dependencies] +-openssl-sys = ">= 0" -[target.i686-linux-android.dependencies] -openssl-sys = ">= 0" -[target.x86_64-unknown-linux-gnu.dependencies] @@ -30,10 +35,18 @@ index bf994bf..f153039 100644 -openssl-sys = ">= 0" -[target.arm-unknown-linux-gnueabihf.dependencies] -openssl-sys = ">= 0" +-[target.armv7-unknown-linux-gnueabihf.dependencies] + openssl-sys = "0.7.0" -[target.arm-linux-androideabi.dependencies] -openssl-sys = ">= 0" -[target.aarch64-unknown-linux-gnu.dependencies] -openssl-sys = ">= 0" +-[target.powerpc-unknown-linux-gnu.dependencies] +-openssl-sys = ">= 0" +-[target.powerpc64-unknown-linux-gnu.dependencies] +-openssl-sys = ">= 0" +-[target.powerpc64le-unknown-linux-gnu.dependencies] +-openssl-sys = ">= 0" -[target.i686-unknown-freebsd.dependencies] -openssl-sys = ">= 0" -[target.x86_64-unknown-freebsd.dependencies] @@ -45,7 +58,7 @@ index bf994bf..f153039 100644 -[target.x86_64-unknown-dragonfly.dependencies] -openssl-sys = ">= 0" diff --git a/curl-sys/lib.rs b/curl-sys/lib.rs -index be80469..b53b445 100644 +index 7990bd6..eb6c27a 100644 --- a/curl-sys/lib.rs +++ b/curl-sys/lib.rs @@ -3,8 +3,6 @@ @@ -58,5 +71,5 @@ index be80469..b53b445 100644 use libc::{c_void, c_int, c_char, c_uint, c_long}; -- -2.4.10 +2.9.2 diff --git a/recipes-devtools/cargo/files/curl-rust/0002-remove-per-triple-deps-on-openssl-sys.patch b/recipes-devtools/cargo/files/curl-rust/0002-remove-per-triple-deps-on-openssl-sys.patch index 2b2b865..1a455d9 100644 --- a/recipes-devtools/cargo/files/curl-rust/0002-remove-per-triple-deps-on-openssl-sys.patch +++ b/recipes-devtools/cargo/files/curl-rust/0002-remove-per-triple-deps-on-openssl-sys.patch @@ -1,17 +1,17 @@ -From 445289f4eacc5c048e4a455bb6d6a6a2b9995e88 Mon Sep 17 00:00:00 2001 +From eb23b1b6f749102e3db92b73a5e55ec6ad688524 Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Sat, 12 Dec 2015 22:40:33 -0500 Subject: [PATCH 2/2] remove per triple deps on openssl-sys --- - Cargo.toml | 27 +-------------------------- - 1 file changed, 1 insertion(+), 26 deletions(-) + Cargo.toml | 40 +--------------------------------------- + 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/Cargo.toml b/Cargo.toml -index 74f63c8..28aa1fa 100644 +index 5f6cf87..0c87156 100644 --- a/Cargo.toml +++ b/Cargo.toml -@@ -12,36 +12,11 @@ url = "0.2.0" +@@ -12,49 +12,11 @@ url = ">= 0.5, < 2.0" log = "0.3.0" libc = "0.2" curl-sys = { path = "curl-sys", version = "0.1.0" } @@ -21,8 +21,13 @@ index 74f63c8..28aa1fa 100644 env_logger = "0.3.0" -# Unix platforms use OpenSSL for now to provide SSL functionality +-[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies] +-openssl-sys = "0.7.0" +- -[target.i686-unknown-linux-gnu.dependencies] -openssl-sys = "0.7.0" +-[target.i586-unknown-linux-gnu.dependencies] +-openssl-sys = "0.7.0" -[target.i686-linux-android.dependencies] -openssl-sys = "0.7.0" -[target.x86_64-unknown-linux-gnu.dependencies] @@ -31,10 +36,18 @@ index 74f63c8..28aa1fa 100644 -openssl-sys = "0.7.0" -[target.arm-unknown-linux-gnueabihf.dependencies] -openssl-sys = "0.7.0" +-[target.armv7-unknown-linux-gnueabihf.dependencies] +-openssl-sys = "0.7.0" -[target.arm-linux-androideabi.dependencies] -openssl-sys = "0.7.0" -[target.aarch64-unknown-linux-gnu.dependencies] -openssl-sys = "0.7.0" +-[target.powerpc-unknown-linux-gnu.dependencies] +-openssl-sys = "0.7.0" +-[target.powerpc64-unknown-linux-gnu.dependencies] +-openssl-sys = "0.7.0" +-[target.powerpc64le-unknown-linux-gnu.dependencies] +-openssl-sys = "0.7.0" -[target.i686-unknown-freebsd.dependencies] -openssl-sys = "0.7.0" -[target.x86_64-unknown-freebsd.dependencies] @@ -50,5 +63,5 @@ index 74f63c8..28aa1fa 100644 name = "test" -- -2.4.10 +2.9.2 diff --git a/recipes-devtools/cargo/files/git2-rs/0001-libgit2-sys-avoid-blessed-triples.patch b/recipes-devtools/cargo/files/git2-rs/0001-libgit2-sys-avoid-blessed-triples.patch index a525607..4a1b448 100644 --- a/recipes-devtools/cargo/files/git2-rs/0001-libgit2-sys-avoid-blessed-triples.patch +++ b/recipes-devtools/cargo/files/git2-rs/0001-libgit2-sys-avoid-blessed-triples.patch @@ -1,17 +1,17 @@ -From 95709b3f5b1495a57043975d7100461feed46b2f Mon Sep 17 00:00:00 2001 +From 308fd350907fba13f68dcdb8e48040582466cae6 Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Sat, 12 Dec 2015 22:53:37 -0500 Subject: [PATCH] libgit2-sys: avoid blessed triples --- - libgit2-sys/Cargo.toml | 22 +--------------------- - 1 file changed, 1 insertion(+), 21 deletions(-) + libgit2-sys/Cargo.toml | 33 +-------------------------------- + 1 file changed, 1 insertion(+), 32 deletions(-) diff --git a/libgit2-sys/Cargo.toml b/libgit2-sys/Cargo.toml -index 15b28d8..3590878 100644 +index 2395314..29000ef 100644 --- a/libgit2-sys/Cargo.toml +++ b/libgit2-sys/Cargo.toml -@@ -17,32 +17,12 @@ path = "lib.rs" +@@ -17,44 +17,13 @@ path = "lib.rs" libssh2-sys = { version = ">= 0", optional = true } libc = "0.2" libz-sys = ">= 0" @@ -20,17 +20,29 @@ index 15b28d8..3590878 100644 [build-dependencies] pkg-config = "0.3" cmake = "0.1.2" + gcc = "0.3" +-[target."cfg(all(unix, not(target_os = \"macos\")))".dependencies] +-openssl-sys = "0.7.0" +- -[target.i686-unknown-linux-gnu.dependencies] -openssl-sys = "0.7.0" +-[target.i586-unknown-linux-gnu.dependencies] +-openssl-sys = "0.7.0" -[target.x86_64-unknown-linux-gnu.dependencies] -openssl-sys = "0.7.0" -[target.x86_64-unknown-linux-musl.dependencies] -openssl-sys = "0.7.0" -[target.aarch64-unknown-linux-gnu.dependencies] -openssl-sys = "0.7.0" +-[target.powerpc64-unknown-linux-gnu.dependencies] +-openssl-sys = "0.7.0" +-[target.powerpc64le-unknown-linux-gnu.dependencies] +-openssl-sys = "0.7.0" -[target.arm-unknown-linux-gnueabihf.dependencies] -openssl-sys = "0.7.0" +-[target.armv7-unknown-linux-gnueabihf.dependencies] +-openssl-sys = "0.7.0" -[target.i686-unknown-freebsd.dependencies] -openssl-sys = "0.7.0" -[target.x86_64-unknown-freebsd.dependencies] @@ -46,5 +58,5 @@ index 15b28d8..3590878 100644 ssh = ["libssh2-sys"] https = [] -- -2.4.10 +2.9.2 From c5978989a78797431fe8127cf42bd4eb6d4fe545 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Tue, 26 Jul 2016 13:51:20 -0400 Subject: [PATCH 011/112] Add recipe for bitflags --- recipes-core/bitflags/bitflags_0.5.0.bb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 recipes-core/bitflags/bitflags_0.5.0.bb diff --git a/recipes-core/bitflags/bitflags_0.5.0.bb b/recipes-core/bitflags/bitflags_0.5.0.bb new file mode 100644 index 0000000..e4f14e9 --- /dev/null +++ b/recipes-core/bitflags/bitflags_0.5.0.bb @@ -0,0 +1,24 @@ +DESCRIPTION = "A macro to generate structures which behave like bitflags." +HOMEPAGE = "https://github.com/rust-lang-nursery/bitflags" +LICENSE = "MIT | Apache-2.0" +LIC_FILES_CHKSUM = "\ + file://LICENSE-MIT;md5=362255802eb5aa87810d12ddf3cfedb4 \ + file://LICENSE-APACHE;md5=1836efb2eb779966696f473ee8540542 \ +" + +inherit rust-bin + +SRC_URI = "git://github.com/rust-lang-nursery/bitflags.git;protocol=https" +SRCREV = "41aa413a7c30d70b93b44ab5447276c381ef249e" + +S = "${WORKDIR}/git" + +LIB_SRC = "${S}/src/lib.rs" + +do_compile () { + oe_compile_rust_lib +} + +do_install () { + oe_install_rust_lib +} From 62b3ed7895bb82123013c71f0565111d1888734b Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Tue, 26 Jul 2016 16:03:05 -0400 Subject: [PATCH 012/112] Add recipes for num crate --- recipes-core/num/num-integer_0.1.34.bb | 5 +++++ recipes-core/num/num-iter_0.1.34.bb | 6 ++++++ recipes-core/num/num-traits_0.1.34.bb | 3 +++ recipes-core/num/num.inc | 22 ++++++++++++++++++++++ recipes-core/num/num_0.1.34.bb | 9 +++++++++ 5 files changed, 45 insertions(+) create mode 100644 recipes-core/num/num-integer_0.1.34.bb create mode 100644 recipes-core/num/num-iter_0.1.34.bb create mode 100644 recipes-core/num/num-traits_0.1.34.bb create mode 100644 recipes-core/num/num.inc create mode 100644 recipes-core/num/num_0.1.34.bb diff --git a/recipes-core/num/num-integer_0.1.34.bb b/recipes-core/num/num-integer_0.1.34.bb new file mode 100644 index 0000000..193e3d7 --- /dev/null +++ b/recipes-core/num/num-integer_0.1.34.bb @@ -0,0 +1,5 @@ +require num.inc + +DEPENDS += "num-traits" + +LIB_SRC = "${S}/integer/src/lib.rs" diff --git a/recipes-core/num/num-iter_0.1.34.bb b/recipes-core/num/num-iter_0.1.34.bb new file mode 100644 index 0000000..4373dcb --- /dev/null +++ b/recipes-core/num/num-iter_0.1.34.bb @@ -0,0 +1,6 @@ +require num.inc + +DEPENDS += "num-traits" +DEPENDS += "num-integer" + +LIB_SRC = "${S}/iter/src/lib.rs" diff --git a/recipes-core/num/num-traits_0.1.34.bb b/recipes-core/num/num-traits_0.1.34.bb new file mode 100644 index 0000000..166f4a6 --- /dev/null +++ b/recipes-core/num/num-traits_0.1.34.bb @@ -0,0 +1,3 @@ +require num.inc + +LIB_SRC = "${S}/traits/src/lib.rs" diff --git a/recipes-core/num/num.inc b/recipes-core/num/num.inc new file mode 100644 index 0000000..baccd6e --- /dev/null +++ b/recipes-core/num/num.inc @@ -0,0 +1,22 @@ +DESCRIPTION = "A collection of numeric types and traits for Rust, including bigint, complex, rational, range iterators, generic integers, and more!" +HOMEPAGE = "https://github.com/rust-num/num" +LICENSE = "MIT | Apache-2.0" +LIC_FILES_CHKSUM = "\ + file://LICENSE-MIT;md5=362255802eb5aa87810d12ddf3cfedb4 \ + file://LICENSE-APACHE;md5=1836efb2eb779966696f473ee8540542 \ +" + +inherit rust-bin + +SRC_URI = "git://github.com/rust-num/num.git;protocol=https" +SRCREV = "d9f08cb148cc686ec407c1e42fbd4536cde6ac82" + +S = "${WORKDIR}/git" + +do_compile () { + oe_compile_rust_lib +} + +do_install () { + oe_install_rust_lib +} diff --git a/recipes-core/num/num_0.1.34.bb b/recipes-core/num/num_0.1.34.bb new file mode 100644 index 0000000..5871feb --- /dev/null +++ b/recipes-core/num/num_0.1.34.bb @@ -0,0 +1,9 @@ +require num.inc + +DEPENDS += "\ + num-traits \ + num-integer \ + num-iter \ + " + +LIB_SRC = "${S}/src/lib.rs" From c4a8abed21c491f1f697e4ebbceaa9fa641c6184 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Tue, 26 Jul 2016 16:05:52 -0400 Subject: [PATCH 013/112] Add recipe for lazy-static --- recipes-core/lazy-static/lazy-static_0.2.1.bb | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 recipes-core/lazy-static/lazy-static_0.2.1.bb diff --git a/recipes-core/lazy-static/lazy-static_0.2.1.bb b/recipes-core/lazy-static/lazy-static_0.2.1.bb new file mode 100644 index 0000000..dc46dc4 --- /dev/null +++ b/recipes-core/lazy-static/lazy-static_0.2.1.bb @@ -0,0 +1,23 @@ +DESCRIPTION = "A macro for declaring lazily evaluated statics in Rust." +HOMEPAGE = "https://github.com/rust-lang-nursery/lazy-static.rs" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "\ + file://LICENSE;md5=5795ddb4df1d696d439b6667081cffc9 \ +" + +inherit rust-bin + +SRC_URI = "git://github.com/rust-lang-nursery/lazy-static.rs.git;protocol=https" +SRCREV = "ffe65c818474f863945ca535c0e53f3b8b848ff7" + +S = "${WORKDIR}/git" + +LIB_SRC = "${S}/src/lib.rs" + +do_compile () { + oe_compile_rust_lib +} + +do_install () { + oe_install_rust_lib +} From cc5832d4bee6a22c4563bb00f82d1b52d9040ace Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Tue, 26 Jul 2016 16:13:53 -0400 Subject: [PATCH 014/112] Add recipes for sdl2-rs --- recipes-graphics/sdl2/sdl2-rs_0.21.0.bb | 12 ++++++++++++ recipes-graphics/sdl2/sdl2-sys_0.21.0.bb | 8 ++++++++ recipes-graphics/sdl2/sdl2.inc | 21 +++++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 recipes-graphics/sdl2/sdl2-rs_0.21.0.bb create mode 100644 recipes-graphics/sdl2/sdl2-sys_0.21.0.bb create mode 100644 recipes-graphics/sdl2/sdl2.inc diff --git a/recipes-graphics/sdl2/sdl2-rs_0.21.0.bb b/recipes-graphics/sdl2/sdl2-rs_0.21.0.bb new file mode 100644 index 0000000..8578dd3 --- /dev/null +++ b/recipes-graphics/sdl2/sdl2-rs_0.21.0.bb @@ -0,0 +1,12 @@ +require sdl2.inc + +DEPENDS += "\ + libc-rs \ + lazy-static \ + bitflags \ + rand-rs \ + num \ + sdl2-sys \ + " + +LIB_SRC = "${S}/src/sdl2/lib.rs" diff --git a/recipes-graphics/sdl2/sdl2-sys_0.21.0.bb b/recipes-graphics/sdl2/sdl2-sys_0.21.0.bb new file mode 100644 index 0000000..8e99cce --- /dev/null +++ b/recipes-graphics/sdl2/sdl2-sys_0.21.0.bb @@ -0,0 +1,8 @@ +require sdl2.inc + +DEPENDS += "\ + libc-rs \ + libsdl2 \ + " + +LIB_SRC = "${S}/sdl2-sys/src/lib.rs" diff --git a/recipes-graphics/sdl2/sdl2.inc b/recipes-graphics/sdl2/sdl2.inc new file mode 100644 index 0000000..36f4444 --- /dev/null +++ b/recipes-graphics/sdl2/sdl2.inc @@ -0,0 +1,21 @@ +DESCRIPTION = "SDL2 bindings for Rust" +HOMEPAGE = "https://github.com/AngryLawyer/rust-sdl2" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "\ + file://LICENSE;md5=efab06594070f714e6e655a25c330fcd \ +" + +inherit rust-bin + +SRC_URI = "git://github.com/AngryLawyer/rust-sdl2.git;protocol=https" +SRCREV = "ffdfe48bd90d8c141f1f8a6f38a88243ad78508f" + +S = "${WORKDIR}/git" + +do_compile () { + oe_compile_rust_lib +} + +do_install () { + oe_install_rust_lib +} From 8d6c809833d3d3fe8b62f2e5b4f33055fe5b790f Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Wed, 3 Aug 2016 13:34:14 -0400 Subject: [PATCH 015/112] Add recipes for sdl2-ttf-rs --- recipes-graphics/sdl2_ttf/sdl2-ttf-rs_0.21.bb | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 recipes-graphics/sdl2_ttf/sdl2-ttf-rs_0.21.bb diff --git a/recipes-graphics/sdl2_ttf/sdl2-ttf-rs_0.21.bb b/recipes-graphics/sdl2_ttf/sdl2-ttf-rs_0.21.bb new file mode 100644 index 0000000..92edda6 --- /dev/null +++ b/recipes-graphics/sdl2_ttf/sdl2-ttf-rs_0.21.bb @@ -0,0 +1,30 @@ +DESCRIPTION = "SDL2 bindings for Rust" +HOMEPAGE = "https://github.com/AngryLawyer/rust-sdl2" +LICENSE = "MIT" +LIC_FILES_CHKSUM = "\ + file://LICENSE;md5=d8786ddfe98d69e641491528dd88fa55 \ +" + +DEPENDS += "\ + bitflags \ + sdl2-sys \ + sdl2-rs \ + libsdl2-ttf \ + " + +inherit rust-bin + +LIB_SRC = "${S}/src/sdl2_ttf/lib.rs" + +SRC_URI = "git://github.com/andelf/rust-sdl2_ttf.git;protocol=https" +SRCREV = "203a550a804aed79e6ad6c1fcc0ed9e31e9ca2f4" + +S = "${WORKDIR}/git" + +do_compile () { + oe_compile_rust_lib +} + +do_install () { + oe_install_rust_lib +} From da71abbef174b51c886e633c997efcb93691df9c Mon Sep 17 00:00:00 2001 From: Tyler Hall Date: Sun, 28 Aug 2016 14:49:01 -0400 Subject: [PATCH 016/112] cargo_util: prefix DEPENDS_append with space --- classes/cargo_util.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/cargo_util.bbclass b/classes/cargo_util.bbclass index 5f0003f..dca4f84 100644 --- a/classes/cargo_util.bbclass +++ b/classes/cargo_util.bbclass @@ -11,7 +11,7 @@ export CARGO_HOME = "${WORKDIR}/cargo_home" BASEDEPENDS_append = " cargo-native" # Ensure we get the right rust variant -DEPENDS_append_class-target = "virtual/${TARGET_PREFIX}rust" +DEPENDS_append_class-target = " virtual/${TARGET_PREFIX}rust" # Cargo only supports in-tree builds at the moment B = "${S}" From 00429e037bc861bf38220f9e44d0668863591896 Mon Sep 17 00:00:00 2001 From: Tyler Hall Date: Sun, 28 Aug 2016 15:10:02 -0400 Subject: [PATCH 017/112] cargo_util: make rustlibdir available This is needed for install and potentially link paths. --- classes/cargo_util.bbclass | 1 + classes/rust-vars.bbclass | 4 ++++ classes/rust.bbclass | 6 ++---- 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 classes/rust-vars.bbclass diff --git a/classes/cargo_util.bbclass b/classes/cargo_util.bbclass index dca4f84..e508f89 100644 --- a/classes/cargo_util.bbclass +++ b/classes/cargo_util.bbclass @@ -1,3 +1,4 @@ +inherit rust-vars # add crate fetch support inherit crate-fetch diff --git a/classes/rust-vars.bbclass b/classes/rust-vars.bbclass new file mode 100644 index 0000000..c987d91 --- /dev/null +++ b/classes/rust-vars.bbclass @@ -0,0 +1,4 @@ +export rustlibdir = "${libdir}/rust" +FILES_${PN} += "${rustlibdir}/*.so" +FILES_${PN}-dev += "${rustlibdir}/*.rlib" +FILES_${PN}-dbg += "${rustlibdir}/.debug" diff --git a/classes/rust.bbclass b/classes/rust.bbclass index 9251d27..132a402 100644 --- a/classes/rust.bbclass +++ b/classes/rust.bbclass @@ -1,3 +1,5 @@ +inherit rust-vars + RUSTC = "rustc" # FIXME: --sysroot might be needed @@ -107,7 +109,3 @@ rustlib_suffix="${TUNE_ARCH}${TARGET_VENDOR}-${TARGET_OS}/rustlib/${HOST_SYS}/li rustlib_src="${prefix}/lib/${rustlib_suffix}" # Host sysroot standard library path rustlib="${libdir}/${rustlib_suffix}" -export rustlibdir = "${libdir}/rust" -FILES_${PN} += "${rustlibdir}/*.so" -FILES_${PN}-dev += "${rustlibdir}/*.rlib" -FILES_${PN}-dbg += "${rustlibdir}/.debug" From d320edc05fa20d34c34d5005686e656eae5014a9 Mon Sep 17 00:00:00 2001 From: Tyler Hall Date: Sun, 28 Aug 2016 14:28:53 -0400 Subject: [PATCH 018/112] cargo_util: install libraries The final output of a crate may be a library along with one or more executables. Install the libraries as well. --- classes/cargo_util.bbclass | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/classes/cargo_util.bbclass b/classes/cargo_util.bbclass index e508f89..967eb04 100644 --- a/classes/cargo_util.bbclass +++ b/classes/cargo_util.bbclass @@ -71,12 +71,15 @@ cargo_util_do_compile () { oe_cargo_build } -# All but the most simple projects will need to override this. cargo_util_do_install () { local have_installed=false - install -d "${D}${bindir}" for tgt in "${B}/target/${CARGO_TARGET_SUBDIR}/"*; do - if [ -f "$tgt" ] && [ -x "$tgt" ]; then + if [[ $tgt == *.so || $tgt == *.rlib ]]; then + install -d "${D}${rustlibdir}" + install -m755 "$tgt" "${D}${rustlibdir}" + have_installed=true + elif [ -f "$tgt" ] && [ -x "$tgt" ]; then + install -d "${D}${bindir}" install -m755 "$tgt" "${D}${bindir}" have_installed=true fi From e3140137e5d5ee75f07d797b2b3ac4d67ee1a868 Mon Sep 17 00:00:00 2001 From: Tyler Hall Date: Sun, 28 Aug 2016 16:06:26 -0400 Subject: [PATCH 019/112] cargo_util: pass RUSTFLAGS to cargo build --- classes/cargo_util.bbclass | 2 ++ 1 file changed, 2 insertions(+) diff --git a/classes/cargo_util.bbclass b/classes/cargo_util.bbclass index 967eb04..614baf9 100644 --- a/classes/cargo_util.bbclass +++ b/classes/cargo_util.bbclass @@ -36,12 +36,14 @@ export RUST_CFLAGS = "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${CFLAGS}" export RUST_BUILD_CC = "${CCACHE}${BUILD_PREFIX}gcc" export RUST_BUILD_CFLAGS = "${BUILD_CC_ARCH} ${BUILD_CFLAGS}" +RUSTFLAGS ??= "" export CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} --release" # This is based on the content of CARGO_BUILD_FLAGS and generally will need to # change if CARGO_BUILD_FLAGS changes. export CARGO_TARGET_SUBDIR="${HOST_SYS}/release" oe_cargo_build () { + export RUSTFLAGS="${RUSTFLAGS}" bbnote "cargo = $(which cargo)" bbnote "rustc = $(which rustc)" bbnote "${CARGO} build ${CARGO_BUILD_FLAGS} $@" From e2d09d03628697b9c16285375bbb5da4eb9e75a8 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Thu, 5 May 2016 18:01:24 -0400 Subject: [PATCH 020/112] libstd-rs: cross compile rust's runtime This can replace rustlib, which just copies the binaries already built by rust-cross. --- recipes-devtools/rust/compiler-rt.bb | 23 +++++++++++++++++++++ recipes-devtools/rust/libstd-rs.bb | 30 ++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 recipes-devtools/rust/compiler-rt.bb create mode 100644 recipes-devtools/rust/libstd-rs.bb diff --git a/recipes-devtools/rust/compiler-rt.bb b/recipes-devtools/rust/compiler-rt.bb new file mode 100644 index 0000000..a9644d1 --- /dev/null +++ b/recipes-devtools/rust/compiler-rt.bb @@ -0,0 +1,23 @@ +SUMMARY = "Rust compiler run-time" +HOMEPAGE = "http://www.rust-lang.org" +SECTION = "devel" +LICENSE = "MIT" + +require rust-shared-source.inc +LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=27b14ab4ce08d04c3a9a5f0ed7997362" + +S .= "/src/compiler-rt" +B = "${WORKDIR}/build" + +do_compile () { + oe_runmake -C ${S} \ + ProjSrcRoot="${S}" \ + ProjObjRoot="${B}" \ + TargetTriple=${HOST_SYS} \ + triple-builtins +} + +do_install () { + mkdir -p ${D}${libdir} + cp triple/builtins/libcompiler_rt.a ${D}${libdir}/libcompiler-rt.a +} diff --git a/recipes-devtools/rust/libstd-rs.bb b/recipes-devtools/rust/libstd-rs.bb new file mode 100644 index 0000000..d8e72a5 --- /dev/null +++ b/recipes-devtools/rust/libstd-rs.bb @@ -0,0 +1,30 @@ +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 rust-shared-source.inc + +DEPENDS += "compiler-rt" + +RUSTLIB_DEP = "" +inherit cargo_util + +# Needed so cargo can find libbacktrace +RUSTFLAGS += "-L ${STAGING_LIBDIR}" + +B = "${WORKDIR}/build" + +do_compile () { + cd ${S}/src/rustc/std_shim + export CARGO_TARGET_DIR="${B}" + export RUSTC_BOOTSTRAP_KEY="e8edd0fd" + oe_cargo_fix_env + oe_cargo_build +} + +do_install () { + mkdir -p ${D}${rustlibdir} + cp ${B}/${TARGET_SYS}/release/deps/* ${D}${rustlibdir} +} From f6c7789c950c65e3fcf8ba4eabbdacae6236b42c Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Tue, 30 Aug 2016 16:49:50 -0400 Subject: [PATCH 021/112] rust-cross: don't actually build a compiler Instead of building a full compiler, we can use rust-native to cross-compile. All we need is a cross-compiled standard library, which libstd-rs builds, and a compiler spec file. rust-cross is now just used to generate the json spec file for cross-compiling, which is naturally much faster. --- classes/cargo_util.bbclass | 2 +- classes/rust-vars.bbclass | 4 ++++ classes/rust.bbclass | 3 --- recipes-devtools/rust/rust-cross.bb | 23 ++++++++++++++--------- recipes-devtools/rust/rust.bb | 1 + recipes-devtools/rust/rust.inc | 1 - recipes-devtools/rust/rustlib.bb | 26 -------------------------- 7 files changed, 20 insertions(+), 40 deletions(-) delete mode 100644 recipes-devtools/rust/rustlib.bb diff --git a/classes/cargo_util.bbclass b/classes/cargo_util.bbclass index 614baf9..f38a519 100644 --- a/classes/cargo_util.bbclass +++ b/classes/cargo_util.bbclass @@ -12,7 +12,7 @@ export CARGO_HOME = "${WORKDIR}/cargo_home" BASEDEPENDS_append = " cargo-native" # Ensure we get the right rust variant -DEPENDS_append_class-target = " virtual/${TARGET_PREFIX}rust" +DEPENDS_append_class-target = " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}" # Cargo only supports in-tree builds at the moment B = "${S}" diff --git a/classes/rust-vars.bbclass b/classes/rust-vars.bbclass index c987d91..a3acc44 100644 --- a/classes/rust-vars.bbclass +++ b/classes/rust-vars.bbclass @@ -2,3 +2,7 @@ export rustlibdir = "${libdir}/rust" FILES_${PN} += "${rustlibdir}/*.so" FILES_${PN}-dev += "${rustlibdir}/*.rlib" FILES_${PN}-dbg += "${rustlibdir}/.debug" + +RUSTLIB = "-L ${STAGING_LIBDIR}/rust" +RUSTFLAGS += "-C rpath -C crate_hash=${BB_TASKHASH} ${RUSTLIB}" +RUSTLIB_DEP ?= "libstd-rs" diff --git a/classes/rust.bbclass b/classes/rust.bbclass index 132a402..15299b2 100644 --- a/classes/rust.bbclass +++ b/classes/rust.bbclass @@ -2,11 +2,8 @@ inherit rust-vars RUSTC = "rustc" -# FIXME: --sysroot might be needed -RUSTFLAGS += "-C rpath -C crate_hash=${BB_TASKHASH}" RUSTC_ARCHFLAGS += "--target=${TARGET_SYS} ${RUSTFLAGS}" -RUSTLIB_DEP ?= "rustlib" def rust_base_dep(d): # Taken from meta/classes/base.bbclass `base_dep_prepend` and modified to # use rust instead of gcc diff --git a/recipes-devtools/rust/rust-cross.bb b/recipes-devtools/rust/rust-cross.bb index d4324f1..70ce2b4 100644 --- a/recipes-devtools/rust/rust-cross.bb +++ b/recipes-devtools/rust/rust-cross.bb @@ -10,6 +10,7 @@ INHIBIT_DEFAULT_RUST_DEPS = "1" # 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}" @@ -31,14 +32,18 @@ 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}" -# cross.bbclass is "helpful" and overrides our do_install. Tell it not to. -do_install () { - rust_do_install +do_configure () { } -# using host-strip on target .so files generated by this recipie causes build errors. -# for now, disable stripping. -# A better (but more complex) approach would be to mimic gcc-runtime and build -# the target.so files in a seperate .bb file. -INHIBIT_PACKAGE_STRIP = "1" -INHIBIT_SYSROOT_STRIP = "1" +do_compile () { +} + +do_install () { + mkdir -p ${D}${prefix}/${baselib}/rustlib + cp ${WORKDIR}/targets/${TARGET_ARCH}* ${D}${prefix}/${baselib}/rustlib +} + +rust_cross_sysroot_preprocess() { + sysroot_stage_dir ${D}${prefix}/${baselib}/rustlib ${SYSROOT_DESTDIR}${prefix}/${baselib}/rustlib +} +SYSROOT_PREPROCESS_FUNCS += "rust_cross_sysroot_preprocess" diff --git a/recipes-devtools/rust/rust.bb b/recipes-devtools/rust/rust.bb index 93ceab2..ab61226 100644 --- a/recipes-devtools/rust/rust.bb +++ b/recipes-devtools/rust/rust.bb @@ -1,3 +1,4 @@ +inherit rust-installer require rust.inc DEPENDS += "rust-llvm" diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index 3c7d7fa..253f676 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -1,6 +1,5 @@ # ex: sts=4 et sw=4 ts=8 inherit rust -inherit rust-installer require rust-shared-source.inc require rust-snapshot-2016-05-24.inc diff --git a/recipes-devtools/rust/rustlib.bb b/recipes-devtools/rust/rustlib.bb deleted file mode 100644 index 9d371f7..0000000 --- a/recipes-devtools/rust/rustlib.bb +++ /dev/null @@ -1,26 +0,0 @@ -SUMMARY = "Rust runtime libaries" -HOMEPAGE = "http://www.rust-lang.org" -SECTION = "devel" -LICENSE = "MIT | Apache-2.0" - -inherit rust-bin - -DEPENDS += "virtual/${TARGET_PREFIX}rust" -RUSTLIB_DEP = "" - -do_install () { - for f in ${STAGING_DIR_NATIVE}/${rustlib_src}/*; do - echo Installing $f - install -D -m 755 $f ${D}/${rustlib}/$(basename $f) - done -} - -# This has no license file -python do_qa_configure() { - return True -} - -FILES_${PN} += "${rustlib}/*.so" -FILES_${PN}-dev += "${rustlib}/*.rlib" -FILES_${PN}-staticdev += "${rustlib}/*.a" -FILES_${PN}-dbg += "${rustlib}/.debug" From 56ac84977120a8b4dc2ee66e68ae733f59f8ef24 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Sat, 3 Sep 2016 10:30:29 -0400 Subject: [PATCH 022/112] rust-cross: use base_libdir_native This fixes rust-cross-aarch64 (and probably rust-cross-x86_64) since those targets will use lib64 for cross but lib for native. --- recipes-devtools/rust/rust-cross.bb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes-devtools/rust/rust-cross.bb b/recipes-devtools/rust/rust-cross.bb index 70ce2b4..36c0bb3 100644 --- a/recipes-devtools/rust/rust-cross.bb +++ b/recipes-devtools/rust/rust-cross.bb @@ -39,11 +39,11 @@ do_compile () { } do_install () { - mkdir -p ${D}${prefix}/${baselib}/rustlib - cp ${WORKDIR}/targets/${TARGET_ARCH}* ${D}${prefix}/${baselib}/rustlib + mkdir -p ${D}${prefix}/${base_libdir_native}/rustlib + cp ${WORKDIR}/targets/${TARGET_ARCH}* ${D}${prefix}/${base_libdir_native}/rustlib } rust_cross_sysroot_preprocess() { - sysroot_stage_dir ${D}${prefix}/${baselib}/rustlib ${SYSROOT_DESTDIR}${prefix}/${baselib}/rustlib + sysroot_stage_dir ${D}${prefix}/${base_libdir_native}/rustlib ${SYSROOT_DESTDIR}${prefix}/${base_libdir_native}/rustlib } SYSROOT_PREPROCESS_FUNCS += "rust_cross_sysroot_preprocess" From c8e2b6166e3e77649947f019c521dc58f9ee14b3 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Wed, 31 Aug 2016 16:32:21 -0400 Subject: [PATCH 023/112] cargo-snapshot.inc: use a date-specific downloadfilename This allows the snapshot to be cached in a local mirror with a unique name --- recipes-devtools/cargo/cargo-snapshot.inc | 2 +- recipes-devtools/cargo/cargo.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes-devtools/cargo/cargo-snapshot.inc b/recipes-devtools/cargo/cargo-snapshot.inc index 0ea10ee..5403ec0 100644 --- a/recipes-devtools/cargo/cargo-snapshot.inc +++ b/recipes-devtools/cargo/cargo-snapshot.inc @@ -1,4 +1,4 @@ -CARGO_SNAPSHOT = "2016-01-31/cargo-nightly-x86_64-unknown-linux-gnu.tar.gz" +CARGO_SNAPSHOT = "2016-01-31/cargo-nightly-x86_64-unknown-linux-gnu.tar.gz;downloadfilename=cargo-nightly-x86_64-unknown-linux-gnu-2016-01-31.tar.gz" SRC_URI[md5sum] = "52f48780b7cfadc88813766048d4d402" SRC_URI[sha256sum] = "1920e661bab536eba763ff6704a1d62fb20bb0f67d8c5a119e41c49510ea5fa6" diff --git a/recipes-devtools/cargo/cargo.inc b/recipes-devtools/cargo/cargo.inc index ca6a31f..df0f603 100644 --- a/recipes-devtools/cargo/cargo.inc +++ b/recipes-devtools/cargo/cargo.inc @@ -54,7 +54,7 @@ do_compile () { rm -rf target/snapshot mkdir -p target - cp -R ${WORKDIR}/$(basename ${CARGO_SNAPSHOT} .tar.gz)/cargo target/snapshot + cp -R ${WORKDIR}/cargo-nightly-x86_64-unknown-linux-gnu/cargo target/snapshot oe_runmake ARGS="--verbose" } From c6ea2fe28572e33eac4520abe0c1fcf8bac8de73 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Thu, 1 Sep 2016 09:45:34 -0400 Subject: [PATCH 024/112] cargo_util.bbclass: support EXTRA_OECARGO_PATHS With this we can convert the cargo-native recipe over to using cargo_util instead of cargo.bbclass --- classes/cargo_util.bbclass | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/classes/cargo_util.bbclass b/classes/cargo_util.bbclass index f38a519..83ebaaa 100644 --- a/classes/cargo_util.bbclass +++ b/classes/cargo_util.bbclass @@ -62,6 +62,21 @@ oe_cargo_fix_env () { export HOST_AR="${BUILD_AR}" } +EXTRA_OECARGO_PATHS ??= "" + +cargo_util_do_configure () { + mkdir -p ${CARGO_HOME} + # NOTE: we cannot pass more flags via this interface, the 'linker' is + # assumed to be a path to a binary. If flags are needed, a wrapper must + # be used. + echo "paths = [" > ${CARGO_HOME}/config + + for p in ${EXTRA_OECARGO_PATHS}; do + printf "\"%s\"\n" "$p" + done | sed -e 's/$/,/' >> ${CARGO_HOME}/config + echo "]" >> ${CARGO_HOME}/config +} + cargo_util_do_compile () { cd "${B}" @@ -91,4 +106,4 @@ cargo_util_do_install () { fi } -EXPORT_FUNCTIONS do_compile do_install +EXPORT_FUNCTIONS do_configure do_compile do_install From 11f0c95763b1d4c68349bb60c43e09967ceaa69f Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Thu, 1 Sep 2016 11:35:36 -0400 Subject: [PATCH 025/112] cargo_util.bbclass: fix for native users Building native packages with cargo means with need a native rust compiler --- classes/cargo_util.bbclass | 1 + 1 file changed, 1 insertion(+) diff --git a/classes/cargo_util.bbclass b/classes/cargo_util.bbclass index 83ebaaa..55d3924 100644 --- a/classes/cargo_util.bbclass +++ b/classes/cargo_util.bbclass @@ -13,6 +13,7 @@ BASEDEPENDS_append = " cargo-native" # Ensure we get the right rust variant DEPENDS_append_class-target = " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}" +DEPENDS_append_class-native = " rust-native" # Cargo only supports in-tree builds at the moment B = "${S}" From 0c54b5727f9b4e1a623bdd90ae9c62769ec11fd3 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Thu, 1 Sep 2016 14:31:13 -0400 Subject: [PATCH 026/112] cargo-snapshot.inc: update to a newer nightly build Switch to a nightly that supports the source-replacement feature. This allows us to swap in our locally-fetched crates for upstream crates.io --- recipes-devtools/cargo/cargo-snapshot.inc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/recipes-devtools/cargo/cargo-snapshot.inc b/recipes-devtools/cargo/cargo-snapshot.inc index 5403ec0..8f3c28a 100644 --- a/recipes-devtools/cargo/cargo-snapshot.inc +++ b/recipes-devtools/cargo/cargo-snapshot.inc @@ -1,4 +1,4 @@ -CARGO_SNAPSHOT = "2016-01-31/cargo-nightly-x86_64-unknown-linux-gnu.tar.gz;downloadfilename=cargo-nightly-x86_64-unknown-linux-gnu-2016-01-31.tar.gz" -SRC_URI[md5sum] = "52f48780b7cfadc88813766048d4d402" -SRC_URI[sha256sum] = "1920e661bab536eba763ff6704a1d62fb20bb0f67d8c5a119e41c49510ea5fa6" +CARGO_SNAPSHOT = "2016-09-01/cargo-nightly-x86_64-unknown-linux-gnu.tar.gz;downloadfilename=cargo-nightly-x86_64-unknown-linux-gnu-2016-09-01.tar.gz" +SRC_URI[md5sum] = "d41ebf79290a7c9c9e5df87cb27e5091" +SRC_URI[sha256sum] = "365e5cad79512d244b8ced32f8e5b86a710fc6c17f0d0f5f744b8058ef6dc756" From f89057c0afe2909a0b562310d09e179e26bc9669 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Fri, 2 Sep 2016 14:20:03 -0400 Subject: [PATCH 027/112] lib/crate.py: additionally populate a local registry The local registry is a more future-proof way to prevent cargo from accessing the network during the build. Unfortunately, this is only used during the build of cargo-native for now. The snapshot used while building cargo-native supports using a local registry ("source replacement") however the version of cargo supported by rust 1.10 does not. Until we can build a new-enough version of cargo that supports source-replacement, we'll have to patch cargo directly to prevent it from accessing the network. Once we do have a new-enough cargo, we can stop populating cargo_home/registry and only create cargo_registry. --- classes/cargo_util.bbclass | 9 +++++++++ lib/crate.py | 17 +++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/classes/cargo_util.bbclass b/classes/cargo_util.bbclass index 55d3924..81d4c85 100644 --- a/classes/cargo_util.bbclass +++ b/classes/cargo_util.bbclass @@ -76,6 +76,15 @@ cargo_util_do_configure () { printf "\"%s\"\n" "$p" done | sed -e 's/$/,/' >> ${CARGO_HOME}/config echo "]" >> ${CARGO_HOME}/config + + # Point cargo at our local mirror of the registry + cat >> ${CARGO_HOME}/config < Date: Fri, 2 Sep 2016 20:14:02 -0400 Subject: [PATCH 028/112] lib/crate.py: update magic hash for new cargo --- classes/cargo_util.bbclass | 4 ++-- lib/crate.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/classes/cargo_util.bbclass b/classes/cargo_util.bbclass index 81d4c85..29bd695 100644 --- a/classes/cargo_util.bbclass +++ b/classes/cargo_util.bbclass @@ -91,8 +91,8 @@ cargo_util_do_compile () { cd "${B}" # prevent cargo from trying to fetch down new data - mkdir -p "${WORKDIR}/cargo_home/registry/index/" - touch "${WORKDIR}/cargo_home/registry/index/.cargo-index-lock" + mkdir -p "${WORKDIR}/cargo_home/registry/index/github.com-1ecc6299db9ec823" + touch "${WORKDIR}/cargo_home/registry/index/github.com-1ecc6299db9ec823/.cargo-index-lock" oe_cargo_fix_env oe_cargo_build diff --git a/lib/crate.py b/lib/crate.py index be626fc..3197037 100644 --- a/lib/crate.py +++ b/lib/crate.py @@ -35,7 +35,8 @@ class Crate(Wget): def _cargo_path(self, rootdir, component): # TODO: make this less brittle - repo = "github.com-88ac128001ac3a9a" + # This can go away entirely once we can build a cargo that supports source-replacement + repo = "github.com-1ecc6299db9ec823" return os.path.join(rootdir, "cargo_home", "registry", component, repo) def _cargo_src_path(self, rootdir): From 8af5d4f7e9475acb6ac12b34cc565e8a2a067d6f Mon Sep 17 00:00:00 2001 From: Tyler Hall Date: Sat, 3 Sep 2016 19:31:37 -0400 Subject: [PATCH 029/112] compiler-rt: ensure -e is passed to make OE-Core rev aeb653861a0ec39ea7a014c0622980edcbf653fa (between jethro and krogoth) removed -e from the default flags in EXTRA_OEMAKE. Without this, the makefile will default to gcc for CC. --- recipes-devtools/rust/compiler-rt.bb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes-devtools/rust/compiler-rt.bb b/recipes-devtools/rust/compiler-rt.bb index a9644d1..d0dc987 100644 --- a/recipes-devtools/rust/compiler-rt.bb +++ b/recipes-devtools/rust/compiler-rt.bb @@ -9,6 +9,9 @@ LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=27b14ab4ce08d04c3a9a5f0ed7997362" S .= "/src/compiler-rt" B = "${WORKDIR}/build" +# Pick up $CC from the environment +EXTRA_OEMAKE += "-e" + do_compile () { oe_runmake -C ${S} \ ProjSrcRoot="${S}" \ From cb753fc536561b14f7e95ee7b390cb53a85bc664 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Thu, 1 Sep 2016 09:46:10 -0400 Subject: [PATCH 030/112] cargo.inc: switch to cargo_util.bbclass This does all the fetching through bitbake which allows it to be built correctly in firewalled environments. --- recipes-devtools/cargo/cargo.inc | 60 ++++++++++++++++++++++++++++---- 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/recipes-devtools/cargo/cargo.inc b/recipes-devtools/cargo/cargo.inc index df0f603..6303f83 100644 --- a/recipes-devtools/cargo/cargo.inc +++ b/recipes-devtools/cargo/cargo.inc @@ -1,6 +1,4 @@ -INHIBIT_CARGO_DEP = "1" - -inherit cargo +inherit cargo_util inherit patch inherit rust-installer @@ -11,8 +9,60 @@ LICENSE = "MIT | Apache-2.0" DEPENDS = "openssl zlib libgit2 curl ca-certificates libssh2" +CARGO_INDEX_COMMIT = "6127fc24b0b6fe73fe4d339817fbf000b9a798a2" + SRC_URI = "\ http://static-rust-lang-org.s3.amazonaws.com/cargo-dist/${CARGO_SNAPSHOT} \ + crate://crates.io/advapi32-sys/0.1.2 \ + crate://crates.io/bufstream/0.1.1 \ + crate://crates.io/crossbeam/0.2.8 \ + crate://crates.io/docopt/0.6.78 \ + crate://crates.io/env_logger/0.3.2 \ + crate://crates.io/filetime/0.1.10 \ + crate://crates.io/flate2/0.2.13 \ + crate://crates.io/fs2/0.2.3 \ + crate://crates.io/glob/0.2.11 \ + crate://crates.io/hamcrest/0.1.0 \ + crate://crates.io/kernel32-sys/0.2.1 \ + crate://crates.io/libc/0.2.8 \ + crate://crates.io/log/0.3.5 \ + crate://crates.io/num_cpus/0.2.11 \ + crate://crates.io/regex/0.1.58 \ + crate://crates.io/rustc-serialize/0.3.18 \ + crate://crates.io/tar/0.4.5 \ + crate://crates.io/tempdir/0.3.4 \ + crate://crates.io/term/0.4.4 \ + crate://crates.io/toml/0.1.28 \ + crate://crates.io/url/1.1.0 \ + crate://crates.io/winapi/0.2.6 \ + crate://crates.io/semver/0.2.3 \ + crate://crates.io/regex-syntax/0.3.0 \ + crate://crates.io/utf8-ranges/0.1.3 \ + crate://crates.io/gcc/0.3.26 \ + crate://crates.io/unicode-normalization/0.1.2 \ + crate://crates.io/libz-sys/1.0.2 \ + crate://crates.io/rand/0.3.14 \ + crate://crates.io/user32-sys/0.1.2 \ + crate://crates.io/idna/0.1.0 \ + crate://crates.io/strsim/0.3.0 \ + crate://crates.io/matches/0.1.2 \ + crate://crates.io/cmake/0.1.16 \ + crate://crates.io/gdi32-sys/0.1.1 \ + crate://crates.io/bitflags/0.1.1 \ + crate://crates.io/unicode-bidi/0.2.3 \ + crate://crates.io/pkg-config/0.3.8 \ + crate://crates.io/winapi-build/0.1.1 \ + crate://crates.io/memchr/0.1.10 \ + crate://crates.io/pnacl-build-helper/1.4.10 \ + crate://crates.io/nom/1.2.2 \ + crate://crates.io/num/0.1.31 \ + crate://crates.io/uuid/0.2.3 \ + crate://crates.io/aho-corasick/0.5.1 \ + crate://crates.io/libressl-pnacl-sys/2.1.6 \ + crate://crates.io/miniz-sys/0.1.7 \ + crate://crates.io/openssl-sys/0.7.8 \ + crate://crates.io/url/0.5.10 \ + crate-index://crates.io/${CARGO_INDEX_COMMIT} \ " B = "${S}" @@ -44,9 +94,7 @@ do_configure () { ${EXTRA_OECONF} \ || die "Could not configure cargo" - # cargo downloads a cargo snapshot to build itself using cargo, we need - # to override it's arch info. - cargo_do_configure + cargo_util_do_configure } do_compile () { From 1059968d25625b298da0ebaafd0966ab2db449d3 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Fri, 2 Sep 2016 15:11:06 -0400 Subject: [PATCH 031/112] cargo: never contact the registry It's forbidden to access the network during the build phase in bitbake. Since this version of cargo does not yet support source-replacement, we must patch out the behavior instead. --- recipes-devtools/cargo/cargo_0.11.0.bb | 1 + ...0001-Never-update-the-registry-index.patch | 88 +++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 recipes-devtools/cargo/files/0001-Never-update-the-registry-index.patch diff --git a/recipes-devtools/cargo/cargo_0.11.0.bb b/recipes-devtools/cargo/cargo_0.11.0.bb index f977673..c70d049 100644 --- a/recipes-devtools/cargo/cargo_0.11.0.bb +++ b/recipes-devtools/cargo/cargo_0.11.0.bb @@ -4,6 +4,7 @@ require cargo.inc SRC_URI += " \ git://github.com/rust-lang/cargo.git;protocol=https;name=cargo \ file://0001-disable-cargo-snapshot-fetch.patch \ + file://0001-Never-update-the-registry-index.patch \ git://github.com/rust-lang/rust-installer.git;protocol=https;name=rust-installer;destsuffix=${S}/src/rust-installer \ " # Compatible with Rust 1.10.0 diff --git a/recipes-devtools/cargo/files/0001-Never-update-the-registry-index.patch b/recipes-devtools/cargo/files/0001-Never-update-the-registry-index.patch new file mode 100644 index 0000000..ac33a06 --- /dev/null +++ b/recipes-devtools/cargo/files/0001-Never-update-the-registry-index.patch @@ -0,0 +1,88 @@ +From 27df8ab04275dfd715d1756fc517bb0323f1b210 Mon Sep 17 00:00:00 2001 +From: Steven Walter +Date: Fri, 2 Sep 2016 14:02:03 -0400 +Subject: [PATCH] Never update the registry index + +Bitbake will fetch the index for us so that we needn't do network IO +during a build +--- + src/cargo/ops/cargo_run.rs | 2 +- + src/cargo/sources/registry.rs | 34 +--------------------------------- + 2 files changed, 2 insertions(+), 34 deletions(-) + +diff --git a/src/cargo/ops/cargo_run.rs b/src/cargo/ops/cargo_run.rs +index 6764118..379b98b 100644 +--- a/src/cargo/ops/cargo_run.rs ++++ b/src/cargo/ops/cargo_run.rs +@@ -1,7 +1,7 @@ + use std::path::Path; + + use ops::{self, CompileFilter}; +-use util::{self, CargoResult, process, ProcessError}; ++use util::{self, CargoResult, ProcessError}; + use core::Package; + + pub fn run(manifest_path: &Path, +diff --git a/src/cargo/sources/registry.rs b/src/cargo/sources/registry.rs +index 614d654..a0c7fe6 100644 +--- a/src/cargo/sources/registry.rs ++++ b/src/cargo/sources/registry.rs +@@ -166,7 +166,6 @@ use std::path::{PathBuf, Path}; + + use curl::http; + use flate2::read::GzDecoder; +-use git2; + use rustc_serialize::hex::ToHex; + use rustc_serialize::json; + use tar::Archive; +@@ -174,7 +173,7 @@ use url::Url; + + use core::{Source, SourceId, PackageId, Package, Summary, Registry}; + use core::dependency::{Dependency, DependencyInner, Kind}; +-use sources::{PathSource, git}; ++use sources::PathSource; + use util::{CargoResult, Config, internal, ChainError, ToUrl, human}; + use util::{hex, Sha256, paths, Filesystem, FileLock}; + use ops; +@@ -464,38 +463,7 @@ impl<'cfg> RegistrySource<'cfg> { + + /// Actually perform network operations to update the registry + fn do_update(&mut self) -> CargoResult<()> { +- if self.updated { +- return Ok(()) +- } +- try!(self.checkout_path.create_dir()); +- let lock = try!(self.checkout_path.open_rw(Path::new(INDEX_LOCK), +- self.config, +- "the registry index")); +- let path = lock.path().parent().unwrap(); +- +- try!(self.config.shell().status("Updating", +- format!("registry `{}`", self.source_id.url()))); +- let repo = try!(git2::Repository::open(path).or_else(|_| { +- let _ = lock.remove_siblings(); +- git2::Repository::init(path) +- })); +- +- // git fetch origin +- let url = self.source_id.url().to_string(); +- let refspec = "refs/heads/*:refs/remotes/origin/*"; +- +- try!(git::fetch(&repo, &url, refspec, &self.config).chain_error(|| { +- internal(format!("failed to fetch `{}`", url)) +- })); +- +- // git reset --hard origin/master +- let reference = "refs/remotes/origin/master"; +- let oid = try!(repo.refname_to_id(reference)); +- trace!("[{}] updating to rev {}", self.source_id, oid); +- let object = try!(repo.find_object(oid, None)); +- try!(repo.reset(&object, git2::ResetType::Hard, None)); + self.updated = true; +- self.cache.clear(); + Ok(()) + } + } +-- +2.7.4 + From f31f0c22572075b6622b3b0a8d9e3a3f4e2bbe9e Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Fri, 2 Sep 2016 12:15:33 -0400 Subject: [PATCH 032/112] libstd-rs: download dependent crates Cargo was trying to download these itself before, which isn't allowed. Use the crate fetcher to get our dependencies --- recipes-devtools/rust/libstd-rs.bb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/recipes-devtools/rust/libstd-rs.bb b/recipes-devtools/rust/libstd-rs.bb index d8e72a5..f458b2c 100644 --- a/recipes-devtools/rust/libstd-rs.bb +++ b/recipes-devtools/rust/libstd-rs.bb @@ -6,6 +6,13 @@ LICENSE = "MIT | Apache-2.0" LIC_FILES_CHKSUM ="file://COPYRIGHT;md5=43e1f1fb9c0ee3af66693d8c4fecafa8" require rust-shared-source.inc +CARGO_INDEX_COMMIT = "6127fc24b0b6fe73fe4d339817fbf000b9a798a2" + +SRC_URI += "\ + crate://crates.io/gcc/0.3.26 \ + crate-index://crates.io/${CARGO_INDEX_COMMIT} \ +" + DEPENDS += "compiler-rt" RUSTLIB_DEP = "" From e87b2d43b0b261e8a8e8364eb8fad79300347ea6 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Fri, 2 Sep 2016 20:14:20 -0400 Subject: [PATCH 033/112] libstd-rs: use cargo_util_do_compile --- classes/cargo_util.bbclass | 2 -- recipes-devtools/rust/libstd-rs.bb | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/classes/cargo_util.bbclass b/classes/cargo_util.bbclass index 29bd695..98af9ee 100644 --- a/classes/cargo_util.bbclass +++ b/classes/cargo_util.bbclass @@ -88,8 +88,6 @@ EOF } cargo_util_do_compile () { - cd "${B}" - # prevent cargo from trying to fetch down new data mkdir -p "${WORKDIR}/cargo_home/registry/index/github.com-1ecc6299db9ec823" touch "${WORKDIR}/cargo_home/registry/index/github.com-1ecc6299db9ec823/.cargo-index-lock" diff --git a/recipes-devtools/rust/libstd-rs.bb b/recipes-devtools/rust/libstd-rs.bb index f458b2c..f785c0d 100644 --- a/recipes-devtools/rust/libstd-rs.bb +++ b/recipes-devtools/rust/libstd-rs.bb @@ -23,12 +23,10 @@ RUSTFLAGS += "-L ${STAGING_LIBDIR}" B = "${WORKDIR}/build" -do_compile () { +do_compile_prepend () { cd ${S}/src/rustc/std_shim export CARGO_TARGET_DIR="${B}" export RUSTC_BOOTSTRAP_KEY="e8edd0fd" - oe_cargo_fix_env - oe_cargo_build } do_install () { From fbf59ed6a04e02280751a69bdb1974c0b5a21708 Mon Sep 17 00:00:00 2001 From: Steven Walter Date: Mon, 5 Sep 2016 15:01:12 -0400 Subject: [PATCH 034/112] cargo.bbclass: replace with what was cargo_util.bbclass The old cargo.bbclass had no users in meta-rust and had lots of problems (not least of which was lots of duplicated lines with cargo_util.bbclass). Delete the old cargo.bbclass and replace it entirely wiht cargo_util --- classes/cargo.bbclass | 68 ++++++---- classes/cargo_util.bbclass | 117 ------------------ recipes-devtools/cargo/cargo.inc | 4 +- recipes-devtools/rust/libstd-rs.bb | 2 +- .../rust-hello-world/rust-hello-world_git.bb | 2 +- recipes-example/rustfmt/rustfmt_0.4.0.bb | 2 +- 6 files changed, 47 insertions(+), 148 deletions(-) delete mode 100644 classes/cargo_util.bbclass diff --git a/classes/cargo.bbclass b/classes/cargo.bbclass index 3d1605c..ded9894 100644 --- a/classes/cargo.bbclass +++ b/classes/cargo.bbclass @@ -1,20 +1,23 @@ -inherit rust +inherit rust-vars +# add crate fetch support +inherit crate-fetch -CARGO ?= "cargo" +# the binary we will use +CARGO = "cargo" + +# Where we download our registry and dependencies to export CARGO_HOME = "${WORKDIR}/cargo_home" -def cargo_base_dep(d): - deps = "" - if not d.getVar('INHIBIT_DEFAULT_DEPS', True) and not d.getVar('INHIBIT_CARGO_DEP', True): - deps += " cargo-native" - return deps +# We need cargo to compile for the target +BASEDEPENDS_append = " cargo-native" -BASEDEPENDS_append = " ${@cargo_base_dep(d)}" +# Ensure we get the right rust variant +DEPENDS_append_class-target = " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}" +DEPENDS_append_class-native = " rust-native" # Cargo only supports in-tree builds at the moment B = "${S}" - # In case something fails in the build process, give a bit more feedback on # where the issue occured export RUST_BACKTRACE = "1" @@ -24,22 +27,26 @@ export RUST_BACKTRACE = "1" # for cross compilation, so tell it we know better than it. export PKG_CONFIG_ALLOW_CROSS = "1" -EXTRA_OECARGO_PATHS ??= "" - cargo_do_configure () { - # FIXME: we currently make a mess in the directory above us - # (${WORKDIR}), which may not be ideal. Look into whether this is - # allowed - mkdir -p ../.cargo + mkdir -p ${CARGO_HOME} # NOTE: we cannot pass more flags via this interface, the 'linker' is # assumed to be a path to a binary. If flags are needed, a wrapper must # be used. - echo "paths = [" >../.cargo/config + echo "paths = [" > ${CARGO_HOME}/config for p in ${EXTRA_OECARGO_PATHS}; do printf "\"%s\"\n" "$p" - done | sed -e 's/$/,/' >>../.cargo/config - echo "]" >>../.cargo/config + done | sed -e 's/$/,/' >> ${CARGO_HOME}/config + echo "]" >> ${CARGO_HOME}/config + + # Point cargo at our local mirror of the registry + cat >> ${CARGO_HOME}/config < ${CARGO_HOME}/config - - for p in ${EXTRA_OECARGO_PATHS}; do - printf "\"%s\"\n" "$p" - done | sed -e 's/$/,/' >> ${CARGO_HOME}/config - echo "]" >> ${CARGO_HOME}/config - - # Point cargo at our local mirror of the registry - cat >> ${CARGO_HOME}/config < Date: Mon, 5 Sep 2016 15:14:19 -0400 Subject: [PATCH 035/112] README.md: link to cargo-bitbake helper program cargo-bitbake can be used to generate recipes for cargo-based rust packages. --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index c2d1cc6..a93bae4 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,19 @@ This openembedded layer provides the rust compiler, tools for building packages - rust (built for target) +## Building a rust package + +When building a rust package in bitbake, it's usually easiest to build with +cargo using cargo.bbclass. If the package already has a Cargo.toml file (most +rust packages do), then it's especially easy. Otherwise you should probably +get the code building in cargo first. + +Once your package builds in cargo, you can use +[cargo-bitbake](https://github.com/cardoe/cargo-bitbake) to generate a bitbake +recipe for it. This allows bitbake to fetch all the necessary dependent +crates, as well as a pegged version of the crates.io index, to ensure maximum +reproducibility. + ## Common issues when packaging things using cargo You may run into errors similar to: From e47bf14904e632252a85ea5a175be198a605593b Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Tue, 13 Sep 2016 23:28:31 -0400 Subject: [PATCH 036/112] cargo: avoid build failure due to --disable-static not being recognized Not sure why this is starting to affect cargo now, but let's fix it. --- recipes-devtools/cargo/cargo.inc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recipes-devtools/cargo/cargo.inc b/recipes-devtools/cargo/cargo.inc index f7d42d5..fa13057 100644 --- a/recipes-devtools/cargo/cargo.inc +++ b/recipes-devtools/cargo/cargo.inc @@ -76,6 +76,9 @@ PACKAGECONFIG[rust-snapshot] = "--local-rust-root=${B}/rustc" # Used in libgit2-sys's build.rs, needed for pkg-config to be used export LIBGIT2_SYS_USE_PKG_CONFIG = "1" +# cargo's configure doesn't recognize --disable-static, so remove it. +DISABLE_STATIC = "" + do_configure () { ${@bb.utils.contains('PACKAGECONFIG', 'rust-snapshot', '${S}/.travis.install.deps.sh', ':', d)} From 237a22fd170601b6ec6d4734b18119fb7af5a30d Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Wed, 14 Sep 2016 00:00:59 -0400 Subject: [PATCH 037/112] rust-cross: fix build where TARGET_ARCH and HOST_ARCH are the same By copying exactly the target we intend to. Fixes #77 --- recipes-devtools/rust/rust-cross.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-devtools/rust/rust-cross.bb b/recipes-devtools/rust/rust-cross.bb index 36c0bb3..c350014 100644 --- a/recipes-devtools/rust/rust-cross.bb +++ b/recipes-devtools/rust/rust-cross.bb @@ -40,7 +40,7 @@ do_compile () { do_install () { mkdir -p ${D}${prefix}/${base_libdir_native}/rustlib - cp ${WORKDIR}/targets/${TARGET_ARCH}* ${D}${prefix}/${base_libdir_native}/rustlib + cp ${WORKDIR}/targets/${TARGET_SYS}.json ${D}${prefix}/${base_libdir_native}/rustlib } rust_cross_sysroot_preprocess() { From 1cb0b64537f234c084c836eb47b73cdffb5c0da0 Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Sat, 24 Sep 2016 13:20:00 -0400 Subject: [PATCH 038/112] rust: remove duplicated TARGET_LLVM_* vars --- recipes-devtools/rust/rust.inc | 3 --- 1 file changed, 3 deletions(-) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index 253f676..c7c4bd5 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -238,12 +238,9 @@ def ldflags_for(d, thing, arch): TARGET_LLVM_CPU="${@llvm_cpu(d)}" TARGET_LLVM_FEATURES = "${@llvm_features_from_tune(d)} ${@llvm_features_from_cc_arch(d)}" -TARGET_LLVM_CPU_class-cross="${@llvm_cpu(d)}" -TARGET_LLVM_FEATURES_class-cross = "${@llvm_features_from_tune(d)} ${@llvm_features_from_cc_arch(d)}" # class-native implies TARGET=HOST, and TUNE_FEATURES only describes the real # (original) target. -TARGET_LLVM_CPU="${@llvm_cpu(d)}" TARGET_LLVM_FEATURES_class-native = "${@llvm_features_from_cc_arch(d)}" def rust_gen_target(d, thing, wd): From 45d540de3613b4f29ab0a2a0fa25d694986173d8 Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Sun, 25 Sep 2016 00:53:39 -0400 Subject: [PATCH 039/112] rust.inc: EXTRA_OEMAKE is now empty by default, drop our set Since poky rev: f8520142c8a33fa9414314511fb01fbe79a2bf01, oe-core rev: aeb653861a0ec39ea7a014c0622980edcbf653fa --- recipes-devtools/rust/rust.inc | 3 --- 1 file changed, 3 deletions(-) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index c7c4bd5..f28f0b5 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -13,9 +13,6 @@ B = "${WORKDIR}/build" DEPENDS += "file-native" -# Avoid having the default bitbake.conf disable sub-make parallelization -EXTRA_OEMAKE = "" - PACKAGECONFIG ??= "" # Controls whether we use the local rust to build. From 9b8d884d6b51d7839beb4b6cf998c7c1f4dacdce Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Sun, 25 Sep 2016 02:29:29 -0400 Subject: [PATCH 040/112] rust.inc: start passing *FLAGS vars to compile When rust's build system builds llvm itself, it uses these flags. Avoid them interfering with other things by cleaning their usage out of the platform cfg mk file. --- recipes-devtools/rust/rust.inc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index f28f0b5..522b910 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -320,6 +320,15 @@ def rust_gen_mk_cfg(d, thing): i = open(d.getVar('S', True) + '/mk/cfg/' + rust_base_sys + '.mk', 'r') r = subprocess.call(['sed', + # CFLAGS, LDFLAGS, CXXFLAGS, CPPFLAGS are used by rust's build for a + # wide range of targets (not just HOST). Yocto's settings for them will + # be inappropriate, avoid having random targets try to use them, we'll + # add as needed. + '-e', 's/$(CFLAGS)//', + '-e', 's/$(CXXFLAGS)//', + '-e', 's/$(CPPFLAGS)//', + '-e', 's/$(LDFLAGS)//', + # update all triplets to the new one '-e', 's/{}/{}/g'.format(rust_base_sys, sys), @@ -377,14 +386,6 @@ do_configure () { # FIXME: target_prefix vs prefix, see cross.bbclass - # CFLAGS, LDFLAGS, CXXFLAGS, CPPFLAGS are used by rust's build for a - # wide range of targets (not just HOST). Yocto's settings for them will - # be inappropriate, avoid using. - unset CFLAGS - unset LDFLAGS - unset CXXFLAGS - unset CPPFLAGS - # FIXME: this path to rustc (via `which rustc`) may not be quite right in the case # where we're reinstalling the compiler. May want to try for a real # path based on bitbake vars From 41800bdd99f7e8ecc7d836faf21e2c31b9a2c63d Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Sun, 25 Sep 2016 02:30:46 -0400 Subject: [PATCH 041/112] rust.inc: ensure proper flags are given to rustllvm rustllvm ships some c++ code that we need to ensure is built with the flags we want. Abuse an existing variable to make this happen. This should fix our issues with the libstdc++ cxx11 abi (_GLIBCXX_USE_CXX11_ABI). --- recipes-devtools/rust/rust.inc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index 522b910..e4f3956 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -359,6 +359,13 @@ def rust_gen_mk_cfg(d, thing): if r: raise Exception o.write("OBJCOPY_{} := {}objcopy\n".format(sys, prefix)) + # Note: this isn't how this variable is supposed to be used, but for + # non-msvc platforms nothing else touches it. + # These are the only extra flags passed to the rustllvm (c++ code) build. + # These are only used for host (even though we emit them for all targets) + # Without this, there are link failures due to GLIBC_CXX11_ABI issues in + # certain setups. + o.write("EXTRA_RUSTLLVM_CXXFLAGS_{} := {}\n".format(sys, cxxflags_for(d, thing))) o.close() i.close() From 3b954b38d115128dd7bede97a999b2b91498035a Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Sat, 30 Jul 2016 15:38:25 -0500 Subject: [PATCH 042/112] update case of OpenEmbedded to match upstream --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a93bae4..56d34d0 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## Introduction -This openembedded layer provides the rust compiler, tools for building packages +This OpenEmbedded layer provides the rust compiler, tools for building packages (cargo), and a few example projects. ## What works: From 1436b996928f93da4a23b11d33416b3a05292d0e Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Sat, 1 Oct 2016 20:52:32 -0400 Subject: [PATCH 043/112] rust: avoid using flags for TARGET for non-TARGET --- recipes-devtools/rust/rust.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index e4f3956..b886e2a 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -247,8 +247,10 @@ def rust_gen_target(d, thing, wd): prefix = prefix_for(d, thing) features = "" + cpu = "generic" if thing is "TARGET": features = d.getVar('TARGET_LLVM_FEATURES', True) or "" + cpu = d.getVar('TARGET_LLVM_CPU', True) features = features or d.getVarFlag('FEATURES', arch, True) or "" # build tspec @@ -264,7 +266,7 @@ def rust_gen_target(d, thing, wd): tspec['linker'] = "{}{}gcc".format(d.getVar('CCACHE', True), prefix) tspec['objcopy'] = "{}objcopy".format(prefix) tspec['ar'] = "{}ar".format(prefix) - tspec['cpu'] = d.getVar('TARGET_LLVM_CPU', True) + tspec['cpu'] = cpu if features is not "": tspec['features'] = features tspec['dynamic-linking'] = True From 8262f3ac0fc77f40fc5bf2fc97da021d4e564f39 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Fri, 28 Oct 2016 13:25:27 -0500 Subject: [PATCH 044/112] containerize script for a Yocto build env The containerize script fetches down a Docker container and wires up the current directory inside so that you can use a known good environment for compiling Yocto that has all the dependencies. Signed-off-by: Doug Goldstein --- scripts/containerize.sh | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 scripts/containerize.sh diff --git a/scripts/containerize.sh b/scripts/containerize.sh new file mode 100755 index 0000000..c9ac0db --- /dev/null +++ b/scripts/containerize.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# what container are we using to build this +CONTAINER="starlabio/yocto:1.5" + +einfo() { + echo "$*" >&2 +} + +die() { + echo "$*" >&2 + exit 1 +} + +# Save the commands for future use +cmd=$@ + +# If no command was specified, just drop us into a shell if we're interactive +[ $# -eq 0 ] && tty -s && cmd="/bin/bash" + +# user and group we are running as to ensure files created inside +# the container retain the same permissions +my_uid=$(id -u) +my_gid=$(id -g) + +# Are we in an interactive terminal? +tty -s && termint=t + +# Fetch the latest version of the container +einfo "*** Ensuring local container is up to date" +docker pull ${CONTAINER} > /dev/null || die "Failed to update docker container" + +# Ensure we've got what we need for SSH_AUTH_SOCK +if [[ -n ${SSH_AUTH_SOCK} ]]; then + SSH_AUTH_DIR=$(dirname $(readlink -f ${SSH_AUTH_SOCK})) + SSH_AUTH_NAME=$(basename ${SSH_AUTH_SOCK}) +fi + +# Kick off Docker +einfo "*** Launching container ..." +exec docker run \ + --privileged \ + -e BUILD_UID=${my_uid} \ + -e BUILD_GID=${my_gid} \ + -e TEMPLATECONF=meta-rust/conf \ + -e MACHINE=${MACHINE:-qemux86} \ + ${SSH_AUTH_SOCK:+-e SSH_AUTH_SOCK="/tmp/ssh-agent/${SSH_AUTH_NAME}"} \ + -v ${HOME}/.ssh:/var/build/.ssh \ + -v "${PWD}":/var/build:rw \ + ${SSH_AUTH_SOCK:+-v "${SSH_AUTH_DIR}":/tmp/ssh-agent} \ + ${EXTRA_CONTAINER_ARGS} \ + -${termint}i --rm -- \ + ${CONTAINER} \ + ${cmd} From a2c1575132e57ece51de6a7740befb42ec391b43 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Fri, 28 Oct 2016 13:28:17 -0500 Subject: [PATCH 045/112] helper script to fetch down dependent layers meta-rust has some layers it depends on and this script ensures it fetches them down appropriately so that the poky directory can be used as the source. Signed-off-by: Doug Goldstein --- scripts/fetch.sh | 91 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100755 scripts/fetch.sh diff --git a/scripts/fetch.sh b/scripts/fetch.sh new file mode 100755 index 0000000..2d4897a --- /dev/null +++ b/scripts/fetch.sh @@ -0,0 +1,91 @@ +#!/bin/bash + +# the repos we want to check out, must setup variables below +# NOTE: poky must remain first +REPOS="poky metaoe" + +POKY_URI="git://git.yoctoproject.org/poky.git" +POKY_PATH="poky" +POKY_REV="${POKY_REV-refs/remotes/origin/$1}" + +METAOE_URI="git://git.openembedded.org/meta-openembedded.git" +METAOE_PATH="poky/meta-openembedded" +METAOE_REV="${METAOE_REV-refs/remotes/origin/$1}" + +METARUST_URI="." +METARUST_PATH="poky/meta-rust" + +die() { + echo "$*" >&2 + exit 1 +} + +update_repo() { + uri=$1 + path=$2 + rev=$3 + + # check if we already have it checked out, if so we just want to update + if [[ -d ${path} ]]; then + pushd ${path} > /dev/null + echo "Updating '${path}'" + git remote set-url origin "${uri}" + git fetch origin || die "unable to fetch ${uri}" + else + echo "Cloning '${path}'" + git clone ${uri} ${path} || die "unable to clone ${uri}" + pushd ${path} > /dev/null + fi + + # The reset steps are taken from Jenkins + + # Reset + # * drop -d from clean to not nuke build/tmp + # * add -e to not clear out bitbake bits + git reset --hard || die "failed reset" + git clean -fx -e bitbake -e meta/lib/oe || die "failed clean" + + # Call the branch what we're basing it on, otherwise use default + # if the revision was not a branch. + branch=$(basename ${rev}) + [[ "${branch}" == "${rev}" ]] && branch="default" + + # Create 'default' branch + git update-ref refs/heads/${branch} ${rev} || \ + die "unable to get ${rev} of ${uri}" + git config branch.${branch}.remote origin || die "failed config remote" + git config branch.${branch}.merge ${rev} || die "failed config merge" + git symbolic-ref HEAD refs/heads/${branch} || die "failed symbolic-ref" + git reset --hard || die "failed reset" + popd > /dev/null + echo "Updated '${path}' to '${rev}'" +} + +# For each repo, do the work +for repo in ${REPOS}; do + # upper case the name + repo=$(echo ${repo} | tr '[:lower:]' '[:upper:]') + + # expand variables + expand_uri="${repo}_URI" + expand_path="${repo}_PATH" + expand_rev="${repo}_REV" + repo_uri=${!expand_uri} + repo_path=${!expand_path} + repo_rev=${!expand_rev} + + # check that we've got data + [[ -z ${repo_uri} ]] && die "No revision defined in ${expand_uri}" + [[ -z ${repo_path} ]] && die "No revision defined in ${expand_path}" + [[ -z ${repo_rev} ]] && die "No revision defined in ${expand_rev}" + + # now fetch/clone/update repo + update_repo "${repo_uri}" "${repo_path}" "${repo_rev}" + +done + +rm -rf "${METARUST_PATH}" || die "unable to clear old ${METARUST_PATH}" +ln -sf "../${METARUST_URI}" "${METARUST_PATH}" || \ + die "unable to symlink ${METARUST_PATH}" + +exit 0 From 52cbdd3b24d2806c15ec78d29a4217375589f6b5 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Fri, 28 Oct 2016 13:32:17 -0500 Subject: [PATCH 046/112] add Yocto config files so we can build So that we can use the meta-rust layer as the final layer with some configuration (for the purposes of testing). These configs should be not used by actual end users. Signed-off-by: Doug Goldstein --- conf/bblayers.conf.sample | 21 ++++ conf/local.conf.sample | 238 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 259 insertions(+) create mode 100644 conf/bblayers.conf.sample create mode 100644 conf/local.conf.sample diff --git a/conf/bblayers.conf.sample b/conf/bblayers.conf.sample new file mode 100644 index 0000000..c2d73a2 --- /dev/null +++ b/conf/bblayers.conf.sample @@ -0,0 +1,21 @@ +# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +LCONF_VERSION = "6" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ##OEROOT##/meta-rust \ + ##OEROOT##/meta \ + ##OEROOT##/meta-yocto \ + ##OEROOT##/meta-yocto-bsp \ + ##OEROOT##/meta-openembedded/meta-oe \ + ##OEROOT##/meta-openembedded/meta-networking \ + ##OEROOT##/meta-openembedded/meta-python \ + ##OEROOT##/meta-openembedded/meta-ruby \ + " +BBLAYERS_NON_REMOVABLE ?= " \ + ##OEROOT##/meta \ + ##OEROOT##/meta-yocto \ + " diff --git a/conf/local.conf.sample b/conf/local.conf.sample new file mode 100644 index 0000000..a7b2d80 --- /dev/null +++ b/conf/local.conf.sample @@ -0,0 +1,238 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at local.conf.extended +# which contains other examples of configuration which can be placed in this file +# but new users likely won't need any of them initially. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +#MACHINE ?= "mpc8315e-rdb" +#MACHINE ?= "edgerouter" +# +# This sets the default machine to be qemux86 if no other machine is selected: +MACHINE ??= "qemux86" + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# We default to rpm: +PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686 and x86_64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes/image.bbclass and meta/classes/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +# - 'image-mklibs' to reduce shared library files size for an image +# - 'image-prelink' in order to prelink the filesystem image +# - 'image-swab' to perform host system intrusion detection +# NOTE: if listing mklibs & prelink both, then make sure mklibs is before prelink +# NOTE: mklibs also needs to be explicitly enabled for a given image, see local.conf.extended +# image-prelink disabled for now due to issues with IFUNC symbol relocation +USER_CLASSES ?= "buildstats image-mklibs" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. To +# enable this uncomment this line. See classes/testimage(-auto).bbclass for +# further details. +#TEST_IMAGE = "1" +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less that 100MB or 1K inodes, perform a hard abort +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necesary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS = "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + ABORT,${TMPDIR},100M,1K \ + ABORT,${DL_DIR},100M,1K \ + ABORT,${SSTATE_DIR},100M,1K \ + ABORT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as http or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ +#file://.* file:///some/local/dir/sstate/PATH" + + +# +# Qemu configuration +# +# By default qemu will build with a builtin VNC server where graphical output can be +# seen. The two lines below enable the SDL backend too. By default libsdl-native will +# be built, if you want to use your host's libSDL instead of the minimal libsdl built +# by libsdl-native then uncomment the ASSUME_PROVIDED line below. +PACKAGECONFIG_append_pn-qemu-native = " sdl" +PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl" +#ASSUME_PROVIDED += "libsdl-native" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "1" From 1622af812d7a8bf8c8a5c01a35f113892efc1d6d Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Fri, 28 Oct 2016 13:58:04 -0500 Subject: [PATCH 047/112] add a basic build script for testing This script can be extended in the future but it uses the containerize script to ensure we run inside of a working build environment. This script can be extended to build additional targets for testing. Signed-off-by: Doug Goldstein --- scripts/build.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 scripts/build.sh diff --git a/scripts/build.sh b/scripts/build.sh new file mode 100755 index 0000000..7c40381 --- /dev/null +++ b/scripts/build.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +# Grab the MACHINE from the environment; otherwise, set it to a sane default +export MACHINE="${MACHINE-qemux86}" + +# What to build +BUILD_TARGETS="\ + rustfmt \ + " + +die() { + echo "$*" >&2 + exit 1 +} + +rm -f build/conf/bblayers.conf || die "failed to nuke bblayers.conf" +rm -f build/conf/local.conf || die "failed to nuke local.conf" + +./scripts/containerize.sh bitbake ${BUILD_TARGETS} || die "failed to build" From d716587c2668b4d426d77b1f3d2886971bc3658b Mon Sep 17 00:00:00 2001 From: Derek Straka Date: Fri, 28 Oct 2016 13:34:49 -0500 Subject: [PATCH 048/112] add Jenkinsfile to test each PR and branch commits This includes a basic test that attempts to compile the rustfmt crate. Ensures that the workspace is always removed at the end of the build. It utilizes available caches to speed up the build process and parallelizes the build across i386, x86_64, arm32, and arm64 targets. Signed-off-by: Derek Straka --- Jenkinsfile | 36 ++++++++++++++++++++++++++++++++++++ conf/local.conf.sample | 4 ++++ scripts/cleanup-env.sh | 5 +++++ scripts/fetch.sh | 8 ++++++-- scripts/setup-env.sh | 7 +++++++ 5 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 Jenkinsfile create mode 100755 scripts/cleanup-env.sh create mode 100755 scripts/setup-env.sh diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..2fc6fdc --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,36 @@ +def targets = [ 'qemux86', 'qemux86-64', 'qemuarm', 'qemuarm64' ] + +def machine_builds = [:] + +for (int i = 0; i < targets.size(); i++) { + def machine = targets.get(i) + + machine_builds["$machine"] = { + node { + try { + stage('Checkout') { + checkout scm + } + stage('Setup Environment') { + sh "./scripts/setup-env.sh" + } + stage('Yocto Fetch') { + sh "GIT_LOCAL_REF_DIR=/srv/git-cache/ ./scripts/fetch.sh master" + } + stage('Build') { + sh "MACHINE=${machine} ./scripts/build.sh" + } + } catch (e) { + echo "Caught: ${e}" + throw e + } finally { + stage('Cleanup Environment') { + sh "./scripts/cleanup-env.sh" + deleteDir() + } + } + } + } +} + +parallel machine_builds diff --git a/conf/local.conf.sample b/conf/local.conf.sample index a7b2d80..08e6e7e 100644 --- a/conf/local.conf.sample +++ b/conf/local.conf.sample @@ -220,6 +220,10 @@ BB_DISKMON_DIRS = "\ #file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \ #file://.* file:///some/local/dir/sstate/PATH" +SSTATE_MIRRORS ?= "file://.* http://build-cache.asterius.io/sstate/PATH;downloadfilename=PATH \n" + +SOURCE_MIRROR_URL ?= "http://build-cache.asterius.io/downloads/" +INHERIT += "own-mirrors rm_work" # # Qemu configuration diff --git a/scripts/cleanup-env.sh b/scripts/cleanup-env.sh new file mode 100755 index 0000000..1367724 --- /dev/null +++ b/scripts/cleanup-env.sh @@ -0,0 +1,5 @@ +#!/bin/bash -e + +sudo umount build + +exit 0 diff --git a/scripts/fetch.sh b/scripts/fetch.sh index 2d4897a..4a54df3 100755 --- a/scripts/fetch.sh +++ b/scripts/fetch.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -x # the repos we want to check out, must setup variables below # NOTE: poky must remain first @@ -33,7 +33,11 @@ update_repo() { git fetch origin || die "unable to fetch ${uri}" else echo "Cloning '${path}'" - git clone ${uri} ${path} || die "unable to clone ${uri}" + if [ -z "${GIT_LOCAL_REF_DIR}" ]; then + git clone ${uri} ${path} || die "unable to clone ${uri}" + else + git clone --reference ${GIT_LOCAL_REF_DIR}/`basename ${path}` ${uri} ${path} + fi pushd ${path} > /dev/null fi diff --git a/scripts/setup-env.sh b/scripts/setup-env.sh new file mode 100755 index 0000000..e5fc3b1 --- /dev/null +++ b/scripts/setup-env.sh @@ -0,0 +1,7 @@ +#!/bin/bash -e + +mkdir -p build + +sudo mount -t tmpfs -o size=64G,mode=755,uid=${UID} tmpfs build + +exit 0 From a1ca1ed06d649efd28d9d4ba9e45954d128fbb5c Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 31 Oct 2016 11:52:58 -0500 Subject: [PATCH 049/112] rust-llvm: stop using shared source Convert rust-llvm to not use the shared source setup and instead use its own extracted directory. Include the version info in the bitbake file so that in the future we can support multiple versions via a PREFERRED_VERSIONS variable. --- recipes-devtools/rust/rust-llvm.bb | 9 --------- recipes-devtools/rust/rust-llvm.inc | 11 ++++++++--- recipes-devtools/rust/rust-llvm_1.10.0.bb | 10 ++++++++++ 3 files changed, 18 insertions(+), 12 deletions(-) delete mode 100644 recipes-devtools/rust/rust-llvm.bb create mode 100644 recipes-devtools/rust/rust-llvm_1.10.0.bb diff --git a/recipes-devtools/rust/rust-llvm.bb b/recipes-devtools/rust/rust-llvm.bb deleted file mode 100644 index 62fb3d4..0000000 --- a/recipes-devtools/rust/rust-llvm.bb +++ /dev/null @@ -1,9 +0,0 @@ -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-devtools/rust/rust-llvm.inc b/recipes-devtools/rust/rust-llvm.inc index 0ed6096..3c94492 100644 --- a/recipes-devtools/rust/rust-llvm.inc +++ b/recipes-devtools/rust/rust-llvm.inc @@ -1,9 +1,14 @@ -require rust-shared-source.inc - SUMMARY = "LLVM compiler framework (packaged with rust)" LICENSE = "NCSA" -S .= "/src/llvm" +SRC_URI = "\ + https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ + file://rust-llvm/0001-Don-t-build-unittests.patch \ +" + +S = "${WORKDIR}/rustc-${PV}/src/llvm" + +LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=4c0bc17c954e99fd547528d938832bfa" inherit autotools diff --git a/recipes-devtools/rust/rust-llvm_1.10.0.bb b/recipes-devtools/rust/rust-llvm_1.10.0.bb new file mode 100644 index 0000000..36a8212 --- /dev/null +++ b/recipes-devtools/rust/rust-llvm_1.10.0.bb @@ -0,0 +1,10 @@ +require rust-llvm.inc + +SRC_URI[rust.md5sum] = "a48fef30353fc9daa70b484b690ce5db" +SRC_URI[rust.sha256sum] = "a4015aacf4f6d8a8239253c4da46e7abaa8584f8214d1828d2ff0a8f56176869" + +do_install_append () { + cd "${B}" + install -d "${D}${bindir}" + install -m755 "Release/bin/FileCheck" "${D}${bindir}" +} From 7f7b3cd652587d6e3774ba9c35e99ef271392ae2 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 31 Oct 2016 22:44:01 -0500 Subject: [PATCH 050/112] rust: stop using shared source Convert rust to not use the shared source setup and instead use its own extracted directory. Include the version info in the bitbake file so that in the future we can support multiple versions via a PREFERRED_VERSIONS variable. --- .../{rust-cross.bb => rust-cross_1.10.0.bb} | 3 ++ recipes-devtools/rust/rust.bb | 11 ------- recipes-devtools/rust/rust.inc | 28 +++++++----------- recipes-devtools/rust/rust_1.10.0.bb | 29 +++++++++++++++++++ 4 files changed, 43 insertions(+), 28 deletions(-) rename recipes-devtools/rust/{rust-cross.bb => rust-cross_1.10.0.bb} (92%) delete mode 100644 recipes-devtools/rust/rust.bb create mode 100644 recipes-devtools/rust/rust_1.10.0.bb diff --git a/recipes-devtools/rust/rust-cross.bb b/recipes-devtools/rust/rust-cross_1.10.0.bb similarity index 92% rename from recipes-devtools/rust/rust-cross.bb rename to recipes-devtools/rust/rust-cross_1.10.0.bb index c350014..d745404 100644 --- a/recipes-devtools/rust/rust-cross.bb +++ b/recipes-devtools/rust/rust-cross_1.10.0.bb @@ -1,6 +1,9 @@ require rust.inc inherit cross +SRC_URI[rust.md5sum] = "a48fef30353fc9daa70b484b690ce5db" +SRC_URI[rust.sha256sum] = "a4015aacf4f6d8a8239253c4da46e7abaa8584f8214d1828d2ff0a8f56176869" + # Otherwise we'll depend on what we provide INHIBIT_DEFAULT_RUST_DEPS = "1" diff --git a/recipes-devtools/rust/rust.bb b/recipes-devtools/rust/rust.bb deleted file mode 100644 index ab61226..0000000 --- a/recipes-devtools/rust/rust.bb +++ /dev/null @@ -1,11 +0,0 @@ -inherit rust-installer -require rust.inc - -DEPENDS += "rust-llvm" - -# 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" diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index b886e2a..e8e7fad 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -1,15 +1,17 @@ -# ex: sts=4 et sw=4 ts=8 -inherit rust -require rust-shared-source.inc -require rust-snapshot-2016-05-24.inc - -LIC_FILES_CHKSUM ="file://COPYRIGHT;md5=43e1f1fb9c0ee3af66693d8c4fecafa8" - SUMMARY = "Rust compiler and runtime libaries" HOMEPAGE = "http://www.rust-lang.org" SECTION = "devel" +LICENSE = "MIT | Apache-2.0" +LIC_FILES_CHKSUM ="file://COPYRIGHT;md5=43e1f1fb9c0ee3af66693d8c4fecafa8" -B = "${WORKDIR}/build" +inherit rust +require rust-snapshot-2016-05-24.inc + +SRC_URI = "\ + https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ + " + +S = "${WORKDIR}/rustc-${PV}" DEPENDS += "file-native" @@ -385,14 +387,6 @@ llvmdir = "${STAGING_DIR_NATIVE}/${prefix_native}" export CFG_DISABLE_LDCONFIG="notempty" do_configure () { - # Note: when we adjust the generated targets, rust doesn't rebuild (even - # when it should), so for now we need to remove the build dir to keep - # things in sync. - cd "${WORKDIR}" - rm -rf "${B}/" - mkdir -p "${B}/" - cd "${B}" - # FIXME: target_prefix vs prefix, see cross.bbclass # FIXME: this path to rustc (via `which rustc`) may not be quite right in the case @@ -484,4 +478,4 @@ rust_do_install () { do_install () { rust_do_install } - +# ex: sts=4 et sw=4 ts=8 diff --git a/recipes-devtools/rust/rust_1.10.0.bb b/recipes-devtools/rust/rust_1.10.0.bb new file mode 100644 index 0000000..be35dbf --- /dev/null +++ b/recipes-devtools/rust/rust_1.10.0.bb @@ -0,0 +1,29 @@ +inherit rust-installer +require rust.inc + +SRC_URI += " \ + file://rust/0001-Add-config-for-musl-based-arm-builds.patch \ + file://rust/0002-Target-add-default-target.json-path-libdir-rust-targ.patch \ + file://rust/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch \ + file://rust/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \ + file://rust/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch \ + file://rust/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch \ + file://rust/0007-mk-install-use-disable-rewrite-paths.patch \ + file://rust/0008-Allow-overriding-crate_hash-with-C-crate_hash.patch \ + file://rust/0009-mk-platform.mk-pass-C-crate_hash-to-builds.patch \ + file://rust/0010-mk-allow-changing-the-platform-configuration-source-.patch \ + file://rust/0011-Get-rid-of-the-.note-interpretation-of-rustc-dylib-m.patch \ + file://rust-installer/0001-add-option-to-disable-rewriting-of-install-paths.patch;patchdir=src/rust-installer \ + " + +SRC_URI[rust.md5sum] = "a48fef30353fc9daa70b484b690ce5db" +SRC_URI[rust.sha256sum] = "a4015aacf4f6d8a8239253c4da46e7abaa8584f8214d1828d2ff0a8f56176869" + +DEPENDS += "rust-llvm" + +# 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 1f903865b42b8fb82943bb524caa509cdfb62125 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 1 Nov 2016 11:16:59 -0500 Subject: [PATCH 051/112] compiler-rt: stop using shared source Convert compiler-rt to not use the shared source setup and instead use its own extracted directory. Include the version info in the bitbake file so that in the future we can support multiple versions via a PREFERRED_VERSIONS variable. --- .../rust/{compiler-rt.bb => compiler-rt_1.10.0.bb} | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) rename recipes-devtools/rust/{compiler-rt.bb => compiler-rt_1.10.0.bb} (63%) diff --git a/recipes-devtools/rust/compiler-rt.bb b/recipes-devtools/rust/compiler-rt_1.10.0.bb similarity index 63% rename from recipes-devtools/rust/compiler-rt.bb rename to recipes-devtools/rust/compiler-rt_1.10.0.bb index d0dc987..fabe0e2 100644 --- a/recipes-devtools/rust/compiler-rt.bb +++ b/recipes-devtools/rust/compiler-rt_1.10.0.bb @@ -2,12 +2,15 @@ SUMMARY = "Rust compiler run-time" HOMEPAGE = "http://www.rust-lang.org" SECTION = "devel" LICENSE = "MIT" - -require rust-shared-source.inc LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=27b14ab4ce08d04c3a9a5f0ed7997362" -S .= "/src/compiler-rt" -B = "${WORKDIR}/build" +SRC_URI = "\ + https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ + " +SRC_URI[rust.md5sum] = "a48fef30353fc9daa70b484b690ce5db" +SRC_URI[rust.sha256sum] = "a4015aacf4f6d8a8239253c4da46e7abaa8584f8214d1828d2ff0a8f56176869" + +S = "${WORKDIR}/rustc-${PV}/src/compiler-rt" # Pick up $CC from the environment EXTRA_OEMAKE += "-e" From 2536080e0bb41079d2d0438a085abd0062e1e29e Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 1 Nov 2016 11:18:15 -0500 Subject: [PATCH 052/112] libstd-rs: stop using shared source Convert libstd-rs to not use the shared source setup and instead use its own extracted directory. Include the version info in the bitbake file so that in the future we can support multiple versions via a PREFERRED_VERSIONS variable. --- .../rust/{libstd-rs.bb => libstd-rs_1.10.0.bb} | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) rename recipes-devtools/rust/{libstd-rs.bb => libstd-rs_1.10.0.bb} (71%) diff --git a/recipes-devtools/rust/libstd-rs.bb b/recipes-devtools/rust/libstd-rs_1.10.0.bb similarity index 71% rename from recipes-devtools/rust/libstd-rs.bb rename to recipes-devtools/rust/libstd-rs_1.10.0.bb index 45229e2..c2ce9eb 100644 --- a/recipes-devtools/rust/libstd-rs.bb +++ b/recipes-devtools/rust/libstd-rs_1.10.0.bb @@ -2,9 +2,15 @@ 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 rust-shared-source.inc + +SRC_URI = "\ + https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ + " +SRC_URI[rust.md5sum] = "a48fef30353fc9daa70b484b690ce5db" +SRC_URI[rust.sha256sum] = "a4015aacf4f6d8a8239253c4da46e7abaa8584f8214d1828d2ff0a8f56176869" + +S = "${WORKDIR}/rustc-${PV}" CARGO_INDEX_COMMIT = "6127fc24b0b6fe73fe4d339817fbf000b9a798a2" @@ -21,7 +27,7 @@ inherit cargo # Needed so cargo can find libbacktrace RUSTFLAGS += "-L ${STAGING_LIBDIR}" -B = "${WORKDIR}/build" +S = "${WORKDIR}/rustc-${PV}" do_compile_prepend () { cd ${S}/src/rustc/std_shim From a97f66224ab05e4b96acca350ee3cf75a93bcbe3 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 1 Nov 2016 11:19:34 -0500 Subject: [PATCH 053/112] drop files supporting shared source --- classes/shared-source-provide.bbclass | 38 -------------------- classes/shared-source-use.bbclass | 23 ------------ recipes-devtools/rust/rust-release.inc | 6 ---- recipes-devtools/rust/rust-shared-source.inc | 3 -- recipes-devtools/rust/rust-source.bb | 29 --------------- recipes-devtools/rust/rust-version.inc | 6 ---- 6 files changed, 105 deletions(-) delete mode 100644 classes/shared-source-provide.bbclass delete mode 100644 classes/shared-source-use.bbclass delete mode 100644 recipes-devtools/rust/rust-release.inc delete mode 100644 recipes-devtools/rust/rust-shared-source.inc delete mode 100644 recipes-devtools/rust/rust-source.bb delete mode 100644 recipes-devtools/rust/rust-version.inc diff --git a/classes/shared-source-provide.bbclass b/classes/shared-source-provide.bbclass deleted file mode 100644 index fc0cad2..0000000 --- a/classes/shared-source-provide.bbclass +++ /dev/null @@ -1,38 +0,0 @@ -# In order to share the same source between multiple packages (.bb files), we -# unpack and patch the X source here into a shared dir. -# -# Take a look at gcc-source.inc for the general structure of this - -# We require that "SOURCE_NAME" be set - -# nopackages.bbclass { -deltask do_package -deltask do_package_write_rpm -deltask do_package_write_ipk -deltask do_package_write_deb -deltask do_package_qa -deltask do_packagedata -#} - -deltask do_configure -deltask do_compile -deltask do_install -deltask do_populate_sysroot -deltask do_populate_lic -deltask do_rm_work - - -# override to get rid of '-native' or other misc -# XXX: consider ${PR} -PN = "${SOURCE_NAME}-source-${PV}" -WORKDIR = "${TMPDIR}/work-shared/${SOURCE_NAME}-${PV}-${PR}" -SSTATE_SWSPEC = "sstate:${SOURCE_NAME}::${PV}:${PR}::${SSTATE_VERSION}:" - -STAMP = "${STAMPS_DIR}/work-shared/${SOURCE_NAME}-${PV}-${PR}" -STAMPCLEAN = "${STAMPS_DIR}/work-shared/${SOURCE_NAME}-${PV}-*" - -INHIBIT_DEFAULT_DEPS = "1" -DEPENDS = "" -PACKAGES = "" - -EXCLUDE_FROM_WORLD = "1" diff --git a/classes/shared-source-use.bbclass b/classes/shared-source-use.bbclass deleted file mode 100644 index 884ee53..0000000 --- a/classes/shared-source-use.bbclass +++ /dev/null @@ -1,23 +0,0 @@ -# gcc's shared source code disables fetch (via the commented code below). We -# can't do that because rust.bb currently fetches a rustc-snapshot archive itself. -#do_fetch() { -# : -#} -#do_fetch[noexec] = "1" - -# gcc does `deltask` do_unpack. We avoid this so that the depends work sanely -# (things that need source code can still be ordered after do_unpack). -# As a side effect, we can also unpack things that aren't shared. -# Note: just setting this normally doesn't work. Use of python() is required. -python () { - d.setVarFlag('do_unpack', 'cleandirs', '') -} -# Avoid disabling do_patch for the same reason. -#deltask do_patch - -SRC_URI = "" - -S = "${TMPDIR}/work-shared/${SOURCE_NAME}-${PV}-${PR}" - -do_unpack[depends] += "${SOURCE_NAME}-source-${PV}:do_patch" -do_populate_lic[depends] += "${SOURCE_NAME}-source-${PV}:do_unpack" diff --git a/recipes-devtools/rust/rust-release.inc b/recipes-devtools/rust/rust-release.inc deleted file mode 100644 index 7ece6e1..0000000 --- a/recipes-devtools/rust/rust-release.inc +++ /dev/null @@ -1,6 +0,0 @@ -SRC_URI = "\ - https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ -" - -S = "${WORKDIR}/rustc-${PV}" - diff --git a/recipes-devtools/rust/rust-shared-source.inc b/recipes-devtools/rust/rust-shared-source.inc deleted file mode 100644 index eeb066c..0000000 --- a/recipes-devtools/rust/rust-shared-source.inc +++ /dev/null @@ -1,3 +0,0 @@ -inherit shared-source-use -require rust-version.inc -S .= "/rustc-${PV}" diff --git a/recipes-devtools/rust/rust-source.bb b/recipes-devtools/rust/rust-source.bb deleted file mode 100644 index ebf5eb4..0000000 --- a/recipes-devtools/rust/rust-source.bb +++ /dev/null @@ -1,29 +0,0 @@ -# In order to share the same source between multiple packages (.bb files), we -# unpack and patch the rustc source here into a shared dir. -# -# Take a look at gcc-source.inc for the general structure of this - -inherit shared-source-provide - -require rust-version.inc -require rust-release.inc - -SRC_URI[rust.md5sum] = "a48fef30353fc9daa70b484b690ce5db" -SRC_URI[rust.sha256sum] = "a4015aacf4f6d8a8239253c4da46e7abaa8584f8214d1828d2ff0a8f56176869" -LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=eb87dba71cb424233bcce88db3ae2f1a" - -SRC_URI_append = "\ - file://rust/0001-Add-config-for-musl-based-arm-builds.patch \ - file://rust/0002-Target-add-default-target.json-path-libdir-rust-targ.patch \ - file://rust/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch \ - file://rust/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \ - file://rust/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch \ - file://rust/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch \ - file://rust/0007-mk-install-use-disable-rewrite-paths.patch \ - file://rust/0008-Allow-overriding-crate_hash-with-C-crate_hash.patch \ - file://rust/0009-mk-platform.mk-pass-C-crate_hash-to-builds.patch \ - file://rust/0010-mk-allow-changing-the-platform-configuration-source-.patch \ - file://rust/0011-Get-rid-of-the-.note-interpretation-of-rustc-dylib-m.patch \ - file://rust-llvm/0001-Don-t-build-unittests.patch;patchdir=src/llvm \ - file://rust-installer/0001-add-option-to-disable-rewriting-of-install-paths.patch;patchdir=src/rust-installer \ -" diff --git a/recipes-devtools/rust/rust-version.inc b/recipes-devtools/rust/rust-version.inc deleted file mode 100644 index 53ea335..0000000 --- a/recipes-devtools/rust/rust-version.inc +++ /dev/null @@ -1,6 +0,0 @@ -# Note: if you adjust this, you'll also need to change the hashes in -# rust-source.bb -SOURCE_NAME = "rust" -PV = "1.10.0" - -LICENSE = "MIT | Apache-2.0" From 6db046c19d4b137ca458dcf8bb2c8a3f86dc5675 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 4 Apr 2016 16:28:50 -0500 Subject: [PATCH 054/112] rust-llvm: combine do_install_append() There were two different do_install_append()'s and they didn't check for errors so this improves that situation. --- recipes-devtools/rust/rust-llvm.inc | 10 +++++----- recipes-devtools/rust/rust-llvm_1.10.0.bb | 6 ------ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/recipes-devtools/rust/rust-llvm.inc b/recipes-devtools/rust/rust-llvm.inc index 3c94492..201b1d0 100644 --- a/recipes-devtools/rust/rust-llvm.inc +++ b/recipes-devtools/rust/rust-llvm.inc @@ -33,11 +33,11 @@ do_install_append () { # Remove the debug info (>2 GB) as part of normal operation rm -rf ${D}${bindir}/.debug - cd ${D}${bindir} - ln -s *-llc llc - for i in *-llvm-*; do - link=$(echo $i | sed -e 's/.*-llvm-\(.*\)/\1/') - ln -sf $i llvm-$link + cd ${D}${bindir} || bbfatal "failed to cd ${D}${bindir}" + for i in *-llvm-* *-llc *-lli *-FileCheck; do + link=$(echo $i | sed -e "s/${TARGET_SYS}-\(.*\)/\1/") + [ -e "${i}" ] || bbfatal "no such file to symlink to ${i}" + ln -sf "$i" "${link}" || bbfatal "failed to symlink ${link} to ${i}" done } diff --git a/recipes-devtools/rust/rust-llvm_1.10.0.bb b/recipes-devtools/rust/rust-llvm_1.10.0.bb index 36a8212..6405153 100644 --- a/recipes-devtools/rust/rust-llvm_1.10.0.bb +++ b/recipes-devtools/rust/rust-llvm_1.10.0.bb @@ -2,9 +2,3 @@ require rust-llvm.inc SRC_URI[rust.md5sum] = "a48fef30353fc9daa70b484b690ce5db" SRC_URI[rust.sha256sum] = "a4015aacf4f6d8a8239253c4da46e7abaa8584f8214d1828d2ff0a8f56176869" - -do_install_append () { - cd "${B}" - install -d "${D}${bindir}" - install -m755 "Release/bin/FileCheck" "${D}${bindir}" -} From 101e818ec57185c42a8d8ad3114886269b05634f Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 2 Nov 2016 08:59:13 -0500 Subject: [PATCH 055/112] fetch: ensure we default to a Yocto branch Instead of a funky git error let's default to the master branch and let the user know that we made that choice for them. --- scripts/fetch.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/fetch.sh b/scripts/fetch.sh index 4a54df3..b428261 100755 --- a/scripts/fetch.sh +++ b/scripts/fetch.sh @@ -1,16 +1,23 @@ #!/bin/bash -x +# default repo +if [[ $# -lt 1 ]]; then + echo "No Yocto branch specified, defaulting to master" + echo "To change this pass a Yocto branch name as an argument to this script" +fi +branch=${1-master} + # the repos we want to check out, must setup variables below # NOTE: poky must remain first REPOS="poky metaoe" POKY_URI="git://git.yoctoproject.org/poky.git" POKY_PATH="poky" -POKY_REV="${POKY_REV-refs/remotes/origin/$1}" +POKY_REV="${POKY_REV-refs/remotes/origin/${branch}}" METAOE_URI="git://git.openembedded.org/meta-openembedded.git" METAOE_PATH="poky/meta-openembedded" -METAOE_REV="${METAOE_REV-refs/remotes/origin/$1}" +METAOE_REV="${METAOE_REV-refs/remotes/origin/${branch}}" METARUST_URI="." METARUST_PATH="poky/meta-rust" From ea040ab01d88f833ede038ff2ba1d7d4b57872cd Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 2 Nov 2016 11:15:38 -0500 Subject: [PATCH 056/112] build: make the default machine x86_64 --- conf/local.conf.sample | 2 +- scripts/build.sh | 2 +- scripts/containerize.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/local.conf.sample b/conf/local.conf.sample index 08e6e7e..3429110 100644 --- a/conf/local.conf.sample +++ b/conf/local.conf.sample @@ -35,7 +35,7 @@ #MACHINE ?= "edgerouter" # # This sets the default machine to be qemux86 if no other machine is selected: -MACHINE ??= "qemux86" +MACHINE ??= "qemux86-64" # # Where to place downloads diff --git a/scripts/build.sh b/scripts/build.sh index 7c40381..cfff7c1 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,7 +1,7 @@ #!/bin/bash # Grab the MACHINE from the environment; otherwise, set it to a sane default -export MACHINE="${MACHINE-qemux86}" +export MACHINE="${MACHINE-qemux86-64}" # What to build BUILD_TARGETS="\ diff --git a/scripts/containerize.sh b/scripts/containerize.sh index c9ac0db..499378b 100755 --- a/scripts/containerize.sh +++ b/scripts/containerize.sh @@ -43,7 +43,7 @@ exec docker run \ -e BUILD_UID=${my_uid} \ -e BUILD_GID=${my_gid} \ -e TEMPLATECONF=meta-rust/conf \ - -e MACHINE=${MACHINE:-qemux86} \ + -e MACHINE=${MACHINE:-qemux86-64} \ ${SSH_AUTH_SOCK:+-e SSH_AUTH_SOCK="/tmp/ssh-agent/${SSH_AUTH_NAME}"} \ -v ${HOME}/.ssh:/var/build/.ssh \ -v "${PWD}":/var/build:rw \ From 8f809476c02598c6177275ed996299aca0981a9c Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Thu, 3 Nov 2016 10:41:04 -0500 Subject: [PATCH 057/112] add build/ and poky/ to ignore Since we have some helper scripts to build poky in the top level here for testing then we should ignore build/ and poky/ --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 0d20b64..5d84268 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ *.pyc +build/ +poky/ From bef7c3f07e4a69e0324dfd72ed52c244871d28e5 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Thu, 3 Nov 2016 16:28:13 -0500 Subject: [PATCH 058/112] rust: fix LLVM data layouts for Rust 1.10 The data layout changed for Rust 1.10. I noticed this because I got a crash when using rust-native to build rust. The assertion that hit was saying data layout mismatch and caused me to check the values in the Rust sources. --- recipes-devtools/rust/rust.inc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index e8e7fad..c7c4d6a 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -126,35 +126,35 @@ def llvm_features_from_cc_arch(d): return ','.join(f) ## arm-unknown-linux-gnueabihf -DATA_LAYOUT[arm] = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:64-n32" +DATA_LAYOUT[arm] = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" LLVM_TARGET[arm] = "${RUST_TARGET_SYS}" TARGET_ENDIAN[arm] = "little" TARGET_POINTER_WIDTH[arm] = "32" FEATURES[arm] = "+v6,+vfp2" PRE_LINK_ARGS[arm] = "-Wl,--as-needed" -DATA_LAYOUT[aarch64] = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-n32:64-S128" +DATA_LAYOUT[aarch64] = "e-m:e-i64:64-i128:128-n32:64-S128" LLVM_TARGET[aarch64] = "aarch64-unknown-linux-gnu" TARGET_ENDIAN[aarch64] = "little" TARGET_POINTER_WIDTH[aarch64] = "64" PRE_LINK_ARGS[aarch64] = "-Wl,--as-needed" ## x86_64-unknown-linux-gnu -DATA_LAYOUT[x86_64] = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128" +DATA_LAYOUT[x86_64] = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" LLVM_TARGET[x86_64] = "x86_64-unknown-linux-gnu" TARGET_ENDIAN[x86_64] = "little" TARGET_POINTER_WIDTH[x86_64] = "64" PRE_LINK_ARGS[x86_64] = "-Wl,--as-needed -m64" ## i686-unknown-linux-gnu -DATA_LAYOUT[i686] = "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32" +DATA_LAYOUT[i686] = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128" LLVM_TARGET[i686] = "i686-unknown-linux-gnu" TARGET_ENDIAN[i686] = "little" TARGET_POINTER_WIDTH[i686] = "32" PRE_LINK_ARGS[i686] = "-Wl,--as-needed -m32" ## XXX: a bit of a hack so qemux86 builds, clone of i686-unknown-linux-gnu above -DATA_LAYOUT[i586] = "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32" +DATA_LAYOUT[i586] = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128" LLVM_TARGET[i586] = "i586-unknown-linux-gnu" TARGET_ENDIAN[i586] = "little" TARGET_POINTER_WIDTH[i586] = "32" From ce9949725c028c2309e853fa9e779c17da5a8193 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Thu, 3 Nov 2016 17:04:40 -0500 Subject: [PATCH 059/112] rust: strip whitespace from features This whitespace in here causes rust to not be happy with the features and throw warnings about a feature such as ' +sse3' being unsupported when '+sse3' works just fine. Amazingly will cause rustc to abort when you try to resolve the features to valid configs with the `--print` arg to rustc. --- recipes-devtools/rust/rust.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index c7c4d6a..b3c7869 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -254,6 +254,7 @@ def rust_gen_target(d, thing, wd): features = d.getVar('TARGET_LLVM_FEATURES', True) or "" cpu = d.getVar('TARGET_LLVM_CPU', True) features = features or d.getVarFlag('FEATURES', arch, True) or "" + features = features.strip() # build tspec tspec = {} From ea888066a3d1d7503137fa0615f246739f8ec4a8 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 2 Nov 2016 16:25:14 -0500 Subject: [PATCH 060/112] rust-llvm: convert to cmake build Future versions of LLVM require cmake to build so it will be easier to prove that out on a known good build and to allow future versions to use this as common code. --- .../0001-Don-t-build-unittests.patch | 34 --------------- recipes-devtools/rust/rust-llvm.inc | 42 +++++++++---------- 2 files changed, 19 insertions(+), 57 deletions(-) delete mode 100644 recipes-devtools/rust/files/rust-llvm/0001-Don-t-build-unittests.patch diff --git a/recipes-devtools/rust/files/rust-llvm/0001-Don-t-build-unittests.patch b/recipes-devtools/rust/files/rust-llvm/0001-Don-t-build-unittests.patch deleted file mode 100644 index 7a297d3..0000000 --- a/recipes-devtools/rust/files/rust-llvm/0001-Don-t-build-unittests.patch +++ /dev/null @@ -1,34 +0,0 @@ -From eee79cc95f57434c4b530da96c88494e9b5d056b Mon Sep 17 00:00:00 2001 -From: Steven Walter -Date: Sat, 27 Aug 2016 13:20:48 -0400 -Subject: [PATCH] Don't build unittests - ---- - Makefile | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/Makefile b/Makefile -index 2b9468a..2bb30f6 100644 ---- a/Makefile -+++ b/Makefile -@@ -31,7 +31,7 @@ ifeq ($(BUILD_DIRS_ONLY),1) - OPTIONAL_DIRS := tools/clang/utils/TableGen - else - DIRS := lib/Support lib/TableGen utils lib/IR lib tools/llvm-shlib \ -- tools/llvm-config tools docs cmake unittests -+ tools/llvm-config tools docs cmake - OPTIONAL_DIRS := projects bindings - endif - -@@ -39,7 +39,7 @@ ifeq ($(BUILD_EXAMPLES),1) - OPTIONAL_DIRS += examples - endif - --EXTRA_DIST := test unittests llvm.spec include win32 Xcode -+EXTRA_DIST := test llvm.spec include win32 Xcode - - include $(LEVEL)/Makefile.config - --- -2.7.4 - diff --git a/recipes-devtools/rust/rust-llvm.inc b/recipes-devtools/rust/rust-llvm.inc index 201b1d0..880e3ec 100644 --- a/recipes-devtools/rust/rust-llvm.inc +++ b/recipes-devtools/rust/rust-llvm.inc @@ -3,25 +3,33 @@ LICENSE = "NCSA" SRC_URI = "\ https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ - file://rust-llvm/0001-Don-t-build-unittests.patch \ " S = "${WORKDIR}/rustc-${PV}/src/llvm" LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=4c0bc17c954e99fd547528d938832bfa" -inherit autotools +inherit cmake pythonnative -EXTRA_OECONF += "--enable-targets=x86,x86_64,arm,aarch64,mips,powerpc" -EXTRA_OECONF += "--enable-optimized" -EXTRA_OECONF += "--disable-assertions" -EXTRA_OECONF += "--disable-docs" -EXTRA_OECONF += "--enable-bindings=none" -EXTRA_OECONF += "--disable-terminfo" -EXTRA_OECONF += "--disable-zlib" -EXTRA_OECONF += "--disable-libffi" +EXTRA_OECMAKE = " \ + -DLLVM_TARGETS_TO_BUILD='X86;ARM;AArch64;PowerPC' \ + -DLLVM_ENABLE_ASSERTIONS=OFF \ + -DLLVM_BUILD_DOCS=OFF \ + -DLLVM_ENABLE_TERMINFO=OFF \ + -DLLVM_ENABLE_ZLIB=OFF \ + -DLLVM_ENABLE_FFI=OFF \ + -DLLVM_INSTALL_UTILS=ON \ + -DLLVM_BUILD_TOOLS=ON \ + -DLLVM_BUILD_EXAMPLES=OFF \ + -DLLVM_INCLUDE_EXAMPLES=OFF \ + -DLLVM_BUILD_TESTS=OFF \ + -DLLVM_INCLUDE_TESTS=OFF \ + -DLLVM_TARGET_ARCH=${TARGET_ARCH} \ +" -EXTRA_OECONF += "--enable-keep-symbols" +# The debug symbols are huge here (>2GB) so suppress them since they +# provide almost no value. If you really need them then override this +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" PACKAGES += "${PN}-data" @@ -29,16 +37,4 @@ PACKAGES += "${PN}-data" FILES_${PN}-data = "${datadir}" FILES_${PN}-dev += "${libdir}" -do_install_append () { - # Remove the debug info (>2 GB) as part of normal operation - rm -rf ${D}${bindir}/.debug - - cd ${D}${bindir} || bbfatal "failed to cd ${D}${bindir}" - for i in *-llvm-* *-llc *-lli *-FileCheck; do - link=$(echo $i | sed -e "s/${TARGET_SYS}-\(.*\)/\1/") - [ -e "${i}" ] || bbfatal "no such file to symlink to ${i}" - ln -sf "$i" "${link}" || bbfatal "failed to symlink ${link} to ${i}" - done -} - BBCLASSEXTEND = "native" From 404cbe3dccba9475ca6aaca9ad318bfe6b2682d9 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Thu, 3 Nov 2016 10:29:50 -0500 Subject: [PATCH 061/112] rust-llvm: cmake build bits from openswitch Grabbed this chunk from http://git.openswitch.net/cgit/openswitch/ops-build/tree/yocto/openswitch/meta-foss-openswitch/recipes-core/llvm/llvm.inc The cmake.bbclass that poky ships with does not generate the proper values for native builds so this is necessary to fix that up. --- recipes-devtools/rust/rust-llvm.inc | 74 +++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/recipes-devtools/rust/rust-llvm.inc b/recipes-devtools/rust/rust-llvm.inc index 880e3ec..c8800b6 100644 --- a/recipes-devtools/rust/rust-llvm.inc +++ b/recipes-devtools/rust/rust-llvm.inc @@ -31,6 +31,80 @@ EXTRA_OECMAKE = " \ # provide almost no value. If you really need them then override this INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +EXTRA_OECMAKE_append_class-target = "\ + -DCROSS_TOOLCHAIN_FLAGS_NATIVE='-DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/native_toolchain.cmake' \ +" + +do_generate_native_toolchain_file() { + cat > ${WORKDIR}/native_toolchain.cmake <:/${baselib}:g' ${S}/tools/llvm-config/llvm-config.cpp +} + +do_compile() { + oe_runmake +} + +do_install_append_class-target() { + # Disable checks on the native tools, since these should came from the native recipe + sed -i -e 's/\(.*APPEND.*_IMPORT_CHECK_FILES_FOR_.*{_IMPORT_PREFIX}\/bin\/.*\)/#\1/' ${D}/usr/share/llvm/cmake/LLVMExports-noconfig.cmake +} + +SYSROOT_PREPROCESS_FUNCS_append_class-target = " llvm_sysroot_preprocess" +SYSROOT_PREPROCESS_FUNCS_append_class-native = " llvm_native_sysroot_preprocess" + +llvm_sysroot_preprocess() { + install -d ${SYSROOT_DESTDIR}${bindir} + cp ${B}/NATIVE/bin/llvm-config ${SYSROOT_DESTDIR}/${bindir} || bbfatal "missing llvm-config" + cp ${B}/NATIVE/bin/llvm-tblgen ${SYSROOT_DESTDIR}/${bindir} || bbfatal "missing llvm-tblgen" +} + +llvm_native_sysroot_preprocess() { + sysroot_stage_dir ${D}${STAGING_DIR_NATIVE}/usr/libexec ${SYSROOT_DESTDIR}${bindir} +} + PACKAGES += "${PN}-data" # Add the extra locations to avoid the complaints about unpackaged files From 3b28ddab2b0a1f1440055b6cf8822d9194cbeeda Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Thu, 3 Nov 2016 22:22:58 -0500 Subject: [PATCH 062/112] rust-llvm: fix up generated packages Avoid issues with non-native builds by splitting up the packages a little closer to how they should be while still leaving the main package containing everything Rust uses. This makes it possible to build rust-llvm for the target, hopefully improving issue #81. --- recipes-devtools/rust/rust-llvm.inc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/recipes-devtools/rust/rust-llvm.inc b/recipes-devtools/rust/rust-llvm.inc index c8800b6..fba8b22 100644 --- a/recipes-devtools/rust/rust-llvm.inc +++ b/recipes-devtools/rust/rust-llvm.inc @@ -105,10 +105,13 @@ llvm_native_sysroot_preprocess() { sysroot_stage_dir ${D}${STAGING_DIR_NATIVE}/usr/libexec ${SYSROOT_DESTDIR}${bindir} } -PACKAGES += "${PN}-data" +PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liblto" # Add the extra locations to avoid the complaints about unpackaged files -FILES_${PN}-data = "${datadir}" -FILES_${PN}-dev += "${libdir}" +FILES_${PN} += "${libdir}/libLLVM*.so" +FILES_${PN}-dev += "${datadir}/llvm" +FILES_${PN}-bugpointpasses = "${libdir}/BugpointPasses.so" +FILES_${PN}-llvmhello = "${libdir}/LLVMHello.so" +FILES_${PN}-liblto = "${libdir}/libLTO.so" BBCLASSEXTEND = "native" From 91319e80f82106b95832038811d70619eec7dd15 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Fri, 4 Nov 2016 10:17:00 -0500 Subject: [PATCH 063/112] rust: include version info for patches To allow for multiple versions in the future we need to include the version info for the patches. --- ...Add-config-for-musl-based-arm-builds.patch | 0 ...lt-target.json-path-libdir-rust-targ.patch | 0 ...e-RUSTFLAGS-to-override-target-libs-.patch | 0 ...4-mk-add-missing-CFG_LIBDIR_RELATIVE.patch | 0 ...t-bindir-and-extend-libdir-to-non-bl.patch | 0 ...cal-workaround-for-NULL-__dso_handle.patch | 0 ...mk-install-use-disable-rewrite-paths.patch | 0 ...rriding-crate_hash-with-C-crate_hash.patch | 0 ...tform.mk-pass-C-crate_hash-to-builds.patch | 0 ...g-the-platform-configuration-source-.patch | 0 ...note-interpretation-of-rustc-dylib-m.patch | 0 ...o-disable-rewriting-of-install-paths.patch | 0 recipes-devtools/rust/rust_1.10.0.bb | 24 +++++++++---------- 13 files changed, 12 insertions(+), 12 deletions(-) rename recipes-devtools/rust/files/{rust => rust-1.10.0}/0001-Add-config-for-musl-based-arm-builds.patch (100%) rename recipes-devtools/rust/files/{rust => rust-1.10.0}/0002-Target-add-default-target.json-path-libdir-rust-targ.patch (100%) rename recipes-devtools/rust/files/{rust => rust-1.10.0}/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch (100%) rename recipes-devtools/rust/files/{rust => rust-1.10.0}/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch (100%) rename recipes-devtools/rust/files/{rust => rust-1.10.0}/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch (100%) rename recipes-devtools/rust/files/{rust => rust-1.10.0}/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch (100%) rename recipes-devtools/rust/files/{rust => rust-1.10.0}/0007-mk-install-use-disable-rewrite-paths.patch (100%) rename recipes-devtools/rust/files/{rust => rust-1.10.0}/0008-Allow-overriding-crate_hash-with-C-crate_hash.patch (100%) rename recipes-devtools/rust/files/{rust => rust-1.10.0}/0009-mk-platform.mk-pass-C-crate_hash-to-builds.patch (100%) rename recipes-devtools/rust/files/{rust => rust-1.10.0}/0010-mk-allow-changing-the-platform-configuration-source-.patch (100%) rename recipes-devtools/rust/files/{rust => rust-1.10.0}/0011-Get-rid-of-the-.note-interpretation-of-rustc-dylib-m.patch (100%) rename recipes-devtools/rust/files/{rust-installer => rust-installer-1.10.0}/0001-add-option-to-disable-rewriting-of-install-paths.patch (100%) diff --git a/recipes-devtools/rust/files/rust/0001-Add-config-for-musl-based-arm-builds.patch b/recipes-devtools/rust/files/rust-1.10.0/0001-Add-config-for-musl-based-arm-builds.patch similarity index 100% rename from recipes-devtools/rust/files/rust/0001-Add-config-for-musl-based-arm-builds.patch rename to recipes-devtools/rust/files/rust-1.10.0/0001-Add-config-for-musl-based-arm-builds.patch diff --git a/recipes-devtools/rust/files/rust/0002-Target-add-default-target.json-path-libdir-rust-targ.patch b/recipes-devtools/rust/files/rust-1.10.0/0002-Target-add-default-target.json-path-libdir-rust-targ.patch similarity index 100% rename from recipes-devtools/rust/files/rust/0002-Target-add-default-target.json-path-libdir-rust-targ.patch rename to recipes-devtools/rust/files/rust-1.10.0/0002-Target-add-default-target.json-path-libdir-rust-targ.patch diff --git a/recipes-devtools/rust/files/rust/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch b/recipes-devtools/rust/files/rust-1.10.0/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch similarity index 100% rename from recipes-devtools/rust/files/rust/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch rename to recipes-devtools/rust/files/rust-1.10.0/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch diff --git a/recipes-devtools/rust/files/rust/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch b/recipes-devtools/rust/files/rust-1.10.0/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch similarity index 100% rename from recipes-devtools/rust/files/rust/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch rename to recipes-devtools/rust/files/rust-1.10.0/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch diff --git a/recipes-devtools/rust/files/rust/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch b/recipes-devtools/rust/files/rust-1.10.0/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch similarity index 100% rename from recipes-devtools/rust/files/rust/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch rename to recipes-devtools/rust/files/rust-1.10.0/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch diff --git a/recipes-devtools/rust/files/rust/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch b/recipes-devtools/rust/files/rust-1.10.0/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch similarity index 100% rename from recipes-devtools/rust/files/rust/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch rename to recipes-devtools/rust/files/rust-1.10.0/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch diff --git a/recipes-devtools/rust/files/rust/0007-mk-install-use-disable-rewrite-paths.patch b/recipes-devtools/rust/files/rust-1.10.0/0007-mk-install-use-disable-rewrite-paths.patch similarity index 100% rename from recipes-devtools/rust/files/rust/0007-mk-install-use-disable-rewrite-paths.patch rename to recipes-devtools/rust/files/rust-1.10.0/0007-mk-install-use-disable-rewrite-paths.patch diff --git a/recipes-devtools/rust/files/rust/0008-Allow-overriding-crate_hash-with-C-crate_hash.patch b/recipes-devtools/rust/files/rust-1.10.0/0008-Allow-overriding-crate_hash-with-C-crate_hash.patch similarity index 100% rename from recipes-devtools/rust/files/rust/0008-Allow-overriding-crate_hash-with-C-crate_hash.patch rename to recipes-devtools/rust/files/rust-1.10.0/0008-Allow-overriding-crate_hash-with-C-crate_hash.patch diff --git a/recipes-devtools/rust/files/rust/0009-mk-platform.mk-pass-C-crate_hash-to-builds.patch b/recipes-devtools/rust/files/rust-1.10.0/0009-mk-platform.mk-pass-C-crate_hash-to-builds.patch similarity index 100% rename from recipes-devtools/rust/files/rust/0009-mk-platform.mk-pass-C-crate_hash-to-builds.patch rename to recipes-devtools/rust/files/rust-1.10.0/0009-mk-platform.mk-pass-C-crate_hash-to-builds.patch diff --git a/recipes-devtools/rust/files/rust/0010-mk-allow-changing-the-platform-configuration-source-.patch b/recipes-devtools/rust/files/rust-1.10.0/0010-mk-allow-changing-the-platform-configuration-source-.patch similarity index 100% rename from recipes-devtools/rust/files/rust/0010-mk-allow-changing-the-platform-configuration-source-.patch rename to recipes-devtools/rust/files/rust-1.10.0/0010-mk-allow-changing-the-platform-configuration-source-.patch diff --git a/recipes-devtools/rust/files/rust/0011-Get-rid-of-the-.note-interpretation-of-rustc-dylib-m.patch b/recipes-devtools/rust/files/rust-1.10.0/0011-Get-rid-of-the-.note-interpretation-of-rustc-dylib-m.patch similarity index 100% rename from recipes-devtools/rust/files/rust/0011-Get-rid-of-the-.note-interpretation-of-rustc-dylib-m.patch rename to recipes-devtools/rust/files/rust-1.10.0/0011-Get-rid-of-the-.note-interpretation-of-rustc-dylib-m.patch diff --git a/recipes-devtools/rust/files/rust-installer/0001-add-option-to-disable-rewriting-of-install-paths.patch b/recipes-devtools/rust/files/rust-installer-1.10.0/0001-add-option-to-disable-rewriting-of-install-paths.patch similarity index 100% rename from recipes-devtools/rust/files/rust-installer/0001-add-option-to-disable-rewriting-of-install-paths.patch rename to recipes-devtools/rust/files/rust-installer-1.10.0/0001-add-option-to-disable-rewriting-of-install-paths.patch diff --git a/recipes-devtools/rust/rust_1.10.0.bb b/recipes-devtools/rust/rust_1.10.0.bb index be35dbf..9200e85 100644 --- a/recipes-devtools/rust/rust_1.10.0.bb +++ b/recipes-devtools/rust/rust_1.10.0.bb @@ -2,18 +2,18 @@ inherit rust-installer require rust.inc SRC_URI += " \ - file://rust/0001-Add-config-for-musl-based-arm-builds.patch \ - file://rust/0002-Target-add-default-target.json-path-libdir-rust-targ.patch \ - file://rust/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch \ - file://rust/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \ - file://rust/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch \ - file://rust/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch \ - file://rust/0007-mk-install-use-disable-rewrite-paths.patch \ - file://rust/0008-Allow-overriding-crate_hash-with-C-crate_hash.patch \ - file://rust/0009-mk-platform.mk-pass-C-crate_hash-to-builds.patch \ - file://rust/0010-mk-allow-changing-the-platform-configuration-source-.patch \ - file://rust/0011-Get-rid-of-the-.note-interpretation-of-rustc-dylib-m.patch \ - file://rust-installer/0001-add-option-to-disable-rewriting-of-install-paths.patch;patchdir=src/rust-installer \ + file://rust-${PV}/0001-Add-config-for-musl-based-arm-builds.patch \ + file://rust-${PV}/0002-Target-add-default-target.json-path-libdir-rust-targ.patch \ + file://rust-${PV}/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch \ + file://rust-${PV}/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \ + file://rust-${PV}/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch \ + file://rust-${PV}/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch \ + file://rust-${PV}/0007-mk-install-use-disable-rewrite-paths.patch \ + file://rust-${PV}/0008-Allow-overriding-crate_hash-with-C-crate_hash.patch \ + file://rust-${PV}/0009-mk-platform.mk-pass-C-crate_hash-to-builds.patch \ + file://rust-${PV}/0010-mk-allow-changing-the-platform-configuration-source-.patch \ + file://rust-${PV}/0011-Get-rid-of-the-.note-interpretation-of-rustc-dylib-m.patch \ + file://rust-installer-${PV}/0001-add-option-to-disable-rewriting-of-install-paths.patch;patchdir=src/rust-installer \ " SRC_URI[rust.md5sum] = "a48fef30353fc9daa70b484b690ce5db" From 75f4549859c39f262798239579c381ee4879cf48 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Fri, 4 Nov 2016 16:41:49 -0500 Subject: [PATCH 064/112] pin dependencies of Rust packages on the same ver Pin the versions of different Rust component packages to the same version to ensure smooth upgrades. Not sure how to hook the compiler together with the shared library. Likely rust-cross will need to provide some kind of dependency to make this happen. --- recipes-devtools/rust/libstd-rs_1.10.0.bb | 2 +- recipes-devtools/rust/rust_1.10.0.bb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/recipes-devtools/rust/libstd-rs_1.10.0.bb b/recipes-devtools/rust/libstd-rs_1.10.0.bb index c2ce9eb..fbed7f8 100644 --- a/recipes-devtools/rust/libstd-rs_1.10.0.bb +++ b/recipes-devtools/rust/libstd-rs_1.10.0.bb @@ -19,7 +19,7 @@ SRC_URI += "\ crate-index://crates.io/${CARGO_INDEX_COMMIT} \ " -DEPENDS += "compiler-rt" +DEPENDS += "compiler-rt (=${PV})" RUSTLIB_DEP = "" inherit cargo diff --git a/recipes-devtools/rust/rust_1.10.0.bb b/recipes-devtools/rust/rust_1.10.0.bb index 9200e85..1a8f163 100644 --- a/recipes-devtools/rust/rust_1.10.0.bb +++ b/recipes-devtools/rust/rust_1.10.0.bb @@ -19,7 +19,7 @@ SRC_URI += " \ SRC_URI[rust.md5sum] = "a48fef30353fc9daa70b484b690ce5db" SRC_URI[rust.sha256sum] = "a4015aacf4f6d8a8239253c4da46e7abaa8584f8214d1828d2ff0a8f56176869" -DEPENDS += "rust-llvm" +DEPENDS += "rust-llvm (=${PV})" # Otherwise we'll depend on what we provide INHIBIT_DEFAULT_RUST_DEPS_class-native = "1" From 8673659f6a24fed576d0a66aa42536e30204b622 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Fri, 4 Nov 2016 16:30:09 -0500 Subject: [PATCH 065/112] rust: convert snapshot to common include Create a common include that can be used by everything that depends on the Rust source. Including stage0 bits and hashes of the source tarballs. --- recipes-devtools/rust/compiler-rt_1.10.0.bb | 4 ++-- recipes-devtools/rust/libstd-rs_1.10.0.bb | 6 +++--- recipes-devtools/rust/rust-cross_1.10.0.bb | 4 +--- recipes-devtools/rust/rust-llvm_1.10.0.bb | 4 +--- ...{rust-snapshot-2016-05-24.inc => rust-source-1.10.0.inc} | 6 ++++++ recipes-devtools/rust/rust.inc | 1 - recipes-devtools/rust/rust_1.10.0.bb | 4 +--- 7 files changed, 14 insertions(+), 15 deletions(-) rename recipes-devtools/rust/{rust-snapshot-2016-05-24.inc => rust-source-1.10.0.inc} (72%) diff --git a/recipes-devtools/rust/compiler-rt_1.10.0.bb b/recipes-devtools/rust/compiler-rt_1.10.0.bb index fabe0e2..9958bd9 100644 --- a/recipes-devtools/rust/compiler-rt_1.10.0.bb +++ b/recipes-devtools/rust/compiler-rt_1.10.0.bb @@ -7,8 +7,8 @@ LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=27b14ab4ce08d04c3a9a5f0ed7997362" SRC_URI = "\ https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ " -SRC_URI[rust.md5sum] = "a48fef30353fc9daa70b484b690ce5db" -SRC_URI[rust.sha256sum] = "a4015aacf4f6d8a8239253c4da46e7abaa8584f8214d1828d2ff0a8f56176869" + +require rust-source-${PV}.inc S = "${WORKDIR}/rustc-${PV}/src/compiler-rt" diff --git a/recipes-devtools/rust/libstd-rs_1.10.0.bb b/recipes-devtools/rust/libstd-rs_1.10.0.bb index fbed7f8..f37d8a7 100644 --- a/recipes-devtools/rust/libstd-rs_1.10.0.bb +++ b/recipes-devtools/rust/libstd-rs_1.10.0.bb @@ -7,8 +7,8 @@ LIC_FILES_CHKSUM ="file://COPYRIGHT;md5=43e1f1fb9c0ee3af66693d8c4fecafa8" SRC_URI = "\ https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ " -SRC_URI[rust.md5sum] = "a48fef30353fc9daa70b484b690ce5db" -SRC_URI[rust.sha256sum] = "a4015aacf4f6d8a8239253c4da46e7abaa8584f8214d1828d2ff0a8f56176869" + +require rust-source-${PV}.inc S = "${WORKDIR}/rustc-${PV}" @@ -32,7 +32,7 @@ S = "${WORKDIR}/rustc-${PV}" do_compile_prepend () { cd ${S}/src/rustc/std_shim export CARGO_TARGET_DIR="${B}" - export RUSTC_BOOTSTRAP_KEY="e8edd0fd" + export RUSTC_BOOTSTRAP_KEY="${RS_KEY}" } do_install () { diff --git a/recipes-devtools/rust/rust-cross_1.10.0.bb b/recipes-devtools/rust/rust-cross_1.10.0.bb index d745404..67b6f3c 100644 --- a/recipes-devtools/rust/rust-cross_1.10.0.bb +++ b/recipes-devtools/rust/rust-cross_1.10.0.bb @@ -1,8 +1,6 @@ require rust.inc inherit cross - -SRC_URI[rust.md5sum] = "a48fef30353fc9daa70b484b690ce5db" -SRC_URI[rust.sha256sum] = "a4015aacf4f6d8a8239253c4da46e7abaa8584f8214d1828d2ff0a8f56176869" +require rust-source-${PV}.inc # Otherwise we'll depend on what we provide INHIBIT_DEFAULT_RUST_DEPS = "1" diff --git a/recipes-devtools/rust/rust-llvm_1.10.0.bb b/recipes-devtools/rust/rust-llvm_1.10.0.bb index 6405153..0e72aff 100644 --- a/recipes-devtools/rust/rust-llvm_1.10.0.bb +++ b/recipes-devtools/rust/rust-llvm_1.10.0.bb @@ -1,4 +1,2 @@ require rust-llvm.inc - -SRC_URI[rust.md5sum] = "a48fef30353fc9daa70b484b690ce5db" -SRC_URI[rust.sha256sum] = "a4015aacf4f6d8a8239253c4da46e7abaa8584f8214d1828d2ff0a8f56176869" +require rust-source-${PV}.inc diff --git a/recipes-devtools/rust/rust-snapshot-2016-05-24.inc b/recipes-devtools/rust/rust-source-1.10.0.inc similarity index 72% rename from recipes-devtools/rust/rust-snapshot-2016-05-24.inc rename to recipes-devtools/rust/rust-source-1.10.0.inc index 765daeb..d9d9480 100644 --- a/recipes-devtools/rust/rust-snapshot-2016-05-24.inc +++ b/recipes-devtools/rust/rust-source-1.10.0.inc @@ -1,9 +1,12 @@ +# Specifics for Rust 1.10.0 + ## snapshot info 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_DATE = "2016-05-24" RS_VERSION = "1.9.0" RS_ARCH = "x86_64-unknown-linux-gnu" +RS_KEY = "e8edd0fd" RUST_SNAPSHOT = "rustc-${RS_VERSION}-${RS_ARCH}.tar.gz" RUST_SNAPSHOT_URI = "https://static.rust-lang.org/dist/${RS_DATE}/${RUST_SNAPSHOT}" @@ -11,3 +14,6 @@ RUST_SNAPSHOT_URI = "https://static.rust-lang.org/dist/${RS_DATE}/${RUST_SNAPSHO SRC_URI[rust-snapshot.md5sum] = "f1cf6d2fe15e4be18a08259f1540a4ae" SRC_URI[rust-snapshot.sha256sum] = "d0704d10237c66c3efafa6f7e5570c59a1d3fe5c6d99487540f90ebb37cd84c4" +SRC_URI[rust.md5sum] = "a48fef30353fc9daa70b484b690ce5db" +SRC_URI[rust.sha256sum] = "a4015aacf4f6d8a8239253c4da46e7abaa8584f8214d1828d2ff0a8f56176869" + diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index b3c7869..b5f7f8a 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -5,7 +5,6 @@ LICENSE = "MIT | Apache-2.0" LIC_FILES_CHKSUM ="file://COPYRIGHT;md5=43e1f1fb9c0ee3af66693d8c4fecafa8" inherit rust -require rust-snapshot-2016-05-24.inc SRC_URI = "\ https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ diff --git a/recipes-devtools/rust/rust_1.10.0.bb b/recipes-devtools/rust/rust_1.10.0.bb index 1a8f163..4ada8fe 100644 --- a/recipes-devtools/rust/rust_1.10.0.bb +++ b/recipes-devtools/rust/rust_1.10.0.bb @@ -1,5 +1,6 @@ inherit rust-installer require rust.inc +require rust-source-${PV}.inc SRC_URI += " \ file://rust-${PV}/0001-Add-config-for-musl-based-arm-builds.patch \ @@ -16,9 +17,6 @@ SRC_URI += " \ file://rust-installer-${PV}/0001-add-option-to-disable-rewriting-of-install-paths.patch;patchdir=src/rust-installer \ " -SRC_URI[rust.md5sum] = "a48fef30353fc9daa70b484b690ce5db" -SRC_URI[rust.sha256sum] = "a4015aacf4f6d8a8239253c4da46e7abaa8584f8214d1828d2ff0a8f56176869" - DEPENDS += "rust-llvm (=${PV})" # Otherwise we'll depend on what we provide From ed62ea5176249ed752048a80fbac730171c7c31c Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 8 Nov 2016 13:21:30 -0600 Subject: [PATCH 066/112] rust: drop local-rust PACKAGECONFIG This drops the ability to supply your own rust through the PACKAGECONFIG local-rust option. This isn't tested and we really need to better expand support for build arches. At the same time this simplifies how the rust stage0 snapshot is extracted and used by the build system. --- recipes-devtools/rust/rust-source-1.10.0.inc | 3 +- recipes-devtools/rust/rust.inc | 29 +++----------------- 2 files changed, 5 insertions(+), 27 deletions(-) diff --git a/recipes-devtools/rust/rust-source-1.10.0.inc b/recipes-devtools/rust/rust-source-1.10.0.inc index d9d9480..593e689 100644 --- a/recipes-devtools/rust/rust-source-1.10.0.inc +++ b/recipes-devtools/rust/rust-source-1.10.0.inc @@ -8,8 +8,7 @@ RS_VERSION = "1.9.0" RS_ARCH = "x86_64-unknown-linux-gnu" RS_KEY = "e8edd0fd" -RUST_SNAPSHOT = "rustc-${RS_VERSION}-${RS_ARCH}.tar.gz" -RUST_SNAPSHOT_URI = "https://static.rust-lang.org/dist/${RS_DATE}/${RUST_SNAPSHOT}" +RUST_SNAPSHOT = "rustc-${RS_VERSION}-${RS_ARCH}" SRC_URI[rust-snapshot.md5sum] = "f1cf6d2fe15e4be18a08259f1540a4ae" SRC_URI[rust-snapshot.sha256sum] = "d0704d10237c66c3efafa6f7e5570c59a1d3fe5c6d99487540f90ebb37cd84c4" diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index b5f7f8a..8bf912d 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -8,24 +8,13 @@ inherit rust SRC_URI = "\ https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ + https://static.rust-lang.org/dist/${RUST_SNAPSHOT}.tar.gz;name=rust-snapshot \ " S = "${WORKDIR}/rustc-${PV}" DEPENDS += "file-native" -PACKAGECONFIG ??= "" - -# Controls whether we use the local rust to build. -# By default, we use the rust-snapshot. In some cases (non-supported host -# systems) this may not be possible. In other cases, it might be desirable -# to have rust-cross built using rust-native. -PACKAGECONFIG[local-rust] = "" - -FETCH_STAGE0 = "${@bb.utils.contains('PACKAGECONFIG', 'local-rust', 'false', 'true', d)}" - -SRC_URI += "${@bb.utils.contains('PACKAGECONFIG', 'local-rust', '', '${RUST_SNAPSHOT_URI};unpack=0;name=rust-snapshot', d)}" - # We generate local targets, and need to be able to locate them export RUST_TARGET_PATH="${WORKDIR}/targets/" @@ -393,18 +382,7 @@ do_configure () { # where we're reinstalling the compiler. May want to try for a real # path based on bitbake vars # Also will be wrong when relative libdir and/or bindir aren't 'bin' and 'lib'. - local_rust_root=/not/set/do/not/use - if ${FETCH_STAGE0}; then - mkdir -p dl - tar -xf ${WORKDIR}/${RUST_SNAPSHOT} -C dl - ./dl/rustc-${RS_VERSION}-${RS_ARCH}/install.sh --prefix=$PWD/dl - local_rust_root="$PWD/dl" - elif which rustc >/dev/null 2>&1; then - local_rustc=$(which rustc) - if [ -n "$local_rustc" ]; then - local_rust_root=$(dirname $(dirname $local_rustc)) - fi - fi + local_rust_root="$PWD/dl" # - rpath is required otherwise rustc fails to resolve symbols # - submodule management is done by bitbake's fetching @@ -431,7 +409,8 @@ do_configure () { "--libdir=${libdir}" \ "--bindir=${bindir}" \ "--platform-cfg=${WORKDIR}/mk-cfg/" \ - "--enable-local-rust --local-rust-root=$local_rust_root" \ + "--enable-local-rust" \ + "--local-rust-root=${WORKDIR}/${RUST_SNAPSHOT}/rustc" \ ${EXTRA_OECONF} } From 489fe195e0b64e2a38470b963631c41a8bccf310 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 8 Nov 2016 13:33:08 -0600 Subject: [PATCH 067/112] rust: derive the stage0 toolchain from the build env The host system where things are being built really should control what toolchain is used for stage0. This in theory should improve #23 but I'm not sure how to specify a hash per host sys. --- recipes-devtools/rust/rust-source-1.10.0.inc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/recipes-devtools/rust/rust-source-1.10.0.inc b/recipes-devtools/rust/rust-source-1.10.0.inc index 593e689..4ee024a 100644 --- a/recipes-devtools/rust/rust-source-1.10.0.inc +++ b/recipes-devtools/rust/rust-source-1.10.0.inc @@ -3,13 +3,12 @@ ## snapshot info 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_DATE = "2016-05-24" RS_VERSION = "1.9.0" -RS_ARCH = "x86_64-unknown-linux-gnu" RS_KEY = "e8edd0fd" -RUST_SNAPSHOT = "rustc-${RS_VERSION}-${RS_ARCH}" +RUST_SNAPSHOT = "rustc-${RS_VERSION}-${RUST_HOST_SYS}" +# These are x86_64-unknown-linux-gnu hashes, how can we add more? SRC_URI[rust-snapshot.md5sum] = "f1cf6d2fe15e4be18a08259f1540a4ae" SRC_URI[rust-snapshot.sha256sum] = "d0704d10237c66c3efafa6f7e5570c59a1d3fe5c6d99487540f90ebb37cd84c4" From e4d37ce4f14044efa9825763dd1f6004ee5c80b4 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 8 Nov 2016 17:26:35 -0600 Subject: [PATCH 068/112] rust: drop bindir/libdir patch I'm honestly not sure what this patch does since everything appears to build the same with and without it. I did a `tree` of the sysroots and images and I don't see any file differences. Something like this used to be necessary in Gentoo but I dropped it a few releases back. --- ...t-bindir-and-extend-libdir-to-non-bl.patch | 335 ------------------ recipes-devtools/rust/rust.inc | 1 - recipes-devtools/rust/rust_1.10.0.bb | 1 - 3 files changed, 337 deletions(-) delete mode 100644 recipes-devtools/rust/files/rust-1.10.0/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch diff --git a/recipes-devtools/rust/files/rust-1.10.0/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch b/recipes-devtools/rust/files/rust-1.10.0/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch deleted file mode 100644 index 6553285..0000000 --- a/recipes-devtools/rust/files/rust-1.10.0/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch +++ /dev/null @@ -1,335 +0,0 @@ -From 0365e3349e373b95fcf4260ba5bcf70ada6328cf Mon Sep 17 00:00:00 2001 -From: Cody P Schafer -Date: Mon, 24 Nov 2014 13:10:15 -0500 -Subject: [PATCH 05/11] 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 | 51 ++++++++++++++++++++++++----- - mk/host.mk | 6 +++- - mk/main.mk | 11 +++++++ - mk/prepare.mk | 27 +++++++--------- - src/librustc/session/filesearch.rs | 66 ++++++++++++++++---------------------- - src/librustc_trans/back/link.rs | 3 +- - 6 files changed, 99 insertions(+), 65 deletions(-) - -diff --git a/configure b/configure -index d417896..e3b7c20 100755 ---- a/configure -+++ b/configure -@@ -342,6 +342,39 @@ 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 ;; -+ x86_64-w64-mingw32) echo x86_64-pc-windows-gnu ;; -+ *) echo $1 ;; -+ esac -+} -+ - to_gnu_triple() { - case $1 in - i686-pc-windows-gnu) echo i686-w64-mingw32 ;; -@@ -656,18 +689,19 @@ valopt_nosave host "${CFG_BUILD}" "GNUs ./configure syntax LLVM host triples" - valopt_nosave target "${CFG_HOST}" "GNUs ./configure syntax LLVM target triples" - valopt_nosave mandir "${CFG_PREFIX}/share/man" "install man pages in PATH" - -+CFG_LIBDIR_RELATIVE=lib -+ - # On Windows this determines root of the subtree for target libraries. - # Host runtime libs always go to 'bin'. --valopt libdir "${CFG_PREFIX}/lib" "install libraries" -+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 [ $HELP -eq 1 ] - then -@@ -1762,6 +1796,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 d17479b..a95f886 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 fcf1409..1c663ee 100644 ---- a/mk/main.mk -+++ b/mk/main.mk -@@ -368,7 +368,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)) -@@ -401,7 +403,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_RELATIVE$(1)_H_$(3) = $$(CFG_LIBDIR_RELATIVE) - -diff --git a/mk/prepare.mk b/mk/prepare.mk -index 20e20e9..efaec75 100644 ---- a/mk/prepare.mk -+++ b/mk/prepare.mk -@@ -90,8 +90,6 @@ PREPARE_TOOLS = $(filter-out compiletest rustbook error_index_generator, $(TOOLS - # $(3) is host - # $(4) tag - define DEF_PREPARE_HOST_TOOL --prepare-host-tool-$(1)-$(2)-$(3)-$(4): \ -- PREPARE_SOURCE_BIN_DIR=$$(HBIN$(2)_H_$(3)) - prepare-host-tool-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \ - $$(foreach dep,$$(TOOL_DEPS_$(1)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4)) \ - $$(HBIN$(2)_H_$(3))/$(1)$$(X_$(3)) \ -@@ -117,10 +115,8 @@ PREPARE_TAR_LIB_DIR = $(patsubst $(CFG_LIBDIR_RELATIVE)%,lib%,$(1)) - # $(3) is host - # $(4) tag - define DEF_PREPARE_HOST_LIB --prepare-host-lib-$(1)-$(2)-$(3)-$(4): \ -- PREPARE_WORKING_SOURCE_LIB_DIR=$$(HLIB$(2)_H_$(3)) --prepare-host-lib-$(1)-$(2)-$(3)-$(4): \ -- PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(call PREPARE_TAR_LIB_DIR,$$(HLIB_RELATIVE$(2)_H_$(3))) -+prepare-host-lib-$(1)-$(2)-$(3)-$(4): PREPARE_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR) -+prepare-host-lib-$(1)-$(2)-$(3)-$(4): PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR) - prepare-host-lib-$(1)-$(2)-$(3)-$(4): prepare-maybe-clean-$(4) \ - $$(foreach dep,$$(RUST_DEPS_$(1)_T_$(3)),prepare-host-lib-$$(dep)-$(2)-$(3)-$(4)) \ - $$(HLIB$(2)_H_$(3))/stamp.$(1) \ -@@ -138,14 +134,10 @@ endef - # $(4) tag - define DEF_PREPARE_TARGET_N - # Rebind PREPARE_*_LIB_DIR to point to rustlib, then install the libs for the targets --prepare-target-$(2)-host-$(3)-$(1)-$(4): \ -- PREPARE_WORKING_SOURCE_LIB_DIR=$$(TLIB$(1)_T_$(2)_H_$(3)) --prepare-target-$(2)-host-$(3)-$(1)-$(4): \ -- PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(2)/lib --prepare-target-$(2)-host-$(3)-$(1)-$(4): \ -- PREPARE_SOURCE_BIN_DIR=$$(TBIN$(1)_T_$(2)_H_$(3)) --prepare-target-$(2)-host-$(3)-$(1)-$(4): \ -- PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(3)/bin -+prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_WORKING_SOURCE_LIB_DIR=$$(PREPARE_SOURCE_LIB_DIR)/rustlib/$(2)/lib -+prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_WORKING_DEST_LIB_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(2)/lib -+prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_SOURCE_BIN_DIR=$$(PREPARE_SOURCE_LIB_DIR)/rustlib/$(3)/bin -+prepare-target-$(2)-host-$(3)-$(1)-$(4): PREPARE_DEST_BIN_DIR=$$(PREPARE_DEST_LIB_DIR)/rustlib/$(3)/bin - prepare-target-$(2)-host-$(3)-$(1)-$(4): prepare-maybe-clean-$(4) \ - $$(foreach crate,$$(TARGET_CRATES_$(2)), \ - $$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate)) \ -@@ -198,9 +190,12 @@ 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)/$$(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_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(call PREPARE_TAR_LIB_DIR,$$(CFG_LIBDIR_RELATIVE)) -+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)-target: prepare-target-$(1) -diff --git a/src/librustc/session/filesearch.rs b/src/librustc/session/filesearch.rs -index a3eea32..e5e449d 100644 ---- a/src/librustc/session/filesearch.rs -+++ b/src/librustc/session/filesearch.rs -@@ -123,7 +123,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"); -@@ -131,8 +131,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); -@@ -142,7 +142,19 @@ 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)) -+} -+ -+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 { -@@ -160,44 +172,22 @@ 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 => bug!("can't determine value for sysroot") - } - } - --// The name of the directory rustc expects libraries to be located. --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() -- } --} - - // The name of rustc's own place to organize libraries. - // Used to be "rustc", now the default is "rustlib" -diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs -index 53cc031..222d447 100644 ---- a/src/librustc_trans/back/link.rs -+++ b/src/librustc_trans/back/link.rs -@@ -819,11 +819,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.7.4 - diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index 8bf912d..ab35d85 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -407,7 +407,6 @@ do_configure () { "--infodir=${infodir}" \ "--mandir=${mandir}" \ "--libdir=${libdir}" \ - "--bindir=${bindir}" \ "--platform-cfg=${WORKDIR}/mk-cfg/" \ "--enable-local-rust" \ "--local-rust-root=${WORKDIR}/${RUST_SNAPSHOT}/rustc" \ diff --git a/recipes-devtools/rust/rust_1.10.0.bb b/recipes-devtools/rust/rust_1.10.0.bb index 4ada8fe..8d32ec7 100644 --- a/recipes-devtools/rust/rust_1.10.0.bb +++ b/recipes-devtools/rust/rust_1.10.0.bb @@ -7,7 +7,6 @@ SRC_URI += " \ file://rust-${PV}/0002-Target-add-default-target.json-path-libdir-rust-targ.patch \ file://rust-${PV}/0003-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch \ file://rust-${PV}/0004-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \ - file://rust-${PV}/0005-configure-support-bindir-and-extend-libdir-to-non-bl.patch \ file://rust-${PV}/0006-std-thread_local-workaround-for-NULL-__dso_handle.patch \ file://rust-${PV}/0007-mk-install-use-disable-rewrite-paths.patch \ file://rust-${PV}/0008-Allow-overriding-crate_hash-with-C-crate_hash.patch \ From d2373244b83d8b40576613a717d20552407415db Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Wed, 16 Nov 2016 11:40:15 -0500 Subject: [PATCH 069/112] github: add issue template to encourage reporting meta-rust version I don't think we really need much structure, but in many cases establishing the version of meta-rust which contains the issue is very helpful in resolving it. This makes it so the issue-reporter is at least given a field which asks for the version. --- .github/ISSUE_TEMPLATE.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..3c6fec6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,9 @@ +## Version(s) of meta-rust + +## Version(s) of poky and/or oe-core + +## Expected result + +## Actual result + +## Steps to reproduce From 7645b9b3312d9a900b2929f3db01a23b7a8b5f24 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 21 Nov 2016 14:55:54 -0600 Subject: [PATCH 070/112] RUSTC_ARCHFLAGS: build for the proper system triple Change to build for the machine we are building for when compiling rust code and not the compiler itself. See #109. --- classes/rust.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/rust.bbclass b/classes/rust.bbclass index 15299b2..bab2dfa 100644 --- a/classes/rust.bbclass +++ b/classes/rust.bbclass @@ -2,7 +2,7 @@ inherit rust-vars RUSTC = "rustc" -RUSTC_ARCHFLAGS += "--target=${TARGET_SYS} ${RUSTFLAGS}" +RUSTC_ARCHFLAGS += "--target=${HOST_SYS} ${RUSTFLAGS}" def rust_base_dep(d): # Taken from meta/classes/base.bbclass `base_dep_prepend` and modified to From 0b6b45fbcab7894f15b999fe54953f507614acf1 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 21 Nov 2016 15:12:34 -0600 Subject: [PATCH 071/112] break the triples logic into its own class This is so we can use the Rust triples in Cargo builds and other places in addition to the Rust build. --- classes/rust-triples.bbclass | 31 +++++++++++++++++++++++++++++++ classes/rust.bbclass | 31 +------------------------------ 2 files changed, 32 insertions(+), 30 deletions(-) create mode 100644 classes/rust-triples.bbclass diff --git a/classes/rust-triples.bbclass b/classes/rust-triples.bbclass new file mode 100644 index 0000000..6833762 --- /dev/null +++ b/classes/rust-triples.bbclass @@ -0,0 +1,31 @@ +# Responseible for taking Yocto triples and converting it to Rust triples + +def rust_base_triple(d, thing): + ''' + Mangle bitbake's *_SYS into something that rust might support (see + rust/mk/cfg/* for a list) + + Note that os is assumed to be some linux form + ''' + + arch = d.getVar('{}_ARCH'.format(thing), True) + vendor = d.getVar('{}_VENDOR'.format(thing), True) + os = d.getVar('{}_OS'.format(thing), True) + + vendor = "-unknown" + + if arch.startswith("arm"): + if os.endswith("gnueabi"): + os += bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'hf', '', d) + elif arch.startswith("aarch64"): + os = "linux-gnu" + elif arch.startswith("x86_64"): + os = "linux-gnu" + elif arch.startswith("i586"): + arch = "i686" + os = "linux-gnu" + return arch + vendor + '-' + os + +RUST_BUILD_SYS = "${@rust_base_triple(d, 'BUILD')}" +RUST_HOST_SYS = "${@rust_base_triple(d, 'HOST')}" +RUST_TARGET_SYS = "${@rust_base_triple(d, 'TARGET')}" diff --git a/classes/rust.bbclass b/classes/rust.bbclass index bab2dfa..0809186 100644 --- a/classes/rust.bbclass +++ b/classes/rust.bbclass @@ -1,4 +1,5 @@ inherit rust-vars +inherit rust-triples RUSTC = "rustc" @@ -17,36 +18,6 @@ def rust_base_dep(d): DEPENDS_append = " ${@rust_base_dep(d)} patchelf-native" -def rust_base_triple(d, thing): - ''' - Mangle bitbake's *_SYS into something that rust might support (see - rust/mk/cfg/* for a list) - - Note that os is assumed to be some linux form - ''' - - arch = d.getVar('{}_ARCH'.format(thing), True) - vendor = d.getVar('{}_VENDOR'.format(thing), True) - os = d.getVar('{}_OS'.format(thing), True) - - vendor = "-unknown" - - if arch.startswith("arm"): - if os.endswith("gnueabi"): - os += bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'hf', '', d) - elif arch.startswith("aarch64"): - os = "linux-gnu" - elif arch.startswith("x86_64"): - os = "linux-gnu" - elif arch.startswith("i586"): - arch = "i686" - os = "linux-gnu" - return arch + vendor + '-' + os - -RUST_BUILD_SYS = "${@rust_base_triple(d, 'BUILD')}" -RUST_HOST_SYS = "${@rust_base_triple(d, 'HOST')}" -RUST_TARGET_SYS = "${@rust_base_triple(d, 'TARGET')}" - # BUILD_LDFLAGS # ${STAGING_LIBDIR_NATIVE} # ${STAGING_BASE_LIBDIR_NATIVE} From 5d60f129570163dfbcc4dedd6331876d09b0a360 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 21 Nov 2016 15:38:32 -0600 Subject: [PATCH 072/112] rust-triples: simplify vendor gathering We don't need to look up the vendor since it will always be unknown. --- classes/rust-triples.bbclass | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/classes/rust-triples.bbclass b/classes/rust-triples.bbclass index 6833762..6b781ae 100644 --- a/classes/rust-triples.bbclass +++ b/classes/rust-triples.bbclass @@ -9,10 +9,9 @@ def rust_base_triple(d, thing): ''' arch = d.getVar('{}_ARCH'.format(thing), True) - vendor = d.getVar('{}_VENDOR'.format(thing), True) - os = d.getVar('{}_OS'.format(thing), True) - + # All the Yocto targets are Linux and are 'unknown' vendor = "-unknown" + os = d.getVar('{}_OS'.format(thing), True) if arch.startswith("arm"): if os.endswith("gnueabi"): From 957ede76f8ccabdb6d35b90e37122af57605fd1b Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 21 Nov 2016 15:53:16 -0600 Subject: [PATCH 073/112] convert to real Rust triples properly This should fix conversion to real Rust triples for musl targets, for i686 targets and possibly others. --- classes/rust-triples.bbclass | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/classes/rust-triples.bbclass b/classes/rust-triples.bbclass index 6b781ae..1f67775 100644 --- a/classes/rust-triples.bbclass +++ b/classes/rust-triples.bbclass @@ -12,18 +12,24 @@ def rust_base_triple(d, thing): # All the Yocto targets are Linux and are 'unknown' vendor = "-unknown" os = d.getVar('{}_OS'.format(thing), True) + libc = d.getVar('TCLIBC', True) - if arch.startswith("arm"): - if os.endswith("gnueabi"): - os += bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'hf', '', d) - elif arch.startswith("aarch64"): - os = "linux-gnu" - elif arch.startswith("x86_64"): - os = "linux-gnu" - elif arch.startswith("i586"): - arch = "i686" - os = "linux-gnu" - return arch + vendor + '-' + os + # Prefix with a dash and convert glibc -> gnu + if libc == "glibc": + libc = "-gnu" + elif libc == "musl": + libc = "-musl" + + # Don't double up musl (only appears to be the case on aarch64) + if os == "linux-musl": + if libc != "-musl": + bb.fatal("{}_OS was '{}' but TCLIBC was not 'musl'".format(thing, os)) + os = "linux" + + # This catches ARM targets and appends the necessary hard float bits + if os == "linux-gnueabi" or os == "linux-musleabi": + libc = bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'hf', '', d) + return arch + vendor + '-' + os + libc RUST_BUILD_SYS = "${@rust_base_triple(d, 'BUILD')}" RUST_HOST_SYS = "${@rust_base_triple(d, 'HOST')}" From f748246caea8da57677bd1eda4e18948ed27aa78 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 22 Nov 2016 10:56:20 -0600 Subject: [PATCH 074/112] remove commented out bits --- classes/rust.bbclass | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/classes/rust.bbclass b/classes/rust.bbclass index 0809186..e4fb677 100644 --- a/classes/rust.bbclass +++ b/classes/rust.bbclass @@ -31,18 +31,6 @@ DEPENDS_append = " ${@rust_base_dep(d)} patchelf-native" # -L${STAGING_BASE_LIBDIR_NATIVE} \ #" -RUST_PATH_NATIVE = "${STAGING_LIBDIR_NATIVE}:${STAGING_BASE_LIBDIR_NATIVE}" - -## Note: the 'rustlib' element of this was a workaround rustc forgetting the -## libdir it was built with. It now remembers so this should be unneeded -#RUST_PATH_NATIVE .= ":${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/rustlib/${TARGET_SYS}/lib" - -# FIXME: set based on whether we are native vs cross vs buildsdk, etc -#export RUST_PATH ??= "${RUST_PATH_NATIVE}" - -## This is builtin to rustc with the value "$libdir/rust/targets" -# RUST_TARGET_PATH = "foo:bar" - oe_runrustc () { bbnote ${RUSTC} ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@" "${RUSTC}" ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@" From 87f67e6d8616bc8d10ffa51920b01c17bba08236 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 22 Nov 2016 10:56:54 -0600 Subject: [PATCH 075/112] remove a call to 'env' For debugging people should really use 'bitbake -e rust' instead. --- recipes-devtools/rust/rust.inc | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index ab35d85..db4dcde 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -415,7 +415,6 @@ do_configure () { rust_runmake () { echo "COMPILE ${PN}" "$@" - env # CFLAGS, LDFLAGS, CXXFLAGS, CPPFLAGS are used by rust's build for a # wide range of targets (not just TARGET). Yocto's settings for them will From 19cdae76b81af6e7448433090fb1b9f974004d74 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 22 Nov 2016 11:55:36 -0600 Subject: [PATCH 076/112] compiler-rt: pass only env needed Build compiler-rt how upstream Rust does it and don't rely on the entire environment being passed to the build process. --- recipes-devtools/rust/compiler-rt_1.10.0.bb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/recipes-devtools/rust/compiler-rt_1.10.0.bb b/recipes-devtools/rust/compiler-rt_1.10.0.bb index 9958bd9..b5e570d 100644 --- a/recipes-devtools/rust/compiler-rt_1.10.0.bb +++ b/recipes-devtools/rust/compiler-rt_1.10.0.bb @@ -12,13 +12,14 @@ require rust-source-${PV}.inc S = "${WORKDIR}/rustc-${PV}/src/compiler-rt" -# Pick up $CC from the environment -EXTRA_OEMAKE += "-e" - do_compile () { oe_runmake -C ${S} \ ProjSrcRoot="${S}" \ ProjObjRoot="${B}" \ + CC="${CC}" \ + AR="${AR}" \ + RANLIB="${RANLIB}" \ + CFLAGS="${CFLAGS}" \ TargetTriple=${HOST_SYS} \ triple-builtins } From 0827bc626be58b81ff606a31cec775c825965ccf Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 23 Nov 2016 11:16:30 -0600 Subject: [PATCH 077/112] rust/rust-bin: move bits to rust-bin Bits that are only used by the rust-bin bbclass should get moved there. They aren't used by any recipe that includes the rust bbclass. --- classes/rust-bin.bbclass | 22 ++++++++++++++++++++++ classes/rust.bbclass | 22 +--------------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/classes/rust-bin.bbclass b/classes/rust-bin.bbclass index 48df8e1..8afe5cb 100644 --- a/classes/rust-bin.bbclass +++ b/classes/rust-bin.bbclass @@ -1,5 +1,6 @@ inherit rust +DEPENDS_append = " patchelf-native" RDEPENDS_${PN} += "${RUSTLIB_DEP}" RUSTC_ARCHFLAGS += "-C opt-level=3 -g -L ${STAGING_DIR_HOST}/${rustlibdir}" @@ -54,6 +55,11 @@ get_overlap_externs () { do_configure () { } +oe_runrustc () { + bbnote ${RUSTC} ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@" + "${RUSTC}" ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@" +} + oe_compile_rust_lib () { [ "${CRATE_TYPE}" == "dylib" ] && suffix=so || suffix=rlib rm -rf ${LIBNAME}.{rlib,so} @@ -88,3 +94,19 @@ oe_install_rust_bin () { echo Installing ${BINNAME} install -D -m 755 ${BINNAME} ${D}/${bindir}/${BINNAME} } + +do_rust_bin_fixups() { + for f in `find ${PKGD} -name '*.so*'`; do + echo "Strip rust note: $f" + ${OBJCOPY} -R .note.rustc $f $f + done + + for f in `find ${PKGD}`; do + file "$f" | grep -q ELF || continue + readelf -d "$f" | grep RUNPATH | grep -q rustlib || continue + echo "Set rpath:" "$f" + patchelf --set-rpath '$ORIGIN:'${rustlibdir}:${rustlib} "$f" + done +} +PACKAGE_PREPROCESS_FUNCS += "do_rust_bin_fixups" + diff --git a/classes/rust.bbclass b/classes/rust.bbclass index e4fb677..e954825 100644 --- a/classes/rust.bbclass +++ b/classes/rust.bbclass @@ -16,7 +16,7 @@ def rust_base_dep(d): deps += " rust-native" return deps -DEPENDS_append = " ${@rust_base_dep(d)} patchelf-native" +DEPENDS_append = " ${@rust_base_dep(d)}" # BUILD_LDFLAGS # ${STAGING_LIBDIR_NATIVE} @@ -31,11 +31,6 @@ DEPENDS_append = " ${@rust_base_dep(d)} patchelf-native" # -L${STAGING_BASE_LIBDIR_NATIVE} \ #" -oe_runrustc () { - bbnote ${RUSTC} ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@" - "${RUSTC}" ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@" -} - # XXX: for some reason bitbake sets BUILD_* & TARGET_* but uses the bare # variables for HOST. Alias things to make it easier for us. HOST_LDFLAGS ?= "${LDFLAGS}" @@ -45,21 +40,6 @@ HOST_CPPFLAGS ?= "${CPPFLAGS}" EXTRA_OECONF_remove = "--disable-static" -do_rust_bin_fixups() { - for f in `find ${PKGD} -name '*.so*'`; do - echo "Strip rust note: $f" - ${OBJCOPY} -R .note.rustc $f $f - done - - for f in `find ${PKGD}`; do - file "$f" | grep -q ELF || continue - readelf -d "$f" | grep RUNPATH | grep -q rustlib || continue - echo "Set rpath:" "$f" - patchelf --set-rpath '$ORIGIN:'${rustlibdir}:${rustlib} "$f" - done -} -PACKAGE_PREPROCESS_FUNCS += "do_rust_bin_fixups" - rustlib_suffix="${TUNE_ARCH}${TARGET_VENDOR}-${TARGET_OS}/rustlib/${HOST_SYS}/lib" # Native sysroot standard library path rustlib_src="${prefix}/lib/${rustlib_suffix}" From f366cff86408b3a46040bf2f6cda69bc1a1b92a0 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 23 Nov 2016 11:26:53 -0600 Subject: [PATCH 078/112] cargo: change trivial verbose flag --- recipes-devtools/cargo/cargo.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-devtools/cargo/cargo.inc b/recipes-devtools/cargo/cargo.inc index fa13057..0d4edd1 100644 --- a/recipes-devtools/cargo/cargo.inc +++ b/recipes-devtools/cargo/cargo.inc @@ -107,7 +107,7 @@ do_compile () { mkdir -p target cp -R ${WORKDIR}/cargo-nightly-x86_64-unknown-linux-gnu/cargo target/snapshot - oe_runmake ARGS="--verbose" + oe_runmake VERBOSE=1 } do_install () { From c98312fd1d610b2794dd452ac524816c8e1d9f9e Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 23 Nov 2016 11:32:18 -0600 Subject: [PATCH 079/112] cargo.bbclass: don't export variables --- classes/cargo.bbclass | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/cargo.bbclass b/classes/cargo.bbclass index ded9894..0934fe0 100644 --- a/classes/cargo.bbclass +++ b/classes/cargo.bbclass @@ -60,11 +60,11 @@ export RUST_BUILD_CC = "${CCACHE}${BUILD_PREFIX}gcc" export RUST_BUILD_CFLAGS = "${BUILD_CC_ARCH} ${BUILD_CFLAGS}" RUSTFLAGS ??= "" -export CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} --release" +CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} --release" # This is based on the content of CARGO_BUILD_FLAGS and generally will need to # change if CARGO_BUILD_FLAGS changes. -export CARGO_TARGET_SUBDIR="${HOST_SYS}/release" +CARGO_TARGET_SUBDIR="${HOST_SYS}/release" oe_cargo_build () { export RUSTFLAGS="${RUSTFLAGS}" bbnote "cargo = $(which cargo)" From 4e1bda643ef7896bdaa77261a3abd8ce312e41c9 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 23 Nov 2016 11:40:17 -0600 Subject: [PATCH 080/112] cargo.bbclass: supply linker and link-args via rustflags Supply the linker and the linker args via rustflags which should make it not necessary to specify them via target JSONs. We explicitly cannot use the RUSTFLAGS environment variable do to the way cargo parses arguments and passes them to rustc. --- classes/cargo.bbclass | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/classes/cargo.bbclass b/classes/cargo.bbclass index 0934fe0..a3d0343 100644 --- a/classes/cargo.bbclass +++ b/classes/cargo.bbclass @@ -1,6 +1,7 @@ inherit rust-vars # add crate fetch support inherit crate-fetch +inherit rust-triples # the binary we will use CARGO = "cargo" @@ -47,6 +48,15 @@ local-registry = "${WORKDIR}/cargo_registry" replace-with = "local" registry = "https://github.com/rust-lang/crates.io-index" EOF + + # We need to use the real Yocto linker and get the linker + # flags to it. Yocto has the concept of BUILD and TARGET + # and uses HOST to be the currently selected one. However + # LDFLAGS and TOOLCHAIN_OPTIONS are not prefixed with HOST + echo "[build]" >> ${CARGO_HOME}/config + echo "rustflags = ['-C', 'link-args=${LDFLAGS}${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}']" >> ${CARGO_HOME}/config + echo "[target.${RUST_HOST_SYS}]" >> ${CARGO_HOME}/config + echo "linker = '${HOST_PREFIX}gcc'" >> ${CARGO_HOME}/config } # All the rust & cargo ecosystem assume that CC, LD, etc are a path to a single @@ -59,14 +69,12 @@ export RUST_CFLAGS = "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${CFLAGS}" export RUST_BUILD_CC = "${CCACHE}${BUILD_PREFIX}gcc" export RUST_BUILD_CFLAGS = "${BUILD_CC_ARCH} ${BUILD_CFLAGS}" -RUSTFLAGS ??= "" CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} --release" # This is based on the content of CARGO_BUILD_FLAGS and generally will need to # change if CARGO_BUILD_FLAGS changes. CARGO_TARGET_SUBDIR="${HOST_SYS}/release" oe_cargo_build () { - export RUSTFLAGS="${RUSTFLAGS}" bbnote "cargo = $(which cargo)" bbnote "rustc = $(which rustc)" bbnote "${CARGO} build ${CARGO_BUILD_FLAGS} $@" From 5afc0cc471eef5c18bbce9bc54aed6110e7c55eb Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 23 Nov 2016 14:03:58 -0600 Subject: [PATCH 081/112] cargo.bbclass: ensure extra RUSTFLAGS are properly passed The RUSTFLAGS env var overrides the rustflags specified in the cargo config so we need to take anything passed in the environment variable and put it in the config. --- classes/cargo.bbclass | 23 +++++++++++++++-------- recipes-devtools/cargo/cargo.inc | 4 ++++ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/classes/cargo.bbclass b/classes/cargo.bbclass index a3d0343..2ddf3c3 100644 --- a/classes/cargo.bbclass +++ b/classes/cargo.bbclass @@ -49,14 +49,20 @@ replace-with = "local" registry = "https://github.com/rust-lang/crates.io-index" EOF - # We need to use the real Yocto linker and get the linker - # flags to it. Yocto has the concept of BUILD and TARGET - # and uses HOST to be the currently selected one. However - # LDFLAGS and TOOLCHAIN_OPTIONS are not prefixed with HOST - echo "[build]" >> ${CARGO_HOME}/config - echo "rustflags = ['-C', 'link-args=${LDFLAGS}${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}']" >> ${CARGO_HOME}/config - echo "[target.${RUST_HOST_SYS}]" >> ${CARGO_HOME}/config - echo "linker = '${HOST_PREFIX}gcc'" >> ${CARGO_HOME}/config + # We need to use the real Yocto linker and get the linker + # flags to it. Yocto has the concept of BUILD and TARGET + # and uses HOST to be the currently selected one. However + # LDFLAGS and TOOLCHAIN_OPTIONS are not prefixed with HOST + echo "[build]" >> ${CARGO_HOME}/config + echo "rustflags = [" >> ${CARGO_HOME}/config + echo "'-C'," >> ${CARGO_HOME}/config + echo "'link-args=${LDFLAGS}${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}'," >> ${CARGO_HOME}/config + for p in ${RUSTFLAGS}; do + printf "'%s'\n" "$p" + done | sed -e 's/$/,/' >> ${CARGO_HOME}/config + echo "]" >> ${CARGO_HOME}/config + echo "[target.${RUST_HOST_SYS}]" >> ${CARGO_HOME}/config + echo "linker = '${HOST_PREFIX}gcc'" >> ${CARGO_HOME}/config } # All the rust & cargo ecosystem assume that CC, LD, etc are a path to a single @@ -75,6 +81,7 @@ CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} --release" # change if CARGO_BUILD_FLAGS changes. CARGO_TARGET_SUBDIR="${HOST_SYS}/release" oe_cargo_build () { + unset RUSTFLAGS bbnote "cargo = $(which cargo)" bbnote "rustc = $(which rustc)" bbnote "${CARGO} build ${CARGO_BUILD_FLAGS} $@" diff --git a/recipes-devtools/cargo/cargo.inc b/recipes-devtools/cargo/cargo.inc index 0d4edd1..efa0988 100644 --- a/recipes-devtools/cargo/cargo.inc +++ b/recipes-devtools/cargo/cargo.inc @@ -67,6 +67,10 @@ SRC_URI = "\ B = "${S}" +# Can't use the default from rust-vars as it cause a compiler crash +# the crate_hash option will cause the compiler to crash +RUSTFLAGS = "-C rpath ${RUSTLIB}" + PACKAGECONFIG ??= "" # Note: this does not appear to work very well due to our use of bitbake triples From dfa7dc1bad25ce9f99cec7a7e7bc7dc757efacad Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 23 Nov 2016 10:54:53 -0600 Subject: [PATCH 082/112] rust: drop link args from the target JSONs The linker args have been moved into the Cargo configuration so there's no need for them in the target spec files. --- recipes-devtools/rust/rust.inc | 35 +--------------------------------- 1 file changed, 1 insertion(+), 34 deletions(-) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index db4dcde..32a1b2a 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -119,45 +119,29 @@ LLVM_TARGET[arm] = "${RUST_TARGET_SYS}" TARGET_ENDIAN[arm] = "little" TARGET_POINTER_WIDTH[arm] = "32" FEATURES[arm] = "+v6,+vfp2" -PRE_LINK_ARGS[arm] = "-Wl,--as-needed" DATA_LAYOUT[aarch64] = "e-m:e-i64:64-i128:128-n32:64-S128" LLVM_TARGET[aarch64] = "aarch64-unknown-linux-gnu" TARGET_ENDIAN[aarch64] = "little" TARGET_POINTER_WIDTH[aarch64] = "64" -PRE_LINK_ARGS[aarch64] = "-Wl,--as-needed" ## x86_64-unknown-linux-gnu DATA_LAYOUT[x86_64] = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" LLVM_TARGET[x86_64] = "x86_64-unknown-linux-gnu" TARGET_ENDIAN[x86_64] = "little" TARGET_POINTER_WIDTH[x86_64] = "64" -PRE_LINK_ARGS[x86_64] = "-Wl,--as-needed -m64" ## i686-unknown-linux-gnu DATA_LAYOUT[i686] = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128" LLVM_TARGET[i686] = "i686-unknown-linux-gnu" TARGET_ENDIAN[i686] = "little" TARGET_POINTER_WIDTH[i686] = "32" -PRE_LINK_ARGS[i686] = "-Wl,--as-needed -m32" ## XXX: a bit of a hack so qemux86 builds, clone of i686-unknown-linux-gnu above DATA_LAYOUT[i586] = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128" LLVM_TARGET[i586] = "i586-unknown-linux-gnu" TARGET_ENDIAN[i586] = "little" TARGET_POINTER_WIDTH[i586] = "32" -PRE_LINK_ARGS[i586] = "-Wl,--as-needed -m32" - -TARGET_PRE_LINK_ARGS = "${TARGET_CC_ARCH} ${TOOLCHAIN_OPTIONS}" -BUILD_PRE_LINK_ARGS = "${BUILD_CC_ARCH} ${TOOLCHAIN_OPTIONS}" -HOST_PRE_LINK_ARGS = "${HOST_CC_ARCH} ${TOOLCHAIN_OPTIONS}" - -# These LDFLAGS have '-L' options in them. We need these to come last so they -# don't screw up the link order and pull in the wrong rust build/version. -# TODO: may want to strip out all the '-L' flags entirely here -TARGET_POST_LINK_ARGS = "${TARGET_LDFLAGS}" -BUILD_POST_LINK_ARGS = "${BUILD_LDFLAGS}" -HOST_POST_LINK_ARGS = "${HOST_LDFLAGS}" def arch_for(d, thing): return d.getVar('{}_ARCH'.format(thing), True) @@ -208,21 +192,6 @@ def llvm_cpu(d): except: return trans.get(target, "generic") -def post_link_args_for(d, thing, arch): - post_link_args = (d.getVar('{}_POST_LINK_ARGS'.format(thing), True) or "").split() - post_link_args.extend((d.getVarFlag('POST_LINK_ARGS', arch, True) or "").split()) - return post_link_args - -def pre_link_args_for(d, thing, arch): - ldflags = (d.getVar('{}_PRE_LINK_ARGS'.format(thing), True) or "").split() - ldflags.extend((d.getVarFlag('PRE_LINK_ARGS', arch, True) or "").split()) - return ldflags - -def ldflags_for(d, thing, arch): - a = pre_link_args_for(d, thing, arch) - a.extend(post_link_args_for(d, thing, arch)) - return a - TARGET_LLVM_CPU="${@llvm_cpu(d)}" TARGET_LLVM_FEATURES = "${@llvm_features_from_tune(d)} ${@llvm_features_from_cc_arch(d)}" @@ -267,8 +236,6 @@ def rust_gen_target(d, thing, wd): tspec['has-rpath'] = True tspec['has-elf-tls'] = True tspec['position-independent-executables'] = True - tspec['pre-link-args'] = pre_link_args_for(d, thing, arch) - tspec['post-link-args'] = post_link_args_for(d, thing, arch) # write out the target spec json file with open(wd + sys + '.json', 'w') as f: @@ -306,7 +273,7 @@ def rust_gen_mk_cfg(d, thing): sys = sys_for(d, thing) prefix = prefix_for(d, thing) llvm_target = d.getVarFlag('LLVM_TARGET', arch, True) - ldflags = ' '.join(ldflags_for(d, thing, arch)) + ldflags = d.getVar('LDFLAGS', True) + d.getVar('HOST_CC_ARCH', True) + d.getVar('TOOLCHAIN_OPTIONS', True) b = d.getVar('WORKDIR', True) + '/mk-cfg/' o = open(b + sys_for(d, thing) + '.mk', 'w') From 61093e260f83cdbd64dc376a00045ae156a857cc Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 23 Nov 2016 14:15:41 -0600 Subject: [PATCH 083/112] cargo: remove code that doesn't work The comment says it doesn't work and I can confirm it won't work. --- recipes-devtools/cargo/cargo.inc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/recipes-devtools/cargo/cargo.inc b/recipes-devtools/cargo/cargo.inc index efa0988..33aab40 100644 --- a/recipes-devtools/cargo/cargo.inc +++ b/recipes-devtools/cargo/cargo.inc @@ -71,12 +71,6 @@ B = "${S}" # the crate_hash option will cause the compiler to crash RUSTFLAGS = "-C rpath ${RUSTLIB}" -PACKAGECONFIG ??= "" - -# Note: this does not appear to work very well due to our use of bitbake triples -# & rust's use of cooked triples -PACKAGECONFIG[rust-snapshot] = "--local-rust-root=${B}/rustc" - # Used in libgit2-sys's build.rs, needed for pkg-config to be used export LIBGIT2_SYS_USE_PKG_CONFIG = "1" @@ -84,8 +78,6 @@ export LIBGIT2_SYS_USE_PKG_CONFIG = "1" DISABLE_STATIC = "" do_configure () { - ${@bb.utils.contains('PACKAGECONFIG', 'rust-snapshot', '${S}/.travis.install.deps.sh', ':', d)} - "${S}/configure" \ "--prefix=${prefix}" \ "--build=${BUILD_SYS}" \ From 311ea03c1f4c0508d752f2a3333c0c45c9daee5f Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Thu, 24 Nov 2016 09:22:44 -0600 Subject: [PATCH 084/112] CI: change from Yocto master to morty Currently master is broken and morty is the next release that we'll likely target so bump our version over to morty. --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2fc6fdc..77e3e2a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -15,7 +15,7 @@ for (int i = 0; i < targets.size(); i++) { sh "./scripts/setup-env.sh" } stage('Yocto Fetch') { - sh "GIT_LOCAL_REF_DIR=/srv/git-cache/ ./scripts/fetch.sh master" + sh "GIT_LOCAL_REF_DIR=/srv/git-cache/ ./scripts/fetch.sh morty" } stage('Build') { sh "MACHINE=${machine} ./scripts/build.sh" From c72c88be92419876bff8f8a00432cec8fe0be23b Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 28 Nov 2016 10:47:01 -0600 Subject: [PATCH 085/112] Jenkinsfile: rename stages for easier tracking Rename the stages to ensure that the machine name is in there so its easier to track what machine is currently being built. --- Jenkinsfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 77e3e2a..cb4ee6f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,23 +8,23 @@ for (int i = 0; i < targets.size(); i++) { machine_builds["$machine"] = { node { try { - stage('Checkout') { + stage("checkout $machine") { checkout scm } - stage('Setup Environment') { + stage("setup-env $machine") { sh "./scripts/setup-env.sh" } - stage('Yocto Fetch') { + stage("fetch $machine") { sh "GIT_LOCAL_REF_DIR=/srv/git-cache/ ./scripts/fetch.sh morty" } - stage('Build') { + stage("build $machine") { sh "MACHINE=${machine} ./scripts/build.sh" } } catch (e) { echo "Caught: ${e}" throw e } finally { - stage('Cleanup Environment') { + stage("cleanup $machine") { sh "./scripts/cleanup-env.sh" deleteDir() } From 3d70f56ae72cdf3d98b8a2810351f9c9320e2e25 Mon Sep 17 00:00:00 2001 From: Derek Straka Date: Wed, 30 Nov 2016 11:13:18 -0500 Subject: [PATCH 086/112] setup-env: only allow slaves with large amounts of RAM to mount tmpfs Signed-off-by: Derek Straka --- scripts/cleanup-env.sh | 5 ++++- scripts/setup-env.sh | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/scripts/cleanup-env.sh b/scripts/cleanup-env.sh index 1367724..9e5ef8b 100755 --- a/scripts/cleanup-env.sh +++ b/scripts/cleanup-env.sh @@ -1,5 +1,8 @@ #!/bin/bash -e -sudo umount build +# Only attempt to unmount if the directory is already mounted +if mountpoint -q `pwd`/build; then + sudo umount build +fi exit 0 diff --git a/scripts/setup-env.sh b/scripts/setup-env.sh index e5fc3b1..dbed061 100755 --- a/scripts/setup-env.sh +++ b/scripts/setup-env.sh @@ -2,6 +2,11 @@ mkdir -p build -sudo mount -t tmpfs -o size=64G,mode=755,uid=${UID} tmpfs build +total_mem=`grep MemTotal /proc/meminfo | awk '{print $2}'` + +# Only have the slaves with large amounts of RAM mount the tmpfs +if [ "$total_mem" -ge "67108864" ]; then + sudo mount -t tmpfs -o size=64G,mode=755,uid=${UID} tmpfs build +fi exit 0 From 168396820d015969cca1aeb3b0c75ba05b5de71b Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Sun, 27 Nov 2016 19:39:11 -0600 Subject: [PATCH 087/112] classes/rust-triples: document the triples Provide documentation behind what the triples mean for Yocto and Rust since they have different meanings of BUILD, TARGET, and HOST. Namely Rust uses HOST when Yocto means BUILD. In our current supported cases HOST and TARGET from Yocto mean the same thing. --- classes/rust-triples.bbclass | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/classes/rust-triples.bbclass b/classes/rust-triples.bbclass index 1f67775..210892e 100644 --- a/classes/rust-triples.bbclass +++ b/classes/rust-triples.bbclass @@ -31,6 +31,28 @@ def rust_base_triple(d, thing): libc = bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'hf', '', d) return arch + vendor + '-' + os + libc +# Naming explanation +# Yocto +# - BUILD_SYS - Yocto triple of the build environment +# - HOST_SYS - What we're building for in Yocto +# - TARGET_SYS - What we're building for in Yocto +# +# So when building '-native' packages BUILD_SYS == HOST_SYS == TARGET_SYS +# When building packages for the image HOST_SYS == TARGET_SYS +# This is a gross over simplification as there are other modes but +# currently this is all that's supported. +# +# Rust +# - TARGET - the system where the binary will run +# - HOST - the system where the binary is being built +# +# Rust additionally will use two additional cases: +# - undecorated (e.g. CC) - equivalent to TARGET +# - triple suffix (e.g. CC_x86_64_unknown_linux_gnu) - both +# see: https://github.com/alexcrichton/gcc-rs +# The way that Rust's internal triples and Yocto triples are mapped together +# its likely best to not use the triple suffix due to potential confusion. + RUST_BUILD_SYS = "${@rust_base_triple(d, 'BUILD')}" RUST_HOST_SYS = "${@rust_base_triple(d, 'HOST')}" RUST_TARGET_SYS = "${@rust_base_triple(d, 'TARGET')}" From 864fe9572258a7beac20fde70fb69c51600e05b8 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Sun, 27 Nov 2016 23:42:20 -0600 Subject: [PATCH 088/112] classes: create proper compiler and linker wrappers Rust builds (custom build.rs and gcc-rs users) expect to have the compiler and the linker available to them as a single command with no white space trailing. Yocto unfortunately does not conform to that. The build compiler and linker almost always have a trailing space due to how the variables are composed and the target compiler and linker are almost always more than a single command. Then if you throw ccache into the mix you'll get another command. As a result to handle all these cases properly there need to be wrappers created. This change creates wrappers for both build and target and both the linker and compiler. This likely fixes #76. --- classes/cargo.bbclass | 11 +++------ classes/rust-triples.bbclass | 48 ++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 8 deletions(-) diff --git a/classes/cargo.bbclass b/classes/cargo.bbclass index 2ddf3c3..7138ca4 100644 --- a/classes/cargo.bbclass +++ b/classes/cargo.bbclass @@ -30,9 +30,6 @@ export PKG_CONFIG_ALLOW_CROSS = "1" cargo_do_configure () { mkdir -p ${CARGO_HOME} - # NOTE: we cannot pass more flags via this interface, the 'linker' is - # assumed to be a path to a binary. If flags are needed, a wrapper must - # be used. echo "paths = [" > ${CARGO_HOME}/config for p in ${EXTRA_OECARGO_PATHS}; do @@ -62,7 +59,7 @@ EOF done | sed -e 's/$/,/' >> ${CARGO_HOME}/config echo "]" >> ${CARGO_HOME}/config echo "[target.${RUST_HOST_SYS}]" >> ${CARGO_HOME}/config - echo "linker = '${HOST_PREFIX}gcc'" >> ${CARGO_HOME}/config + echo "linker = '${RUST_TARGET_CCLD}'" >> ${CARGO_HOME}/config } # All the rust & cargo ecosystem assume that CC, LD, etc are a path to a single @@ -70,9 +67,7 @@ EOF # XXX: this is hard coded based on meta/conf/bitbake.conf # TODO: we do quite a bit very similar to this in rust.inc, see if it can be # generalized. -export RUST_CC = "${CCACHE}${HOST_PREFIX}gcc" export RUST_CFLAGS = "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${CFLAGS}" -export RUST_BUILD_CC = "${CCACHE}${BUILD_PREFIX}gcc" export RUST_BUILD_CFLAGS = "${BUILD_CC_ARCH} ${BUILD_CFLAGS}" CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} --release" @@ -89,10 +84,10 @@ oe_cargo_build () { } oe_cargo_fix_env () { - export CC="${RUST_CC}" + export CC="${RUST_TARGET_CC}" export CFLAGS="${RUST_CFLAGS}" export AR="${AR}" - export TARGET_CC="${RUST_CC}" + export TARGET_CC="${RUST_TARGET_CC}" export TARGET_CFLAGS="${RUST_CFLAGS}" export TARGET_AR="${AR}" export HOST_CC="${RUST_BUILD_CC}" diff --git a/classes/rust-triples.bbclass b/classes/rust-triples.bbclass index 210892e..0975c2b 100644 --- a/classes/rust-triples.bbclass +++ b/classes/rust-triples.bbclass @@ -56,3 +56,51 @@ def rust_base_triple(d, thing): RUST_BUILD_SYS = "${@rust_base_triple(d, 'BUILD')}" RUST_HOST_SYS = "${@rust_base_triple(d, 'HOST')}" RUST_TARGET_SYS = "${@rust_base_triple(d, 'TARGET')}" + +# wrappers to get around the fact that Rust needs a single +# binary but Yocto's compiler and linker commands have +# arguments. Technically the archiver is always one command but +# this is necessary for builds that determine the prefix and then +# use those commands based on the prefix. +WRAPPER_DIR = "${WORKDIR}/wrapper" +RUST_BUILD_CC = "${WRAPPER_DIR}/build-rust-cc" +RUST_BUILD_CCLD = "${WRAPPER_DIR}/build-rust-ccld" +RUST_BUILD_AR = "${WRAPPER_DIR}/build-rust-ar" +RUST_TARGET_CC = "${WRAPPER_DIR}/target-rust-cc" +RUST_TARGET_CCLD = "${WRAPPER_DIR}/target-rust-ccld" +RUST_TARGET_AR = "${WRAPPER_DIR}/target-rust-ar" + +create_wrapper () { + file="$1" + shift + + cat <<- EOF > "${file}" + #!/bin/sh + $@ "\$@" + EOF + chmod +x "${file}" +} + +# compiler is used by gcc-rs +# linker is used by rustc/cargo +# archiver is used by the build of libstd-rs +do_rust_create_wrappers () { + mkdir -p "${WRAPPER_DIR}" + + # Yocto Build / Rust Host compiler + create_wrapper "${RUST_BUILD_CC}" "${BUILD_CC}" + # Yocto Build / Rust Host linker + create_wrapper "${RUST_BUILD_CCLD}" "${BUILD_CCLD}" "${BUILD_LDFLAGS}" + # Yocto Build / Rust Host archiver + create_wrapper "${RUST_BUILD_AR}" "${BUILD_AR}" + + # Yocto Target / Rust Target compiler + create_wrapper "${RUST_TARGET_CC}" "${CC}" + # Yocto Target / Rust Target linker + create_wrapper "${RUST_TARGET_CCLD}" "${CCLD}" "${LDFLAGS}" + # Yocto Target / Rust Target archiver + create_wrapper "${RUST_TARGET_AR}" "${AR}" +} + +addtask rust_create_wrappers before do_configure after do_patch +do_rust_create_wrappers[dirs] += "${WRAPPER_DIR}" From 689dfe8004d050a73571bd2962edd20c61d814f0 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Sun, 27 Nov 2016 23:52:40 -0600 Subject: [PATCH 089/112] classes/cargo: fix up build CFLAGS being passed to Rust Firstly, BUILD_CC_ARCH is included in BUILD_CC (hence why we actually need a BUILD_CC wrapper because it produces the space), so its redundant (now with the wrapper using BUILD_CC). The RUST_BUILD_CFLAGS variable doesn't need to be exported since its not actually used by rustc/gcc-rs/cargo. Since its redundant and doesn't need to be exported remove it and simplify. --- classes/cargo.bbclass | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/classes/cargo.bbclass b/classes/cargo.bbclass index 7138ca4..5a3e950 100644 --- a/classes/cargo.bbclass +++ b/classes/cargo.bbclass @@ -68,7 +68,6 @@ EOF # TODO: we do quite a bit very similar to this in rust.inc, see if it can be # generalized. export RUST_CFLAGS = "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${CFLAGS}" -export RUST_BUILD_CFLAGS = "${BUILD_CC_ARCH} ${BUILD_CFLAGS}" CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} --release" @@ -91,7 +90,7 @@ oe_cargo_fix_env () { export TARGET_CFLAGS="${RUST_CFLAGS}" export TARGET_AR="${AR}" export HOST_CC="${RUST_BUILD_CC}" - export HOST_CFLAGS="${RUST_BUILD_CFLAGS}" + export HOST_CFLAGS="${BUILD_CFLAGS}" export HOST_AR="${BUILD_AR}" } From a387a5fe8fb1e32192a3becc9f25bdf75f8abacf Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Sun, 27 Nov 2016 23:57:23 -0600 Subject: [PATCH 090/112] classes/cargo: fix up target CFLAGS being passed to Rust Firstly, HOST_CC_ARCH and TOOLCHAIN_OPTIONS are included in CC so them being passed in are redundant now (due to the wrapper). The RUST_CFLAGS variable doesn't need to be exported since its not actually used by rustc/gcc-rs/cargo. Since its redundant and doesn't need to be exported, remove it and simplify. --- classes/cargo.bbclass | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/classes/cargo.bbclass b/classes/cargo.bbclass index 5a3e950..8cddc58 100644 --- a/classes/cargo.bbclass +++ b/classes/cargo.bbclass @@ -62,13 +62,6 @@ EOF echo "linker = '${RUST_TARGET_CCLD}'" >> ${CARGO_HOME}/config } -# All the rust & cargo ecosystem assume that CC, LD, etc are a path to a single -# command. Fixup the ones we give it so that is the case. -# XXX: this is hard coded based on meta/conf/bitbake.conf -# TODO: we do quite a bit very similar to this in rust.inc, see if it can be -# generalized. -export RUST_CFLAGS = "${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} ${CFLAGS}" - CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} --release" # This is based on the content of CARGO_BUILD_FLAGS and generally will need to @@ -84,10 +77,10 @@ oe_cargo_build () { oe_cargo_fix_env () { export CC="${RUST_TARGET_CC}" - export CFLAGS="${RUST_CFLAGS}" + export CFLAGS="${CFLAGS}" export AR="${AR}" export TARGET_CC="${RUST_TARGET_CC}" - export TARGET_CFLAGS="${RUST_CFLAGS}" + export TARGET_CFLAGS="${CFLAGS}" export TARGET_AR="${AR}" export HOST_CC="${RUST_BUILD_CC}" export HOST_CFLAGS="${BUILD_CFLAGS}" From 20ac8ea88882178ff1be58b33ec1dd1e1abc2616 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 28 Nov 2016 00:02:26 -0600 Subject: [PATCH 091/112] classes/cargo: fix cargo target for linker override We don't use the native Rust triples but instead use the Yocto triples so we need to provide this override properly. This typo was introduced in 5afc0cc471. --- classes/cargo.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/cargo.bbclass b/classes/cargo.bbclass index 8cddc58..53fcec0 100644 --- a/classes/cargo.bbclass +++ b/classes/cargo.bbclass @@ -58,7 +58,7 @@ EOF printf "'%s'\n" "$p" done | sed -e 's/$/,/' >> ${CARGO_HOME}/config echo "]" >> ${CARGO_HOME}/config - echo "[target.${RUST_HOST_SYS}]" >> ${CARGO_HOME}/config + echo "[target.${HOST_SYS}]" >> ${CARGO_HOME}/config echo "linker = '${RUST_TARGET_CCLD}'" >> ${CARGO_HOME}/config } From 1bf70b13a75daee1dff8730f3f67681c973ba746 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 28 Nov 2016 00:05:11 -0600 Subject: [PATCH 092/112] classes/cargo: revert to utilizing compiler/linker wrappers Don't supply the linker arguments via rustflags and then mangle with the RUSTFLAGS environment variable. This is also a parial reversion of 4e1bda643e and 5afc0cc471. These changes are reverted since it assumed people would build with cargo and not directly with rustc. ref #116. --- classes/cargo.bbclass | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/classes/cargo.bbclass b/classes/cargo.bbclass index 53fcec0..551c788 100644 --- a/classes/cargo.bbclass +++ b/classes/cargo.bbclass @@ -46,29 +46,18 @@ replace-with = "local" registry = "https://github.com/rust-lang/crates.io-index" EOF - # We need to use the real Yocto linker and get the linker - # flags to it. Yocto has the concept of BUILD and TARGET - # and uses HOST to be the currently selected one. However - # LDFLAGS and TOOLCHAIN_OPTIONS are not prefixed with HOST - echo "[build]" >> ${CARGO_HOME}/config - echo "rustflags = [" >> ${CARGO_HOME}/config - echo "'-C'," >> ${CARGO_HOME}/config - echo "'link-args=${LDFLAGS}${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS}'," >> ${CARGO_HOME}/config - for p in ${RUSTFLAGS}; do - printf "'%s'\n" "$p" - done | sed -e 's/$/,/' >> ${CARGO_HOME}/config - echo "]" >> ${CARGO_HOME}/config echo "[target.${HOST_SYS}]" >> ${CARGO_HOME}/config echo "linker = '${RUST_TARGET_CCLD}'" >> ${CARGO_HOME}/config } +RUSTFLAGS ??= "" CARGO_BUILD_FLAGS = "-v --target ${HOST_SYS} --release" # This is based on the content of CARGO_BUILD_FLAGS and generally will need to # change if CARGO_BUILD_FLAGS changes. CARGO_TARGET_SUBDIR="${HOST_SYS}/release" oe_cargo_build () { - unset RUSTFLAGS + export RUSTFLAGS="${RUSTFLAGS}" bbnote "cargo = $(which cargo)" bbnote "rustc = $(which rustc)" bbnote "${CARGO} build ${CARGO_BUILD_FLAGS} $@" From 2ffd11b9fe71f552c17e31c5f7c23e9c95886a3e Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 28 Nov 2016 00:08:26 -0600 Subject: [PATCH 093/112] cargo: revert dropped usage of -C crate_hash This reverts the change from 5afc0cc471 based on the discussion in #116. --- recipes-devtools/cargo/cargo.inc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/recipes-devtools/cargo/cargo.inc b/recipes-devtools/cargo/cargo.inc index 33aab40..7b46472 100644 --- a/recipes-devtools/cargo/cargo.inc +++ b/recipes-devtools/cargo/cargo.inc @@ -67,10 +67,6 @@ SRC_URI = "\ B = "${S}" -# Can't use the default from rust-vars as it cause a compiler crash -# the crate_hash option will cause the compiler to crash -RUSTFLAGS = "-C rpath ${RUSTLIB}" - # Used in libgit2-sys's build.rs, needed for pkg-config to be used export LIBGIT2_SYS_USE_PKG_CONFIG = "1" From f87bb054140d03f15d6501b4c8702b305d390c13 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 28 Nov 2016 16:27:14 -0600 Subject: [PATCH 094/112] classes/cargo: provide linker for BUILD_SYS Ensure that we have a linker for the BUILD_SYS (Yocto) / HOST (Rust). --- classes/cargo.bbclass | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/classes/cargo.bbclass b/classes/cargo.bbclass index 551c788..44ff604 100644 --- a/classes/cargo.bbclass +++ b/classes/cargo.bbclass @@ -48,6 +48,10 @@ EOF echo "[target.${HOST_SYS}]" >> ${CARGO_HOME}/config echo "linker = '${RUST_TARGET_CCLD}'" >> ${CARGO_HOME}/config + if [ "${HOST_SYS}" != "${BUILD_SYS}" ]; then + echo "[target.${BUILD_SYS}]" >> ${CARGO_HOME}/config + echo "linker = '${RUST_BUILD_CCLD}'" >> ${CARGO_HOME}/config + fi } RUSTFLAGS ??= "" From 5985331f33f64fe7464c5fd330597ca730df60e6 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Fri, 2 Dec 2016 08:55:34 -0600 Subject: [PATCH 095/112] rust: remove patch to change path to $S/mk/cfg Since we no longer use shared source we can modify the source directory as we build. This drops another patch we need to build and simplifies the addition of Rust 1.12.1 in #97. --- ...g-the-platform-configuration-source-.patch | 56 ------------------- recipes-devtools/rust/rust.inc | 10 ++-- recipes-devtools/rust/rust_1.10.0.bb | 1 - 3 files changed, 5 insertions(+), 62 deletions(-) delete mode 100644 recipes-devtools/rust/files/rust-1.10.0/0010-mk-allow-changing-the-platform-configuration-source-.patch diff --git a/recipes-devtools/rust/files/rust-1.10.0/0010-mk-allow-changing-the-platform-configuration-source-.patch b/recipes-devtools/rust/files/rust-1.10.0/0010-mk-allow-changing-the-platform-configuration-source-.patch deleted file mode 100644 index e6f8f3c..0000000 --- a/recipes-devtools/rust/files/rust-1.10.0/0010-mk-allow-changing-the-platform-configuration-source-.patch +++ /dev/null @@ -1,56 +0,0 @@ -From 8efc27cfdbebcfb0e544ce1b7ee242955af0f68a Mon Sep 17 00:00:00 2001 -From: Cody P Schafer -Date: Thu, 4 Feb 2016 10:44:23 -0500 -Subject: [PATCH 10/11] mk: allow changing the platform configuration source - directory - ---- - configure | 4 +++- - mk/platform.mk | 2 +- - 2 files changed, 4 insertions(+), 2 deletions(-) - -diff --git a/configure b/configure -index 7747850..f5224ca 100755 ---- a/configure -+++ b/configure -@@ -663,6 +663,7 @@ valopt_nosave local-rust-root "/usr/local" "set prefix for local rust binary" - valopt_nosave host "${CFG_BUILD}" "GNUs ./configure syntax LLVM host triples" - valopt_nosave target "${CFG_HOST}" "GNUs ./configure syntax LLVM target triples" - valopt_nosave mandir "${CFG_PREFIX}/share/man" "install man pages in PATH" -+valopt_nosave platform-cfg "${CFG_SRC_DIR}/mk/cfg" "Location platform configuration for non-rust code" - - CFG_LIBDIR_RELATIVE=lib - -@@ -1084,7 +1085,7 @@ CFG_MANDIR=${CFG_MANDIR%/} - CFG_HOST="$(echo $CFG_HOST | tr ',' ' ')" - CFG_TARGET="$(echo $CFG_TARGET | tr ',' ' ')" - CFG_SUPPORTED_TARGET="" --for target_file in ${CFG_SRC_DIR}mk/cfg/*.mk; do -+for target_file in ${CFG_PLATFORM_CFG}/*.mk; do - CFG_SUPPORTED_TARGET="${CFG_SUPPORTED_TARGET} $(basename "$target_file" .mk)" - done - -@@ -1780,6 +1781,7 @@ putvar CFG_I686_LINUX_ANDROID_NDK - putvar CFG_NACL_CROSS_PATH - putvar CFG_MANDIR - putvar CFG_USING_LIBCPP -+putvar CFG_PLATFORM_CFG - - # Avoid spurious warnings from clang by feeding it original source on - # ccache-miss rather than preprocessed input. -diff --git a/mk/platform.mk b/mk/platform.mk -index b959d59..bddd203 100644 ---- a/mk/platform.mk -+++ b/mk/platform.mk -@@ -97,7 +97,7 @@ $(foreach cvar,CC CXX CPP CFLAGS CXXFLAGS CPPFLAGS, \ - - CFG_RLIB_GLOB=lib$(1)-*.rlib - --include $(wildcard $(CFG_SRC_DIR)mk/cfg/*.mk) -+include $(wildcard $(CFG_PLATFORM_CFG)/*.mk) - - define ADD_INSTALLED_OBJECTS - INSTALLED_OBJECTS_$(1) += $$(CFG_INSTALLED_OBJECTS_$(1)) --- -2.7.4 - diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index 32a1b2a..a173f7e 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -266,6 +266,7 @@ def rust_gen_mk_cfg(d, thing): Note that the configure process also depends on the existence of #1, so we have to run this before do_configure ''' + import os import subprocess rust_base_sys = rust_base_triple(d, thing) @@ -275,9 +276,9 @@ def rust_gen_mk_cfg(d, thing): llvm_target = d.getVarFlag('LLVM_TARGET', arch, True) ldflags = d.getVar('LDFLAGS', True) + d.getVar('HOST_CC_ARCH', True) + d.getVar('TOOLCHAIN_OPTIONS', True) - b = d.getVar('WORKDIR', True) + '/mk-cfg/' - o = open(b + sys_for(d, thing) + '.mk', 'w') - i = open(d.getVar('S', True) + '/mk/cfg/' + rust_base_sys + '.mk', 'r') + b = os.path.join(d.getVar('S', True), 'mk', 'cfg') + o = open(os.path.join(b, sys_for(d, thing) + '.mk'), 'w') + i = open(os.path.join(b, rust_base_sys + '.mk'), 'r') r = subprocess.call(['sed', # CFLAGS, LDFLAGS, CXXFLAGS, CPPFLAGS are used by rust's build for a @@ -335,7 +336,7 @@ python do_rust_arch_fixup () { rust_gen_mk_cfg(d, thing) } addtask rust_arch_fixup before do_configure after do_patch -do_rust_arch_fixup[dirs] += "${WORKDIR}/mk-cfg" +do_rust_arch_fixup[dirs] += "${S}/mk/cfg" llvmdir = "${STAGING_DIR_NATIVE}/${prefix_native}" @@ -374,7 +375,6 @@ do_configure () { "--infodir=${infodir}" \ "--mandir=${mandir}" \ "--libdir=${libdir}" \ - "--platform-cfg=${WORKDIR}/mk-cfg/" \ "--enable-local-rust" \ "--local-rust-root=${WORKDIR}/${RUST_SNAPSHOT}/rustc" \ ${EXTRA_OECONF} diff --git a/recipes-devtools/rust/rust_1.10.0.bb b/recipes-devtools/rust/rust_1.10.0.bb index 8d32ec7..bfccfd1 100644 --- a/recipes-devtools/rust/rust_1.10.0.bb +++ b/recipes-devtools/rust/rust_1.10.0.bb @@ -11,7 +11,6 @@ SRC_URI += " \ file://rust-${PV}/0007-mk-install-use-disable-rewrite-paths.patch \ file://rust-${PV}/0008-Allow-overriding-crate_hash-with-C-crate_hash.patch \ file://rust-${PV}/0009-mk-platform.mk-pass-C-crate_hash-to-builds.patch \ - file://rust-${PV}/0010-mk-allow-changing-the-platform-configuration-source-.patch \ file://rust-${PV}/0011-Get-rid-of-the-.note-interpretation-of-rustc-dylib-m.patch \ file://rust-installer-${PV}/0001-add-option-to-disable-rewriting-of-install-paths.patch;patchdir=src/rust-installer \ " From 07069a186979081f609154737062a688854c139f Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Fri, 2 Dec 2016 08:57:09 -0600 Subject: [PATCH 096/112] rust: drop outdated comment and variable --- recipes-devtools/rust/rust.inc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index a173f7e..0b18cea 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -346,12 +346,6 @@ export CFG_DISABLE_LDCONFIG="notempty" do_configure () { # FIXME: target_prefix vs prefix, see cross.bbclass - # FIXME: this path to rustc (via `which rustc`) may not be quite right in the case - # where we're reinstalling the compiler. May want to try for a real - # path based on bitbake vars - # Also will be wrong when relative libdir and/or bindir aren't 'bin' and 'lib'. - local_rust_root="$PWD/dl" - # - rpath is required otherwise rustc fails to resolve symbols # - submodule management is done by bitbake's fetching ${S}/configure \ From e4143212283c5f47ac4453689d2c2315dac82655 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Fri, 2 Dec 2016 08:58:53 -0600 Subject: [PATCH 097/112] rust: drop variable from global scope This variable had one place it was being used and it didn't need to be globally scoped. --- recipes-devtools/rust/rust.inc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index 0b18cea..e797360 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -338,8 +338,6 @@ python do_rust_arch_fixup () { addtask rust_arch_fixup before do_configure after do_patch do_rust_arch_fixup[dirs] += "${S}/mk/cfg" -llvmdir = "${STAGING_DIR_NATIVE}/${prefix_native}" - # prevent the rust-installer scripts from calling ldconfig export CFG_DISABLE_LDCONFIG="notempty" @@ -356,7 +354,7 @@ do_configure () { "--enable-optimize" \ "--enable-optimize-cxx" \ "--disable-llvm-version-check" \ - "--llvm-root=${llvmdir}" \ + "--llvm-root=${STAGING_DIR_NATIVE}/${prefix_native}" \ "--enable-optimize-tests" \ "--release-channel=stable" \ "--prefix=${prefix}" \ From 95fa6c92a90a1669c5673fa262b5c1e04dcb4f61 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Fri, 2 Dec 2016 09:26:46 -0600 Subject: [PATCH 098/112] rust: remove unnecessary install chmods The comment isn't true anymore and we don't need to run chmod anymore. --- recipes-devtools/rust/rust.inc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index e797360..d104d4a 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -393,12 +393,6 @@ do_compile () { rust_do_install () { rust_runmake DESTDIR="${D}" install - # Rust's install.sh doesn't mark executables as executable because - # we're using a custom bindir, do it ourselves. - chmod +x "${D}/${bindir}/rustc" - chmod +x "${D}/${bindir}/rustdoc" - chmod +x "${D}/${bindir}/rust-gdb" - # Install our custom target.json files local td="${D}${libdir}/rustlib/" install -d "$td" From 972fbd4582834c94a6e639521a11eceece703417 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 29 Nov 2016 16:02:55 -0600 Subject: [PATCH 099/112] rust: we need the build system snapshot, not host We need the Rust snapshot (stage0) for the build environment not the host environment. This is not affecting us currently because we are only building native versions of this today but should improve the behavior of #81 or if any Rust components are built for the target machine. --- recipes-devtools/rust/rust-source-1.10.0.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recipes-devtools/rust/rust-source-1.10.0.inc b/recipes-devtools/rust/rust-source-1.10.0.inc index 4ee024a..45a7792 100644 --- a/recipes-devtools/rust/rust-source-1.10.0.inc +++ b/recipes-devtools/rust/rust-source-1.10.0.inc @@ -6,7 +6,7 @@ RS_VERSION = "1.9.0" RS_KEY = "e8edd0fd" -RUST_SNAPSHOT = "rustc-${RS_VERSION}-${RUST_HOST_SYS}" +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] = "f1cf6d2fe15e4be18a08259f1540a4ae" From ba428c19bf88895b183fa04bb1e214be1a9cf37d Mon Sep 17 00:00:00 2001 From: Cody P Schafer Date: Thu, 29 Sep 2016 23:12:43 -0400 Subject: [PATCH 100/112] rust: regenerate patches for 1.12.1 --- ...lt-target.json-path-libdir-rust-targ.patch | 107 ++++++++++++++++++ ...e-RUSTFLAGS-to-override-target-libs-.patch | 73 ++++++++++++ ...3-mk-add-missing-CFG_LIBDIR_RELATIVE.patch | 27 +++++ ...cal-workaround-for-NULL-__dso_handle.patch | 25 ++++ ...mk-install-use-disable-rewrite-paths.patch | 30 +++++ ...rriding-crate_hash-with-C-crate_hash.patch | 65 +++++++++++ ...tform.mk-pass-C-crate_hash-to-builds.patch | 27 +++++ ...o-disable-rewriting-of-install-paths.patch | 58 ++++++++++ recipes-devtools/rust/rust-source-1.12.1.inc | 18 +++ 9 files changed, 430 insertions(+) create mode 100644 recipes-devtools/rust/files/rust-1.12.1/0001-Target-add-default-target.json-path-libdir-rust-targ.patch create mode 100644 recipes-devtools/rust/files/rust-1.12.1/0002-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch create mode 100644 recipes-devtools/rust/files/rust-1.12.1/0003-mk-add-missing-CFG_LIBDIR_RELATIVE.patch create mode 100644 recipes-devtools/rust/files/rust-1.12.1/0005-std-thread_local-workaround-for-NULL-__dso_handle.patch create mode 100644 recipes-devtools/rust/files/rust-1.12.1/0006-mk-install-use-disable-rewrite-paths.patch create mode 100644 recipes-devtools/rust/files/rust-1.12.1/0007-Allow-overriding-crate_hash-with-C-crate_hash.patch create mode 100644 recipes-devtools/rust/files/rust-1.12.1/0008-mk-platform.mk-pass-C-crate_hash-to-builds.patch create mode 100644 recipes-devtools/rust/files/rust-installer-1.12.1/0001-add-option-to-disable-rewriting-of-install-paths.patch create mode 100644 recipes-devtools/rust/rust-source-1.12.1.inc diff --git a/recipes-devtools/rust/files/rust-1.12.1/0001-Target-add-default-target.json-path-libdir-rust-targ.patch b/recipes-devtools/rust/files/rust-1.12.1/0001-Target-add-default-target.json-path-libdir-rust-targ.patch new file mode 100644 index 0000000..6186c5b --- /dev/null +++ b/recipes-devtools/rust/files/rust-1.12.1/0001-Target-add-default-target.json-path-libdir-rust-targ.patch @@ -0,0 +1,107 @@ +From bb2d8649b2b344e0bb4b1cf94135378831735557 Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Tue, 18 Nov 2014 01:40:21 -0500 +Subject: [PATCH 01/10] 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 | 13 +++++++++++-- + 3 files changed, 20 insertions(+), 7 deletions(-) + +diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs +index e988ddc..563f3ac 100644 +--- a/src/librustc/session/config.rs ++++ b/src/librustc/session/config.rs +@@ -42,7 +42,7 @@ use std::env; + use std::fmt; + use std::hash::{Hasher, SipHasher}; + use std::iter::FromIterator; +-use std::path::PathBuf; ++use std::path::{Path, PathBuf}; + + pub struct Config { + pub target: Target, +@@ -1011,8 +1011,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 c71253a..13b4e05 100644 +--- a/src/librustc/session/mod.rs ++++ b/src/librustc/session/mod.rs +@@ -395,13 +395,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 18686e3..d439b59 100644 +--- a/src/librustc_back/target/mod.rs ++++ b/src/librustc_back/target/mod.rs +@@ -49,6 +49,8 @@ use std::collections::BTreeMap; + use std::default::Default; + use std::io::prelude::*; + use syntax::abi::Abi; ++use std::borrow::ToOwned; ++use std::path::Path; + + mod android_base; + mod apple_base; +@@ -541,12 +543,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())?; +@@ -577,8 +580,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.0 + diff --git a/recipes-devtools/rust/files/rust-1.12.1/0002-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch b/recipes-devtools/rust/files/rust-1.12.1/0002-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch new file mode 100644 index 0000000..e1eaa05 --- /dev/null +++ b/recipes-devtools/rust/files/rust-1.12.1/0002-mk-for-stage0-use-RUSTFLAGS-to-override-target-libs-.patch @@ -0,0 +1,73 @@ +From 0829743c109a147213d06d38052662a5f2b0dd9b Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Tue, 18 Nov 2014 14:52:56 -0500 +Subject: [PATCH 02/10] 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 90d3563..cdcbdf2 100644 +--- a/mk/main.mk ++++ b/mk/main.mk +@@ -420,32 +420,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)) +@@ -558,6 +552,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.0 + diff --git a/recipes-devtools/rust/files/rust-1.12.1/0003-mk-add-missing-CFG_LIBDIR_RELATIVE.patch b/recipes-devtools/rust/files/rust-1.12.1/0003-mk-add-missing-CFG_LIBDIR_RELATIVE.patch new file mode 100644 index 0000000..dad4b4e --- /dev/null +++ b/recipes-devtools/rust/files/rust-1.12.1/0003-mk-add-missing-CFG_LIBDIR_RELATIVE.patch @@ -0,0 +1,27 @@ +From 128503bf447e82b9e99bea8ef83294a6446036b5 Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Tue, 18 Nov 2014 13:48:14 -0500 +Subject: [PATCH 03/10] 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.10.0 + diff --git a/recipes-devtools/rust/files/rust-1.12.1/0005-std-thread_local-workaround-for-NULL-__dso_handle.patch b/recipes-devtools/rust/files/rust-1.12.1/0005-std-thread_local-workaround-for-NULL-__dso_handle.patch new file mode 100644 index 0000000..42a6c88 --- /dev/null +++ b/recipes-devtools/rust/files/rust-1.12.1/0005-std-thread_local-workaround-for-NULL-__dso_handle.patch @@ -0,0 +1,25 @@ +From d73ce5d99346812fcf063a87b4efac54c263737d Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Wed, 3 Dec 2014 19:15:19 -0500 +Subject: [PATCH 05/10] 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 152b977..3c62862 100644 +--- a/src/libstd/thread/local.rs ++++ b/src/libstd/thread/local.rs +@@ -380,7 +380,7 @@ pub mod elf { + #[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.0 + diff --git a/recipes-devtools/rust/files/rust-1.12.1/0006-mk-install-use-disable-rewrite-paths.patch b/recipes-devtools/rust/files/rust-1.12.1/0006-mk-install-use-disable-rewrite-paths.patch new file mode 100644 index 0000000..1c003b5 --- /dev/null +++ b/recipes-devtools/rust/files/rust-1.12.1/0006-mk-install-use-disable-rewrite-paths.patch @@ -0,0 +1,30 @@ +From f8d4b1ea925789bca1aa6261017d63f5efa95c0f Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Mon, 2 Mar 2015 13:34:59 -0500 +Subject: [PATCH 06/10] 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 d2e5449..e67650b 100644 +--- a/mk/install.mk ++++ b/mk/install.mk +@@ -12,7 +12,9 @@ RUN_INSTALLER = 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.10.0 + diff --git a/recipes-devtools/rust/files/rust-1.12.1/0007-Allow-overriding-crate_hash-with-C-crate_hash.patch b/recipes-devtools/rust/files/rust-1.12.1/0007-Allow-overriding-crate_hash-with-C-crate_hash.patch new file mode 100644 index 0000000..cb8e017 --- /dev/null +++ b/recipes-devtools/rust/files/rust-1.12.1/0007-Allow-overriding-crate_hash-with-C-crate_hash.patch @@ -0,0 +1,65 @@ +From 2a42d59c3671f3ab68d8ff49c46240842aff6eb6 Mon Sep 17 00:00:00 2001 +From: Steven Walter +Date: Wed, 18 Nov 2015 08:33:26 -0500 +Subject: [PATCH 07/10] Allow overriding crate_hash with -C crate_hash + +The current crate hash is not stable from run-to-run. This causes +problems with bitbake; it needs a guarantee that every build with the +same input will generate compatible output, otherwise sstate won't work. +Using -C crate_hash, we can do that by using the bitbake input hash to +determine the crate hash; the bitbake input hash will be stable, but +still different for different rust recipes. + +Upstream-Status: not-appropriate + +Upstream wants to fix it's actual object generation here. See +https://github.com/rust-lang/rust/issues/34902 (and others) for details. +--- + src/librustc/session/config.rs | 2 ++ + src/librustc_trans/back/link.rs | 12 +++++++++++- + 2 files changed, 13 insertions(+), 1 deletion(-) + +diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs +index 563f3ac..52a5130 100644 +--- a/src/librustc/session/config.rs ++++ b/src/librustc/session/config.rs +@@ -804,6 +804,8 @@ options! {CodegenOptions, CodegenSetter, basic_codegen_options, + "choose the code model to use (rustc --print code-models for details)"), + metadata: Vec = (Vec::new(), parse_list, [TRACKED], + "metadata to mangle symbol names with"), ++ crate_hash: String = ("".to_string(), parse_string, [TRACKED], ++ "override crate hash with given value"), + extra_filename: String = ("".to_string(), parse_string, [UNTRACKED], + "extra data to put in each output filename"), + codegen_units: usize = (1, parse_uint, [UNTRACKED], +diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs +index 3cf2500..0e48063 100644 +--- a/src/librustc_trans/back/link.rs ++++ b/src/librustc_trans/back/link.rs +@@ -125,12 +125,22 @@ pub fn find_crate_name(sess: Option<&Session>, + + } + ++use std::hash::{Hasher, SipHasher}; ++use rustc::hir::svh::Svh; ++ + pub fn build_link_meta<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, + name: &str) + -> LinkMeta { ++ let crate_hash = if tcx.sess.opts.cg.crate_hash != "" { ++ let mut state = SipHasher::new(); ++ state.write(tcx.sess.opts.cg.crate_hash.as_bytes()); ++ Svh::new(state.finish()) ++ } else { ++ tcx.calculate_krate_hash() ++ }; + let r = LinkMeta { + crate_name: name.to_owned(), +- crate_hash: tcx.calculate_krate_hash(), ++ crate_hash: crate_hash, + }; + info!("{:?}", r); + return r; +-- +2.10.0 + diff --git a/recipes-devtools/rust/files/rust-1.12.1/0008-mk-platform.mk-pass-C-crate_hash-to-builds.patch b/recipes-devtools/rust/files/rust-1.12.1/0008-mk-platform.mk-pass-C-crate_hash-to-builds.patch new file mode 100644 index 0000000..37acbe4 --- /dev/null +++ b/recipes-devtools/rust/files/rust-1.12.1/0008-mk-platform.mk-pass-C-crate_hash-to-builds.patch @@ -0,0 +1,27 @@ +From 174ae38bcc197658dd0ad6bcdae2bb06112e68a2 Mon Sep 17 00:00:00 2001 +From: Steven Walter +Date: Wed, 18 Nov 2015 08:41:17 -0500 +Subject: [PATCH 08/10] mk/platform.mk: pass -C crate_hash to builds + +bitbake recipe will export FORCE_CRATE_HASH + +Upstream-Status: not-appropriate +--- + mk/platform.mk | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/mk/platform.mk b/mk/platform.mk +index d601cab..0b5e9f2 100644 +--- a/mk/platform.mk ++++ b/mk/platform.mk +@@ -181,6 +181,7 @@ define CFG_MAKE_TOOLCHAIN + AR_$(1)=$(CROSS_PREFIX_$(1))$(AR_$(1)) + LINK_$(1)=$(CROSS_PREFIX_$(1))$(LINK_$(1)) + RUSTC_CROSS_FLAGS_$(1)=-C linker=$$(call FIND_COMPILER,$$(LINK_$(1))) \ ++ -C crate_hash=$(FORCE_CRATE_HASH) \ + -C ar=$$(call FIND_COMPILER,$$(AR_$(1))) $(RUSTC_CROSS_FLAGS_$(1)) + + RUSTC_FLAGS_$(1)=$$(RUSTC_CROSS_FLAGS_$(1)) $(RUSTC_FLAGS_$(1)) +-- +2.10.0 + diff --git a/recipes-devtools/rust/files/rust-installer-1.12.1/0001-add-option-to-disable-rewriting-of-install-paths.patch b/recipes-devtools/rust/files/rust-installer-1.12.1/0001-add-option-to-disable-rewriting-of-install-paths.patch new file mode 100644 index 0000000..9471252 --- /dev/null +++ b/recipes-devtools/rust/files/rust-installer-1.12.1/0001-add-option-to-disable-rewriting-of-install-paths.patch @@ -0,0 +1,58 @@ +From c7daec775a917d9e3017bc35ea7d88cc9418f181 Mon Sep 17 00:00:00 2001 +From: Cody P Schafer +Date: Mon, 2 Mar 2015 13:27:49 -0500 +Subject: [PATCH] add option to disable rewriting of install paths + +This is intended for use by rust & cargo's `make install`, as in that +case: + + - these paths are typically built into the pre-install layout already + - attempting to do the replacement will be incorrect subdirectory + cases (ie: libdir=lib/foo) +--- + install-template.sh | 21 ++++++++++++--------- + 1 file changed, 12 insertions(+), 9 deletions(-) + +diff --git a/install-template.sh b/install-template.sh +index 042b955..4ecf430 100644 +--- a/install-template.sh ++++ b/install-template.sh +@@ -618,16 +618,18 @@ install_components() { + # Decide the destination of the file + local _file_install_path="$_dest_prefix/$_file" + +- if echo "$_file" | grep "^lib/" > /dev/null +- then +- local _f="$(echo "$_file" | sed 's/^lib\///')" +- _file_install_path="$CFG_LIBDIR/$_f" +- fi ++ if [ -n "${CFG_REWRITE_PATHS-}" ]; then ++ if echo "$_file" | grep "^lib/" > /dev/null ++ then ++ local _f="$(echo "$_file" | sed 's/^lib\///')" ++ _file_install_path="$CFG_LIBDIR/$_f" ++ fi + +- if echo "$_file" | grep "^share/man/" > /dev/null +- then +- local _f="$(echo "$_file" | sed 's/^share\/man\///')" +- _file_install_path="$CFG_MANDIR/$_f" ++ if echo "$_file" | grep "^share/man/" > /dev/null ++ then ++ local _f="$(echo "$_file" | sed 's/^share\/man\///')" ++ _file_install_path="$CFG_MANDIR/$_f" ++ fi + fi + + # Make sure there's a directory for it +@@ -810,6 +812,7 @@ valopt mandir "$CFG_DESTDIR_PREFIX/share/man" "install man pages in PATH" + opt ldconfig 1 "run ldconfig after installation (Linux only)" + opt verify 1 "obsolete" + flag verbose "run with verbose output" ++opt rewrite-paths 1 "rewrite install paths for libdir & mandir" + + if [ $HELP -eq 1 ] + then +-- +2.4.1 + diff --git a/recipes-devtools/rust/rust-source-1.12.1.inc b/recipes-devtools/rust/rust-source-1.12.1.inc new file mode 100644 index 0000000..b9b2a4c --- /dev/null +++ b/recipes-devtools/rust/rust-source-1.12.1.inc @@ -0,0 +1,18 @@ +# Specifics for Rust 1.12.1 + +## 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.11.0" +RS_KEY = "5c6cf767" + +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] = "b83d7a1a90c2d80bef97a518022948c8" +SRC_URI[rust-snapshot.sha256sum] = "e9d27a72900da33c1bbd0e59dd42fd6414c6bcdfa33593fb7c7360068406394a" + +SRC_URI[rust.md5sum] = "82db5a9cb9a051bf8ece2f5174cb273b" +SRC_URI[rust.sha256sum] = "97913ae4cb255618aaacd1a534b11f343634b040b32656250d09d8d9ec02d3dc" + From 634498e0aceb2945de230dad78745922b7644f0f Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Fri, 4 Nov 2016 16:38:12 -0500 Subject: [PATCH 101/112] rust: bump versions to 1.12.1 Redid how compiler-rt is built by using the Rust makefiles to build it instead of compiler-rt's build system. Rust itself deviated from using compiler-rt's build system and provided their own rules requiring the source tree to be configured to use them. --- recipes-devtools/rust/compiler-rt_1.12.1.bb | 24 ++++++++++ recipes-devtools/rust/libstd-rs_1.12.1.bb | 37 +++++++++++++++ recipes-devtools/rust/rust-cross_1.12.1.bb | 50 ++++++++++++++++++++ recipes-devtools/rust/rust-llvm.inc | 4 -- recipes-devtools/rust/rust-llvm_1.12.1.bb | 16 +++++++ recipes-devtools/rust/rust-source-1.12.1.inc | 3 ++ recipes-devtools/rust/rust.inc | 1 - recipes-devtools/rust/rust_1.12.1.bb | 28 +++++++++++ 8 files changed, 158 insertions(+), 5 deletions(-) create mode 100644 recipes-devtools/rust/compiler-rt_1.12.1.bb create mode 100644 recipes-devtools/rust/libstd-rs_1.12.1.bb create mode 100644 recipes-devtools/rust/rust-cross_1.12.1.bb create mode 100644 recipes-devtools/rust/rust-llvm_1.12.1.bb create mode 100644 recipes-devtools/rust/rust_1.12.1.bb diff --git a/recipes-devtools/rust/compiler-rt_1.12.1.bb b/recipes-devtools/rust/compiler-rt_1.12.1.bb new file mode 100644 index 0000000..878e59e --- /dev/null +++ b/recipes-devtools/rust/compiler-rt_1.12.1.bb @@ -0,0 +1,24 @@ +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 rust-source-${PV}.inc + +DEPENDS += "rust-llvm-native (=${PV})" + +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 +} diff --git a/recipes-devtools/rust/libstd-rs_1.12.1.bb b/recipes-devtools/rust/libstd-rs_1.12.1.bb new file mode 100644 index 0000000..821f3cc --- /dev/null +++ b/recipes-devtools/rust/libstd-rs_1.12.1.bb @@ -0,0 +1,37 @@ +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 rust-source-${PV}.inc + +S = "${WORKDIR}/rustc-${PV}" + +CARGO_INDEX_COMMIT = "6127fc24b0b6fe73fe4d339817fbf000b9a798a2" + +SRC_URI += "\ + crate://crates.io/gcc/0.3.27 \ + crate-index://crates.io/${CARGO_INDEX_COMMIT} \ +" + +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_1.12.1.bb b/recipes-devtools/rust/rust-cross_1.12.1.bb new file mode 100644 index 0000000..67b6f3c --- /dev/null +++ b/recipes-devtools/rust/rust-cross_1.12.1.bb @@ -0,0 +1,50 @@ +require rust.inc +inherit cross +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" diff --git a/recipes-devtools/rust/rust-llvm.inc b/recipes-devtools/rust/rust-llvm.inc index fba8b22..2706ae3 100644 --- a/recipes-devtools/rust/rust-llvm.inc +++ b/recipes-devtools/rust/rust-llvm.inc @@ -1,10 +1,6 @@ SUMMARY = "LLVM compiler framework (packaged with rust)" LICENSE = "NCSA" -SRC_URI = "\ - https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ -" - S = "${WORKDIR}/rustc-${PV}/src/llvm" LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=4c0bc17c954e99fd547528d938832bfa" diff --git a/recipes-devtools/rust/rust-llvm_1.12.1.bb b/recipes-devtools/rust/rust-llvm_1.12.1.bb new file mode 100644 index 0000000..12dd8e9 --- /dev/null +++ b/recipes-devtools/rust/rust-llvm_1.12.1.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.12.1.inc b/recipes-devtools/rust/rust-source-1.12.1.inc index b9b2a4c..add9509 100644 --- a/recipes-devtools/rust/rust-source-1.12.1.inc +++ b/recipes-devtools/rust/rust-source-1.12.1.inc @@ -13,6 +13,9 @@ RUST_SNAPSHOT = "rustc-${RS_VERSION}-${RUST_BUILD_SYS}" SRC_URI[rust-snapshot.md5sum] = "b83d7a1a90c2d80bef97a518022948c8" SRC_URI[rust-snapshot.sha256sum] = "e9d27a72900da33c1bbd0e59dd42fd6414c6bcdfa33593fb7c7360068406394a" +SRC_URI += "\ + https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ + " SRC_URI[rust.md5sum] = "82db5a9cb9a051bf8ece2f5174cb273b" SRC_URI[rust.sha256sum] = "97913ae4cb255618aaacd1a534b11f343634b040b32656250d09d8d9ec02d3dc" diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index d104d4a..21f44b1 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -7,7 +7,6 @@ LIC_FILES_CHKSUM ="file://COPYRIGHT;md5=43e1f1fb9c0ee3af66693d8c4fecafa8" inherit rust SRC_URI = "\ - https://static.rust-lang.org/dist/rustc-${PV}-src.tar.gz;name=rust \ https://static.rust-lang.org/dist/${RUST_SNAPSHOT}.tar.gz;name=rust-snapshot \ " diff --git a/recipes-devtools/rust/rust_1.12.1.bb b/recipes-devtools/rust/rust_1.12.1.bb new file mode 100644 index 0000000..d6269b1 --- /dev/null +++ b/recipes-devtools/rust/rust_1.12.1.bb @@ -0,0 +1,28 @@ +inherit rust-installer +require rust.inc +require rust-source-${PV}.inc + +# the configure script always requires cmake so despite +# rust not needing this (only rust-llvm needs it) we must +# have it for the configure script to succeed. +DEPENDS += "cmake-native" + +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-mk-add-missing-CFG_LIBDIR_RELATIVE.patch \ + file://rust-${PV}/0005-std-thread_local-workaround-for-NULL-__dso_handle.patch \ + file://rust-${PV}/0006-mk-install-use-disable-rewrite-paths.patch \ + file://rust-${PV}/0007-Allow-overriding-crate_hash-with-C-crate_hash.patch \ + file://rust-${PV}/0008-mk-platform.mk-pass-C-crate_hash-to-builds.patch \ + file://rust-installer-${PV}/0001-add-option-to-disable-rewriting-of-install-paths.patch;patchdir=src/rust-installer \ + " + +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 1d0e0e834373ba8d8b92e82b5422861ad3269b5a Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Thu, 1 Dec 2016 21:38:52 -0600 Subject: [PATCH 102/112] rust: data layout changed between 1.10.0 and 1.12.1 The data layout for aarch64 changed between 1.10.0 and 1.12.1 of rust-llvm. --- recipes-devtools/rust/rust.inc | 3 ++- recipes-devtools/rust/rust_1.10.0.bb | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index 21f44b1..549066c 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -119,7 +119,8 @@ TARGET_ENDIAN[arm] = "little" TARGET_POINTER_WIDTH[arm] = "32" FEATURES[arm] = "+v6,+vfp2" -DATA_LAYOUT[aarch64] = "e-m:e-i64:64-i128:128-n32:64-S128" +## aarch64-unknown-linux-gnu +DATA_LAYOUT[aarch64] = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" LLVM_TARGET[aarch64] = "aarch64-unknown-linux-gnu" TARGET_ENDIAN[aarch64] = "little" TARGET_POINTER_WIDTH[aarch64] = "64" diff --git a/recipes-devtools/rust/rust_1.10.0.bb b/recipes-devtools/rust/rust_1.10.0.bb index bfccfd1..6c5fbeb 100644 --- a/recipes-devtools/rust/rust_1.10.0.bb +++ b/recipes-devtools/rust/rust_1.10.0.bb @@ -2,6 +2,9 @@ inherit rust-installer require rust.inc require rust-source-${PV}.inc +# overriden due to difference between 1.10.0 and 1.12.1 +DATA_LAYOUT[aarch64] = "e-m:e-i64:64-i128:128-n32:64-S128" + SRC_URI += " \ file://rust-${PV}/0001-Add-config-for-musl-based-arm-builds.patch \ file://rust-${PV}/0002-Target-add-default-target.json-path-libdir-rust-targ.patch \ From 06cc11b2b406e26b94913de58fd91a737f6e3ff7 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 30 Nov 2016 16:58:41 -0600 Subject: [PATCH 103/112] cargo: move explicitly versioned deps out of common These dependencies are explicitly for Cargo 0.11.0 and shouldn't appear in the common file. --- recipes-devtools/cargo/cargo.inc | 49 -------------------------- recipes-devtools/cargo/cargo_0.11.0.bb | 49 ++++++++++++++++++++++++++ 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/recipes-devtools/cargo/cargo.inc b/recipes-devtools/cargo/cargo.inc index 7b46472..7347766 100644 --- a/recipes-devtools/cargo/cargo.inc +++ b/recipes-devtools/cargo/cargo.inc @@ -13,55 +13,6 @@ CARGO_INDEX_COMMIT = "6127fc24b0b6fe73fe4d339817fbf000b9a798a2" SRC_URI = "\ http://static-rust-lang-org.s3.amazonaws.com/cargo-dist/${CARGO_SNAPSHOT} \ - crate://crates.io/advapi32-sys/0.1.2 \ - crate://crates.io/bufstream/0.1.1 \ - crate://crates.io/crossbeam/0.2.8 \ - crate://crates.io/docopt/0.6.78 \ - crate://crates.io/env_logger/0.3.2 \ - crate://crates.io/filetime/0.1.10 \ - crate://crates.io/flate2/0.2.13 \ - crate://crates.io/fs2/0.2.3 \ - crate://crates.io/glob/0.2.11 \ - crate://crates.io/hamcrest/0.1.0 \ - crate://crates.io/kernel32-sys/0.2.1 \ - crate://crates.io/libc/0.2.8 \ - crate://crates.io/log/0.3.5 \ - crate://crates.io/num_cpus/0.2.11 \ - crate://crates.io/regex/0.1.58 \ - crate://crates.io/rustc-serialize/0.3.18 \ - crate://crates.io/tar/0.4.5 \ - crate://crates.io/tempdir/0.3.4 \ - crate://crates.io/term/0.4.4 \ - crate://crates.io/toml/0.1.28 \ - crate://crates.io/url/1.1.0 \ - crate://crates.io/winapi/0.2.6 \ - crate://crates.io/semver/0.2.3 \ - crate://crates.io/regex-syntax/0.3.0 \ - crate://crates.io/utf8-ranges/0.1.3 \ - crate://crates.io/gcc/0.3.26 \ - crate://crates.io/unicode-normalization/0.1.2 \ - crate://crates.io/libz-sys/1.0.2 \ - crate://crates.io/rand/0.3.14 \ - crate://crates.io/user32-sys/0.1.2 \ - crate://crates.io/idna/0.1.0 \ - crate://crates.io/strsim/0.3.0 \ - crate://crates.io/matches/0.1.2 \ - crate://crates.io/cmake/0.1.16 \ - crate://crates.io/gdi32-sys/0.1.1 \ - crate://crates.io/bitflags/0.1.1 \ - crate://crates.io/unicode-bidi/0.2.3 \ - crate://crates.io/pkg-config/0.3.8 \ - crate://crates.io/winapi-build/0.1.1 \ - crate://crates.io/memchr/0.1.10 \ - crate://crates.io/pnacl-build-helper/1.4.10 \ - crate://crates.io/nom/1.2.2 \ - crate://crates.io/num/0.1.31 \ - crate://crates.io/uuid/0.2.3 \ - crate://crates.io/aho-corasick/0.5.1 \ - crate://crates.io/libressl-pnacl-sys/2.1.6 \ - crate://crates.io/miniz-sys/0.1.7 \ - crate://crates.io/openssl-sys/0.7.8 \ - crate://crates.io/url/0.5.10 \ crate-index://crates.io/${CARGO_INDEX_COMMIT} \ " diff --git a/recipes-devtools/cargo/cargo_0.11.0.bb b/recipes-devtools/cargo/cargo_0.11.0.bb index c70d049..08e0de3 100644 --- a/recipes-devtools/cargo/cargo_0.11.0.bb +++ b/recipes-devtools/cargo/cargo_0.11.0.bb @@ -6,6 +6,55 @@ SRC_URI += " \ file://0001-disable-cargo-snapshot-fetch.patch \ file://0001-Never-update-the-registry-index.patch \ git://github.com/rust-lang/rust-installer.git;protocol=https;name=rust-installer;destsuffix=${S}/src/rust-installer \ + crate://crates.io/advapi32-sys/0.1.2 \ + crate://crates.io/bufstream/0.1.1 \ + crate://crates.io/crossbeam/0.2.8 \ + crate://crates.io/docopt/0.6.78 \ + crate://crates.io/env_logger/0.3.2 \ + crate://crates.io/filetime/0.1.10 \ + crate://crates.io/flate2/0.2.13 \ + crate://crates.io/fs2/0.2.3 \ + crate://crates.io/glob/0.2.11 \ + crate://crates.io/hamcrest/0.1.0 \ + crate://crates.io/kernel32-sys/0.2.1 \ + crate://crates.io/libc/0.2.8 \ + crate://crates.io/log/0.3.5 \ + crate://crates.io/num_cpus/0.2.11 \ + crate://crates.io/regex/0.1.58 \ + crate://crates.io/rustc-serialize/0.3.18 \ + crate://crates.io/tar/0.4.5 \ + crate://crates.io/tempdir/0.3.4 \ + crate://crates.io/term/0.4.4 \ + crate://crates.io/toml/0.1.28 \ + crate://crates.io/url/1.1.0 \ + crate://crates.io/winapi/0.2.6 \ + crate://crates.io/semver/0.2.3 \ + crate://crates.io/regex-syntax/0.3.0 \ + crate://crates.io/utf8-ranges/0.1.3 \ + crate://crates.io/gcc/0.3.26 \ + crate://crates.io/unicode-normalization/0.1.2 \ + crate://crates.io/libz-sys/1.0.2 \ + crate://crates.io/rand/0.3.14 \ + crate://crates.io/user32-sys/0.1.2 \ + crate://crates.io/idna/0.1.0 \ + crate://crates.io/strsim/0.3.0 \ + crate://crates.io/matches/0.1.2 \ + crate://crates.io/cmake/0.1.16 \ + crate://crates.io/gdi32-sys/0.1.1 \ + crate://crates.io/bitflags/0.1.1 \ + crate://crates.io/unicode-bidi/0.2.3 \ + crate://crates.io/pkg-config/0.3.8 \ + crate://crates.io/winapi-build/0.1.1 \ + crate://crates.io/memchr/0.1.10 \ + crate://crates.io/pnacl-build-helper/1.4.10 \ + crate://crates.io/nom/1.2.2 \ + crate://crates.io/num/0.1.31 \ + crate://crates.io/uuid/0.2.3 \ + crate://crates.io/aho-corasick/0.5.1 \ + crate://crates.io/libressl-pnacl-sys/2.1.6 \ + crate://crates.io/miniz-sys/0.1.7 \ + crate://crates.io/openssl-sys/0.7.8 \ + crate://crates.io/url/0.5.10 \ " # Compatible with Rust 1.10.0 # https://static.rust-lang.org/dist/channel-rust-1.10.0.toml From 21224d76a02b952a0b4506728978b3f8c2bb2941 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 30 Nov 2016 16:57:34 -0600 Subject: [PATCH 104/112] cargo: add version 0.13.0 This version was released alongside Rust 1.12.0 --- recipes-devtools/cargo/cargo_0.13.0.bb | 89 ++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 recipes-devtools/cargo/cargo_0.13.0.bb diff --git a/recipes-devtools/cargo/cargo_0.13.0.bb b/recipes-devtools/cargo/cargo_0.13.0.bb new file mode 100644 index 0000000..e7d0984 --- /dev/null +++ b/recipes-devtools/cargo/cargo_0.13.0.bb @@ -0,0 +1,89 @@ +require cargo-snapshot.inc +require cargo.inc + +SRC_URI += " \ + git://github.com/rust-lang/cargo.git;protocol=https;name=cargo \ + git://github.com/rust-lang/rust-installer.git;protocol=https;name=rust-installer;destsuffix=${S}/src/rust-installer \ + crate://crates.io/advapi32-sys/0.2.0 \ + crate://crates.io/aho-corasick/0.5.2 \ + crate://crates.io/bitflags/0.1.1 \ + crate://crates.io/bitflags/0.7.0 \ + crate://crates.io/bufstream/0.1.2 \ + crate://crates.io/cfg-if/0.1.0 \ + crate://crates.io/cmake/0.1.17 \ + crate://crates.io/crossbeam/0.2.9 \ + crate://crates.io/curl-sys/0.2.1 \ + crate://crates.io/curl/0.3.2 \ + crate://crates.io/docopt/0.6.82 \ + crate://crates.io/env_logger/0.3.4 \ + crate://crates.io/filetime/0.1.10 \ + crate://crates.io/flate2/0.2.14 \ + crate://crates.io/fs2/0.2.5 \ + crate://crates.io/gcc/0.3.32 \ + crate://crates.io/gdi32-sys/0.2.0 \ + crate://crates.io/git2-curl/0.5.0 \ + crate://crates.io/git2/0.4.4 \ + crate://crates.io/glob/0.2.11 \ + crate://crates.io/hamcrest/0.1.0 \ + crate://crates.io/idna/0.1.0 \ + crate://crates.io/kernel32-sys/0.2.2 \ + crate://crates.io/lazy_static/0.2.1 \ + crate://crates.io/libc/0.2.15 \ + crate://crates.io/libgit2-sys/0.4.5 \ + crate://crates.io/libressl-pnacl-sys/2.1.6 \ + crate://crates.io/libssh2-sys/0.1.38 \ + crate://crates.io/libz-sys/1.0.5 \ + crate://crates.io/log/0.3.6 \ + crate://crates.io/matches/0.1.2 \ + crate://crates.io/memchr/0.1.11 \ + crate://crates.io/miniz-sys/0.1.7 \ + crate://crates.io/miow/0.1.3 \ + crate://crates.io/net2/0.2.26 \ + crate://crates.io/nom/1.2.4 \ + crate://crates.io/num-bigint/0.1.33 \ + crate://crates.io/num-complex/0.1.33 \ + crate://crates.io/num-integer/0.1.32 \ + crate://crates.io/num-iter/0.1.32 \ + crate://crates.io/num-rational/0.1.32 \ + crate://crates.io/num-traits/0.1.34 \ + crate://crates.io/num/0.1.34 \ + crate://crates.io/num_cpus/1.0.0 \ + crate://crates.io/openssl-sys-extras/0.7.14 \ + crate://crates.io/openssl-sys/0.7.14 \ + crate://crates.io/openssl/0.7.14 \ + crate://crates.io/pkg-config/0.3.8 \ + crate://crates.io/pnacl-build-helper/1.4.10 \ + crate://crates.io/rand/0.3.14 \ + crate://crates.io/regex-syntax/0.3.4 \ + crate://crates.io/regex/0.1.73 \ + crate://crates.io/rustc-serialize/0.3.19 \ + crate://crates.io/semver/0.2.3 \ + crate://crates.io/strsim/0.3.0 \ + crate://crates.io/tar/0.4.8 \ + crate://crates.io/tempdir/0.3.5 \ + crate://crates.io/term/0.4.4 \ + crate://crates.io/thread-id/2.0.0 \ + crate://crates.io/thread_local/0.2.6 \ + crate://crates.io/toml/0.2.0 \ + crate://crates.io/unicode-bidi/0.2.3 \ + crate://crates.io/unicode-normalization/0.1.2 \ + crate://crates.io/url/1.2.0 \ + crate://crates.io/user32-sys/0.2.0 \ + crate://crates.io/utf8-ranges/0.1.3 \ + crate://crates.io/winapi-build/0.1.1 \ + crate://crates.io/winapi/0.2.8 \ + crate://crates.io/ws2_32-sys/0.2.1 \ +" +# Compatible with Rust 1.12.1 +# https://static.rust-lang.org/dist/channel-rust-1.12.1.toml +SRCREV_cargo = "109cb7c33d426044d141457049bd0fffaca1327c" + +SRCREV_rust-installer = "c37d3747da75c280237dc2d6b925078e69555499" + +S = "${WORKDIR}/git" + +LIC_FILES_CHKSUM ="\ + file://LICENSE-MIT;md5=362255802eb5aa87810d12ddf3cfedb4 \ + file://LICENSE-APACHE;md5=1836efb2eb779966696f473ee8540542 \ + file://LICENSE-THIRD-PARTY;md5=892ea68b169e69cfe75097fc38a15b56 \ +" From 846454281e64edd40b259cbfba5ce60c834b2da9 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Thu, 1 Dec 2016 10:13:31 -0600 Subject: [PATCH 105/112] classes/cargo: implement directory source redirection Reworked the source redirection to use directory source redirection like I've done for Gentoo. This allows us to specify all crate dependencies in the bitbake SRC_URI and have Yocto fetch them down using our crate fetcher and then Cargo will build without reaching out to the network. --- classes/cargo.bbclass | 15 ++++---- lib/crate.py | 79 ++++++++++++++++++++++++++++++++----------- 2 files changed, 67 insertions(+), 27 deletions(-) diff --git a/classes/cargo.bbclass b/classes/cargo.bbclass index 44ff604..2be039e 100644 --- a/classes/cargo.bbclass +++ b/classes/cargo.bbclass @@ -38,13 +38,14 @@ cargo_do_configure () { echo "]" >> ${CARGO_HOME}/config # Point cargo at our local mirror of the registry - cat >> ${CARGO_HOME}/config <> ${CARGO_HOME}/config + [source.bitbake] + directory = "${CARGO_HOME}/bitbake" + + [source.crates-io] + replace-with = "bitbake" + local-registry = "/nonexistant" + EOF echo "[target.${HOST_SYS}]" >> ${CARGO_HOME}/config echo "linker = '${RUST_TARGET_CCLD}'" >> ${CARGO_HOME}/config diff --git a/lib/crate.py b/lib/crate.py index 3197037..178e7f4 100644 --- a/lib/crate.py +++ b/lib/crate.py @@ -21,6 +21,8 @@ BitBake 'Fetch' implementation for crates.io # # Based on functions from the base bb module, Copyright 2003 Holger Schurig +import hashlib +import json import os import shutil import subprocess @@ -48,8 +50,8 @@ class Crate(Wget): def _cargo_cache_path(self, rootdir): return self._cargo_path(rootdir, "cache") - def _cargo_registry_path(self, rootdir, component=""): - return os.path.join(rootdir, "cargo_registry", component) + def _cargo_bitbake_path(self, rootdir): + return os.path.join(rootdir, "cargo_home", "bitbake") def supports(self, ud, d): """ @@ -136,18 +138,13 @@ class Crate(Wget): super(Crate, self).unpack(ud, rootdir, d) def _index_unpack(self, ud, rootdir, d): - cargo_index = self._cargo_index_path(rootdir) - self._index_unpack_to(ud, rootdir, d, cargo_index) - - cargo_registry_index = self._cargo_registry_path(rootdir, "index") - self._index_unpack_to(ud, rootdir, d, cargo_registry_index) - - def _index_unpack_to(self, ud, rootdir, d, cargo_index): """ Unpacks the index """ thefile = ud.localpath + cargo_index = self._cargo_index_path(rootdir) + cmd = "tar -xz --no-same-owner --strip-components 1 -f %s -C %s" % (thefile, cargo_index) # change to the rootdir to unpack but save the old working dir @@ -176,6 +173,9 @@ class Crate(Wget): """ thefile = ud.localpath + # possible metadata we need to write out + metadata = {} + # change to the rootdir to unpack but save the old working dir save_cwd = os.getcwd() os.chdir(rootdir) @@ -184,22 +184,22 @@ class Crate(Wget): if pn == ud.parm.get('name'): cmd = "tar -xz --no-same-owner -f %s" % thefile else: - cargo_src = self._cargo_src_path(rootdir) - cargo_cache = self._cargo_cache_path(rootdir) - cargo_registry = self._cargo_registry_path(rootdir) + self._crate_unpack_old_layout(ud, rootdir, d) - cmd = "tar -xz --no-same-owner -f %s -C %s" % (thefile, cargo_src) + cargo_bitbake = self._cargo_bitbake_path(rootdir) + + cmd = "tar -xz --no-same-owner -f %s -C %s" % (thefile, cargo_bitbake) # ensure we've got these paths made - bb.utils.mkdirhier(cargo_cache) - bb.utils.mkdirhier(cargo_registry) - bb.utils.mkdirhier(cargo_src) + bb.utils.mkdirhier(cargo_bitbake) - bb.note("Copying %s to %s/" % (thefile, cargo_cache)) - shutil.copy(thefile, cargo_cache) + # generate metadata necessary + with open(thefile, 'rb') as f: + # get the SHA256 of the original tarball + tarhash = hashlib.sha256(f.read()).hexdigest() - bb.note("Copying %s to %s/" % (thefile, cargo_registry)) - shutil.copy(thefile, cargo_registry) + metadata['files'] = {} + metadata['package'] = tarhash # path it path = d.getVar('PATH', True) @@ -214,3 +214,42 @@ class Crate(Wget): if ret != 0: raise UnpackError("Unpack command %s failed with return value %s" % (cmd, ret), ud.url) + # if we have metadata to write out.. + if len(metadata) > 0: + cratepath = os.path.splitext(os.path.basename(thefile))[0] + bbpath = self._cargo_bitbake_path(rootdir) + mdfile = '.cargo-checksum.json' + mdpath = os.path.join(bbpath, cratepath, mdfile) + with open(mdpath, "w") as f: + json.dump(metadata, f) + + + def _crate_unpack_old_layout(self, ud, rootdir, d): + """ + Unpacks a crate in the old location that tried to emulate + the Cargo registry layout. + """ + thefile = ud.localpath + + cargo_src = self._cargo_src_path(rootdir) + cargo_cache = self._cargo_cache_path(rootdir) + + cmd = "tar -xz --no-same-owner -f %s -C %s" % (thefile, cargo_src) + + # ensure we've got these paths made + bb.utils.mkdirhier(cargo_cache) + bb.utils.mkdirhier(cargo_src) + + bb.note("Copying %s to %s/" % (thefile, cargo_cache)) + shutil.copy(thefile, cargo_cache) + + # path it + path = d.getVar('PATH', True) + if path: + cmd = "PATH=\"%s\" %s" % (path, cmd) + bb.note("Unpacking %s to %s/" % (thefile, os.getcwd())) + + ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True) + + if ret != 0: + raise UnpackError("Unpack command %s failed with return value %s" % (cmd, ret), ud.url) From 03496f658f2e6fc5fa2d3ab5926ed3438e44332d Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Wed, 9 Nov 2016 22:10:32 -0600 Subject: [PATCH 106/112] cargo: use install targets to avoid rust-installer This install target is used by Gentoo to avoid needing rust-installer. --- recipes-devtools/cargo/cargo.inc | 2 +- recipes-devtools/cargo/cargo_0.11.0.bb | 3 --- recipes-devtools/cargo/cargo_0.13.0.bb | 3 --- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/recipes-devtools/cargo/cargo.inc b/recipes-devtools/cargo/cargo.inc index 7347766..e9462d8 100644 --- a/recipes-devtools/cargo/cargo.inc +++ b/recipes-devtools/cargo/cargo.inc @@ -54,7 +54,7 @@ do_compile () { } do_install () { - oe_runmake DESTDIR="${D}" install + oe_runmake prepare-image-${TARGET_SYS} IMGDIR_${TARGET_SYS}="${D}${prefix}" } BBCLASSEXTEND = "native" diff --git a/recipes-devtools/cargo/cargo_0.11.0.bb b/recipes-devtools/cargo/cargo_0.11.0.bb index 08e0de3..df198d8 100644 --- a/recipes-devtools/cargo/cargo_0.11.0.bb +++ b/recipes-devtools/cargo/cargo_0.11.0.bb @@ -5,7 +5,6 @@ SRC_URI += " \ git://github.com/rust-lang/cargo.git;protocol=https;name=cargo \ file://0001-disable-cargo-snapshot-fetch.patch \ file://0001-Never-update-the-registry-index.patch \ - git://github.com/rust-lang/rust-installer.git;protocol=https;name=rust-installer;destsuffix=${S}/src/rust-installer \ crate://crates.io/advapi32-sys/0.1.2 \ crate://crates.io/bufstream/0.1.1 \ crate://crates.io/crossbeam/0.2.8 \ @@ -60,8 +59,6 @@ SRC_URI += " \ # https://static.rust-lang.org/dist/channel-rust-1.10.0.toml SRCREV_cargo = "259324cd8f9bb6e1068a3a2b77685e90fda3e3b6" -SRCREV_rust-installer = "c37d3747da75c280237dc2d6b925078e69555499" - S = "${WORKDIR}/git" LIC_FILES_CHKSUM ="\ diff --git a/recipes-devtools/cargo/cargo_0.13.0.bb b/recipes-devtools/cargo/cargo_0.13.0.bb index e7d0984..eb6c1ae 100644 --- a/recipes-devtools/cargo/cargo_0.13.0.bb +++ b/recipes-devtools/cargo/cargo_0.13.0.bb @@ -3,7 +3,6 @@ require cargo.inc SRC_URI += " \ git://github.com/rust-lang/cargo.git;protocol=https;name=cargo \ - git://github.com/rust-lang/rust-installer.git;protocol=https;name=rust-installer;destsuffix=${S}/src/rust-installer \ crate://crates.io/advapi32-sys/0.2.0 \ crate://crates.io/aho-corasick/0.5.2 \ crate://crates.io/bitflags/0.1.1 \ @@ -78,8 +77,6 @@ SRC_URI += " \ # https://static.rust-lang.org/dist/channel-rust-1.12.1.toml SRCREV_cargo = "109cb7c33d426044d141457049bd0fffaca1327c" -SRCREV_rust-installer = "c37d3747da75c280237dc2d6b925078e69555499" - S = "${WORKDIR}/git" LIC_FILES_CHKSUM ="\ From 6083dff0b669f95990655f28d712c637a13c5e7d Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Thu, 21 Jan 2016 15:06:06 -0600 Subject: [PATCH 107/112] drop rust-installer.bbclass This is only necessary for installations of rust so move the actual functional bits into the do_install() phase of rust. --- classes/rust-installer.bbclass | 15 --------------- recipes-devtools/cargo/cargo.inc | 1 - recipes-devtools/rust/rust.inc | 6 ++++++ recipes-devtools/rust/rust_1.10.0.bb | 1 - recipes-devtools/rust/rust_1.12.1.bb | 1 - 5 files changed, 6 insertions(+), 18 deletions(-) delete mode 100644 classes/rust-installer.bbclass diff --git a/classes/rust-installer.bbclass b/classes/rust-installer.bbclass deleted file mode 100644 index 395101d..0000000 --- a/classes/rust-installer.bbclass +++ /dev/null @@ -1,15 +0,0 @@ -# Rust installer isn't very nice and drops a bunch of junk in our filesystem, -# clean it up after the install. - -rust_installer_do_install () { - rm ${D}/${libdir}/rustlib/install.log - rm ${D}/${libdir}/rustlib/rust-installer-version - rm ${D}/${libdir}/rustlib/uninstall.sh - rm ${D}/${libdir}/rustlib/components -} - -do_install_append () { - rust_installer_do_install -} - -EXPORT_FUNCTIONS rust_installer_do_install diff --git a/recipes-devtools/cargo/cargo.inc b/recipes-devtools/cargo/cargo.inc index e9462d8..71f96e0 100644 --- a/recipes-devtools/cargo/cargo.inc +++ b/recipes-devtools/cargo/cargo.inc @@ -1,6 +1,5 @@ inherit cargo inherit patch -inherit rust-installer SUMMARY = "Cargo downloads your Rust project's dependencies and builds your project" HOMEPAGE = "http://crates.io" diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index 549066c..a608c94 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -403,6 +403,12 @@ rust_do_install () { # Remove any files directly installed into libdir to avoid # conflicts between cross and native rm -f ${D}${libdir}/lib*.so + + # cleanup after rust-installer since we don't need these bits + rm ${D}/${libdir}/rustlib/install.log + rm ${D}/${libdir}/rustlib/rust-installer-version + rm ${D}/${libdir}/rustlib/uninstall.sh + rm ${D}/${libdir}/rustlib/components } do_install () { diff --git a/recipes-devtools/rust/rust_1.10.0.bb b/recipes-devtools/rust/rust_1.10.0.bb index 6c5fbeb..621c60b 100644 --- a/recipes-devtools/rust/rust_1.10.0.bb +++ b/recipes-devtools/rust/rust_1.10.0.bb @@ -1,4 +1,3 @@ -inherit rust-installer require rust.inc require rust-source-${PV}.inc diff --git a/recipes-devtools/rust/rust_1.12.1.bb b/recipes-devtools/rust/rust_1.12.1.bb index d6269b1..78b9185 100644 --- a/recipes-devtools/rust/rust_1.12.1.bb +++ b/recipes-devtools/rust/rust_1.12.1.bb @@ -1,4 +1,3 @@ -inherit rust-installer require rust.inc require rust-source-${PV}.inc From 487e670b9b855cf774903eb74dcd4a5fcfd4c8fa Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Sun, 4 Dec 2016 16:33:47 -0600 Subject: [PATCH 108/112] crate.py: use BPN instead of PN If we don't use BPN then native packages will not extract correct since PN will be something-native and we won't extract the something crate to ${S}. --- lib/crate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/crate.py b/lib/crate.py index 178e7f4..f26b272 100644 --- a/lib/crate.py +++ b/lib/crate.py @@ -180,7 +180,7 @@ class Crate(Wget): save_cwd = os.getcwd() os.chdir(rootdir) - pn = d.getVar('PN', True) + pn = d.getVar('BPN', True) if pn == ud.parm.get('name'): cmd = "tar -xz --no-same-owner -f %s" % thefile else: From 43c139f131d22ce30caf05c812c58e1f18604fa8 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Sun, 4 Dec 2016 23:27:34 -0600 Subject: [PATCH 109/112] rust: remove --disable-static only for rust Only remove --disable-static from OECONF for things built from the rust source and not things inheriting rust. --- classes/rust.bbclass | 2 -- recipes-devtools/rust/rust.inc | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/classes/rust.bbclass b/classes/rust.bbclass index e954825..0790a95 100644 --- a/classes/rust.bbclass +++ b/classes/rust.bbclass @@ -38,8 +38,6 @@ HOST_CFLAGS ?= "${CFLAGS}" HOST_CXXFLAGS ?= "${CXXFLAGS}" HOST_CPPFLAGS ?= "${CPPFLAGS}" -EXTRA_OECONF_remove = "--disable-static" - rustlib_suffix="${TUNE_ARCH}${TARGET_VENDOR}-${TARGET_OS}/rustlib/${HOST_SYS}/lib" # Native sysroot standard library path rustlib_src="${prefix}/lib/${rustlib_suffix}" diff --git a/recipes-devtools/rust/rust.inc b/recipes-devtools/rust/rust.inc index a608c94..e4ef114 100644 --- a/recipes-devtools/rust/rust.inc +++ b/recipes-devtools/rust/rust.inc @@ -341,6 +341,9 @@ do_rust_arch_fixup[dirs] += "${S}/mk/cfg" # prevent the rust-installer scripts from calling ldconfig export CFG_DISABLE_LDCONFIG="notempty" +# rust's configure doesn't recognize --disable-static, so remove it. +DISABLE_STATIC = "" + do_configure () { # FIXME: target_prefix vs prefix, see cross.bbclass From d364837120da50ab26c499d1fee97e1d73f4124e Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Sun, 4 Dec 2016 23:38:45 -0600 Subject: [PATCH 110/112] merge rust-vars and rust-triples to rust-common Merge two bbclasses that were included in the same places so merge it into one common file. --- classes/cargo.bbclass | 3 +-- classes/{rust-triples.bbclass => rust-common.bbclass} | 10 ++++++++++ classes/rust-vars.bbclass | 8 -------- classes/rust.bbclass | 3 +-- 4 files changed, 12 insertions(+), 12 deletions(-) rename classes/{rust-triples.bbclass => rust-common.bbclass} (91%) delete mode 100644 classes/rust-vars.bbclass diff --git a/classes/cargo.bbclass b/classes/cargo.bbclass index 2be039e..045dfc1 100644 --- a/classes/cargo.bbclass +++ b/classes/cargo.bbclass @@ -1,7 +1,6 @@ -inherit rust-vars # add crate fetch support inherit crate-fetch -inherit rust-triples +inherit rust-common # the binary we will use CARGO = "cargo" diff --git a/classes/rust-triples.bbclass b/classes/rust-common.bbclass similarity index 91% rename from classes/rust-triples.bbclass rename to classes/rust-common.bbclass index 0975c2b..5d425c7 100644 --- a/classes/rust-triples.bbclass +++ b/classes/rust-common.bbclass @@ -1,3 +1,13 @@ +# Common variables used by all Rust builds +export rustlibdir = "${libdir}/rust" +FILES_${PN} += "${rustlibdir}/*.so" +FILES_${PN}-dev += "${rustlibdir}/*.rlib" +FILES_${PN}-dbg += "${rustlibdir}/.debug" + +RUSTLIB = "-L ${STAGING_LIBDIR}/rust" +RUSTFLAGS += "-C rpath -C crate_hash=${BB_TASKHASH} ${RUSTLIB}" +RUSTLIB_DEP ?= "libstd-rs" + # Responseible for taking Yocto triples and converting it to Rust triples def rust_base_triple(d, thing): diff --git a/classes/rust-vars.bbclass b/classes/rust-vars.bbclass deleted file mode 100644 index a3acc44..0000000 --- a/classes/rust-vars.bbclass +++ /dev/null @@ -1,8 +0,0 @@ -export rustlibdir = "${libdir}/rust" -FILES_${PN} += "${rustlibdir}/*.so" -FILES_${PN}-dev += "${rustlibdir}/*.rlib" -FILES_${PN}-dbg += "${rustlibdir}/.debug" - -RUSTLIB = "-L ${STAGING_LIBDIR}/rust" -RUSTFLAGS += "-C rpath -C crate_hash=${BB_TASKHASH} ${RUSTLIB}" -RUSTLIB_DEP ?= "libstd-rs" diff --git a/classes/rust.bbclass b/classes/rust.bbclass index 0790a95..f9a34e2 100644 --- a/classes/rust.bbclass +++ b/classes/rust.bbclass @@ -1,5 +1,4 @@ -inherit rust-vars -inherit rust-triples +inherit rust-common RUSTC = "rustc" From 0340c31a427884fb3796d566bde88e21a0780d6a Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 5 Dec 2016 10:55:00 -0600 Subject: [PATCH 111/112] fix bad engrish --- classes/rust-common.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/rust-common.bbclass b/classes/rust-common.bbclass index 5d425c7..1788153 100644 --- a/classes/rust-common.bbclass +++ b/classes/rust-common.bbclass @@ -8,7 +8,7 @@ RUSTLIB = "-L ${STAGING_LIBDIR}/rust" RUSTFLAGS += "-C rpath -C crate_hash=${BB_TASKHASH} ${RUSTLIB}" RUSTLIB_DEP ?= "libstd-rs" -# Responseible for taking Yocto triples and converting it to Rust triples +# Responsible for taking Yocto triples and converting it to Rust triples def rust_base_triple(d, thing): ''' From 1f18869377d39fece73447188018be8f5046850e Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 6 Dec 2016 11:08:46 -0600 Subject: [PATCH 112/112] workaround bug in the -C crate_hash option The -C crate_hash option does not work if multiple versions of the same crate are being linked into a binary. This can happen if different dependencies depend on different versions of the same crate. The -C crate_hash argument causes all versions of a given crate to have the same crate hash which in turn causes the compiler to select the wrong one internally and crash. This works around issue #126 for Cargo builds but does not fix the underlying cause. --- classes/rust-bin.bbclass | 1 + classes/rust-common.bbclass | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/rust-bin.bbclass b/classes/rust-bin.bbclass index 8afe5cb..42d5b48 100644 --- a/classes/rust-bin.bbclass +++ b/classes/rust-bin.bbclass @@ -3,6 +3,7 @@ inherit rust DEPENDS_append = " patchelf-native" RDEPENDS_${PN} += "${RUSTLIB_DEP}" +RUSTFLAGS += "-C crate_hash=${BB_TASKHASH}" RUSTC_ARCHFLAGS += "-C opt-level=3 -g -L ${STAGING_DIR_HOST}/${rustlibdir}" EXTRA_OEMAKE += 'RUSTC_ARCHFLAGS="${RUSTC_ARCHFLAGS}"' diff --git a/classes/rust-common.bbclass b/classes/rust-common.bbclass index 1788153..903e8af 100644 --- a/classes/rust-common.bbclass +++ b/classes/rust-common.bbclass @@ -5,7 +5,7 @@ FILES_${PN}-dev += "${rustlibdir}/*.rlib" FILES_${PN}-dbg += "${rustlibdir}/.debug" RUSTLIB = "-L ${STAGING_LIBDIR}/rust" -RUSTFLAGS += "-C rpath -C crate_hash=${BB_TASKHASH} ${RUSTLIB}" +RUSTFLAGS += "-C rpath ${RUSTLIB}" RUSTLIB_DEP ?= "libstd-rs" # Responsible for taking Yocto triples and converting it to Rust triples