mirror of
https://git.yoctoproject.org/poky
synced 2026-04-26 18:32:13 +02:00
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. (From OE-Core rev: 6ec18de9d6f49bccff72f2665821dbd732b69b48) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -1,49 +0,0 @@
|
|||||||
|
|
||||||
RUST_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config"
|
|
||||||
|
|
||||||
require rust.inc
|
|
||||||
|
|
||||||
DEPENDS += "rust-llvm (=${PV})"
|
|
||||||
|
|
||||||
inherit cross-canadian
|
|
||||||
|
|
||||||
DEPENDS += " \
|
|
||||||
virtual/${HOST_PREFIX}gcc-crosssdk \
|
|
||||||
virtual/nativesdk-libc rust-llvm-native \
|
|
||||||
virtual/${TARGET_PREFIX}compilerlibs \
|
|
||||||
virtual/nativesdk-${HOST_PREFIX}compilerlibs \
|
|
||||||
gcc-cross-${TARGET_ARCH} \
|
|
||||||
"
|
|
||||||
|
|
||||||
# The host tools are likely not to be able to do the necessary operation on
|
|
||||||
# the target architecturea. Alternatively one could check compatibility
|
|
||||||
# between host/target.
|
|
||||||
EXCLUDE_FROM_SHLIBS_${RUSTLIB_TARGET_PN} = "1"
|
|
||||||
|
|
||||||
DEBUG_PREFIX_MAP = "-fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
|
|
||||||
-fdebug-prefix-map=${STAGING_DIR_HOST}= \
|
|
||||||
-fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
|
|
||||||
"
|
|
||||||
|
|
||||||
RUST_TARGETGENS = "BUILD HOST TARGET"
|
|
||||||
|
|
||||||
INHIBIT_DEFAULT_RUST_DEPS = "1"
|
|
||||||
|
|
||||||
export WRAPPER_TARGET_CC = "${CCACHE}${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TARGET_CC_ARCH} ${SECURITY_NOPIE_CFLAGS}"
|
|
||||||
export WRAPPER_TARGET_CXX = "${CCACHE}${TARGET_PREFIX}g++ --sysroot=${STAGING_DIR_TARGET} ${TARGET_CC_ARCH} ${SECURITY_NOPIE_CFLAGS}"
|
|
||||||
export WRAPPER_TARGET_CCLD = "${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TARGET_CC_ARCH} ${SECURITY_NOPIE_CFLAGS}"
|
|
||||||
export WRAPPER_TARGET_LDFLAGS = "${TARGET_LDFLAGS}"
|
|
||||||
export WRAPPER_TARGET_AR = "${TARGET_PREFIX}ar"
|
|
||||||
|
|
||||||
python do_configure:prepend() {
|
|
||||||
targets = [d.getVar("TARGET_SYS", True), "{}-unknown-linux-gnu".format(d.getVar("HOST_ARCH", True))]
|
|
||||||
hosts = ["{}-unknown-linux-gnu".format(d.getVar("HOST_ARCH", True))]
|
|
||||||
}
|
|
||||||
|
|
||||||
INSANE_SKIP:${RUSTLIB_TARGET_PN} = "file-rdeps arch ldflags"
|
|
||||||
SKIP_FILEDEPS:${RUSTLIB_TARGET_PN} = "1"
|
|
||||||
|
|
||||||
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
|
|
||||||
INHIBIT_PACKAGE_STRIP = "1"
|
|
||||||
INHIBIT_SYSROOT_STRIP = "1"
|
|
||||||
|
|
||||||
@@ -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}"
|
PN = "rust-cross-canadian-${TRANSLATED_TARGET_ARCH}"
|
||||||
|
|
||||||
PACKAGES = "${RUSTLIB_PKGS} ${PN}"
|
inherit rust-target-config
|
||||||
RDEPENDS:${PN} += "${RUSTLIB_PKGS}"
|
inherit rust-common
|
||||||
|
|
||||||
# The default behaviour of x.py changed in 1.47+ so now we need to
|
LICENSE = "MIT"
|
||||||
# explicitly ask for the stage 2 compiler to be assembled.
|
|
||||||
do_compile () {
|
MODIFYTOS = "0"
|
||||||
rust_runx build --stage 2
|
|
||||||
}
|
|
||||||
|
|
||||||
create_sdk_wrapper () {
|
create_sdk_wrapper () {
|
||||||
file="$1"
|
file="$1"
|
||||||
@@ -30,39 +21,14 @@ create_sdk_wrapper () {
|
|||||||
|
|
||||||
do_install () {
|
do_install () {
|
||||||
# Rust requires /usr/lib to contain the libs.
|
# 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.
|
# The required structure is retained for simplicity.
|
||||||
SYS_LIBDIR=$(dirname ${D}${libdir})
|
SYS_LIBDIR=$(dirname ${D}${libdir})
|
||||||
SYS_BINDIR=$(dirname ${D}${bindir})
|
SYS_BINDIR=$(dirname ${D}${bindir})
|
||||||
RUSTLIB_DIR=${SYS_LIBDIR}/${TARGET_SYS}/rustlib
|
RUSTLIB_DIR=${SYS_LIBDIR}/${TARGET_SYS}/rustlib
|
||||||
|
|
||||||
install -d "${SYS_BINDIR}"
|
install -d ${RUSTLIB_DIR}
|
||||||
cp build/${SNAPSHOT_BUILD_SYS}/stage2/bin/* ${SYS_BINDIR}
|
install -m 0644 "${RUST_TARGETS_DIR}/${RUST_HOST_SYS}.json" "${RUSTLIB_DIR}"
|
||||||
for i in ${SYS_BINDIR}/*; do
|
install -m 0644 "${RUST_TARGETS_DIR}/${RUST_TARGET_SYS}.json" "${RUSTLIB_DIR}"
|
||||||
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}
|
|
||||||
|
|
||||||
|
|
||||||
# Uses SDK's CC as linker so linked binaries works out of box.
|
# Uses SDK's CC as linker so linked binaries works out of box.
|
||||||
install -d ${SYS_BINDIR}
|
install -d ${SYS_BINDIR}
|
||||||
@@ -73,7 +39,7 @@ do_install () {
|
|||||||
ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh"
|
ENV_SETUP_SH="${ENV_SETUP_DIR}/rust.sh"
|
||||||
|
|
||||||
cat <<- EOF > "${ENV_SETUP_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"
|
export RUST_TARGET_PATH="\$OECORE_NATIVE_SYSROOT/usr/lib/${TARGET_SYS}/rustlib"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@@ -100,16 +66,5 @@ do_install () {
|
|||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
PKG_SYS_LIBDIR = "${SDKPATHNATIVE}/usr/lib"
|
FILES:${PN} += "${base_prefix}/environment-setup.d"
|
||||||
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"
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,2 @@
|
|||||||
require rust-cross-canadian.inc
|
inherit cross-canadian
|
||||||
require rust-source.inc
|
require rust-cross-canadian.inc
|
||||||
require rust-snapshot.inc
|
|
||||||
|
|
||||||
FILESEXTRAPATHS:prepend := "${THISDIR}/rust:"
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user