Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | require rust-target.inc |
| 2 | require rust-source.inc |
| 3 | require rust-snapshot.inc |
| 4 | |
| 5 | INSANE_SKIP:${PN}:class-native = "already-stripped" |
| 6 | FILES:${PN} += "${libdir}/rustlib" |
| 7 | FILES:${PN} += "${libdir}/*.so" |
| 8 | FILES:${PN}-dev = "" |
| 9 | |
| 10 | # Used by crossbeam_atomic.patch |
| 11 | export TARGET_VENDOR |
| 12 | |
| 13 | do_compile () { |
| 14 | rust_runx build --stage 2 |
| 15 | } |
| 16 | |
| 17 | do_compile:append:class-target () { |
| 18 | rust_runx build --stage 2 src/tools/clippy |
| 19 | rust_runx build --stage 2 src/tools/rustfmt |
| 20 | } |
| 21 | |
| 22 | do_compile:append:class-nativesdk () { |
| 23 | rust_runx build --stage 2 src/tools/clippy |
| 24 | rust_runx build --stage 2 src/tools/rustfmt |
| 25 | } |
| 26 | |
| 27 | ALLOW_EMPTY:${PN} = "1" |
| 28 | |
| 29 | PACKAGES =+ "${PN}-tools-clippy ${PN}-tools-rustfmt" |
| 30 | FILES:${PN}-tools-clippy = "${bindir}/cargo-clippy ${bindir}/clippy-driver" |
| 31 | FILES:${PN}-tools-rustfmt = "${bindir}/rustfmt" |
| 32 | RDEPENDS:${PN}-tools-clippy = "${PN}" |
| 33 | RDEPENDS:${PN}-tools-rustfmt = "${PN}" |
| 34 | |
| 35 | SUMMARY:${PN}-tools-clippy = "A collection of lints to catch common mistakes and improve your Rust code" |
| 36 | SUMMARY:${PN}-tools-rustfmt = "A tool for formatting Rust code according to style guidelines" |
| 37 | |
| 38 | rust_do_install() { |
| 39 | rust_runx install |
| 40 | } |
| 41 | |
| 42 | rust_do_install:class-nativesdk() { |
| 43 | export PSEUDO_UNLOAD=1 |
| 44 | rust_runx install |
| 45 | unset PSEUDO_UNLOAD |
| 46 | |
| 47 | install -d ${D}${bindir} |
| 48 | for i in cargo-clippy clippy-driver rustfmt; do |
| 49 | cp build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/$i ${D}${bindir} |
| 50 | chrpath -r "\$ORIGIN/../lib" ${D}${bindir}/$i |
| 51 | done |
| 52 | |
| 53 | chown root:root ${D}/ -R |
| 54 | rm ${D}${libdir}/rustlib/uninstall.sh |
| 55 | rm ${D}${libdir}/rustlib/install.log |
| 56 | rm ${D}${libdir}/rustlib/manifest* |
| 57 | } |
| 58 | |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 59 | EXTRA_TOOLS ?= "cargo-clippy clippy-driver rustfmt" |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 60 | rust_do_install:class-target() { |
| 61 | export PSEUDO_UNLOAD=1 |
| 62 | rust_runx install |
| 63 | unset PSEUDO_UNLOAD |
| 64 | |
| 65 | install -d ${D}${bindir} |
Andrew Geissler | 87f5cff | 2022-09-30 13:13:31 -0500 | [diff] [blame] | 66 | for i in ${EXTRA_TOOLS}; do |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 67 | cp build/${RUST_BUILD_SYS}/stage2-tools/${RUST_HOST_SYS}/release/$i ${D}${bindir} |
| 68 | chrpath -r "\$ORIGIN/../lib" ${D}${bindir}/$i |
| 69 | done |
| 70 | |
| 71 | chown root:root ${D}/ -R |
| 72 | rm ${D}${libdir}/rustlib/uninstall.sh |
| 73 | rm ${D}${libdir}/rustlib/install.log |
| 74 | rm ${D}${libdir}/rustlib/manifest* |
| 75 | } |
| 76 | |
| 77 | # see recipes-devtools/gcc/gcc/0018-Add-ssp_nonshared-to-link-commandline-for-musl-targe.patch |
| 78 | # we need to link with ssp_nonshared on musl to avoid "undefined reference to `__stack_chk_fail_local'" |
| 79 | # when building MACHINE=qemux86 for musl |
| 80 | WRAPPER_TARGET_EXTRALD:libc-musl = "-lssp_nonshared" |
| 81 | |
| 82 | RUSTLIB_DEP:class-nativesdk = "" |
| 83 | |
| 84 | # musl builds include libunwind.a |
| 85 | INSANE_SKIP:${PN} = "staticdev" |
| 86 | |