From 537ed2b654bbc44a84ad193feffee967355f6c65 Mon Sep 17 00:00:00 2001 From: Alex Kiernan Date: Fri, 29 Dec 2023 11:44:33 +0000 Subject: rust: Upgrade 1.72.1 -> 1.73.0 https://blog.rust-lang.org/2023/10/05/Rust-1.73.0.html (From OE-Core rev: 728c40b939c6af6358a483237298ca834cbb8993) Signed-off-by: Alex Kiernan Signed-off-by: Richard Purdie --- meta/conf/distro/include/tcmode-default.inc | 2 +- meta/recipes-devtools/rust/cargo_1.72.1.bb | 73 ----- meta/recipes-devtools/rust/cargo_1.73.0.bb | 73 +++++ .../0001-Do-not-use-LFS64-on-linux-with-musl.patch | 36 +-- .../rust/files/hardcodepaths.patch | 8 +- meta/recipes-devtools/rust/libstd-rs_1.72.1.bb | 53 --- meta/recipes-devtools/rust/libstd-rs_1.73.0.bb | 53 +++ .../rust/rust-cross-canadian_1.72.1.bb | 2 - .../rust/rust-cross-canadian_1.73.0.bb | 2 + meta/recipes-devtools/rust/rust-llvm_1.72.1.bb | 94 ------ meta/recipes-devtools/rust/rust-llvm_1.73.0.bb | 94 ++++++ meta/recipes-devtools/rust/rust-snapshot.inc | 68 ++-- meta/recipes-devtools/rust/rust-source.inc | 2 +- meta/recipes-devtools/rust/rust_1.72.1.bb | 360 --------------------- meta/recipes-devtools/rust/rust_1.73.0.bb | 360 +++++++++++++++++++++ 15 files changed, 637 insertions(+), 643 deletions(-) delete mode 100644 meta/recipes-devtools/rust/cargo_1.72.1.bb create mode 100644 meta/recipes-devtools/rust/cargo_1.73.0.bb delete mode 100644 meta/recipes-devtools/rust/libstd-rs_1.72.1.bb create mode 100644 meta/recipes-devtools/rust/libstd-rs_1.73.0.bb delete mode 100644 meta/recipes-devtools/rust/rust-cross-canadian_1.72.1.bb create mode 100644 meta/recipes-devtools/rust/rust-cross-canadian_1.73.0.bb delete mode 100644 meta/recipes-devtools/rust/rust-llvm_1.72.1.bb create mode 100644 meta/recipes-devtools/rust/rust-llvm_1.73.0.bb delete mode 100644 meta/recipes-devtools/rust/rust_1.72.1.bb create mode 100644 meta/recipes-devtools/rust/rust_1.73.0.bb diff --git a/meta/conf/distro/include/tcmode-default.inc b/meta/conf/distro/include/tcmode-default.inc index f67b7be39c..8960d9e014 100644 --- a/meta/conf/distro/include/tcmode-default.inc +++ b/meta/conf/distro/include/tcmode-default.inc @@ -25,7 +25,7 @@ LINUXLIBCVERSION ?= "6.5%" QEMUVERSION ?= "8.1%" GOVERSION ?= "1.20%" LLVMVERSION ?= "17.%" -RUSTVERSION ?= "1.72%" +RUSTVERSION ?= "1.73%" PREFERRED_VERSION_gcc ?= "${GCCVERSION}" PREFERRED_VERSION_gcc-cross-${TARGET_ARCH} ?= "${GCCVERSION}" diff --git a/meta/recipes-devtools/rust/cargo_1.72.1.bb b/meta/recipes-devtools/rust/cargo_1.72.1.bb deleted file mode 100644 index 50b7e7c7b4..0000000000 --- a/meta/recipes-devtools/rust/cargo_1.72.1.bb +++ /dev/null @@ -1,73 +0,0 @@ -SUMMARY = "Cargo, a package manager for Rust." -HOMEPAGE = "https://crates.io" -LICENSE = "MIT | Apache-2.0" -SECTION = "devel" - -DEPENDS = "openssl zlib curl ca-certificates libssh2" - -LIC_FILES_CHKSUM = " \ - file://LICENSE-MIT;md5=b377b220f43d747efdec40d69fcaa69d \ - file://LICENSE-APACHE;md5=71b224ca933f0676e26d5c2e2271331c \ - file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \ -" - -require rust-source.inc -require rust-snapshot.inc - -S = "${RUSTSRC}/src/tools/cargo" -CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" - -inherit cargo pkgconfig - -DEBUG_PREFIX_MAP += "-fdebug-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}" - -do_cargo_setup_snapshot () { - ${WORKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig - # Need to use uninative's loader if enabled/present since the library paths - # are used internally by rust and result in symbol mismatches if we don't - if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then - patchelf-uninative ${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo --set-interpreter ${UNINATIVE_LOADER} - fi -} - -addtask cargo_setup_snapshot after do_unpack before do_configure -do_cargo_setup_snapshot[dirs] += "${WORKDIR}/${CARGO_SNAPSHOT}" -do_cargo_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER" - - -do_compile:prepend () { - export RUSTC_BOOTSTRAP="1" -} - -do_install () { - install -d "${D}${bindir}" - install -m 755 "${B}/target/${CARGO_TARGET_SUBDIR}/cargo" "${D}${bindir}" -} - -do_install:append:class-nativesdk() { - # To quote the cargo docs, "Cargo also sets the dynamic library path when compiling - # and running binaries with commands like `cargo run` and `cargo test`". Sadly it - # sets to libdir but not base_libdir leading to symbol mismatches depending on the - # host OS. Fully set LD_LIBRARY_PATH to contain both to avoid this. - create_wrapper ${D}/${bindir}/cargo LD_LIBRARY_PATH=${libdir}:${base_libdir} -} - -# Disabled due to incompatibility with libgit2 0.28.x (https://github.com/rust-lang/git2-rs/issues/458, https://bugs.gentoo.org/707746#c1) -# as shipped by Yocto Dunfell. -# According to https://github.com/rust-lang/git2-rs/issues/458#issuecomment-522567539, there are no compatibility guarantees between -# libgit2-sys and arbitrary system libgit2 versions, so better keep this turned off. -#export LIBGIT2_SYS_USE_PKG_CONFIG = "1" - -# Needed for pkg-config to be used -export LIBSSH2_SYS_USE_PKG_CONFIG = "1" - -# When building cargo-native we don't have cargo-native to use and depend on, -# so we must use the locally set up snapshot to bootstrap the build. -BASEDEPENDS:remove:class-native = "cargo-native" -CARGO:class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo" - -DEPENDS:append:class-nativesdk = " nativesdk-rust" -RUSTLIB:append:class-nativesdk = " -L ${STAGING_DIR_HOST}/${SDKPATHNATIVE}/usr/lib/rustlib/${RUST_HOST_SYS}/lib" -RUSTLIB_DEP:class-nativesdk = "" - -BBCLASSEXTEND = "native nativesdk" diff --git a/meta/recipes-devtools/rust/cargo_1.73.0.bb b/meta/recipes-devtools/rust/cargo_1.73.0.bb new file mode 100644 index 0000000000..50b7e7c7b4 --- /dev/null +++ b/meta/recipes-devtools/rust/cargo_1.73.0.bb @@ -0,0 +1,73 @@ +SUMMARY = "Cargo, a package manager for Rust." +HOMEPAGE = "https://crates.io" +LICENSE = "MIT | Apache-2.0" +SECTION = "devel" + +DEPENDS = "openssl zlib curl ca-certificates libssh2" + +LIC_FILES_CHKSUM = " \ + file://LICENSE-MIT;md5=b377b220f43d747efdec40d69fcaa69d \ + file://LICENSE-APACHE;md5=71b224ca933f0676e26d5c2e2271331c \ + file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \ +" + +require rust-source.inc +require rust-snapshot.inc + +S = "${RUSTSRC}/src/tools/cargo" +CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" + +inherit cargo pkgconfig + +DEBUG_PREFIX_MAP += "-fdebug-prefix-map=${RUSTSRC}/vendor=${TARGET_DBGSRC_DIR}" + +do_cargo_setup_snapshot () { + ${WORKDIR}/rust-snapshot-components/${CARGO_SNAPSHOT}/install.sh --prefix="${WORKDIR}/${CARGO_SNAPSHOT}" --disable-ldconfig + # Need to use uninative's loader if enabled/present since the library paths + # are used internally by rust and result in symbol mismatches if we don't + if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then + patchelf-uninative ${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo --set-interpreter ${UNINATIVE_LOADER} + fi +} + +addtask cargo_setup_snapshot after do_unpack before do_configure +do_cargo_setup_snapshot[dirs] += "${WORKDIR}/${CARGO_SNAPSHOT}" +do_cargo_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER" + + +do_compile:prepend () { + export RUSTC_BOOTSTRAP="1" +} + +do_install () { + install -d "${D}${bindir}" + install -m 755 "${B}/target/${CARGO_TARGET_SUBDIR}/cargo" "${D}${bindir}" +} + +do_install:append:class-nativesdk() { + # To quote the cargo docs, "Cargo also sets the dynamic library path when compiling + # and running binaries with commands like `cargo run` and `cargo test`". Sadly it + # sets to libdir but not base_libdir leading to symbol mismatches depending on the + # host OS. Fully set LD_LIBRARY_PATH to contain both to avoid this. + create_wrapper ${D}/${bindir}/cargo LD_LIBRARY_PATH=${libdir}:${base_libdir} +} + +# Disabled due to incompatibility with libgit2 0.28.x (https://github.com/rust-lang/git2-rs/issues/458, https://bugs.gentoo.org/707746#c1) +# as shipped by Yocto Dunfell. +# According to https://github.com/rust-lang/git2-rs/issues/458#issuecomment-522567539, there are no compatibility guarantees between +# libgit2-sys and arbitrary system libgit2 versions, so better keep this turned off. +#export LIBGIT2_SYS_USE_PKG_CONFIG = "1" + +# Needed for pkg-config to be used +export LIBSSH2_SYS_USE_PKG_CONFIG = "1" + +# When building cargo-native we don't have cargo-native to use and depend on, +# so we must use the locally set up snapshot to bootstrap the build. +BASEDEPENDS:remove:class-native = "cargo-native" +CARGO:class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo" + +DEPENDS:append:class-nativesdk = " nativesdk-rust" +RUSTLIB:append:class-nativesdk = " -L ${STAGING_DIR_HOST}/${SDKPATHNATIVE}/usr/lib/rustlib/${RUST_HOST_SYS}/lib" +RUSTLIB_DEP:class-nativesdk = "" + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta/recipes-devtools/rust/files/0001-Do-not-use-LFS64-on-linux-with-musl.patch b/meta/recipes-devtools/rust/files/0001-Do-not-use-LFS64-on-linux-with-musl.patch index dd23d09101..794ad804f0 100644 --- a/meta/recipes-devtools/rust/files/0001-Do-not-use-LFS64-on-linux-with-musl.patch +++ b/meta/recipes-devtools/rust/files/0001-Do-not-use-LFS64-on-linux-with-musl.patch @@ -19,10 +19,10 @@ Signed-off-by: Khem Raj library/std/src/sys/unix/fs.rs | 27 ++++++++++++++++++++------- 3 files changed, 38 insertions(+), 12 deletions(-) -Index: rustc-1.72.0-src/library/std/src/os/linux/fs.rs +Index: rustc-1.73.0-src/library/std/src/os/linux/fs.rs =================================================================== ---- rustc-1.72.0-src.orig/library/std/src/os/linux/fs.rs -+++ rustc-1.72.0-src/library/std/src/os/linux/fs.rs +--- rustc-1.73.0-src.orig/library/std/src/os/linux/fs.rs ++++ rustc-1.73.0-src/library/std/src/os/linux/fs.rs @@ -329,7 +329,14 @@ pub trait MetadataExt { impl MetadataExt for Metadata { #[allow(deprecated)] @@ -39,10 +39,10 @@ Index: rustc-1.72.0-src/library/std/src/os/linux/fs.rs } fn st_dev(&self) -> u64 { self.as_inner().as_inner().st_dev as u64 -Index: rustc-1.72.0-src/library/std/src/sys/unix/fd.rs +Index: rustc-1.73.0-src/library/std/src/sys/unix/fd.rs =================================================================== ---- rustc-1.72.0-src.orig/library/std/src/sys/unix/fd.rs -+++ rustc-1.72.0-src/library/std/src/sys/unix/fd.rs +--- rustc-1.73.0-src.orig/library/std/src/sys/unix/fd.rs ++++ rustc-1.73.0-src/library/std/src/sys/unix/fd.rs @@ -124,9 +124,12 @@ impl FileDesc { } @@ -73,11 +73,11 @@ Index: rustc-1.72.0-src/library/std/src/sys/unix/fd.rs use libc::pwrite64; unsafe { -Index: rustc-1.72.0-src/library/std/src/sys/unix/fs.rs +Index: rustc-1.73.0-src/library/std/src/sys/unix/fs.rs =================================================================== ---- rustc-1.72.0-src.orig/library/std/src/sys/unix/fs.rs -+++ rustc-1.72.0-src/library/std/src/sys/unix/fs.rs -@@ -50,9 +50,13 @@ use libc::{c_int, mode_t}; +--- rustc-1.73.0-src.orig/library/std/src/sys/unix/fs.rs ++++ rustc-1.73.0-src/library/std/src/sys/unix/fs.rs +@@ -39,9 +39,13 @@ use libc::{c_int, mode_t}; all(target_os = "linux", target_env = "gnu") ))] use libc::c_char; @@ -93,7 +93,7 @@ Index: rustc-1.72.0-src/library/std/src/sys/unix/fs.rs use libc::fstatat64; #[cfg(any( target_os = "android", -@@ -64,7 +68,7 @@ use libc::fstatat64; +@@ -53,7 +57,7 @@ use libc::fstatat64; target_os = "vita", ))] use libc::readdir as readdir64; @@ -102,7 +102,7 @@ Index: rustc-1.72.0-src/library/std/src/sys/unix/fs.rs use libc::readdir64; #[cfg(any(target_os = "emscripten", target_os = "l4re"))] use libc::readdir64_r; -@@ -79,6 +83,7 @@ use libc::readdir64_r; +@@ -68,6 +72,7 @@ use libc::readdir64_r; target_os = "redox", target_os = "nto", target_os = "vita", @@ -110,7 +110,7 @@ Index: rustc-1.72.0-src/library/std/src/sys/unix/fs.rs )))] use libc::readdir_r as readdir64_r; #[cfg(target_os = "android")] -@@ -86,7 +91,13 @@ use libc::{ +@@ -75,7 +80,13 @@ use libc::{ dirent as dirent64, fstat as fstat64, fstatat as fstatat64, ftruncate64, lseek64, lstat as lstat64, off64_t, open as open64, stat as stat64, }; @@ -124,7 +124,7 @@ Index: rustc-1.72.0-src/library/std/src/sys/unix/fs.rs target_os = "linux", target_os = "emscripten", target_os = "l4re", -@@ -96,7 +107,7 @@ use libc::{ +@@ -85,7 +96,7 @@ use libc::{ dirent as dirent64, fstat as fstat64, ftruncate as ftruncate64, lseek as lseek64, lstat as lstat64, off_t as off64_t, open as open64, stat as stat64, }; @@ -133,7 +133,7 @@ Index: rustc-1.72.0-src/library/std/src/sys/unix/fs.rs use libc::{dirent64, fstat64, ftruncate64, lseek64, lstat64, off64_t, open64, stat64}; pub use crate::sys_common::fs::try_exists; -@@ -283,6 +294,7 @@ unsafe impl Sync for Dir {} +@@ -272,6 +283,7 @@ unsafe impl Sync for Dir {} #[cfg(any( target_os = "android", target_os = "linux", @@ -141,7 +141,7 @@ Index: rustc-1.72.0-src/library/std/src/sys/unix/fs.rs target_os = "solaris", target_os = "illumos", target_os = "fuchsia", -@@ -324,6 +336,7 @@ struct dirent64_min { +@@ -313,6 +325,7 @@ struct dirent64_min { } #[cfg(not(any( @@ -149,7 +149,7 @@ Index: rustc-1.72.0-src/library/std/src/sys/unix/fs.rs target_os = "android", target_os = "linux", target_os = "solaris", -@@ -832,7 +845,7 @@ impl DirEntry { +@@ -809,7 +822,7 @@ impl DirEntry { } #[cfg(all( @@ -158,7 +158,7 @@ Index: rustc-1.72.0-src/library/std/src/sys/unix/fs.rs not(miri) ))] pub fn metadata(&self) -> io::Result { -@@ -856,7 +869,7 @@ impl DirEntry { +@@ -833,7 +846,7 @@ impl DirEntry { } #[cfg(any( diff --git a/meta/recipes-devtools/rust/files/hardcodepaths.patch b/meta/recipes-devtools/rust/files/hardcodepaths.patch index 19c494ad9a..6eb091461f 100644 --- a/meta/recipes-devtools/rust/files/hardcodepaths.patch +++ b/meta/recipes-devtools/rust/files/hardcodepaths.patch @@ -6,9 +6,11 @@ Upstream-Status: Inappropriate [patches need rework] Signed-off-by: Richard Purdie Signed-off-by: Alex Kiernan ---- rustc-1.69.0-src/compiler/rustc_codegen_llvm/src/context.rs.orig 2023-04-21 08:38:23.092458478 +0100 -+++ rustc-1.69.0-src/compiler/rustc_codegen_llvm/src/context.rs 2023-04-21 08:39:00.266819755 +0100 -@@ -156,46 +156,6 @@ +Index: rustc-1.73.0-src/compiler/rustc_codegen_llvm/src/context.rs +=================================================================== +--- rustc-1.73.0-src.orig/compiler/rustc_codegen_llvm/src/context.rs ++++ rustc-1.73.0-src/compiler/rustc_codegen_llvm/src/context.rs +@@ -157,46 +157,6 @@ pub unsafe fn create_module<'ll>( } } diff --git a/meta/recipes-devtools/rust/libstd-rs_1.72.1.bb b/meta/recipes-devtools/rust/libstd-rs_1.72.1.bb deleted file mode 100644 index d2bf266f9d..0000000000 --- a/meta/recipes-devtools/rust/libstd-rs_1.72.1.bb +++ /dev/null @@ -1,53 +0,0 @@ -SUMMARY = "Rust standard libaries" -HOMEPAGE = "http://www.rust-lang.org" -SECTION = "devel" -LICENSE = "(MIT | Apache-2.0) & Unicode-TOU" -LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=c2cccf560306876da3913d79062a54b9" - -require rust-source.inc - -# The dummy crate named `sysroot` represents the standard library target. -# -# See fd4c81f4c19e ("Add a `sysroot` crate to represent the standard library crates") -# https://github.com/rust-lang/rust/pull/108865/ -S = "${RUSTSRC}/library/sysroot" - -RUSTLIB_DEP = "" -inherit cargo - -DEPENDS:append:libc-musl = " libunwind" -# rv32 does not have libunwind ported yet -DEPENDS:remove:riscv32 = "libunwind" -DEPENDS:remove:riscv64 = "libunwind" - -# Embed bitcode in order to allow compiling both with and without LTO -RUSTFLAGS += "-Cembed-bitcode=yes" -# Needed so cargo can find libbacktrace -RUSTFLAGS += "-L ${STAGING_LIBDIR} -C link-arg=-Wl,-soname,libstd.so" - -CARGO_FEATURES ?= "panic-unwind backtrace" -CARGO_BUILD_FLAGS += "--features '${CARGO_FEATURES}'" -CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" - -do_compile:prepend () { - export CARGO_TARGET_DIR="${B}" - # For Rust 1.13.0 and newer - export RUSTC_BOOTSTRAP="1" -} - -do_install () { - mkdir -p ${D}${rustlibdir} - - # With the incremental build support added in 1.24, the libstd deps directory also includes dependency - # files that get installed. Those are really only needed to incrementally rebuild the libstd library - # itself and don't need to be installed. - rm -f ${B}/${RUST_TARGET_SYS}/${BUILD_DIR}/deps/*.d - cp ${B}/${RUST_TARGET_SYS}/${BUILD_DIR}/deps/* ${D}${rustlibdir} -} - -BBCLASSEXTEND = "nativesdk" - -# Since 1.70.0 upgrade this fails to build with gold: -# http://errors.yoctoproject.org/Errors/Details/708194/ -# ld: error: version script assignment of to symbol __rust_alloc_error_handler_should_panic failed: symbol not defined -LDFLAGS:append = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd', '', d)}" diff --git a/meta/recipes-devtools/rust/libstd-rs_1.73.0.bb b/meta/recipes-devtools/rust/libstd-rs_1.73.0.bb new file mode 100644 index 0000000000..d2bf266f9d --- /dev/null +++ b/meta/recipes-devtools/rust/libstd-rs_1.73.0.bb @@ -0,0 +1,53 @@ +SUMMARY = "Rust standard libaries" +HOMEPAGE = "http://www.rust-lang.org" +SECTION = "devel" +LICENSE = "(MIT | Apache-2.0) & Unicode-TOU" +LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=c2cccf560306876da3913d79062a54b9" + +require rust-source.inc + +# The dummy crate named `sysroot` represents the standard library target. +# +# See fd4c81f4c19e ("Add a `sysroot` crate to represent the standard library crates") +# https://github.com/rust-lang/rust/pull/108865/ +S = "${RUSTSRC}/library/sysroot" + +RUSTLIB_DEP = "" +inherit cargo + +DEPENDS:append:libc-musl = " libunwind" +# rv32 does not have libunwind ported yet +DEPENDS:remove:riscv32 = "libunwind" +DEPENDS:remove:riscv64 = "libunwind" + +# Embed bitcode in order to allow compiling both with and without LTO +RUSTFLAGS += "-Cembed-bitcode=yes" +# Needed so cargo can find libbacktrace +RUSTFLAGS += "-L ${STAGING_LIBDIR} -C link-arg=-Wl,-soname,libstd.so" + +CARGO_FEATURES ?= "panic-unwind backtrace" +CARGO_BUILD_FLAGS += "--features '${CARGO_FEATURES}'" +CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor" + +do_compile:prepend () { + export CARGO_TARGET_DIR="${B}" + # For Rust 1.13.0 and newer + export RUSTC_BOOTSTRAP="1" +} + +do_install () { + mkdir -p ${D}${rustlibdir} + + # With the incremental build support added in 1.24, the libstd deps directory also includes dependency + # files that get installed. Those are really only needed to incrementally rebuild the libstd library + # itself and don't need to be installed. + rm -f ${B}/${RUST_TARGET_SYS}/${BUILD_DIR}/deps/*.d + cp ${B}/${RUST_TARGET_SYS}/${BUILD_DIR}/deps/* ${D}${rustlibdir} +} + +BBCLASSEXTEND = "nativesdk" + +# Since 1.70.0 upgrade this fails to build with gold: +# http://errors.yoctoproject.org/Errors/Details/708194/ +# ld: error: version script assignment of to symbol __rust_alloc_error_handler_should_panic failed: symbol not defined +LDFLAGS:append = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd', '', d)}" diff --git a/meta/recipes-devtools/rust/rust-cross-canadian_1.72.1.bb b/meta/recipes-devtools/rust/rust-cross-canadian_1.72.1.bb deleted file mode 100644 index 55865238ab..0000000000 --- a/meta/recipes-devtools/rust/rust-cross-canadian_1.72.1.bb +++ /dev/null @@ -1,2 +0,0 @@ -inherit cross-canadian -require rust-cross-canadian.inc \ No newline at end of file diff --git a/meta/recipes-devtools/rust/rust-cross-canadian_1.73.0.bb b/meta/recipes-devtools/rust/rust-cross-canadian_1.73.0.bb new file mode 100644 index 0000000000..55865238ab --- /dev/null +++ b/meta/recipes-devtools/rust/rust-cross-canadian_1.73.0.bb @@ -0,0 +1,2 @@ +inherit cross-canadian +require rust-cross-canadian.inc \ No newline at end of file diff --git a/meta/recipes-devtools/rust/rust-llvm_1.72.1.bb b/meta/recipes-devtools/rust/rust-llvm_1.72.1.bb deleted file mode 100644 index 5bfc1faea8..0000000000 --- a/meta/recipes-devtools/rust/rust-llvm_1.72.1.bb +++ /dev/null @@ -1,94 +0,0 @@ -SUMMARY = "LLVM compiler framework (packaged with rust)" -LICENSE ?= "Apache-2.0-with-LLVM-exception" -HOMEPAGE = "http://www.rust-lang.org" - -# check src/llvm-project/llvm/CMakeLists.txt for llvm version in use -# -LLVM_RELEASE = "16.0.2" - -require rust-source.inc - -SRC_URI += "file://0002-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \ - file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \ - file://0003-llvm-fix-include-benchmarks.patch;striplevel=2" - -S = "${RUSTSRC}/src/llvm-project/llvm" - -LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=8a15a0759ef07f2682d2ba4b893c9afe" - -inherit cmake - -DEPENDS += "ninja-native rust-llvm-native" - -ARM_INSTRUCTION_SET:armv5 = "arm" -ARM_INSTRUCTION_SET:armv4t = "arm" - -# rustc_llvm with debug info is not recognized as a valid crate that's -# generated by rust-llvm-native. -CFLAGS:remove = "-g" -CXXFLAGS:remove = "-g" - -LLVM_DIR = "llvm${LLVM_RELEASE}" - -RUST_LLVM_TARGETS ?= "ARM;AArch64;Mips;PowerPC;RISCV;X86" - -EXTRA_OECMAKE = " \ - -DCMAKE_BUILD_TYPE=Release \ - -DLLVM_TARGETS_TO_BUILD='${RUST_LLVM_TARGETS}' \ - -DLLVM_BUILD_DOCS=OFF \ - -DLLVM_ENABLE_TERMINFO=OFF \ - -DLLVM_ENABLE_ZLIB=OFF \ - -DLLVM_ENABLE_ZSTD=OFF \ - -DLLVM_ENABLE_LIBXML2=OFF \ - -DLLVM_ENABLE_FFI=OFF \ - -DLLVM_INSTALL_UTILS=ON \ - -DLLVM_BUILD_EXAMPLES=OFF \ - -DLLVM_INCLUDE_EXAMPLES=OFF \ - -DLLVM_BUILD_TESTS=OFF \ - -DLLVM_INCLUDE_TESTS=OFF \ - -DLLVM_TARGET_ARCH=${TARGET_ARCH} \ - -DCMAKE_INSTALL_PREFIX:PATH=${libdir}/llvm-rust \ -" - -# Forcibly disable the detection of these packages as otherwise -# it will look at the host Python install -EXTRA_OECMAKE += "\ - -DPY_PYGMENTS_FOUND=OFF \ - -DPY_PYGMENTS_LEXERS_C_CPP_FOUND=OFF \ - -DPY_YAML_FOUND=OFF \ -" - -EXTRA_OECMAKE:append:class-target = "\ - -DLLVM_BUILD_TOOLS=OFF \ - -DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \ - -DLLVM_CONFIG_PATH=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config \ -" - -EXTRA_OECMAKE:append:class-nativesdk = "\ - -DLLVM_BUILD_TOOLS=OFF \ - -DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \ - -DLLVM_CONFIG_PATH=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config \ -" - -# 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" - -export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config" - -do_install:append () { - # we don't need any of this stuff to build Rust - rm -rf "${D}/usr/lib/cmake" -} - -PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liblto" - -# Add the extra locations to avoid the complaints about unpackaged files -FILES:${PN}-bugpointpasses = "${libdir}/llvm-rust/lib/BugpointPasses.so" -FILES:${PN}-llvmhello = "${libdir}/llvm-rust/lib/LLVMHello.so" -FILES:${PN}-liblto = "${libdir}/llvm-rust/lib/libLTO.so.*" -FILES:${PN}-staticdev =+ "${libdir}/llvm-rust/*/*.a" -FILES:${PN} += "${libdir}/libLLVM*.so.* ${libdir}/llvm-rust/lib/*.so.* ${libdir}/llvm-rust/bin" -FILES:${PN}-dev += "${datadir}/llvm ${libdir}/llvm-rust/lib/*.so ${libdir}/llvm-rust/include ${libdir}/llvm-rust/share ${libdir}/llvm-rust/lib/cmake" - -BBCLASSEXTEND = "native nativesdk" diff --git a/meta/recipes-devtools/rust/rust-llvm_1.73.0.bb b/meta/recipes-devtools/rust/rust-llvm_1.73.0.bb new file mode 100644 index 0000000000..5bfc1faea8 --- /dev/null +++ b/meta/recipes-devtools/rust/rust-llvm_1.73.0.bb @@ -0,0 +1,94 @@ +SUMMARY = "LLVM compiler framework (packaged with rust)" +LICENSE ?= "Apache-2.0-with-LLVM-exception" +HOMEPAGE = "http://www.rust-lang.org" + +# check src/llvm-project/llvm/CMakeLists.txt for llvm version in use +# +LLVM_RELEASE = "16.0.2" + +require rust-source.inc + +SRC_URI += "file://0002-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \ + file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \ + file://0003-llvm-fix-include-benchmarks.patch;striplevel=2" + +S = "${RUSTSRC}/src/llvm-project/llvm" + +LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=8a15a0759ef07f2682d2ba4b893c9afe" + +inherit cmake + +DEPENDS += "ninja-native rust-llvm-native" + +ARM_INSTRUCTION_SET:armv5 = "arm" +ARM_INSTRUCTION_SET:armv4t = "arm" + +# rustc_llvm with debug info is not recognized as a valid crate that's +# generated by rust-llvm-native. +CFLAGS:remove = "-g" +CXXFLAGS:remove = "-g" + +LLVM_DIR = "llvm${LLVM_RELEASE}" + +RUST_LLVM_TARGETS ?= "ARM;AArch64;Mips;PowerPC;RISCV;X86" + +EXTRA_OECMAKE = " \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_TARGETS_TO_BUILD='${RUST_LLVM_TARGETS}' \ + -DLLVM_BUILD_DOCS=OFF \ + -DLLVM_ENABLE_TERMINFO=OFF \ + -DLLVM_ENABLE_ZLIB=OFF \ + -DLLVM_ENABLE_ZSTD=OFF \ + -DLLVM_ENABLE_LIBXML2=OFF \ + -DLLVM_ENABLE_FFI=OFF \ + -DLLVM_INSTALL_UTILS=ON \ + -DLLVM_BUILD_EXAMPLES=OFF \ + -DLLVM_INCLUDE_EXAMPLES=OFF \ + -DLLVM_BUILD_TESTS=OFF \ + -DLLVM_INCLUDE_TESTS=OFF \ + -DLLVM_TARGET_ARCH=${TARGET_ARCH} \ + -DCMAKE_INSTALL_PREFIX:PATH=${libdir}/llvm-rust \ +" + +# Forcibly disable the detection of these packages as otherwise +# it will look at the host Python install +EXTRA_OECMAKE += "\ + -DPY_PYGMENTS_FOUND=OFF \ + -DPY_PYGMENTS_LEXERS_C_CPP_FOUND=OFF \ + -DPY_YAML_FOUND=OFF \ +" + +EXTRA_OECMAKE:append:class-target = "\ + -DLLVM_BUILD_TOOLS=OFF \ + -DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \ + -DLLVM_CONFIG_PATH=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config \ +" + +EXTRA_OECMAKE:append:class-nativesdk = "\ + -DLLVM_BUILD_TOOLS=OFF \ + -DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \ + -DLLVM_CONFIG_PATH=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config \ +" + +# 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" + +export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config" + +do_install:append () { + # we don't need any of this stuff to build Rust + rm -rf "${D}/usr/lib/cmake" +} + +PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liblto" + +# Add the extra locations to avoid the complaints about unpackaged files +FILES:${PN}-bugpointpasses = "${libdir}/llvm-rust/lib/BugpointPasses.so" +FILES:${PN}-llvmhello = "${libdir}/llvm-rust/lib/LLVMHello.so" +FILES:${PN}-liblto = "${libdir}/llvm-rust/lib/libLTO.so.*" +FILES:${PN}-staticdev =+ "${libdir}/llvm-rust/*/*.a" +FILES:${PN} += "${libdir}/libLLVM*.so.* ${libdir}/llvm-rust/lib/*.so.* ${libdir}/llvm-rust/bin" +FILES:${PN}-dev += "${datadir}/llvm ${libdir}/llvm-rust/lib/*.so ${libdir}/llvm-rust/include ${libdir}/llvm-rust/share ${libdir}/llvm-rust/lib/cmake" + +BBCLASSEXTEND = "native nativesdk" diff --git a/meta/recipes-devtools/rust/rust-snapshot.inc b/meta/recipes-devtools/rust/rust-snapshot.inc index e8f97cf031..38d735db41 100644 --- a/meta/recipes-devtools/rust/rust-snapshot.inc +++ b/meta/recipes-devtools/rust/rust-snapshot.inc @@ -4,55 +4,47 @@ ## The exact (previous) version that has been used is specified in the source tarball. ## The version is replicated here. -SNAPSHOT_VERSION = "1.71.0" +SNAPSHOT_VERSION = "1.72.0" -SRC_URI[cargo-snapshot-aarch64.sha256sum] = "13e8ff23d6af976a45f3ab451bf698e318a8d1823d588ff8a989555096f894a8" -SRC_URI[rust-std-snapshot-aarch64.sha256sum] = "58542a0ab1162ce05a45eb751793782dc24c5bf8eb9a7467317f254260305ea6" -SRC_URI[rustc-snapshot-aarch64.sha256sum] = "e61b6e34df8c3a002798a9f627c4da701d66f9fc066a70264e354b03d06e6722" +SRC_URI[cargo-snapshot-aarch64.sha256sum] = "95741a4cd2073adbd74a7c5596bb912abf4b2dfe00d70a9919cba4a836b7a0ff" +SRC_URI[rust-std-snapshot-aarch64.sha256sum] = "41d259c6f84280fd0e7719fea03a7583ba54e33e8ac32a2a7b703ffb0aebb7d9" +SRC_URI[rustc-snapshot-aarch64.sha256sum] = "1948a80453956d494457dcced1942e2e204fb26d4e57e718ef1c7aa378efbedb" -SRC_URI[cargo-snapshot-i686.sha256sum] = "ee836c079c53e8e2ed5b2cbad849f991f2142b0b47b593a29b5cb39a76ee910e" -SRC_URI[rust-std-snapshot-i686.sha256sum] = "46976bf8297efc65556ccddfec395d5327fbe303f9dabffd104628a37cb1de6d" -SRC_URI[rustc-snapshot-i686.sha256sum] = "e7c9c943b727de4f978cc9366e5c42536992d52ad418ffb9015e836723fd75ca" +SRC_URI[cargo-snapshot-i686.sha256sum] = "549eda5cda44750b0b2e6d3ce3f9c90c3a133b695e4882b4c6b93e54d6e8a73a" +SRC_URI[rust-std-snapshot-i686.sha256sum] = "536c5ec1403b55045a502af1d6f8af192b560fbf9a24874bce6d59163fb8a38a" +SRC_URI[rustc-snapshot-i686.sha256sum] = "53c0e2045078326fd2ac9e77900a34b4ced1545a489b2a438deaebd2150cf543" -SRC_URI[cargo-snapshot-loongarch64.sha256sum] = "33dd282f63a2ccf0251baec5fa8d989276b1735528fe4b5153319038cedbe115" -SRC_URI[rust-std-snapshot-loongarch64.sha256sum] = "1a7c473cb50248a505a0e08dc05df49291e48a302a7b138e3ce396b0d0df9dbb" -SRC_URI[rustc-snapshot-loongarch64.sha256sum] = "fbb21fefc8dee4c73f151b15f175caaabf10c3e122974d3fea3f3e2fbe916822" +SRC_URI[cargo-snapshot-loongarch64.sha256sum] = "216a9ccbfab10778f977b62416c17cf94a374e84a7acf3f50a11cf0b8b88940c" +SRC_URI[rust-std-snapshot-loongarch64.sha256sum] = "116065f0bb6d8e13725b974f057709e12ed85d93217a0feb16581850db7a0ede" +SRC_URI[rustc-snapshot-loongarch64.sha256sum] = "73633f52ff12c448d2523409967d8d5d1e0b664c5a3a214395d10a9be7cc020d" -SRC_URI[cargo-snapshot-mips.sha256sum] = "ad068f683e44dbf539ab28d9a1ad1508d22b932aaa81ab0f77df2237817ef1e8" -SRC_URI[rust-std-snapshot-mips.sha256sum] = "a259bddfc3ee36279b016ebd2682fc5b4d1b93c63bed6e4f57b5a2963d661dc9" -SRC_URI[rustc-snapshot-mips.sha256sum] = "10d663c3b6cbf1d2166c2d544a2567c83bd8fb110c80064263393b89f025204c" +SRC_URI[cargo-snapshot-powerpc.sha256sum] = "8a6452262e062be0e7eef92b2aafaa06caf0853b264a3fd337e92079a43f0a24" +SRC_URI[rust-std-snapshot-powerpc.sha256sum] = "cca2897f091227cc53d63f3eefcfcb65f42d9e24a04a1b37a0d3ee36b7f84b5b" +SRC_URI[rustc-snapshot-powerpc.sha256sum] = "3a8f0f115ae2d599e1de12d38cb47bd7f9b508e213bf2f9a41efc136021c49a2" -SRC_URI[cargo-snapshot-mipsel.sha256sum] = "c7973b800cadb67f6c5a4b938e03bb9e891ca5ab153da10a7913d9c3e18c9371" -SRC_URI[rust-std-snapshot-mipsel.sha256sum] = "ad91d662c93e5092367048c8e717f64a5096b876623e5fbc3c791b2d1f868dfb" -SRC_URI[rustc-snapshot-mipsel.sha256sum] = "05d15f51fc33439582967dfc8f19364e67e8b5050abefbdd8913984e8a7be84e" +SRC_URI[cargo-snapshot-powerpc64.sha256sum] = "a24a385d9f403e0800adb4d8364e663e40a04663a18df8d8704a5156d4232a1b" +SRC_URI[rust-std-snapshot-powerpc64.sha256sum] = "4aa7b7e80a5c45825f01aee96a88c5bcd56317c66298c4bd4ce99c80095e492e" +SRC_URI[rustc-snapshot-powerpc64.sha256sum] = "f1863c033fa88ebb9628f38988da54fadd16075b06765dc93abcd8b4f58f557b" -SRC_URI[cargo-snapshot-powerpc.sha256sum] = "38d0a67429bbbe5e56ba30110c77d8dab3ebe96f8159de1d973da74e5bcbbc71" -SRC_URI[rust-std-snapshot-powerpc.sha256sum] = "fac6cc57d8a922423db2f0239b8484df3b029d0b58a63676868de682680bbf87" -SRC_URI[rustc-snapshot-powerpc.sha256sum] = "1961433bbe12e84f2a01daa713779cb4a3fc53b856447047efee3ad02e596164" +SRC_URI[cargo-snapshot-powerpc64le.sha256sum] = "f659bf3ab70c376c736b7d7112d1fcee32a56dbfa66f6ef4fc039652f66c99e7" +SRC_URI[rust-std-snapshot-powerpc64le.sha256sum] = "b6ef684ebf77063dbc1ff0abfe1316651fa73bbb95b023255b301b415867ff8b" +SRC_URI[rustc-snapshot-powerpc64le.sha256sum] = "20ed9ec0599e6582a218dae544566ddf7e2af46341705f35de874c90d7eecc0c" -SRC_URI[cargo-snapshot-powerpc64.sha256sum] = "a8f7d55c8e17db9737fad863b0b9327d79acf2baad2159d099b6d79e40ae79a5" -SRC_URI[rust-std-snapshot-powerpc64.sha256sum] = "628957fbe1f8665578167c6814486941f7b04417dce8a499cababa3284a2260a" -SRC_URI[rustc-snapshot-powerpc64.sha256sum] = "0b14c621f0144d454fbe6093a31171e91163ea2a566092f35364817f5c77a96b" +SRC_URI[cargo-snapshot-riscv64gc.sha256sum] = "43c89f16832e16fff0b2c51b953c8295db97bc5623cb1bf0164d992a7f29af03" +SRC_URI[rust-std-snapshot-riscv64gc.sha256sum] = "0208dd644f6e266cc7c07695889f1280e04be06672cb172a401a444b54ffa9e9" +SRC_URI[rustc-snapshot-riscv64gc.sha256sum] = "3a5a1dddf679720fec5c7af9e38f3ed5d7fe134c430458fae98f116da01becf6" -SRC_URI[cargo-snapshot-powerpc64le.sha256sum] = "9e6e184ad1836f52e5863b6ed72619926bb2e8c7ccf2b3c96bf86d7783f19673" -SRC_URI[rust-std-snapshot-powerpc64le.sha256sum] = "3ce73e032232522cd7c37e64b1e8895f16ddcef02b1646d078f67bb36b6c1494" -SRC_URI[rustc-snapshot-powerpc64le.sha256sum] = "9c4e3d5740e48265ab59888090013793777a526ecf5541c0fb055f9f0a13f409" +SRC_URI[cargo-snapshot-s390x.sha256sum] = "f2ce1bfc373efe162ca5b8ccfdb366dd526710fac305c61ed0b582b9185d68e9" +SRC_URI[rust-std-snapshot-s390x.sha256sum] = "9ebe880ea998fc13d3ed9cbe71d26c69dd93859be8a8e582a8ddc5393400d4e5" +SRC_URI[rustc-snapshot-s390x.sha256sum] = "41a958bc4313fb0c0446376c84476818820cfe75937675a9594823b63dc9e219" -SRC_URI[cargo-snapshot-riscv64gc.sha256sum] = "bb78d8d09c8bb34d47a11276bc5566565a1dd075e1a5f4388347c767ba2b06a2" -SRC_URI[rust-std-snapshot-riscv64gc.sha256sum] = "bf692cee46d6c04c3993795633fdc5d4c1dffa7e4d4924227fa3e044872440a4" -SRC_URI[rustc-snapshot-riscv64gc.sha256sum] = "1941967619e0a3b6b8d6c3175bd5530c8b1bf30a7044c071f1b1808a56532ea7" +SRC_URI[cargo-snapshot-x86_64.sha256sum] = "4a401dfe7b3056dc0d42acbcd380b2b90f936577706ca74ef5327af0f5abd0a0" +SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "36f27513a6e4381f15b0cd14097c885af537f990cb6193cec3337c429367bf23" +SRC_URI[rustc-snapshot-x86_64.sha256sum] = "5b5d7854a0d73368f15146c1aa47e4dbccf12762c93282f410a09a605929ce09" -SRC_URI[cargo-snapshot-s390x.sha256sum] = "6ab6597d7e42e7a94246ec6679b6a5479e95ca84e76cc952544514ff901da605" -SRC_URI[rust-std-snapshot-s390x.sha256sum] = "4ceab97a7c15e1235aa099306798e1eb8620aad5477b7123dc9e343bb9a6fcfe" -SRC_URI[rustc-snapshot-s390x.sha256sum] = "b94e7db76f3a0b13b8bc6f51f65f3a66ac3694ab2cf63b03c3f56ba6e7cce841" +SRC_URI[rust-std-snapshot-i586.sha256sum] = "57df2bdcfb659cb34bcb199400e84eb09d564fc390e5f8d3b011a15955241266" -SRC_URI[cargo-snapshot-x86_64.sha256sum] = "fe6fb520f59966300ee661d18b37c36cb3e614877c4c01dfedf987b8a9c577e9" -SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "98ae6530c3a41167e9d93d11ea078be98a02f6d809a06d0d51af3ce0f73150d7" -SRC_URI[rustc-snapshot-x86_64.sha256sum] = "c293d906769671d1cd18e945671bbd14e0b8a41df5075c47f33e6086fc8a1558" - -SRC_URI[rust-std-snapshot-i586.sha256sum] = "5878f641f4e5a12ced79d2f0d5d9a9d5b0b97b56967684cf09357162c3e6a7b7" - -SRC_URI[rust-std-snapshot-sparc64.sha256sum] = "679ef3ee4a3876f071e08539734de2fabfcc3410977e8c20ba685bc9f40a693b" +SRC_URI[rust-std-snapshot-sparc64.sha256sum] = "b39c5d31ad61c5670a09dc4c8020f888e9b5be2dd0deec90899a7ed14b759488" SRC_URI += " \ ${RUST_DIST_SERVER}/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${RUST_BUILD_ARCH};subdir=rust-snapshot-components \ diff --git a/meta/recipes-devtools/rust/rust-source.inc b/meta/recipes-devtools/rust/rust-source.inc index ca3fcf9e88..c2a64c061a 100644 --- a/meta/recipes-devtools/rust/rust-source.inc +++ b/meta/recipes-devtools/rust/rust-source.inc @@ -7,7 +7,7 @@ SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n file://0001-musl-Define-SOCK_SEQPACKET-in-common-place.patch;patchdir=${RUSTSRC} \ file://0001-Revert-Map-source-absolute-paths-to-OUT_DIR-as-relat.patch;patchdir=${RUSTSRC} \ " -SRC_URI[rust.sha256sum] = "aea58d962ff1c19521b9f587aad88285f0fd35b6b6738b031a7a15bb1b70a7c3" +SRC_URI[rust.sha256sum] = "6eaf672dbea2e6596af8c999f5e6924b9af4bb8b02166bfe0b928e68aa75ae62" RUSTSRC = "${WORKDIR}/rustc-${RUST_VERSION}-src" diff --git a/meta/recipes-devtools/rust/rust_1.72.1.bb b/meta/recipes-devtools/rust/rust_1.72.1.bb deleted file mode 100644 index bc076997de..0000000000 --- a/meta/recipes-devtools/rust/rust_1.72.1.bb +++ /dev/null @@ -1,360 +0,0 @@ -SUMMARY = "Rust compiler and runtime libaries" -HOMEPAGE = "http://www.rust-lang.org" -SECTION = "devel" -LICENSE = "(MIT | Apache-2.0) & Unicode-TOU" -LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=c2cccf560306876da3913d79062a54b9" - -inherit rust -inherit cargo_common - -DEPENDS += "file-native python3-native" -DEPENDS:append:class-native = " rust-llvm-native" -DEPENDS:append:class-nativesdk = " nativesdk-rust-llvm" - -DEPENDS += "rust-llvm (=${PV})" - -RDEPENDS:${PN}:append:class-target = " gcc g++ binutils" - -# 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" - -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" -RUST_ALTERNATE_EXE_PATH_NATIVE = "${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config" - -# We don't want to use bitbakes vendoring because the rust sources do their -# own vendoring. -CARGO_DISABLE_BITBAKE_VENDORING = "1" - -# We can't use RUST_BUILD_SYS here because that may be "musl" if -# TCLIBC="musl". Snapshots are always -unknown-linux-gnu -setup_cargo_environment () { - # The first step is to build bootstrap and some early stage tools, - # these are build for the same target as the snapshot, e.g. - # x86_64-unknown-linux-gnu. - # Later stages are build for the native target (i.e. target.x86_64-linux) - cargo_common_do_configure -} - -inherit rust-target-config - -do_rust_setup_snapshot () { - for installer in "${WORKDIR}/rust-snapshot-components/"*"/install.sh"; do - "${installer}" --prefix="${WORKDIR}/rust-snapshot" --disable-ldconfig - done - - # Some versions of rust (e.g. 1.18.0) tries to find cargo in stage0/bin/cargo - # and fail without it there. - mkdir -p ${RUSTSRC}/build/${BUILD_SYS} - ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${BUILD_SYS}/stage0 - - # Need to use uninative's loader if enabled/present since the library paths - # are used internally by rust and result in symbol mismatches if we don't - if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then - for bin in cargo rustc rustdoc; do - patchelf-uninative ${WORKDIR}/rust-snapshot/bin/$bin --set-interpreter ${UNINATIVE_LOADER} - done - fi -} -addtask rust_setup_snapshot after do_unpack before do_configure -addtask do_test_compile after do_configure do_rust_gen_targets -do_rust_setup_snapshot[dirs] += "${WORKDIR}/rust-snapshot" -do_rust_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER" - -python do_configure() { - import json - import configparser - - # toml is rather similar to standard ini like format except it likes values - # that look more JSON like. So for our purposes simply escaping all values - # as JSON seem to work fine. - - e = lambda s: json.dumps(s) - - config = configparser.RawConfigParser() - - # [target.ARCH-poky-linux] - host_section = "target.{}".format(d.getVar('RUST_HOST_SYS')) - config.add_section(host_section) - - llvm_config_target = d.expand("${RUST_ALTERNATE_EXE_PATH}") - llvm_config_build = d.expand("${RUST_ALTERNATE_EXE_PATH_NATIVE}") - config.set(host_section, "llvm-config", e(llvm_config_target)) - - config.set(host_section, "cxx", e(d.expand("${RUST_TARGET_CXX}"))) - config.set(host_section, "cc", e(d.expand("${RUST_TARGET_CC}"))) - config.set(host_section, "linker", e(d.expand("${RUST_TARGET_CCLD}"))) - if "musl" in host_section: - config.set(host_section, "musl-root", e(d.expand("${STAGING_DIR_HOST}${exec_prefix}"))) - - # If we don't do this rust-native will compile it's own llvm for BUILD. - # [target.${BUILD_ARCH}-unknown-linux-gnu] - build_section = "target.{}".format(d.getVar('RUST_BUILD_SYS')) - if build_section != host_section: - config.add_section(build_section) - - config.set(build_section, "llvm-config", e(llvm_config_build)) - - config.set(build_section, "cxx", e(d.expand("${RUST_BUILD_CXX}"))) - config.set(build_section, "cc", e(d.expand("${RUST_BUILD_CC}"))) - config.set(build_section, "linker", e(d.expand("${RUST_BUILD_CCLD}"))) - - target_section = "target.{}".format(d.getVar('RUST_TARGET_SYS')) - if target_section != host_section and target_section != build_section: - config.add_section(target_section) - - config.set(target_section, "llvm-config", e(llvm_config_target)) - - config.set(target_section, "cxx", e(d.expand("${RUST_TARGET_CXX}"))) - config.set(target_section, "cc", e(d.expand("${RUST_TARGET_CC}"))) - config.set(target_section, "linker", e(d.expand("${RUST_TARGET_CCLD}"))) - - # [llvm] - config.add_section("llvm") - config.set("llvm", "static-libstdcpp", e(False)) - if "llvm" in (d.getVar('TC_CXX_RUNTIME') or ""): - config.set("llvm", "use-libcxx", e(True)) - - # [rust] - config.add_section("rust") - config.set("rust", "rpath", e(True)) - config.set("rust", "remap-debuginfo", e(True)) - 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)) - - # Emits extraneous output from tests to ensure that failures of the test - # harness are debuggable just from logfiles - config.set("rust", "verbose-tests", e(True)) - - # [build] - config.add_section("build") - config.set("build", "submodules", e(False)) - config.set("build", "docs", e(False)) - config.set("build", "tools", ["rust-demangler",]) - - rustc = d.expand("${WORKDIR}/rust-snapshot/bin/rustc") - config.set("build", "rustc", e(rustc)) - - # Support for the profiler runtime to generate e.g. coverage report, - # PGO etc. - config.set("build", "profiler", e(False)) - - cargo = d.expand("${WORKDIR}/rust-snapshot/bin/cargo") - config.set("build", "cargo", e(cargo)) - - config.set("build", "vendor", e(True)) - - config.set("build", "target", e([d.getVar("RUST_TARGET_SYS")])) - - config.set("build", "host", e([d.getVar("RUST_HOST_SYS")])) - - # We can't use BUILD_SYS since that is something the rust snapshot knows - # nothing about when trying to build some stage0 tools (like fabricate) - config.set("build", "build", e(d.getVar("RUST_BUILD_SYS"))) - - # [install] - config.add_section("install") - # ./x.py install doesn't have any notion of "destdir" - # but we can prepend ${D} to all the directories instead - config.set("install", "prefix", e(d.getVar("D") + d.getVar("prefix"))) - config.set("install", "bindir", e(d.getVar("D") + d.getVar("bindir"))) - config.set("install", "libdir", e(d.getVar("D") + d.getVar("libdir"))) - config.set("install", "datadir", e(d.getVar("D") + d.getVar("datadir"))) - config.set("install", "mandir", e(d.getVar("D") + d.getVar("mandir"))) - - with open("config.toml", "w") as f: - f.write('changelog-seen = 2\n\n') - config.write(f) - - # set up ${WORKDIR}/cargo_home - bb.build.exec_func("setup_cargo_environment", d) -} - -rust_runx () { - echo "COMPILE ${PN}" "$@" - - # 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 - # be inappropriate, avoid using. - unset CFLAGS - unset LDFLAGS - unset CXXFLAGS - unset CPPFLAGS - - export RUSTFLAGS="${RUST_DEBUG_REMAP}" - - # Copy the natively built llvm-config into the target so we can run it. Horrible, - # but works! - if [ ${RUST_ALTERNATE_EXE_PATH_NATIVE} != ${RUST_ALTERNATE_EXE_PATH} -a ! -f ${RUST_ALTERNATE_EXE_PATH} ]; then - mkdir -p `dirname ${RUST_ALTERNATE_EXE_PATH}` - cp ${RUST_ALTERNATE_EXE_PATH_NATIVE} ${RUST_ALTERNATE_EXE_PATH} - chrpath -d ${RUST_ALTERNATE_EXE_PATH} - fi - - oe_cargo_fix_env - - python3 src/bootstrap/bootstrap.py ${@oe.utils.parallel_make_argument(d, '-j %d')} "$@" --verbose -} -rust_runx[vardepsexclude] += "PARALLEL_MAKE" - -require rust-source.inc -require rust-snapshot.inc - -INSANE_SKIP:${PN}:class-native = "already-stripped" -FILES:${PN} += "${libdir}/rustlib" -FILES:${PN} += "${libdir}/*.so" -FILES:${PN}-dev = "" - -do_compile () { -} - -do_test_compile[dirs] = "${B}" -do_test_compile () { - rust_runx build src/tools/remote-test-server --target "${RUST_TARGET_SYS}" -} - -ALLOW_EMPTY:${PN} = "1" - -PACKAGES =+ "${PN}-rustdoc ${PN}-tools-clippy ${PN}-tools-rustfmt" -FILES:${PN}-rustdoc = "${bindir}/rustdoc" -FILES:${PN}-tools-clippy = "${bindir}/cargo-clippy ${bindir}/clippy-driver" -FILES:${PN}-tools-rustfmt = "${bindir}/rustfmt" -RDEPENDS:${PN}-rustdoc = "${PN}" -RDEPENDS:${PN}-tools-clippy = "${PN}" -RDEPENDS:${PN}-tools-rustfmt = "${PN}" - -SUMMARY:${PN}-tools-clippy = "A collection of lints to catch common mistakes and improve your Rust code" -SUMMARY:${PN}-tools-rustfmt = "A tool for formatting Rust code according to style guidelines" - -do_install () { - rust_do_install -} - -rust_do_install() { - rust_runx install -} - -rust_do_install:class-nativesdk() { - export PSEUDO_UNLOAD=1 - rust_runx install - rust_runx install clippy - rust_runx install rustfmt - unset PSEUDO_UNLOAD - - install -d ${D}${bindir} - for i in cargo-clippy clippy-driver rustfmt; do - cp build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/$i ${D}${bindir} - chrpath -r "\$ORIGIN/../lib" ${D}${bindir}/$i - done - - chown root:root ${D}/ -R - rm ${D}${libdir}/rustlib/uninstall.sh - rm ${D}${libdir}/rustlib/install.log - rm ${D}${libdir}/rustlib/manifest* -} - -EXTRA_TOOLS ?= "cargo-clippy clippy-driver rustfmt" -rust_do_install:class-target() { - export PSEUDO_UNLOAD=1 - rust_runx install - rust_runx install clippy - rust_runx install rustfmt - unset PSEUDO_UNLOAD - - install -d ${D}${bindir} - for i in ${EXTRA_TOOLS}; do - cp build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/$i ${D}${bindir} - chrpath -r "\$ORIGIN/../lib" ${D}${bindir}/$i - done - - install -d ${D}${libdir}/rustlib/${RUST_HOST_SYS} - install -m 0644 ${WORKDIR}/rust-targets/${RUST_HOST_SYS}.json ${D}${libdir}/rustlib/${RUST_HOST_SYS}/target.json - - chown root:root ${D}/ -R - rm ${D}${libdir}/rustlib/uninstall.sh - rm ${D}${libdir}/rustlib/install.log - rm ${D}${libdir}/rustlib/manifest* -} - -addtask do_update_snapshot after do_patch -do_update_snapshot[nostamp] = "1" - -# Run with `bitbake -c update_snapshot rust` to update `rust-snapshot.inc` -# with the checksums for the rust snapshot associated with this rustc-src -# tarball. -python do_update_snapshot() { - import json - import re - import sys - - from collections import defaultdict - - with open(os.path.join(d.getVar("S"), "src", "stage0.json")) as f: - j = json.load(f) - - config_dist_server = j['config']['dist_server'] - compiler_date = j['compiler']['date'] - compiler_version = j['compiler']['version'] - - src_uri = defaultdict(list) - for k, v in j['checksums_sha256'].items(): - m = re.search(f"dist/{compiler_date}/(?P.*)-{compiler_version}-(?P.*)-unknown-linux-gnu\\.tar\\.xz", k) - if m: - component = m.group('component') - arch = m.group('arch') - src_uri[arch].append(f"SRC_URI[{component}-snapshot-{arch}.sha256sum] = \"{v}\"") - - snapshot = """\ -## This is information on the rust-snapshot (binary) used to build our current release. -## snapshot info is taken from rust/src/stage0.json -## Rust is self-hosting and bootstraps itself with a pre-built previous version of itself. -## The exact (previous) version that has been used is specified in the source tarball. -## The version is replicated here. - -SNAPSHOT_VERSION = "%s" - -""" % compiler_version - - for arch, components in src_uri.items(): - snapshot += "\n".join(components) + "\n\n" - - snapshot += """\ -SRC_URI += " \\ - ${RUST_DIST_SERVER}/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${RUST_BUILD_ARCH};subdir=rust-snapshot-components \\ - ${RUST_DIST_SERVER}/dist/${RUSTC_SNAPSHOT}.tar.xz;name=rustc-snapshot-${RUST_BUILD_ARCH};subdir=rust-snapshot-components \\ - ${RUST_DIST_SERVER}/dist/${CARGO_SNAPSHOT}.tar.xz;name=cargo-snapshot-${RUST_BUILD_ARCH};subdir=rust-snapshot-components \\ -" - -RUST_DIST_SERVER = "%s" - -RUST_STD_SNAPSHOT = "rust-std-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu" -RUSTC_SNAPSHOT = "rustc-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu" -CARGO_SNAPSHOT = "cargo-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu" -""" % config_dist_server - - with open(os.path.join(d.getVar("THISDIR"), "rust-snapshot.inc"), "w") as f: - f.write(snapshot) -} - -RUSTLIB_DEP:class-nativesdk = "" - -# musl builds include libunwind.a -INSANE_SKIP:${PN} = "staticdev" - -BBCLASSEXTEND = "native nativesdk" - -# Since 1.70.0 upgrade this fails to build with gold: -# http://errors.yoctoproject.org/Errors/Details/708196/ -# ld: error: version script assignment of to symbol __rust_alloc_error_handler_should_panic failed: symbol not defined -LDFLAGS:append = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd', '', d)}" diff --git a/meta/recipes-devtools/rust/rust_1.73.0.bb b/meta/recipes-devtools/rust/rust_1.73.0.bb new file mode 100644 index 0000000000..bc076997de --- /dev/null +++ b/meta/recipes-devtools/rust/rust_1.73.0.bb @@ -0,0 +1,360 @@ +SUMMARY = "Rust compiler and runtime libaries" +HOMEPAGE = "http://www.rust-lang.org" +SECTION = "devel" +LICENSE = "(MIT | Apache-2.0) & Unicode-TOU" +LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=c2cccf560306876da3913d79062a54b9" + +inherit rust +inherit cargo_common + +DEPENDS += "file-native python3-native" +DEPENDS:append:class-native = " rust-llvm-native" +DEPENDS:append:class-nativesdk = " nativesdk-rust-llvm" + +DEPENDS += "rust-llvm (=${PV})" + +RDEPENDS:${PN}:append:class-target = " gcc g++ binutils" + +# 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" + +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" +RUST_ALTERNATE_EXE_PATH_NATIVE = "${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config" + +# We don't want to use bitbakes vendoring because the rust sources do their +# own vendoring. +CARGO_DISABLE_BITBAKE_VENDORING = "1" + +# We can't use RUST_BUILD_SYS here because that may be "musl" if +# TCLIBC="musl". Snapshots are always -unknown-linux-gnu +setup_cargo_environment () { + # The first step is to build bootstrap and some early stage tools, + # these are build for the same target as the snapshot, e.g. + # x86_64-unknown-linux-gnu. + # Later stages are build for the native target (i.e. target.x86_64-linux) + cargo_common_do_configure +} + +inherit rust-target-config + +do_rust_setup_snapshot () { + for installer in "${WORKDIR}/rust-snapshot-components/"*"/install.sh"; do + "${installer}" --prefix="${WORKDIR}/rust-snapshot" --disable-ldconfig + done + + # Some versions of rust (e.g. 1.18.0) tries to find cargo in stage0/bin/cargo + # and fail without it there. + mkdir -p ${RUSTSRC}/build/${BUILD_SYS} + ln -sf ${WORKDIR}/rust-snapshot/ ${RUSTSRC}/build/${BUILD_SYS}/stage0 + + # Need to use uninative's loader if enabled/present since the library paths + # are used internally by rust and result in symbol mismatches if we don't + if [ ! -z "${UNINATIVE_LOADER}" -a -e "${UNINATIVE_LOADER}" ]; then + for bin in cargo rustc rustdoc; do + patchelf-uninative ${WORKDIR}/rust-snapshot/bin/$bin --set-interpreter ${UNINATIVE_LOADER} + done + fi +} +addtask rust_setup_snapshot after do_unpack before do_configure +addtask do_test_compile after do_configure do_rust_gen_targets +do_rust_setup_snapshot[dirs] += "${WORKDIR}/rust-snapshot" +do_rust_setup_snapshot[vardepsexclude] += "UNINATIVE_LOADER" + +python do_configure() { + import json + import configparser + + # toml is rather similar to standard ini like format except it likes values + # that look more JSON like. So for our purposes simply escaping all values + # as JSON seem to work fine. + + e = lambda s: json.dumps(s) + + config = configparser.RawConfigParser() + + # [target.ARCH-poky-linux] + host_section = "target.{}".format(d.getVar('RUST_HOST_SYS')) + config.add_section(host_section) + + llvm_config_target = d.expand("${RUST_ALTERNATE_EXE_PATH}") + llvm_config_build = d.expand("${RUST_ALTERNATE_EXE_PATH_NATIVE}") + config.set(host_section, "llvm-config", e(llvm_config_target)) + + config.set(host_section, "cxx", e(d.expand("${RUST_TARGET_CXX}"))) + config.set(host_section, "cc", e(d.expand("${RUST_TARGET_CC}"))) + config.set(host_section, "linker", e(d.expand("${RUST_TARGET_CCLD}"))) + if "musl" in host_section: + config.set(host_section, "musl-root", e(d.expand("${STAGING_DIR_HOST}${exec_prefix}"))) + + # If we don't do this rust-native will compile it's own llvm for BUILD. + # [target.${BUILD_ARCH}-unknown-linux-gnu] + build_section = "target.{}".format(d.getVar('RUST_BUILD_SYS')) + if build_section != host_section: + config.add_section(build_section) + + config.set(build_section, "llvm-config", e(llvm_config_build)) + + config.set(build_section, "cxx", e(d.expand("${RUST_BUILD_CXX}"))) + config.set(build_section, "cc", e(d.expand("${RUST_BUILD_CC}"))) + config.set(build_section, "linker", e(d.expand("${RUST_BUILD_CCLD}"))) + + target_section = "target.{}".format(d.getVar('RUST_TARGET_SYS')) + if target_section != host_section and target_section != build_section: + config.add_section(target_section) + + config.set(target_section, "llvm-config", e(llvm_config_target)) + + config.set(target_section, "cxx", e(d.expand("${RUST_TARGET_CXX}"))) + config.set(target_section, "cc", e(d.expand("${RUST_TARGET_CC}"))) + config.set(target_section, "linker", e(d.expand("${RUST_TARGET_CCLD}"))) + + # [llvm] + config.add_section("llvm") + config.set("llvm", "static-libstdcpp", e(False)) + if "llvm" in (d.getVar('TC_CXX_RUNTIME') or ""): + config.set("llvm", "use-libcxx", e(True)) + + # [rust] + config.add_section("rust") + config.set("rust", "rpath", e(True)) + config.set("rust", "remap-debuginfo", e(True)) + 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)) + + # Emits extraneous output from tests to ensure that failures of the test + # harness are debuggable just from logfiles + config.set("rust", "verbose-tests", e(True)) + + # [build] + config.add_section("build") + config.set("build", "submodules", e(False)) + config.set("build", "docs", e(False)) + config.set("build", "tools", ["rust-demangler",]) + + rustc = d.expand("${WORKDIR}/rust-snapshot/bin/rustc") + config.set("build", "rustc", e(rustc)) + + # Support for the profiler runtime to generate e.g. coverage report, + # PGO etc. + config.set("build", "profiler", e(False)) + + cargo = d.expand("${WORKDIR}/rust-snapshot/bin/cargo") + config.set("build", "cargo", e(cargo)) + + config.set("build", "vendor", e(True)) + + config.set("build", "target", e([d.getVar("RUST_TARGET_SYS")])) + + config.set("build", "host", e([d.getVar("RUST_HOST_SYS")])) + + # We can't use BUILD_SYS since that is something the rust snapshot knows + # nothing about when trying to build some stage0 tools (like fabricate) + config.set("build", "build", e(d.getVar("RUST_BUILD_SYS"))) + + # [install] + config.add_section("install") + # ./x.py install doesn't have any notion of "destdir" + # but we can prepend ${D} to all the directories instead + config.set("install", "prefix", e(d.getVar("D") + d.getVar("prefix"))) + config.set("install", "bindir", e(d.getVar("D") + d.getVar("bindir"))) + config.set("install", "libdir", e(d.getVar("D") + d.getVar("libdir"))) + config.set("install", "datadir", e(d.getVar("D") + d.getVar("datadir"))) + config.set("install", "mandir", e(d.getVar("D") + d.getVar("mandir"))) + + with open("config.toml", "w") as f: + f.write('changelog-seen = 2\n\n') + config.write(f) + + # set up ${WORKDIR}/cargo_home + bb.build.exec_func("setup_cargo_environment", d) +} + +rust_runx () { + echo "COMPILE ${PN}" "$@" + + # 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 + # be inappropriate, avoid using. + unset CFLAGS + unset LDFLAGS + unset CXXFLAGS + unset CPPFLAGS + + export RUSTFLAGS="${RUST_DEBUG_REMAP}" + + # Copy the natively built llvm-config into the target so we can run it. Horrible, + # but works! + if [ ${RUST_ALTERNATE_EXE_PATH_NATIVE} != ${RUST_ALTERNATE_EXE_PATH} -a ! -f ${RUST_ALTERNATE_EXE_PATH} ]; then + mkdir -p `dirname ${RUST_ALTERNATE_EXE_PATH}` + cp ${RUST_ALTERNATE_EXE_PATH_NATIVE} ${RUST_ALTERNATE_EXE_PATH} + chrpath -d ${RUST_ALTERNATE_EXE_PATH} + fi + + oe_cargo_fix_env + + python3 src/bootstrap/bootstrap.py ${@oe.utils.parallel_make_argument(d, '-j %d')} "$@" --verbose +} +rust_runx[vardepsexclude] += "PARALLEL_MAKE" + +require rust-source.inc +require rust-snapshot.inc + +INSANE_SKIP:${PN}:class-native = "already-stripped" +FILES:${PN} += "${libdir}/rustlib" +FILES:${PN} += "${libdir}/*.so" +FILES:${PN}-dev = "" + +do_compile () { +} + +do_test_compile[dirs] = "${B}" +do_test_compile () { + rust_runx build src/tools/remote-test-server --target "${RUST_TARGET_SYS}" +} + +ALLOW_EMPTY:${PN} = "1" + +PACKAGES =+ "${PN}-rustdoc ${PN}-tools-clippy ${PN}-tools-rustfmt" +FILES:${PN}-rustdoc = "${bindir}/rustdoc" +FILES:${PN}-tools-clippy = "${bindir}/cargo-clippy ${bindir}/clippy-driver" +FILES:${PN}-tools-rustfmt = "${bindir}/rustfmt" +RDEPENDS:${PN}-rustdoc = "${PN}" +RDEPENDS:${PN}-tools-clippy = "${PN}" +RDEPENDS:${PN}-tools-rustfmt = "${PN}" + +SUMMARY:${PN}-tools-clippy = "A collection of lints to catch common mistakes and improve your Rust code" +SUMMARY:${PN}-tools-rustfmt = "A tool for formatting Rust code according to style guidelines" + +do_install () { + rust_do_install +} + +rust_do_install() { + rust_runx install +} + +rust_do_install:class-nativesdk() { + export PSEUDO_UNLOAD=1 + rust_runx install + rust_runx install clippy + rust_runx install rustfmt + unset PSEUDO_UNLOAD + + install -d ${D}${bindir} + for i in cargo-clippy clippy-driver rustfmt; do + cp build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/$i ${D}${bindir} + chrpath -r "\$ORIGIN/../lib" ${D}${bindir}/$i + done + + chown root:root ${D}/ -R + rm ${D}${libdir}/rustlib/uninstall.sh + rm ${D}${libdir}/rustlib/install.log + rm ${D}${libdir}/rustlib/manifest* +} + +EXTRA_TOOLS ?= "cargo-clippy clippy-driver rustfmt" +rust_do_install:class-target() { + export PSEUDO_UNLOAD=1 + rust_runx install + rust_runx install clippy + rust_runx install rustfmt + unset PSEUDO_UNLOAD + + install -d ${D}${bindir} + for i in ${EXTRA_TOOLS}; do + cp build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/$i ${D}${bindir} + chrpath -r "\$ORIGIN/../lib" ${D}${bindir}/$i + done + + install -d ${D}${libdir}/rustlib/${RUST_HOST_SYS} + install -m 0644 ${WORKDIR}/rust-targets/${RUST_HOST_SYS}.json ${D}${libdir}/rustlib/${RUST_HOST_SYS}/target.json + + chown root:root ${D}/ -R + rm ${D}${libdir}/rustlib/uninstall.sh + rm ${D}${libdir}/rustlib/install.log + rm ${D}${libdir}/rustlib/manifest* +} + +addtask do_update_snapshot after do_patch +do_update_snapshot[nostamp] = "1" + +# Run with `bitbake -c update_snapshot rust` to update `rust-snapshot.inc` +# with the checksums for the rust snapshot associated with this rustc-src +# tarball. +python do_update_snapshot() { + import json + import re + import sys + + from collections import defaultdict + + with open(os.path.join(d.getVar("S"), "src", "stage0.json")) as f: + j = json.load(f) + + config_dist_server = j['config']['dist_server'] + compiler_date = j['compiler']['date'] + compiler_version = j['compiler']['version'] + + src_uri = defaultdict(list) + for k, v in j['checksums_sha256'].items(): + m = re.search(f"dist/{compiler_date}/(?P.*)-{compiler_version}-(?P.*)-unknown-linux-gnu\\.tar\\.xz", k) + if m: + component = m.group('component') + arch = m.group('arch') + src_uri[arch].append(f"SRC_URI[{component}-snapshot-{arch}.sha256sum] = \"{v}\"") + + snapshot = """\ +## This is information on the rust-snapshot (binary) used to build our current release. +## snapshot info is taken from rust/src/stage0.json +## Rust is self-hosting and bootstraps itself with a pre-built previous version of itself. +## The exact (previous) version that has been used is specified in the source tarball. +## The version is replicated here. + +SNAPSHOT_VERSION = "%s" + +""" % compiler_version + + for arch, components in src_uri.items(): + snapshot += "\n".join(components) + "\n\n" + + snapshot += """\ +SRC_URI += " \\ + ${RUST_DIST_SERVER}/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${RUST_BUILD_ARCH};subdir=rust-snapshot-components \\ + ${RUST_DIST_SERVER}/dist/${RUSTC_SNAPSHOT}.tar.xz;name=rustc-snapshot-${RUST_BUILD_ARCH};subdir=rust-snapshot-components \\ + ${RUST_DIST_SERVER}/dist/${CARGO_SNAPSHOT}.tar.xz;name=cargo-snapshot-${RUST_BUILD_ARCH};subdir=rust-snapshot-components \\ +" + +RUST_DIST_SERVER = "%s" + +RUST_STD_SNAPSHOT = "rust-std-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu" +RUSTC_SNAPSHOT = "rustc-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu" +CARGO_SNAPSHOT = "cargo-${SNAPSHOT_VERSION}-${RUST_BUILD_ARCH}-unknown-linux-gnu" +""" % config_dist_server + + with open(os.path.join(d.getVar("THISDIR"), "rust-snapshot.inc"), "w") as f: + f.write(snapshot) +} + +RUSTLIB_DEP:class-nativesdk = "" + +# musl builds include libunwind.a +INSANE_SKIP:${PN} = "staticdev" + +BBCLASSEXTEND = "native nativesdk" + +# Since 1.70.0 upgrade this fails to build with gold: +# http://errors.yoctoproject.org/Errors/Details/708196/ +# ld: error: version script assignment of to symbol __rust_alloc_error_handler_should_panic failed: symbol not defined +LDFLAGS:append = "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', ' -fuse-ld=bfd', '', d)}" -- cgit v1.2.3-54-g00ecf