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 | |
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')
-rw-r--r-- | meta/recipes-devtools/rust/rust-target.inc | 2 | ||||
-rw-r--r-- | meta/recipes-devtools/rust/rust-tools-cross-canadian.inc | 38 | ||||
-rw-r--r-- | meta/recipes-devtools/rust/rust-tools-cross-canadian_1.62.0.bb | 6 | ||||
-rw-r--r-- | meta/recipes-devtools/rust/rust.inc | 13 | ||||
-rw-r--r-- | meta/recipes-devtools/rust/rust_1.62.0.bb | 69 |
5 files changed, 67 insertions, 61 deletions
diff --git a/meta/recipes-devtools/rust/rust-target.inc b/meta/recipes-devtools/rust/rust-target.inc index 3f637b3ba5..dce2b47517 100644 --- a/meta/recipes-devtools/rust/rust-target.inc +++ b/meta/recipes-devtools/rust/rust-target.inc | |||
@@ -7,4 +7,4 @@ INHIBIT_DEFAULT_RUST_DEPS:class-native = "1" | |||
7 | # We don't need to depend on gcc-native because yocto assumes it exists | 7 | # We don't need to depend on gcc-native because yocto assumes it exists |
8 | PROVIDES:class-native = "virtual/${TARGET_PREFIX}rust" | 8 | PROVIDES:class-native = "virtual/${TARGET_PREFIX}rust" |
9 | 9 | ||
10 | BBCLASSEXTEND = "native" | 10 | BBCLASSEXTEND = "native nativesdk" |
diff --git a/meta/recipes-devtools/rust/rust-tools-cross-canadian.inc b/meta/recipes-devtools/rust/rust-tools-cross-canadian.inc deleted file mode 100644 index f0358551ae..0000000000 --- a/meta/recipes-devtools/rust/rust-tools-cross-canadian.inc +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | |||
2 | require rust-cross-canadian-common.inc | ||
3 | |||
4 | RUST_TOOLS_CLIPPY_PN = "rust-tools-clippy-cross-canadian-${TRANSLATED_TARGET_ARCH}" | ||
5 | RUST_TOOLS_RUSTFMT_PN = "rust-tools-rustfmt-cross-canadian-${TRANSLATED_TARGET_ARCH}" | ||
6 | RUST_TOOLS_PKGS = "${RUST_TOOLS_CLIPPY_PN} ${RUST_TOOLS_RUSTFMT_PN}" | ||
7 | PN = "rust-tools-cross-canadian-${TRANSLATED_TARGET_ARCH}" | ||
8 | |||
9 | PACKAGES = "${RUST_TOOLS_CLIPPY_PN} ${RUST_TOOLS_RUSTFMT_PN} ${PN}" | ||
10 | RDEPENDS:${PN} += "${RUST_TOOLS_PKGS}" | ||
11 | |||
12 | do_compile () { | ||
13 | rust_runx build --stage 2 src/tools/clippy | ||
14 | rust_runx build --stage 2 src/tools/rustfmt | ||
15 | } | ||
16 | |||
17 | do_install () { | ||
18 | SYS_BINDIR=$(dirname ${D}${bindir}) | ||
19 | |||
20 | install -d "${SYS_BINDIR}" | ||
21 | cp build/${SNAPSHOT_BUILD_SYS}/stage2-tools-bin/* ${SYS_BINDIR} | ||
22 | for i in ${SYS_BINDIR}/*; do | ||
23 | chrpath -r "\$ORIGIN/../lib" ${i} | ||
24 | done | ||
25 | |||
26 | chown -R root.root ${D} | ||
27 | } | ||
28 | |||
29 | ALLOW_EMPTY:${PN} = "1" | ||
30 | |||
31 | PKG_SYS_BINDIR = "${SDKPATHNATIVE}/usr/bin" | ||
32 | FILES:${RUST_TOOLS_CLIPPY_PN} = "${PKG_SYS_BINDIR}/cargo-clippy ${PKG_SYS_BINDIR}/clippy-driver" | ||
33 | FILES:${RUST_TOOLS_RUSTFMT_PN} = "${PKG_SYS_BINDIR}/rustfmt" | ||
34 | |||
35 | SUMMARY:${PN} = "Rust helper tools" | ||
36 | SUMMARY:${RUST_TOOLS_CLIPPY_PN} = "A collection of lints to catch common mistakes and improve your Rust code" | ||
37 | SUMMARY:${RUST_TOOLS_RUSTFMT_PN} = "A tool for formatting Rust code according to style guidelines" | ||
38 | |||
diff --git a/meta/recipes-devtools/rust/rust-tools-cross-canadian_1.62.0.bb b/meta/recipes-devtools/rust/rust-tools-cross-canadian_1.62.0.bb deleted file mode 100644 index 2d809d68f5..0000000000 --- a/meta/recipes-devtools/rust/rust-tools-cross-canadian_1.62.0.bb +++ /dev/null | |||
@@ -1,6 +0,0 @@ | |||
1 | require rust-tools-cross-canadian.inc | ||
2 | require rust-source.inc | ||
3 | require rust-snapshot.inc | ||
4 | |||
5 | FILESEXTRAPATHS:prepend := "${THISDIR}/rust:" | ||
6 | |||
diff --git a/meta/recipes-devtools/rust/rust.inc b/meta/recipes-devtools/rust/rust.inc index 7c16b8165b..1c8fe225fd 100644 --- a/meta/recipes-devtools/rust/rust.inc +++ b/meta/recipes-devtools/rust/rust.inc | |||
@@ -9,6 +9,7 @@ inherit cargo_common | |||
9 | 9 | ||
10 | DEPENDS += "file-native python3-native" | 10 | DEPENDS += "file-native python3-native" |
11 | DEPENDS:append:class-native = " rust-llvm-native" | 11 | DEPENDS:append:class-native = " rust-llvm-native" |
12 | DEPENDS:append:class-nativesdk = " nativesdk-rust-llvm" | ||
12 | 13 | ||
13 | S = "${RUSTSRC}" | 14 | S = "${RUSTSRC}" |
14 | 15 | ||
@@ -202,18 +203,6 @@ rust_do_install () { | |||
202 | rm -f ${D}${libdir}/rustlib/src/rust | 203 | rm -f ${D}${libdir}/rustlib/src/rust |
203 | } | 204 | } |
204 | 205 | ||
205 | rust_install_targets() { | ||
206 | # Install our custom target.json files | ||
207 | local td="${D}${libdir}/rustlib/" | ||
208 | install -d "$td" | ||
209 | for tgt in "${WORKDIR}/targets/"* ; do | ||
210 | install -m 0644 "$tgt" "$td" | ||
211 | done | ||
212 | } | ||
213 | |||
214 | |||
215 | do_install () { | 206 | do_install () { |
216 | rust_do_install | 207 | rust_do_install |
217 | rust_install_targets | ||
218 | } | 208 | } |
219 | # ex: sts=4 et sw=4 ts=8 | ||
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 | |||