summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rust/rust_1.62.0.bb
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-05 13:55:49 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-08-08 15:44:20 +0100
commit16b4ac3f558fda6e1c3bb51bef0803836b96cf62 (patch)
tree14bb9de306dd58e27ed76d11f581dadc80b1bba0 /meta/recipes-devtools/rust/rust_1.62.0.bb
parent38934deeea87686982fb1536a2ccff4ae51781d5 (diff)
downloadpoky-16b4ac3f558fda6e1c3bb51bef0803836b96cf62.tar.gz
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>
Diffstat (limited to 'meta/recipes-devtools/rust/rust_1.62.0.bb')
-rw-r--r--meta/recipes-devtools/rust/rust_1.62.0.bb69
1 files changed, 65 insertions, 4 deletions
diff --git a/meta/recipes-devtools/rust/rust_1.62.0.bb b/meta/recipes-devtools/rust/rust_1.62.0.bb
index b505ad46ca..81923c3331 100644
--- a/meta/recipes-devtools/rust/rust_1.62.0.bb
+++ b/meta/recipes-devtools/rust/rust_1.62.0.bb
@@ -3,19 +3,80 @@ require rust-source.inc
3require rust-snapshot.inc 3require rust-snapshot.inc
4 4
5INSANE_SKIP:${PN}:class-native = "already-stripped" 5INSANE_SKIP:${PN}:class-native = "already-stripped"
6FILES:${PN} += "${libdir}/rustlib"
7FILES:${PN} += "${libdir}/*.so"
8FILES:${PN}-dev = ""
6 9
7do_compile () { 10do_compile () {
8 rust_runx build --stage 2 11 rust_runx build --stage 2
9} 12}
10 13
14do_compile:append:class-target () {
15 rust_runx build --stage 2 src/tools/clippy
16 rust_runx build --stage 2 src/tools/rustfmt
17}
18
19do_compile:append:class-nativesdk () {
20 rust_runx build --stage 2 src/tools/clippy
21 rust_runx build --stage 2 src/tools/rustfmt
22}
23
24ALLOW_EMPTY:${PN} = "1"
25
26PACKAGES =+ "${PN}-tools-clippy ${PN}-tools-rustfmt"
27FILES:${PN}-tools-clippy = "${bindir}/cargo-clippy ${bindir}/clippy-driver"
28FILES:${PN}-tools-rustfmt = "${bindir}/rustfmt"
29RDEPENDS:${PN}-tools-clippy = "${PN}"
30RDEPENDS:${PN}-tools-rustfmt = "${PN}"
31
32SUMMARY:${PN}-tools-clippy = "A collection of lints to catch common mistakes and improve your Rust code"
33SUMMARY:${PN}-tools-rustfmt = "A tool for formatting Rust code according to style guidelines"
34
11rust_do_install() { 35rust_do_install() {
12 rust_runx install 36 rust_runx install
13} 37}
14 38
15python () { 39rust_do_install:class-nativesdk() {
16 pn = d.getVar('PN') 40 export PSEUDO_UNLOAD=1
41 rust_runx install
42 unset PSEUDO_UNLOAD
43
44 install -d ${D}${bindir}
45 for i in cargo-clippy clippy-driver rustfmt; do
46 cp build/${RUST_BUILD_SYS}/stage2-tools-bin/$i ${D}${bindir}
47 chrpath -r "\$ORIGIN/../lib" ${D}${bindir}/$i
48 done
17 49
18 if not pn.endswith("-native"): 50 chown root:root ${D}/ -R
19 raise bb.parse.SkipRecipe("Rust recipe doesn't work for target builds at this time. Fixes welcome.") 51 rm ${D}${libdir}/rustlib/uninstall.sh
52 rm ${D}${libdir}/rustlib/install.log
53 rm ${D}${libdir}/rustlib/manifest*
20} 54}
21 55
56rust_do_install:class-target() {
57 export PSEUDO_UNLOAD=1
58 rust_runx install
59 unset PSEUDO_UNLOAD
60
61 install -d ${D}${bindir}
62 for i in cargo-clippy clippy-driver rustfmt; do
63 cp build/${RUST_BUILD_SYS}/stage2-tools-bin/$i ${D}${bindir}
64 chrpath -r "\$ORIGIN/../lib" ${D}${bindir}/$i
65 done
66
67 chown root:root ${D}/ -R
68 rm ${D}${libdir}/rustlib/uninstall.sh
69 rm ${D}${libdir}/rustlib/install.log
70 rm ${D}${libdir}/rustlib/manifest*
71}
72
73# see recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch
74# we need to link with ssp_nonshared on musl to avoid "undefined reference to `__stack_chk_fail_local'"
75# when building MACHINE=qemux86 for musl
76WRAPPER_TARGET_EXTRALD:libc-musl = "-lssp_nonshared"
77
78RUSTLIB_DEP:class-nativesdk = ""
79
80# musl builds include libunwind.a
81INSANE_SKIP:${PN} = "staticdev"
82