Initial commit
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
## Introduction
|
||||
|
||||
This provides the Rust compiler, tools for building packages (cargo), and
|
||||
a few example projects.
|
||||
|
||||
## 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. Once the Rust SDK support is added to oe-core, cargo-bitbake
|
||||
may also be added to the SDK.
|
||||
|
||||
NOTE: You will have to edit the generated recipe based on the comments
|
||||
contained within it
|
||||
|
||||
## Pitfalls
|
||||
|
||||
- TARGET_SYS _must_ be different from BUILD_SYS. This is due to the way Rust
|
||||
configuration options are tracked for different targets. This is the reason
|
||||
we use the Yocto triples instead of the native Rust triples. See rust-lang/cargo#3349.
|
||||
|
||||
## Dependencies
|
||||
|
||||
On the host:
|
||||
- Any `-sys` packages your project might need must have RDEPENDs for
|
||||
the native library.
|
||||
|
||||
On the target:
|
||||
- Any `-sys` packages your project might need must have RDEPENDs for
|
||||
the native library.
|
||||
|
||||
@@ -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=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
|
||||
|
||||
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"
|
||||
@@ -0,0 +1,164 @@
|
||||
From 3ecce665198e3420d70139d86ed22e74804c9379 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Wed, 28 Dec 2022 22:35:55 -0800
|
||||
Subject: [PATCH] Do not use LFS64 on linux with musl
|
||||
|
||||
glibc is providing open64 and other lfs64 functions but musl aliases
|
||||
them to normal equivalents since off_t is always 64-bit on musl,
|
||||
therefore check for target env along when target OS is linux before
|
||||
using open64, this is more available. Latest Musl has made these
|
||||
namespace changes [1]
|
||||
|
||||
[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4
|
||||
|
||||
Upstream-Status: Submitted [https://github.com/rust-lang/rust/pull/106246]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
library/std/src/os/linux/fs.rs | 9 ++++++++-
|
||||
library/std/src/sys/unix/fd.rs | 14 ++++++++++----
|
||||
library/std/src/sys/unix/fs.rs | 27 ++++++++++++++++++++-------
|
||||
3 files changed, 38 insertions(+), 12 deletions(-)
|
||||
|
||||
Index: rustc-1.70.0-src/library/std/src/os/linux/fs.rs
|
||||
===================================================================
|
||||
--- rustc-1.70.0-src.orig/library/std/src/os/linux/fs.rs
|
||||
+++ rustc-1.70.0-src/library/std/src/os/linux/fs.rs
|
||||
@@ -329,7 +329,14 @@ pub trait MetadataExt {
|
||||
impl MetadataExt for Metadata {
|
||||
#[allow(deprecated)]
|
||||
fn as_raw_stat(&self) -> &raw::stat {
|
||||
- unsafe { &*(self.as_inner().as_inner() as *const libc::stat64 as *const raw::stat) }
|
||||
+ #[cfg(target_env = "musl")]
|
||||
+ unsafe {
|
||||
+ &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat)
|
||||
+ }
|
||||
+ #[cfg(not(target_env = "musl"))]
|
||||
+ unsafe {
|
||||
+ &*(self.as_inner().as_inner() as *const libc::stat64 as *const raw::stat)
|
||||
+ }
|
||||
}
|
||||
fn st_dev(&self) -> u64 {
|
||||
self.as_inner().as_inner().st_dev as u64
|
||||
Index: rustc-1.70.0-src/library/std/src/sys/unix/fd.rs
|
||||
===================================================================
|
||||
--- rustc-1.70.0-src.orig/library/std/src/sys/unix/fd.rs
|
||||
+++ rustc-1.70.0-src/library/std/src/sys/unix/fd.rs
|
||||
@@ -121,9 +121,12 @@ impl FileDesc {
|
||||
}
|
||||
|
||||
pub fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result<usize> {
|
||||
- #[cfg(not(any(target_os = "linux", target_os = "android")))]
|
||||
+ #[cfg(not(any(
|
||||
+ all(target_os = "linux", not(target_env = "musl")),
|
||||
+ target_os = "android"
|
||||
+ )))]
|
||||
use libc::pread as pread64;
|
||||
- #[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
+ #[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "android"))]
|
||||
use libc::pread64;
|
||||
|
||||
unsafe {
|
||||
@@ -276,9 +279,12 @@ impl FileDesc {
|
||||
}
|
||||
|
||||
pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result<usize> {
|
||||
- #[cfg(not(any(target_os = "linux", target_os = "android")))]
|
||||
+ #[cfg(not(any(
|
||||
+ all(target_os = "linux", not(target_env = "musl")),
|
||||
+ target_os = "android"
|
||||
+ )))]
|
||||
use libc::pwrite as pwrite64;
|
||||
- #[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
+ #[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "android"))]
|
||||
use libc::pwrite64;
|
||||
|
||||
unsafe {
|
||||
Index: rustc-1.70.0-src/library/std/src/sys/unix/fs.rs
|
||||
===================================================================
|
||||
--- rustc-1.70.0-src.orig/library/std/src/sys/unix/fs.rs
|
||||
+++ rustc-1.70.0-src/library/std/src/sys/unix/fs.rs
|
||||
@@ -47,9 +47,13 @@ use libc::{c_int, mode_t};
|
||||
all(target_os = "linux", target_env = "gnu")
|
||||
))]
|
||||
use libc::c_char;
|
||||
-#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "android"))]
|
||||
+#[cfg(any(
|
||||
+ all(target_os = "linux", not(target_env = "musl")),
|
||||
+ target_os = "emscripten",
|
||||
+ target_os = "android"
|
||||
+))]
|
||||
use libc::dirfd;
|
||||
-#[cfg(any(target_os = "linux", target_os = "emscripten"))]
|
||||
+#[cfg(any(not(target_env = "musl"), target_os = "emscripten"))]
|
||||
use libc::fstatat64;
|
||||
#[cfg(any(
|
||||
target_os = "android",
|
||||
@@ -58,9 +62,10 @@ use libc::fstatat64;
|
||||
target_os = "redox",
|
||||
target_os = "illumos",
|
||||
target_os = "nto",
|
||||
+ target_env = "musl",
|
||||
))]
|
||||
use libc::readdir as readdir64;
|
||||
-#[cfg(target_os = "linux")]
|
||||
+#[cfg(all(target_os = "linux", not(target_env = "musl")))]
|
||||
use libc::readdir64;
|
||||
#[cfg(any(target_os = "emscripten", target_os = "l4re"))]
|
||||
use libc::readdir64_r;
|
||||
@@ -81,7 +86,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,
|
||||
};
|
||||
+#[cfg(target_env = "musl")]
|
||||
+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,
|
||||
+};
|
||||
#[cfg(not(any(
|
||||
+ target_env = "musl",
|
||||
target_os = "linux",
|
||||
target_os = "emscripten",
|
||||
target_os = "l4re",
|
||||
@@ -91,7 +102,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,
|
||||
};
|
||||
-#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "l4re"))]
|
||||
+#[cfg(any(not(target_env = "musl"), target_os = "emscripten", target_os = "l4re"))]
|
||||
use libc::{dirent64, fstat64, ftruncate64, lseek64, lstat64, off64_t, open64, stat64};
|
||||
|
||||
pub use crate::sys_common::fs::try_exists;
|
||||
@@ -278,6 +289,7 @@ unsafe impl Sync for Dir {}
|
||||
#[cfg(any(
|
||||
target_os = "android",
|
||||
target_os = "linux",
|
||||
+ not(target_env = "musl"),
|
||||
target_os = "solaris",
|
||||
target_os = "illumos",
|
||||
target_os = "fuchsia",
|
||||
@@ -312,6 +324,7 @@ struct dirent64_min {
|
||||
}
|
||||
|
||||
#[cfg(not(any(
|
||||
+ target_env = "musl",
|
||||
target_os = "android",
|
||||
target_os = "linux",
|
||||
target_os = "solaris",
|
||||
@@ -787,7 +800,7 @@ impl DirEntry {
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
- any(target_os = "linux", target_os = "emscripten", target_os = "android"),
|
||||
+ any(not(target_env = "musl"), target_os = "emscripten", target_os = "android"),
|
||||
not(miri)
|
||||
))]
|
||||
pub fn metadata(&self) -> io::Result<FileAttr> {
|
||||
@@ -811,7 +824,7 @@ impl DirEntry {
|
||||
}
|
||||
|
||||
#[cfg(any(
|
||||
- not(any(target_os = "linux", target_os = "emscripten", target_os = "android")),
|
||||
+ not(any(not(target_env = "musl"), target_os = "emscripten", target_os = "android")),
|
||||
miri
|
||||
))]
|
||||
pub fn metadata(&self) -> io::Result<FileAttr> {
|
||||
+114
File diff suppressed because one or more lines are too long
@@ -0,0 +1,46 @@
|
||||
Do not use open64 on linux with musl
|
||||
|
||||
glibc is providing open64 and other lfs64 functions but musl aliases
|
||||
them to normal equivalents since off_t is always 64-bit on musl,
|
||||
therefore check for target env along when target OS is linux before
|
||||
using open64, this is more available. Latest Musl has made these
|
||||
namespace changes [1]
|
||||
|
||||
There is no need for using LFS64 open explicitly as we are only using it
|
||||
for opening device files and not real files
|
||||
|
||||
[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4
|
||||
|
||||
Upstream-Status: Backport [https://github.com/rust-random/getrandom/commit/7f73e3ccc1f53bfc419e4ddcfd343766aa5837b6]
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
|
||||
--- a/vendor/getrandom/.cargo-checksum.json
|
||||
+++ b/vendor/getrandom/.cargo-checksum.json
|
||||
@@ -1 +1 @@
|
||||
-{"files":{"CHANGELOG.md":"cb054908f44d0e7f229dcc4580bcc4f2c3e2da198c84292710f730b33cc3d5f6","Cargo.toml":"708a5d9c89443b937aa50260e26a01f9ebfdd50a7ae312956795834e3187baf3","LICENSE-APACHE":"aaff376532ea30a0cd5330b9502ad4a4c8bf769c539c87ffe78819d188a18ebf","LICENSE-MIT":"209fbbe0ad52d9235e37badf9cadfe4dbdc87203179c0899e738b39ade42177b","README.md":"7ae74633326a22fd6298d7f209fb14884277bd98049795f444945acbb2b0dfbd","benches/mod.rs":"c01b05c6d690a4b8937d25252f1385a6bff378517318ce832ea520036aabd571","src/3ds.rs":"0f48fc15f89b518fb92e06aaa4838b62dc073598e8f288df56ad1e5a9251af1e","src/bsd_arandom.rs":"d90c419d4def20f83e7535cd3f5ec07035045011a50c3652951d196a120c5d3e","src/custom.rs":"ce4640776d36872dbbd5e194bf29f6bcda3ef4549ca04fe59f5aeab1dea1d821","src/dragonfly.rs":"47f933eac189f6ea48ecf021efd0747ebce1b43d1bece6bbf72a951bab705987","src/error.rs":"ff09a7e02d7aff3e45eca6bbef6c686cc46f3c2371a0897a856e4dec4b942e46","src/error_impls.rs":"9c34832ebb99cd5e31bc5c8ffc5beb5b3fa6f7ff0226aaa1cdf8e10e6d64b324","src/espidf.rs":"19f101486584fde6dad962f4d9792de168658047312106641a5caf6866a5bbcf","src/fuchsia.rs":"470d8509deb5b06fa6417f294c0a49e0e35a580249a5d8944c3be5aa746f64ea","src/ios.rs":"4bad4f5c096a50338b86aeac91a937c18bc55b9555e6f34806ad13732e64523d","src/js.rs":"370610a19045012c87c986279aad6b150cd728a44015dcc5779256e4a2e6629b","src/lib.rs":"8e5c2c8edcbdbf2cee46b86d96d951cc6d5c00f7c11cfc9c27de27e756b5c4cc","src/linux_android.rs":"ec24575aa4ae71b6991290dadfdea931b05397c3faababf24bd794f1a9624835","src/macos.rs":"6c09827ad5292cd022e063efa79523bfdb50ed08b9867ebaa007cd321b8d218e","src/openbsd.rs":"450a23ead462d4a840fee4aa0bfdab1e3d88c8f48e4bb608d457429ddeca69c0","src/rdrand.rs":"79d23183b1905d61bd9df9729dc798505a2ed750d3339e342ab144e1709827e4","src/solaris_illumos.rs":"d52fee9dd7d661f960c01894edd563c1ff8a512c111f7803092d9aa2ff98718e","src/solid.rs":"997035d54c9762d22a5a14f54e7fbed4dd266cdeacbdf6aab7d8aee05537e8ba","src/use_file.rs":"16e42eb0a56e375c330c1ca8eb58c444e82ef3ad35230b961fdba96a02a68804","src/util.rs":"da6964dc1523f1cb8d26365fa6a8ece46360587e6974931624b271f0c72cda8b","src/util_libc.rs":"2a63ac0e6dab16b85c4728b79a16e0640301e8b876f151b0a1db0b4394fa219f","src/vxworks.rs":"a5aa0e40f890e0f35626458bb656a3340b8af3111e4bacd2e12505a8d50a3505","src/wasi.rs":"dfdd0a870581948bd03abe64d49ca4295d9cfa26e09b97a526fd5e17148ad9ca","src/windows.rs":"d0b4f2afd1959660aa9abcd9477764bd7dc0b7d7048aee748804b37963c77c6f","tests/common/mod.rs":"b6beee8f535d2d094a65711fe0af91a6fc220aa09729ed7269fe33cafdc9177f","tests/custom.rs":"9f2c0193193f6bcf641116ca0b3653b33d2015e0e98ce107ee1d1f60c5eeae3a","tests/normal.rs":"9e1c4b1e468a09ed0225370dfb6608f8b8135e0fabb09bbc1a718105164aade6","tests/rdrand.rs":"4474ccebf9d33c89288862a7e367018405968dddc55c7c6f97e21b5fe2264601"},"package":"c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"}
|
||||
\ No newline at end of file
|
||||
+{"files":{"CHANGELOG.md":"cb054908f44d0e7f229dcc4580bcc4f2c3e2da198c84292710f730b33cc3d5f6","Cargo.toml":"708a5d9c89443b937aa50260e26a01f9ebfdd50a7ae312956795834e3187baf3","LICENSE-APACHE":"aaff376532ea30a0cd5330b9502ad4a4c8bf769c539c87ffe78819d188a18ebf","LICENSE-MIT":"209fbbe0ad52d9235e37badf9cadfe4dbdc87203179c0899e738b39ade42177b","README.md":"7ae74633326a22fd6298d7f209fb14884277bd98049795f444945acbb2b0dfbd","benches/mod.rs":"c01b05c6d690a4b8937d25252f1385a6bff378517318ce832ea520036aabd571","src/3ds.rs":"0f48fc15f89b518fb92e06aaa4838b62dc073598e8f288df56ad1e5a9251af1e","src/bsd_arandom.rs":"d90c419d4def20f83e7535cd3f5ec07035045011a50c3652951d196a120c5d3e","src/custom.rs":"ce4640776d36872dbbd5e194bf29f6bcda3ef4549ca04fe59f5aeab1dea1d821","src/dragonfly.rs":"47f933eac189f6ea48ecf021efd0747ebce1b43d1bece6bbf72a951bab705987","src/error.rs":"ff09a7e02d7aff3e45eca6bbef6c686cc46f3c2371a0897a856e4dec4b942e46","src/error_impls.rs":"9c34832ebb99cd5e31bc5c8ffc5beb5b3fa6f7ff0226aaa1cdf8e10e6d64b324","src/espidf.rs":"19f101486584fde6dad962f4d9792de168658047312106641a5caf6866a5bbcf","src/fuchsia.rs":"470d8509deb5b06fa6417f294c0a49e0e35a580249a5d8944c3be5aa746f64ea","src/ios.rs":"4bad4f5c096a50338b86aeac91a937c18bc55b9555e6f34806ad13732e64523d","src/js.rs":"370610a19045012c87c986279aad6b150cd728a44015dcc5779256e4a2e6629b","src/lib.rs":"8e5c2c8edcbdbf2cee46b86d96d951cc6d5c00f7c11cfc9c27de27e756b5c4cc","src/linux_android.rs":"ec24575aa4ae71b6991290dadfdea931b05397c3faababf24bd794f1a9624835","src/macos.rs":"6c09827ad5292cd022e063efa79523bfdb50ed08b9867ebaa007cd321b8d218e","src/openbsd.rs":"450a23ead462d4a840fee4aa0bfdab1e3d88c8f48e4bb608d457429ddeca69c0","src/rdrand.rs":"79d23183b1905d61bd9df9729dc798505a2ed750d3339e342ab144e1709827e4","src/solaris_illumos.rs":"d52fee9dd7d661f960c01894edd563c1ff8a512c111f7803092d9aa2ff98718e","src/solid.rs":"997035d54c9762d22a5a14f54e7fbed4dd266cdeacbdf6aab7d8aee05537e8ba","src/use_file.rs":"16e42eb0a56e375c330c1ca8eb58c444e82ef3ad35230b961fdba96a02a68804","src/util.rs":"da6964dc1523f1cb8d26365fa6a8ece46360587e6974931624b271f0c72cda8b","src/util_libc.rs":"a47b20e73637fed248405650f56358f3339e511b217b7ba80e32011d8ee2ca22","src/vxworks.rs":"a5aa0e40f890e0f35626458bb656a3340b8af3111e4bacd2e12505a8d50a3505","src/wasi.rs":"dfdd0a870581948bd03abe64d49ca4295d9cfa26e09b97a526fd5e17148ad9ca","src/windows.rs":"d0b4f2afd1959660aa9abcd9477764bd7dc0b7d7048aee748804b37963c77c6f","tests/common/mod.rs":"b6beee8f535d2d094a65711fe0af91a6fc220aa09729ed7269fe33cafdc9177f","tests/custom.rs":"9f2c0193193f6bcf641116ca0b3653b33d2015e0e98ce107ee1d1f60c5eeae3a","tests/normal.rs":"9e1c4b1e468a09ed0225370dfb6608f8b8135e0fabb09bbc1a718105164aade6","tests/rdrand.rs":"4474ccebf9d33c89288862a7e367018405968dddc55c7c6f97e21b5fe2264601"},"package":"c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"}
|
||||
\ No newline at end of file
|
||||
--- a/vendor/getrandom/src/util_libc.rs
|
||||
+++ b/vendor/getrandom/src/util_libc.rs
|
||||
@@ -135,19 +135,11 @@ impl Weak {
|
||||
}
|
||||
}
|
||||
|
||||
-cfg_if! {
|
||||
- if #[cfg(any(target_os = "linux", target_os = "emscripten"))] {
|
||||
- use libc::open64 as open;
|
||||
- } else {
|
||||
- use libc::open;
|
||||
- }
|
||||
-}
|
||||
-
|
||||
// SAFETY: path must be null terminated, FD must be manually closed.
|
||||
pub unsafe fn open_readonly(path: &str) -> Result<libc::c_int, Error> {
|
||||
debug_assert_eq!(path.as_bytes().last(), Some(&0));
|
||||
loop {
|
||||
- let fd = open(path.as_ptr() as *const _, libc::O_RDONLY | libc::O_CLOEXEC);
|
||||
+ let fd = libc::open(path.as_ptr() as *const _, libc::O_RDONLY | libc::O_CLOEXEC);
|
||||
if fd >= 0 {
|
||||
return Ok(fd);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
When building for the target, some build paths end up embedded in the binaries.
|
||||
These changes remove that. Further investigation is needed to work out the way
|
||||
to resolve these issues properly upstream.
|
||||
|
||||
Upstream-Status: Inappropriate [patches need rework]
|
||||
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
|
||||
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
|
||||
|
||||
--- 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 @@
|
||||
}
|
||||
}
|
||||
|
||||
- // Ensure the data-layout values hardcoded remain the defaults.
|
||||
- if sess.target.is_builtin {
|
||||
- let tm = crate::back::write::create_informational_target_machine(tcx.sess);
|
||||
- llvm::LLVMRustSetDataLayoutFromTargetMachine(llmod, tm);
|
||||
- llvm::LLVMRustDisposeTargetMachine(tm);
|
||||
-
|
||||
- let llvm_data_layout = llvm::LLVMGetDataLayoutStr(llmod);
|
||||
- let llvm_data_layout = str::from_utf8(CStr::from_ptr(llvm_data_layout).to_bytes())
|
||||
- .expect("got a non-UTF8 data-layout from LLVM");
|
||||
-
|
||||
- // Unfortunately LLVM target specs change over time, and right now we
|
||||
- // don't have proper support to work with any more than one
|
||||
- // `data_layout` than the one that is in the rust-lang/rust repo. If
|
||||
- // this compiler is configured against a custom LLVM, we may have a
|
||||
- // differing data layout, even though we should update our own to use
|
||||
- // that one.
|
||||
- //
|
||||
- // As an interim hack, if CFG_LLVM_ROOT is not an empty string then we
|
||||
- // disable this check entirely as we may be configured with something
|
||||
- // that has a different target layout.
|
||||
- //
|
||||
- // Unsure if this will actually cause breakage when rustc is configured
|
||||
- // as such.
|
||||
- //
|
||||
- // FIXME(#34960)
|
||||
- let cfg_llvm_root = option_env!("CFG_LLVM_ROOT").unwrap_or("");
|
||||
- let custom_llvm_used = !cfg_llvm_root.trim().is_empty();
|
||||
-
|
||||
- if !custom_llvm_used && target_data_layout != llvm_data_layout {
|
||||
- bug!(
|
||||
- "data-layout for target `{rustc_target}`, `{rustc_layout}`, \
|
||||
- differs from LLVM target's `{llvm_target}` default layout, `{llvm_layout}`",
|
||||
- rustc_target = sess.opts.target_triple,
|
||||
- rustc_layout = target_data_layout,
|
||||
- llvm_target = sess.target.llvm_target,
|
||||
- llvm_layout = llvm_data_layout
|
||||
- );
|
||||
- }
|
||||
- }
|
||||
-
|
||||
let data_layout = SmallCStr::new(&target_data_layout);
|
||||
llvm::LLVMSetDataLayout(llmod, data_layout.as_ptr());
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 2022 Wind River Systems
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
unsetenv("LD_LIBRARY_PATH");
|
||||
execvp("target-rust-ccld-wrapper", argv);
|
||||
|
||||
return 0;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,52 @@
|
||||
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
|
||||
|
||||
# Building with library/std omits proc_macro from the sysroot. Using
|
||||
# library/test causes that to be installed which then allows cargo to
|
||||
# build (https://github.com/meta-rust/meta-rust/issues/266)
|
||||
S = "${RUSTSRC}/library/test"
|
||||
|
||||
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)}"
|
||||
@@ -0,0 +1,86 @@
|
||||
SUMMARY = "Rust compiler and runtime libaries (cross-canadian for ${TARGET_ARCH} target)"
|
||||
PN = "rust-cross-canadian-${TRANSLATED_TARGET_ARCH}"
|
||||
|
||||
inherit rust-target-config
|
||||
inherit rust-common
|
||||
|
||||
LICENSE = "MIT"
|
||||
|
||||
MODIFYTOS = "0"
|
||||
|
||||
DEPENDS += "virtual/${SDK_PREFIX}gcc virtual/nativesdk-libc virtual/nativesdk-${SDK_PREFIX}compilerlibs"
|
||||
|
||||
SRC_URI += "file://target-rust-ccld.c"
|
||||
LIC_FILES_CHKSUM = "file://target-rust-ccld.c;md5=af4e0e29f81a34cffe05aa07c89e93e9;endline=7"
|
||||
S = "${WORKDIR}"
|
||||
|
||||
# Need to use our SDK's sh here, see #14878
|
||||
create_sdk_wrapper () {
|
||||
file="$1"
|
||||
shift
|
||||
cat <<- EOF > "${file}"
|
||||
#!/bin/sh
|
||||
\$$1 \$@
|
||||
EOF
|
||||
|
||||
chmod +x "$file"
|
||||
}
|
||||
|
||||
do_install () {
|
||||
# Rust requires /usr/lib to contain the libs.
|
||||
# The required structure is retained for simplicity.
|
||||
SYS_LIBDIR=$(dirname ${D}${libdir})
|
||||
SYS_BINDIR=$(dirname ${D}${bindir})
|
||||
RUSTLIB_DIR=${SYS_LIBDIR}/${TARGET_SYS}/rustlib
|
||||
|
||||
install -d ${RUSTLIB_DIR}
|
||||
install -m 0644 "${RUST_TARGETS_DIR}/${RUST_HOST_SYS}.json" "${RUSTLIB_DIR}"
|
||||
install -m 0644 "${RUST_TARGETS_DIR}/${RUST_TARGET_SYS}.json" "${RUSTLIB_DIR}"
|
||||
|
||||
# Uses SDK's CC as linker so linked binaries works out of box.
|
||||
# We have a problem as rust sets LD_LIBRARY_PATH and this will break running host
|
||||
# binaries (even /bin/sh) in the SDK as they detect a newer glibc from the SDK
|
||||
# in those paths and we hit symbol errors. We saw particular problems with symbol
|
||||
# mismatch on ubuntu1804 during development. To avoid this we have an SDK built
|
||||
# binary which unsets LD_LIBRARY_PATH, which can then call the wrapper script
|
||||
# where the context is easier to do the env maniupations needed
|
||||
install -d ${SYS_BINDIR}
|
||||
outfile="${SYS_BINDIR}/target-rust-ccld"
|
||||
${CC} ${WORKDIR}/target-rust-ccld.c -o $outfile
|
||||
chmod +x "$outfile"
|
||||
create_sdk_wrapper "${SYS_BINDIR}/target-rust-ccld-wrapper" "CC"
|
||||
|
||||
ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d
|
||||
mkdir "${ENV_SETUP_DIR}"
|
||||
RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh"
|
||||
|
||||
cat <<- EOF > "${RUST_ENV_SETUP_SH}"
|
||||
export RUSTFLAGS="--sysroot=\$OECORE_TARGET_SYSROOT/usr -C link-arg=--sysroot=\$OECORE_TARGET_SYSROOT"
|
||||
export RUST_TARGET_PATH="\$OECORE_NATIVE_SYSROOT/usr/lib/${TARGET_SYS}/rustlib"
|
||||
EOF
|
||||
|
||||
chown -R root.root ${D}
|
||||
|
||||
CARGO_ENV_SETUP_SH="${ENV_SETUP_DIR}/cargo.sh"
|
||||
cat <<- EOF > "${CARGO_ENV_SETUP_SH}"
|
||||
export CARGO_HOME="\$OECORE_TARGET_SYSROOT/home/cargo"
|
||||
mkdir -p "\$CARGO_HOME"
|
||||
# Init the default target once, it might be otherwise user modified.
|
||||
if [ ! -f "\$CARGO_HOME/config" ]; then
|
||||
touch "\$CARGO_HOME/config"
|
||||
echo "[build]" >> "\$CARGO_HOME/config"
|
||||
echo 'target = "'${RUST_TARGET_SYS}'"' >> "\$CARGO_HOME/config"
|
||||
echo '# TARGET_SYS' >> "\$CARGO_HOME/config"
|
||||
echo '[target.'${RUST_TARGET_SYS}']' >> "\$CARGO_HOME/config"
|
||||
echo 'linker = "target-rust-ccld"' >> "\$CARGO_HOME/config"
|
||||
fi
|
||||
|
||||
# Keep the below off as long as HTTP/2 is disabled.
|
||||
export CARGO_HTTP_MULTIPLEXING=false
|
||||
|
||||
export CARGO_HTTP_CAINFO="\$OECORE_NATIVE_SYSROOT/etc/ssl/certs/ca-certificates.crt"
|
||||
EOF
|
||||
}
|
||||
|
||||
FILES:${PN} += "${base_prefix}/environment-setup.d"
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
inherit cross-canadian
|
||||
require rust-cross-canadian.inc
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
From 86940d87026432683fb6741cd8a34d3b9b18e40d Mon Sep 17 00:00:00 2001
|
||||
From: Alexander Kanavin <alex.kanavin@gmail.com>
|
||||
Date: Fri, 27 Nov 2020 10:11:08 +0000
|
||||
Subject: [PATCH] AsmMatcherEmitter: sort ClassInfo lists by name as well
|
||||
|
||||
Otherwise, there are instances which are identical in
|
||||
every other field and therefore sort non-reproducibly
|
||||
(which breaks binary and source reproducibiliy).
|
||||
|
||||
Upstream-Status: Submitted [https://reviews.llvm.org/D97477]
|
||||
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
|
||||
---
|
||||
llvm/utils/TableGen/AsmMatcherEmitter.cpp | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/llvm/utils/TableGen/AsmMatcherEmitter.cpp b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
|
||||
index ccf0959389b..1f801e83b7d 100644
|
||||
--- a/llvm/utils/TableGen/AsmMatcherEmitter.cpp
|
||||
+++ b/llvm/utils/TableGen/AsmMatcherEmitter.cpp
|
||||
@@ -359,7 +359,10 @@ public:
|
||||
// name of a class shouldn't be significant. However, some of the backends
|
||||
// accidentally rely on this behaviour, so it will have to stay like this
|
||||
// until they are fixed.
|
||||
- return ValueName < RHS.ValueName;
|
||||
+ if (ValueName != RHS.ValueName)
|
||||
+ return ValueName < RHS.ValueName;
|
||||
+ // All else being equal, we should sort by name, for source and binary reproducibility
|
||||
+ return Name < RHS.Name;
|
||||
}
|
||||
};
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
From 7111770e8290082530d920e120995bf81431b0aa Mon Sep 17 00:00:00 2001
|
||||
From: Martin Kelly <mkelly@xevo.com>
|
||||
Date: Fri, 19 May 2017 00:22:57 -0700
|
||||
Subject: [PATCH 12/18] llvm: allow env override of exe path
|
||||
|
||||
When using a native llvm-config from inside a sysroot, we need llvm-config to
|
||||
return the libraries, include directories, etc. from inside the sysroot rather
|
||||
than from the native sysroot. Thus provide an env override for calling
|
||||
llvm-config from a target sysroot.
|
||||
|
||||
Upstream-Status: Inappropriate [oe-core specific]
|
||||
Signed-off-by: Martin Kelly <mkelly@xevo.com>
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
llvm/tools/llvm-config/llvm-config.cpp | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
--- a/llvm/tools/llvm-config/llvm-config.cpp
|
||||
+++ b/llvm/tools/llvm-config/llvm-config.cpp
|
||||
@@ -226,6 +226,13 @@ Typical components:\n\
|
||||
|
||||
/// Compute the path to the main executable.
|
||||
std::string GetExecutablePath(const char *Argv0) {
|
||||
+ // Hack for Yocto: we need to override the root path when we are using
|
||||
+ // llvm-config from within a target sysroot.
|
||||
+ const char *Sysroot = std::getenv("YOCTO_ALTERNATE_EXE_PATH");
|
||||
+ if (Sysroot != nullptr) {
|
||||
+ return Sysroot;
|
||||
+ }
|
||||
+
|
||||
// This just needs to be some symbol in the binary; C++ doesn't
|
||||
// allow taking the address of ::main however.
|
||||
void *P = (void *)(intptr_t)GetExecutablePath;
|
||||
@@ -0,0 +1,25 @@
|
||||
Subject: LLVM_INCLUDE_BENCHMARKS with llvm 14.0.1 failing to build
|
||||
|
||||
https://github.com/llvm/llvm-project/issues/54941
|
||||
|
||||
The LLVM_INCLUDE_BENCHMARKS is turned OFF to fix the build error as
|
||||
per the discussions in the above link. We will work on the issue and
|
||||
replace the workaround with actual fix once committed in LLVM.
|
||||
|
||||
Please refer the following link for more discussions on the issue:-
|
||||
https://github.com/rust-lang/rust/issues/96054
|
||||
|
||||
Upstream-Status: Pending
|
||||
Signed-off-by: Pgowda <pgowda.cve@gmail.com>
|
||||
|
||||
--- a/llvm/CMakeLists.txt 2022-04-22 00:45:30.543445478 -0700
|
||||
+++ b/llvm/CMakeLists.txt 2022-04-22 00:45:42.095232974 -0700
|
||||
@@ -615,7 +615,7 @@ option(LLVM_INCLUDE_GO_TESTS "Include th
|
||||
|
||||
option(LLVM_BUILD_BENCHMARKS "Add LLVM benchmark targets to the list of default
|
||||
targets. If OFF, benchmarks still could be built using Benchmarks target." OFF)
|
||||
-option(LLVM_INCLUDE_BENCHMARKS "Generate benchmark targets. If OFF, benchmarks can't be built." ON)
|
||||
+option(LLVM_INCLUDE_BENCHMARKS "Generate benchmark targets. If OFF, benchmarks can't be built." OFF)
|
||||
|
||||
option (LLVM_BUILD_DOCS "Build the llvm documentation." OFF)
|
||||
option (LLVM_INCLUDE_DOCS "Generate build targets for llvm documentation." ON)
|
||||
@@ -0,0 +1,83 @@
|
||||
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 python3native
|
||||
|
||||
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}"
|
||||
|
||||
EXTRA_OECMAKE = " \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DLLVM_TARGETS_TO_BUILD='ARM;AArch64;Mips;PowerPC;RISCV;X86' \
|
||||
-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 \
|
||||
"
|
||||
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"
|
||||
@@ -0,0 +1,63 @@
|
||||
## 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 = "1.69.0"
|
||||
|
||||
SRC_URI[cargo-snapshot-aarch64.sha256sum] = "b0ffb368d4e66a5808f96659cc598030761cb06966ae8d5299596b14fbc09364"
|
||||
SRC_URI[rust-std-snapshot-aarch64.sha256sum] = "c3c5346b1e95ea9bd806b0dd9ff9aa618976fb38f4f3a615af4964bb4dd15633"
|
||||
SRC_URI[rustc-snapshot-aarch64.sha256sum] = "d14166fa0b2832dd87b3f35c08d0bc829f83aa01a539b45df3d923469ee119be"
|
||||
|
||||
SRC_URI[cargo-snapshot-i686.sha256sum] = "4c9b1b2fb692bb0c81e524df6368723f061c8bb0d21a1f487eb8e5c2bdf323ab"
|
||||
SRC_URI[rust-std-snapshot-i686.sha256sum] = "bef330af5bfb381a01349186e05402983495a3e2d4d1c35723a8443039d19a2d"
|
||||
SRC_URI[rustc-snapshot-i686.sha256sum] = "788ff61555857680d5ea7cf76023f74a7f4820dd1c26abf76536561d4de3cbe6"
|
||||
|
||||
SRC_URI[cargo-snapshot-mips.sha256sum] = "bdaef2f95b0485dc2a5cde74c08bd269174bbbb553226c5b5d2287e52841b061"
|
||||
SRC_URI[rust-std-snapshot-mips.sha256sum] = "89849b93af9d4922554c938bc1c7641498d13c3a8b2b464f3bb7a060eae7a580"
|
||||
SRC_URI[rustc-snapshot-mips.sha256sum] = "ef17b364df355f7322c1fdd3b4cc4296d2d5d489b58fdd4b12374a1f2975a455"
|
||||
|
||||
SRC_URI[cargo-snapshot-mipsel.sha256sum] = "df114ac589fb50fcc3027e26c6e201fc530aadef1bcc8f6396c761a457ba7bbb"
|
||||
SRC_URI[rust-std-snapshot-mipsel.sha256sum] = "22bb266cf4e6da4d6867144873579b0da47e59c8ec9cb1a329ee8a7f418e8ee3"
|
||||
SRC_URI[rustc-snapshot-mipsel.sha256sum] = "9df4110f716a309323a776952fcf0dccaae878e7abf0d148c14a2a03c5170850"
|
||||
|
||||
SRC_URI[cargo-snapshot-powerpc.sha256sum] = "26c774db5e21ddf66107b677d5c6612d50611186feaa68ff11c34a61e4d5a57e"
|
||||
SRC_URI[rust-std-snapshot-powerpc.sha256sum] = "6303fc2be557467af0f1ff9cc756fd14ae2b9db7f17f42a1d2238ed934351e56"
|
||||
SRC_URI[rustc-snapshot-powerpc.sha256sum] = "716e790b7658206c59dc8019c1b603f230c5ce945229463367fade862cea60b9"
|
||||
|
||||
SRC_URI[cargo-snapshot-powerpc64.sha256sum] = "160692a0fc5fe1b48b617e063c6ce1d4546e108b32c0049dbde95602a30af133"
|
||||
SRC_URI[rust-std-snapshot-powerpc64.sha256sum] = "6a4b8b5307141c8207ed67d4fbaf9345c42fb3662e389b9dd3d9a4086c1b6efe"
|
||||
SRC_URI[rustc-snapshot-powerpc64.sha256sum] = "313d0944a1fc41c1c5ce0a054b3cebccd6f471ce8e8272e5e68f36b8d08e5bb1"
|
||||
|
||||
SRC_URI[cargo-snapshot-powerpc64le.sha256sum] = "9a3fe155d763b382ea18753133cb0e2186993e2850568134e2f7e468f2d07197"
|
||||
SRC_URI[rust-std-snapshot-powerpc64le.sha256sum] = "c44bcf91a9d13412a59ba75e7f8bd14c7f60d44cdb7b21916e502c90b4b378ce"
|
||||
SRC_URI[rustc-snapshot-powerpc64le.sha256sum] = "1781b5be30fa4fadf7608cc9cd3a2de93b3671a09adfa98ae4d975f789ba2275"
|
||||
|
||||
SRC_URI[cargo-snapshot-riscv64gc.sha256sum] = "9bc29f493c353313b968243fbdf5147c9ca401f7f8205aed63f180b5757161e2"
|
||||
SRC_URI[rust-std-snapshot-riscv64gc.sha256sum] = "8c32a848e2688b2900c3e073da8814ce5649ce6e0362be30d53517d7a9ef21ff"
|
||||
SRC_URI[rustc-snapshot-riscv64gc.sha256sum] = "03606f1ad3fd196e73e0d255ab6342e4e8fef2edaa1afcc577411aa8a68f0133"
|
||||
|
||||
SRC_URI[cargo-snapshot-s390x.sha256sum] = "812907846a454a182b05eab76658b49eabd8d06d2b5e8df56f29d73971f91b03"
|
||||
SRC_URI[rust-std-snapshot-s390x.sha256sum] = "5c98653199b89bff6f368bed61fca7860f7179364ce9e9474c90af38e2629baf"
|
||||
SRC_URI[rustc-snapshot-s390x.sha256sum] = "3cef208c0761bc83d156a14a5a94821cc9421772f0f376ea54765a6d00842b21"
|
||||
|
||||
SRC_URI[cargo-snapshot-x86_64.sha256sum] = "336eeabf231a7665c26c127a37b8aefffe28cb087c5c8d4ba0460419f5f8eff2"
|
||||
SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "4c95739e6f0f1d4defd937f6d60360b566e051dfb2fa71879d0f9751392f3709"
|
||||
SRC_URI[rustc-snapshot-x86_64.sha256sum] = "70e97ab5b9600328b977268fc92ca4aa53064e4e97468df35215d4396e509279"
|
||||
|
||||
SRC_URI[rust-std-snapshot-i586.sha256sum] = "a8125d72e06f2d866472a7aca3bd20a247160171d23a75c4207761a05e00ed5b"
|
||||
|
||||
SRC_URI[rust-std-snapshot-sparc64.sha256sum] = "7d50ff8499d8925ea973aa659e1a88190547615b3cfecb79e776ef8de953b755"
|
||||
|
||||
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 = "https://static.rust-lang.org"
|
||||
|
||||
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"
|
||||
@@ -0,0 +1,19 @@
|
||||
RUST_VERSION ?= "${@d.getVar('PV').split('-')[0]}"
|
||||
|
||||
SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;name=rust \
|
||||
file://hardcodepaths.patch;patchdir=${RUSTSRC} \
|
||||
file://getrandom-open64.patch;patchdir=${RUSTSRC} \
|
||||
file://0001-Do-not-use-LFS64-on-linux-with-musl.patch;patchdir=${RUSTSRC} \
|
||||
file://zlib-off64_t.patch;patchdir=${RUSTSRC} \
|
||||
file://0001-musl-Define-SOCK_SEQPACKET-in-common-place.patch;patchdir=${RUSTSRC} \
|
||||
file://rust-oe-selftest.patch;patchdir=${RUSTSRC} \
|
||||
"
|
||||
SRC_URI[rust.sha256sum] = "bb8e9c564566b2d3228d95de9063a9254182446a161353f1d843bfbaf5c34639"
|
||||
|
||||
RUSTSRC = "${WORKDIR}/rustc-${RUST_VERSION}-src"
|
||||
|
||||
# Used by crossbeam_atomic.patch
|
||||
export TARGET_VENDOR
|
||||
|
||||
UPSTREAM_CHECK_URI = "https://forge.rust-lang.org/infra/other-installation-methods.html"
|
||||
UPSTREAM_CHECK_REGEX = "rustc-(?P<pver>\d+(\.\d+)+)-src"
|
||||
@@ -0,0 +1,363 @@
|
||||
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
|
||||
try:
|
||||
import configparser
|
||||
except ImportError:
|
||||
import ConfigParser as 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", "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))
|
||||
|
||||
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(True))
|
||||
|
||||
cargo = d.expand("${WORKDIR}/rust-snapshot/bin/cargo")
|
||||
config.set("build", "cargo", e(cargo))
|
||||
|
||||
config.set("build", "vendor", e(True))
|
||||
|
||||
if not "targets" in locals():
|
||||
targets = [d.getVar("RUST_TARGET_SYS")]
|
||||
config.set("build", "target", e(targets))
|
||||
|
||||
if not "hosts" in locals():
|
||||
hosts = [d.getVar("RUST_HOST_SYS")]
|
||||
config.set("build", "host", e(hosts))
|
||||
|
||||
# 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}-tools-clippy ${PN}-tools-rustfmt"
|
||||
FILES:${PN}-tools-clippy = "${bindir}/cargo-clippy ${bindir}/clippy-driver"
|
||||
FILES:${PN}-tools-rustfmt = "${bindir}/rustfmt"
|
||||
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<component>.*)-{compiler_version}-(?P<arch>.*)-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)}"
|
||||
Reference in New Issue
Block a user