@@ -54,18 +54,16 @@ do_install () {
ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d
mkdir "${ENV_SETUP_DIR}"
- RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh"
+ RUST_ENV_SETUP_SH="${ENV_SETUP_DIR}/${RUST_TARGET_SYS}_rust.sh"
RUST_TARGET_TRIPLE=`echo ${RUST_TARGET_SYS} | tr '[:lower:]' '[:upper:]' | sed 's/-/_/g'`
SDKLOADER=${@bb.utils.contains('SDK_ARCH', 'x86_64', 'ld-linux-x86-64.so.2', '', d)}${@bb.utils.contains('SDK_ARCH', 'i686', 'ld-linux.so.2', '', d)}${@bb.utils.contains('SDK_ARCH', 'aarch64', 'ld-linux-aarch64.so.1', '', d)}${@bb.utils.contains('SDK_ARCH', 'ppc64le', 'ld64.so.2', '', d)}${@bb.utils.contains('SDK_ARCH', 'riscv64', 'ld-linux-riscv64-lp64d.so.1', '', d)}
cat <<- EOF > "${RUST_ENV_SETUP_SH}"
export CARGO_TARGET_${RUST_TARGET_TRIPLE}_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"
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
+ if ! grep -q '^\[target.${RUST_TARGET_SYS}]' "\$CARGO_HOME/config"; the
touch "\$CARGO_HOME/config"
echo 'target = "'${RUST_TARGET_SYS}'"' >> "\$CARGO_HOME/config"
echo '# TARGET_SYS' >> "\$CARGO_HOME/config"
@@ -271,8 +271,21 @@ rust_do_install:class-nativesdk() {
rm ${D}${libdir}/rustlib/uninstall.sh
rm ${D}${libdir}/rustlib/install.log
rm ${D}${libdir}/rustlib/manifest*
+
+ 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 RUST_TARGET_PATH="\$RUST_TARGET_PATH:\$OECORE_NATIVE_SYSROOT/usr/lib/${TARGET_SYS}/rustlib"
+ EOF
+
+ chown -R root.root ${D}
+
}
+FILES:${PN} += "${base_prefix}/environment-setup.d"
+
EXTRA_TOOLS ?= "cargo-clippy clippy-driver rustfmt"
rust_do_install:class-target() {
export PSEUDO_UNLOAD=1