summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rust/rust-cross-canadian.inc
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-05 13:49:47 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-08 15:41:37 +0100
commit6ec18de9d6f49bccff72f2665821dbd732b69b48 (patch)
tree6eea90a0f6404e49c23d2d3716bd9e947cb9401e /meta/recipes-devtools/rust/rust-cross-canadian.inc
parent06af65757b7694df983b3f99cec75e4e9bec0725 (diff)
downloadopenembedded-core-6ec18de9d6f49bccff72f2665821dbd732b69b48.tar.gz
rust-cross-canadian: Simplify and fix
Since a copy of rust can target any target and doesn't need to be target specific, we can simplify rust-cross-canadian to simply contain the json configuration and envirionment setup scripts. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/rust/rust-cross-canadian.inc')
-rw-r--r--meta/recipes-devtools/rust/rust-cross-canadian.inc65
1 files changed, 10 insertions, 55 deletions
diff --git a/meta/recipes-devtools/rust/rust-cross-canadian.inc b/meta/recipes-devtools/rust/rust-cross-canadian.inc
index 677bd8842c..2b09661542 100644
--- a/meta/recipes-devtools/rust/rust-cross-canadian.inc
+++ b/meta/recipes-devtools/rust/rust-cross-canadian.inc
@@ -1,20 +1,11 @@
-
-require rust-cross-canadian-common.inc
-
-RUSTLIB_TARGET_PN = "rust-cross-canadian-rustlib-target-${TRANSLATED_TARGET_ARCH}"
-RUSTLIB_HOST_PN = "rust-cross-canadian-rustlib-host-${TRANSLATED_TARGET_ARCH}"
-RUSTLIB_SRC_PN = "rust-cross-canadian-src"
-RUSTLIB_PKGS = "${RUSTLIB_SRC_PN} ${RUSTLIB_TARGET_PN} ${RUSTLIB_HOST_PN}"
PN = "rust-cross-canadian-${TRANSLATED_TARGET_ARCH}"
-PACKAGES = "${RUSTLIB_PKGS} ${PN}"
-RDEPENDS:${PN} += "${RUSTLIB_PKGS}"
+inherit rust-target-config
+inherit rust-common
-# The default behaviour of x.py changed in 1.47+ so now we need to
-# explicitly ask for the stage 2 compiler to be assembled.
-do_compile () {
- rust_runx build --stage 2
-}
+LICENSE = "MIT"
+
+MODIFYTOS = "0"
create_sdk_wrapper () {
file="$1"
@@ -30,39 +21,14 @@ create_sdk_wrapper () {
do_install () {
# Rust requires /usr/lib to contain the libs.
- # Similar story is with /usr/bin ruquiring `lib` to be at the same level.
# 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 "${SYS_BINDIR}"
- cp build/${SNAPSHOT_BUILD_SYS}/stage2/bin/* ${SYS_BINDIR}
- for i in ${SYS_BINDIR}/*; do
- chrpath -r "\$ORIGIN/../lib" ${i}
- done
-
- install -d "${D}${libdir}"
- cp -pRd build/${SNAPSHOT_BUILD_SYS}/stage2/lib/${TARGET_SYS}/*.so ${SYS_LIBDIR}
- cp -pRd build/${SNAPSHOT_BUILD_SYS}/stage2/lib/${TARGET_SYS}/rustlib ${RUSTLIB_DIR}
-
- for i in ${SYS_LIBDIR}/*.so; do
- chrpath -r "\$ORIGIN/../lib" ${i}
- done
- for i in ${RUSTLIB_DIR}/*/lib/*.so; do
- chrpath -d ${i}
- done
-
- install -m 0644 "${WORKDIR}/targets/${TARGET_SYS}.json" "${RUSTLIB_DIR}"
-
- SRC_DIR=${RUSTLIB_DIR}/src/rust
- install -d ${SRC_DIR}/src/llvm-project
- cp -R --no-dereference build/${SNAPSHOT_BUILD_SYS}/stage2/lib/rustlib/src/rust/src/llvm-project/libunwind ${SRC_DIR}/src/llvm-project
- cp -R --no-dereference build/${SNAPSHOT_BUILD_SYS}/stage2/lib/rustlib/src/rust/library ${SRC_DIR}
- cp --no-dereference build/${SNAPSHOT_BUILD_SYS}/stage2/lib/rustlib/src/rust/Cargo.lock ${SRC_DIR}
- # Remove executable bit from any files so then SDK doesn't try to relocate.
- chmod -R -x+X ${SRC_DIR}
-
+ 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.
install -d ${SYS_BINDIR}
@@ -73,7 +39,7 @@ do_install () {
ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh"
cat <<- EOF > "${ENV_SETUP_SH}"
- export RUSTFLAGS="--sysroot=\$OECORE_NATIVE_SYSROOT/usr -C link-arg=--sysroot=\$OECORE_TARGET_SYSROOT -L\$OECORE_NATIVE_SYSROOT/usr/lib/${TARGET_SYS}/rustlib/${TARGET_SYS}/lib"
+ 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
@@ -100,16 +66,5 @@ do_install () {
EOF
}
-PKG_SYS_LIBDIR = "${SDKPATHNATIVE}/usr/lib"
-PKG_SYS_BINDIR = "${SDKPATHNATIVE}/usr/bin"
-PKG_RUSTLIB_DIR = "${PKG_SYS_LIBDIR}/${TARGET_SYS}/rustlib"
-FILES:${PN} = "${PKG_SYS_LIBDIR}/*.so ${PKG_SYS_BINDIR} ${base_prefix}/environment-setup.d"
-FILES:${RUSTLIB_TARGET_PN} = "${PKG_RUSTLIB_DIR}/${TARGET_SYS} ${PKG_RUSTLIB_DIR}/${TARGET_SYS}.json"
-FILES:${RUSTLIB_HOST_PN} = "${PKG_RUSTLIB_DIR}/${BUILD_ARCH}-unknown-linux-gnu"
-FILES:${RUSTLIB_SRC_PN} = "${PKG_RUSTLIB_DIR}/src"
-
-SUMMARY:${RUSTLIB_TARGET_PN} = "Rust cross canadian libaries for ${TARGET_SYS}"
-SUMMARY:${RUSTLIB_HOST_PN} = "Rust cross canadian libaries for ${HOST_SYS}"
-SUMMARY:${RUSTLIB_SRC_PN} = "Rust standard library sources for cross canadian toolchain"
-SUMMARY:${PN} = "Rust crost canadian compiler"
+FILES:${PN} += "${base_prefix}/environment-setup.d"