diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-05 13:55:49 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-08-08 15:44:20 +0100 |
commit | 16b4ac3f558fda6e1c3bb51bef0803836b96cf62 (patch) | |
tree | 14bb9de306dd58e27ed76d11f581dadc80b1bba0 /meta/recipes-devtools/rust/rust_1.62.0.bb | |
parent | 38934deeea87686982fb1536a2ccff4ae51781d5 (diff) | |
download | poky-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.bb | 69 |
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 | |||
3 | require rust-snapshot.inc | 3 | require rust-snapshot.inc |
4 | 4 | ||
5 | INSANE_SKIP:${PN}:class-native = "already-stripped" | 5 | INSANE_SKIP:${PN}:class-native = "already-stripped" |
6 | FILES:${PN} += "${libdir}/rustlib" | ||
7 | FILES:${PN} += "${libdir}/*.so" | ||
8 | FILES:${PN}-dev = "" | ||
6 | 9 | ||
7 | do_compile () { | 10 | do_compile () { |
8 | rust_runx build --stage 2 | 11 | rust_runx build --stage 2 |
9 | } | 12 | } |
10 | 13 | ||
14 | do_compile:append:class-target () { | ||
15 | rust_runx build --stage 2 src/tools/clippy | ||
16 | rust_runx build --stage 2 src/tools/rustfmt | ||
17 | } | ||
18 | |||
19 | do_compile:append:class-nativesdk () { | ||
20 | rust_runx build --stage 2 src/tools/clippy | ||
21 | rust_runx build --stage 2 src/tools/rustfmt | ||
22 | } | ||
23 | |||
24 | ALLOW_EMPTY:${PN} = "1" | ||
25 | |||
26 | PACKAGES =+ "${PN}-tools-clippy ${PN}-tools-rustfmt" | ||
27 | FILES:${PN}-tools-clippy = "${bindir}/cargo-clippy ${bindir}/clippy-driver" | ||
28 | FILES:${PN}-tools-rustfmt = "${bindir}/rustfmt" | ||
29 | RDEPENDS:${PN}-tools-clippy = "${PN}" | ||
30 | RDEPENDS:${PN}-tools-rustfmt = "${PN}" | ||
31 | |||
32 | SUMMARY:${PN}-tools-clippy = "A collection of lints to catch common mistakes and improve your Rust code" | ||
33 | SUMMARY:${PN}-tools-rustfmt = "A tool for formatting Rust code according to style guidelines" | ||
34 | |||
11 | rust_do_install() { | 35 | rust_do_install() { |
12 | rust_runx install | 36 | rust_runx install |
13 | } | 37 | } |
14 | 38 | ||
15 | python () { | 39 | rust_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 | ||
56 | rust_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 | ||
76 | WRAPPER_TARGET_EXTRALD:libc-musl = "-lssp_nonshared" | ||
77 | |||
78 | RUSTLIB_DEP:class-nativesdk = "" | ||
79 | |||
80 | # musl builds include libunwind.a | ||
81 | INSANE_SKIP:${PN} = "staticdev" | ||
82 | |||