Skip to contentSkip to conversation

libstd-rs: Extend to nativesdk

PATCH New Richard Purdie 1 participant 3 messages Mar 16, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 libstd-rs: Extend to nativesdk

This is needed to add the rust standard library to SDKs for use by SDK tools.

---
 meta/recipes-devtools/rust/libstd-rs_1.59.0.bb | 2 ++
 1 file changed, 2 insertions(+)
meta/recipes-devtools/rust/libstd-rs_1.59.0.bb +2 -0
index 7c453a593a5..0ff1fbd6783 100644
@@ -8,3 +8,5 @@ SRC_URI += " \
 "
 # libstd moved from src/libstd to library/std in 1.47+
 S = "${RUSTSRC}/library/std"
+
+BBCLASSEXTEND = "nativesdk"
\ No newline at end of file
Signature · 1 line
2.32.0
#1 lore raw

PATCH 2/3 rust-cross: Add rust-crosssdk variant for nativesdk use

Allow nativesdk recipes to find a correct version of the rust cross compiler.

---
 meta/recipes-devtools/rust/rust-cross.inc          | 7 -------
 meta/recipes-devtools/rust/rust-cross_1.59.0.bb    | 6 ++++++
 meta/recipes-devtools/rust/rust-crosssdk_1.59.0.bb | 8 ++++++++
 3 files changed, 14 insertions(+), 7 deletions(-)
 create mode 100644 meta/recipes-devtools/rust/rust-crosssdk_1.59.0.bb
meta/recipes-devtools/rust/rust-cross.inc +0 -7
index a77f7d51223..f6babfeedaa 100644
@@ -1,6 +1,3 @@
-require rust.inc
-inherit cross
-
 python do_rust_gen_targets () {
     wd = d.getVar('WORKDIR') + '/targets/'
     # It is important 'TARGET' is last here so that it overrides our less
@@ -30,12 +27,8 @@ INHIBIT_DEFAULT_RUST_DEPS = "1"
 # 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-${TUNE_PKGARCH}-${TCLIBC}"
-
 # 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
meta/recipes-devtools/rust/rust-cross_1.59.0.bb +6 -0
index 3179d395d25..5358d98da85 100644
@@ -1,2 +1,8 @@
+require rust.inc
+inherit cross
 require rust-cross.inc
 require rust-source.inc
+
+DEPENDS += "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}compilerlibs virtual/libc"
+PROVIDES = "virtual/${TARGET_PREFIX}rust"
+PN = "rust-cross-${TUNE_PKGARCH}-${TCLIBC}"
meta/recipes-devtools/rust/rust-crosssdk_1.59.0.bb new file +8 -0
new file mode 100644
index 00000000000..5929978591f
@@ -0,0 +1,8 @@
+require rust.inc
+inherit crosssdk
+require rust-cross.inc
+require rust-source.inc
+
+DEPENDS += "virtual/${TARGET_PREFIX}gcc-crosssdk virtual/nativesdk-${TARGET_PREFIX}compilerlibs virtual/nativesdk-libc"
+PROVIDES = "virtual/nativesdk-${TARGET_PREFIX}rust"
+PN = "rust-crosssdk-${TUNE_PKGARCH}-${TCLIBC}"
Signature · 1 line
2.32.0
#2 lore raw

PATCH 3/3 cargo: Add missing nativesdk support

In reply to Richard Purdie

Copy the target definition for nativesdk to allow nativesdk builds to work.

---
 meta/classes/cargo.bbclass | 1 +
 1 file changed, 1 insertion(+)
meta/classes/cargo.bbclass +1 -0
index 0ca38143c0b..4a780a501ff 100644
@@ -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-nativesdk = " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}"
 DEPENDS:append:class-native = " rust-native"
 
 # Enable build separation
Signature · 1 line
2.32.0