summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
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
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')
-rw-r--r--meta/recipes-devtools/rust/rust-target.inc2
-rw-r--r--meta/recipes-devtools/rust/rust-tools-cross-canadian.inc38
-rw-r--r--meta/recipes-devtools/rust/rust-tools-cross-canadian_1.62.0.bb6
-rw-r--r--meta/recipes-devtools/rust/rust.inc13
-rw-r--r--meta/recipes-devtools/rust/rust_1.62.0.bb69
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
8PROVIDES:class-native = "virtual/${TARGET_PREFIX}rust" 8PROVIDES:class-native = "virtual/${TARGET_PREFIX}rust"
9 9
10BBCLASSEXTEND = "native" 10BBCLASSEXTEND = "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
2require rust-cross-canadian-common.inc
3
4RUST_TOOLS_CLIPPY_PN = "rust-tools-clippy-cross-canadian-${TRANSLATED_TARGET_ARCH}"
5RUST_TOOLS_RUSTFMT_PN = "rust-tools-rustfmt-cross-canadian-${TRANSLATED_TARGET_ARCH}"
6RUST_TOOLS_PKGS = "${RUST_TOOLS_CLIPPY_PN} ${RUST_TOOLS_RUSTFMT_PN}"
7PN = "rust-tools-cross-canadian-${TRANSLATED_TARGET_ARCH}"
8
9PACKAGES = "${RUST_TOOLS_CLIPPY_PN} ${RUST_TOOLS_RUSTFMT_PN} ${PN}"
10RDEPENDS:${PN} += "${RUST_TOOLS_PKGS}"
11
12do_compile () {
13 rust_runx build --stage 2 src/tools/clippy
14 rust_runx build --stage 2 src/tools/rustfmt
15}
16
17do_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
29ALLOW_EMPTY:${PN} = "1"
30
31PKG_SYS_BINDIR = "${SDKPATHNATIVE}/usr/bin"
32FILES:${RUST_TOOLS_CLIPPY_PN} = "${PKG_SYS_BINDIR}/cargo-clippy ${PKG_SYS_BINDIR}/clippy-driver"
33FILES:${RUST_TOOLS_RUSTFMT_PN} = "${PKG_SYS_BINDIR}/rustfmt"
34
35SUMMARY:${PN} = "Rust helper tools"
36SUMMARY:${RUST_TOOLS_CLIPPY_PN} = "A collection of lints to catch common mistakes and improve your Rust code"
37SUMMARY:${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 @@
1require rust-tools-cross-canadian.inc
2require rust-source.inc
3require rust-snapshot.inc
4
5FILESEXTRAPATHS: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
10DEPENDS += "file-native python3-native" 10DEPENDS += "file-native python3-native"
11DEPENDS:append:class-native = " rust-llvm-native" 11DEPENDS:append:class-native = " rust-llvm-native"
12DEPENDS:append:class-nativesdk = " nativesdk-rust-llvm"
12 13
13S = "${RUSTSRC}" 14S = "${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
205rust_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
215do_install () { 206do_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
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