summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kanavin <alex@linutronix.de>2024-05-21 14:50:39 +0200
committerSteve Sakoman <steve@sakoman.com>2025-01-26 14:04:46 -0800
commit04976a1e40e16105847d44f55747afe11dfb5374 (patch)
tree47512d5f0b86313576dc5511546acec984be4b25
parente4de7259e4d20c1fdb655f663fcfdee26d0497c5 (diff)
downloadpoky-04976a1e40e16105847d44f55747afe11dfb5374.tar.gz
rust: use rust-snapshot binaries only in rust-native
Otherwise, use rust-native and cargo-native binaries as that allows our native tweaks in them to be used for target/nativesdk rust - same as for everything else written in rust. In particular, this allows building target rust with cargo-native that includes important reproducibility tweaks. Unfortunately, this also breaks rust selftest, and that is partially addressed by the following commit. [YOCTO #15185] (From OE-Core rev: d592bc02b0846411796c1d481c09833559d1d29f) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 8f2230cb51fe22ef4711a56fecfab4858c04e35b) Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-devtools/rust/rust_1.75.0.bb14
1 files changed, 12 insertions, 2 deletions
diff --git a/meta/recipes-devtools/rust/rust_1.75.0.bb b/meta/recipes-devtools/rust/rust_1.75.0.bb
index 4c0fb907e5..f3140252a5 100644
--- a/meta/recipes-devtools/rust/rust_1.75.0.bb
+++ b/meta/recipes-devtools/rust/rust_1.75.0.bb
@@ -11,6 +11,11 @@ DEPENDS += "file-native python3-native"
11DEPENDS:append:class-native = " rust-llvm-native" 11DEPENDS:append:class-native = " rust-llvm-native"
12DEPENDS:append:class-nativesdk = " nativesdk-rust-llvm" 12DEPENDS:append:class-nativesdk = " nativesdk-rust-llvm"
13 13
14# native rust uses cargo/rustc from binary snapshots to bootstrap
15# but everything else should use our native builds
16DEPENDS:append:class-target = " cargo-native rust-native"
17DEPENDS:append:class-nativesdk = " cargo-native rust-native"
18
14DEPENDS += "rust-llvm (=${PV})" 19DEPENDS += "rust-llvm (=${PV})"
15 20
16RDEPENDS:${PN}:append:class-target = " gcc g++ binutils" 21RDEPENDS:${PN}:append:class-target = " gcc g++ binutils"
@@ -70,6 +75,11 @@ addtask do_test_compile after do_configure do_rust_gen_targets
70do_rust_setup_snapshot[dirs] += "${WORKDIR}/rust-snapshot" 75do_rust_setup_snapshot[dirs] += "${WORKDIR}/rust-snapshot"
71do_rust_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER" 76do_rust_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER"
72 77
78RUSTC_BOOTSTRAP = "${STAGING_BINDIR_NATIVE}/rustc"
79CARGO_BOOTSTRAP = "${STAGING_BINDIR_NATIVE}/cargo"
80RUSTC_BOOTSTRAP:class-native = "${WORKDIR}/rust-snapshot/bin/rustc"
81CARGO_BOOTSTRAP:class-native = "${WORKDIR}/rust-snapshot/bin/cargo"
82
73python do_configure() { 83python do_configure() {
74 import json 84 import json
75 import configparser 85 import configparser
@@ -142,10 +152,10 @@ python do_configure() {
142 config.set("build", "submodules", e(False)) 152 config.set("build", "submodules", e(False))
143 config.set("build", "docs", e(False)) 153 config.set("build", "docs", e(False))
144 154
145 rustc = d.expand("${WORKDIR}/rust-snapshot/bin/rustc") 155 rustc = d.getVar('RUSTC_BOOTSTRAP')
146 config.set("build", "rustc", e(rustc)) 156 config.set("build", "rustc", e(rustc))
147 157
148 cargo = d.expand("${WORKDIR}/rust-snapshot/bin/cargo") 158 cargo = d.getVar('CARGO_BOOTSTRAP')
149 config.set("build", "cargo", e(cargo)) 159 config.set("build", "cargo", e(cargo))
150 160
151 config.set("build", "vendor", e(True)) 161 config.set("build", "vendor", e(True))