mirror of
https://git.yoctoproject.org/poky
synced 2026-04-05 08:02:25 +02:00
rust: Enable nativesdk and target builds + replace rust-tools-cross-canadian
Enable rust target builds as well as nativesdk-rust for the sdk. Merge the builds of rust-tools components into the rust build, packaged separately since this is a lot more efficient and saves rebuilding core rust multiple times. The tools are not target specific so nativesdk-rust-tools suffices and we can drop the cross canadian piece. (From OE-Core rev: b9b0cd99cdc77e7a90e5fd5711e706ebe64c7b6b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -720,7 +720,6 @@ RECIPE_MAINTAINER:pn-rust = "Randy MacLeod <Randy.MacLeod@windriver.com>"
|
||||
RECIPE_MAINTAINER:pn-rust-cross-canadian-${TRANSLATED_TARGET_ARCH} = "Randy MacLeod <Randy.MacLeod@windriver.com>"
|
||||
RECIPE_MAINTAINER:pn-rust-hello-world = "Randy MacLeod <Randy.MacLeod@windriver.com>"
|
||||
RECIPE_MAINTAINER:pn-rust-llvm = "Randy MacLeod <Randy.MacLeod@windriver.com>"
|
||||
RECIPE_MAINTAINER:pn-rust-tools-cross-canadian-${TRANSLATED_TARGET_ARCH} = "Randy MacLeod <Randy.MacLeod@windriver.com>"
|
||||
RECIPE_MAINTAINER:pn-rxvt-unicode = "Unassigned <unassigned@yoctoproject.org>"
|
||||
RECIPE_MAINTAINER:pn-sato-screenshot = "Ross Burton <ross.burton@arm.com>"
|
||||
RECIPE_MAINTAINER:pn-sato-icon-theme = "Richard Purdie <richard.purdie@linuxfoundation.org>"
|
||||
|
||||
@@ -6,12 +6,12 @@ inherit cross-canadian packagegroup
|
||||
PACKAGEGROUP_DISABLE_COMPLEMENTARY = "1"
|
||||
|
||||
RUST="rust-cross-canadian-${TRANSLATED_TARGET_ARCH}"
|
||||
RUST_TOOLS="rust-tools-cross-canadian-${TRANSLATED_TARGET_ARCH}"
|
||||
|
||||
RDEPENDS:${PN} = " \
|
||||
${@all_multilib_tune_values(d, 'RUST')} \
|
||||
nativesdk-rust \
|
||||
nativesdk-cargo \
|
||||
rust-cross-canadian-src \
|
||||
${@all_multilib_tune_values(d, 'RUST_TOOLS')} \
|
||||
nativesdk-rust-tools-clippy \
|
||||
nativesdk-rust-tools-rustfmt \
|
||||
"
|
||||
|
||||
|
||||
@@ -7,4 +7,4 @@ 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"
|
||||
|
||||
BBCLASSEXTEND = "native"
|
||||
BBCLASSEXTEND = "native nativesdk"
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
|
||||
require rust-cross-canadian-common.inc
|
||||
|
||||
RUST_TOOLS_CLIPPY_PN = "rust-tools-clippy-cross-canadian-${TRANSLATED_TARGET_ARCH}"
|
||||
RUST_TOOLS_RUSTFMT_PN = "rust-tools-rustfmt-cross-canadian-${TRANSLATED_TARGET_ARCH}"
|
||||
RUST_TOOLS_PKGS = "${RUST_TOOLS_CLIPPY_PN} ${RUST_TOOLS_RUSTFMT_PN}"
|
||||
PN = "rust-tools-cross-canadian-${TRANSLATED_TARGET_ARCH}"
|
||||
|
||||
PACKAGES = "${RUST_TOOLS_CLIPPY_PN} ${RUST_TOOLS_RUSTFMT_PN} ${PN}"
|
||||
RDEPENDS:${PN} += "${RUST_TOOLS_PKGS}"
|
||||
|
||||
do_compile () {
|
||||
rust_runx build --stage 2 src/tools/clippy
|
||||
rust_runx build --stage 2 src/tools/rustfmt
|
||||
}
|
||||
|
||||
do_install () {
|
||||
SYS_BINDIR=$(dirname ${D}${bindir})
|
||||
|
||||
install -d "${SYS_BINDIR}"
|
||||
cp build/${SNAPSHOT_BUILD_SYS}/stage2-tools-bin/* ${SYS_BINDIR}
|
||||
for i in ${SYS_BINDIR}/*; do
|
||||
chrpath -r "\$ORIGIN/../lib" ${i}
|
||||
done
|
||||
|
||||
chown -R root.root ${D}
|
||||
}
|
||||
|
||||
ALLOW_EMPTY:${PN} = "1"
|
||||
|
||||
PKG_SYS_BINDIR = "${SDKPATHNATIVE}/usr/bin"
|
||||
FILES:${RUST_TOOLS_CLIPPY_PN} = "${PKG_SYS_BINDIR}/cargo-clippy ${PKG_SYS_BINDIR}/clippy-driver"
|
||||
FILES:${RUST_TOOLS_RUSTFMT_PN} = "${PKG_SYS_BINDIR}/rustfmt"
|
||||
|
||||
SUMMARY:${PN} = "Rust helper tools"
|
||||
SUMMARY:${RUST_TOOLS_CLIPPY_PN} = "A collection of lints to catch common mistakes and improve your Rust code"
|
||||
SUMMARY:${RUST_TOOLS_RUSTFMT_PN} = "A tool for formatting Rust code according to style guidelines"
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
require rust-tools-cross-canadian.inc
|
||||
require rust-source.inc
|
||||
require rust-snapshot.inc
|
||||
|
||||
FILESEXTRAPATHS:prepend := "${THISDIR}/rust:"
|
||||
|
||||
@@ -9,6 +9,7 @@ inherit cargo_common
|
||||
|
||||
DEPENDS += "file-native python3-native"
|
||||
DEPENDS:append:class-native = " rust-llvm-native"
|
||||
DEPENDS:append:class-nativesdk = " nativesdk-rust-llvm"
|
||||
|
||||
S = "${RUSTSRC}"
|
||||
|
||||
@@ -202,18 +203,6 @@ rust_do_install () {
|
||||
rm -f ${D}${libdir}/rustlib/src/rust
|
||||
}
|
||||
|
||||
rust_install_targets() {
|
||||
# Install our custom target.json files
|
||||
local td="${D}${libdir}/rustlib/"
|
||||
install -d "$td"
|
||||
for tgt in "${WORKDIR}/targets/"* ; do
|
||||
install -m 0644 "$tgt" "$td"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
do_install () {
|
||||
rust_do_install
|
||||
rust_install_targets
|
||||
}
|
||||
# ex: sts=4 et sw=4 ts=8
|
||||
|
||||
@@ -3,19 +3,80 @@ 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 () {
|
||||
rust_runx build --stage 2
|
||||
}
|
||||
|
||||
do_compile:append:class-target () {
|
||||
rust_runx build --stage 2 src/tools/clippy
|
||||
rust_runx build --stage 2 src/tools/rustfmt
|
||||
}
|
||||
|
||||
do_compile:append:class-nativesdk () {
|
||||
rust_runx build --stage 2 src/tools/clippy
|
||||
rust_runx build --stage 2 src/tools/rustfmt
|
||||
}
|
||||
|
||||
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"
|
||||
|
||||
rust_do_install() {
|
||||
rust_runx install
|
||||
}
|
||||
|
||||
python () {
|
||||
pn = d.getVar('PN')
|
||||
rust_do_install:class-nativesdk() {
|
||||
export PSEUDO_UNLOAD=1
|
||||
rust_runx install
|
||||
unset PSEUDO_UNLOAD
|
||||
|
||||
if not pn.endswith("-native"):
|
||||
raise bb.parse.SkipRecipe("Rust recipe doesn't work for target builds at this time. Fixes welcome.")
|
||||
install -d ${D}${bindir}
|
||||
for i in cargo-clippy clippy-driver rustfmt; do
|
||||
cp build/${RUST_BUILD_SYS}/stage2-tools-bin/$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*
|
||||
}
|
||||
|
||||
rust_do_install:class-target() {
|
||||
export PSEUDO_UNLOAD=1
|
||||
rust_runx install
|
||||
unset PSEUDO_UNLOAD
|
||||
|
||||
install -d ${D}${bindir}
|
||||
for i in cargo-clippy clippy-driver rustfmt; do
|
||||
cp build/${RUST_BUILD_SYS}/stage2-tools-bin/$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*
|
||||
}
|
||||
|
||||
# see recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
|
||||
# we need to link with ssp_nonshared on musl to avoid "undefined reference to `__stack_chk_fail_local'"
|
||||
# when building MACHINE=qemux86 for musl
|
||||
WRAPPER_TARGET_EXTRALD:libc-musl = "-lssp_nonshared"
|
||||
|
||||
RUSTLIB_DEP:class-nativesdk = ""
|
||||
|
||||
# musl builds include libunwind.a
|
||||
INSANE_SKIP:${PN} = "staticdev"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user