From cb33d63060eee74823482de07c1c50a4933ab8f1 Mon Sep 17 00:00:00 2001 From: Alejandro Hernandez Samaniego Date: Sat, 17 Dec 2022 09:20:57 -0700 Subject: rust: Enable building rust from stable, beta and nightly channels Rust follows the train release model via the stable, beta and nightly channels, by default we build rust from the stable channel, however there are certain features which are only available in the beta or nightly channels. Make these channels available by setting a RUST_CHANNEL variable which defaults to stable making this change transparent to the user. The snapshot version used by rust during its compilation wont necessarily match the version being built, specially if were building from an unstable channel, to avoid confusion rename this to SNAPSHOT_VERSION and use RUST_VERSION for the version to be built, which is automatically defined to PV. Append -beta or -nightly to rusts PV for signature awareness. It is important to note that this does not build rust from the beta/nightly published tarball (which today build rust v1.67.0 and v1.68.0 respectively), instead this builds rust from the current selected version (1.66.0) and enables the beta/nightly features for that version. Setting the variable RUST_CHANNEL=nightly results in the following: $ rustc -Vv rustc 1.66.0-nightly (From OE-Core rev: 807a52686682d0d0a151ea3dadd99880feb67cc0) Signed-off-by: Alejandro Hernandez Samaniego Signed-off-by: Alexandre Belloni Signed-off-by: Richard Purdie --- meta/recipes-devtools/rust/rust.inc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'meta/recipes-devtools/rust/rust.inc') diff --git a/meta/recipes-devtools/rust/rust.inc b/meta/recipes-devtools/rust/rust.inc index 8d25e7993a..f58aa46444 100644 --- a/meta/recipes-devtools/rust/rust.inc +++ b/meta/recipes-devtools/rust/rust.inc @@ -13,6 +13,10 @@ DEPENDS:append:class-nativesdk = " nativesdk-rust-llvm" S = "${RUSTSRC}" +# Use at your own risk, accepted values are stable, beta and nightly +RUST_CHANNEL ?= "stable" +PV .= "${@bb.utils.contains('RUST_CHANNEL', 'stable', '', '-${RUST_CHANNEL}', d)}" + export FORCE_CRATE_HASH="${BB_TASKHASH}" RUST_ALTERNATE_EXE_PATH ?= "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config" @@ -116,7 +120,7 @@ python do_configure() { # [rust] config.add_section("rust") config.set("rust", "rpath", e(True)) - config.set("rust", "channel", e("stable")) + config.set("rust", "channel", e(d.expand("${RUST_CHANNEL}"))) # Whether or not to optimize the compiler and standard library config.set("rust", "optimize", e(True)) -- cgit v1.2.3-54-g00ecf