mirror of https://github.com/openwrt/openwrt.git
Build the sysroot crate with the selected Cargo and rustc, using the source tarball's vendored crates and shared target CPU flags. Stage the rlibs and shared library through normal package-owned target staging, and include that sysroot in the SDK. Separate Cargo output by ABI identity to keep dependency artefacts from different configurations in their own build directories. Name the shared library and package ABI from compiler, source, target and build configuration inputs, with configuration changes triggering a rebuild. Declare libgcc as a runtime dependency for libgcc_s.so.1. Release builds optimise for size, abort on panic and emit no unwind tables. They also take the size options of unstable rustc, which the sysroot build permits anyway: panics carry no location (-Zlocation-detail=none) and derived Debug output is reduced to type names (-Zfmt-debug=shallow). RUST_PANIC_IMMEDIATE_ABORT, on by default, builds with -Cpanic=immediate-abort and without the panic-unwind feature: a panic stops the program at once, without formatting a message. rustc requires the same panic strategy for all crates of a program, the standard library included, so this is a build-wide option. Debug builds retain unwinding, panic messages and full Debug output. Build paths are mapped out of the library as iremap in rules.mk does for C, unless CONFIG_DEBUG is set without CONFIG_REPRODUCIBLE_DEBUG_INFO. The map stays out of the inputs of the ABI identity, which would otherwise depend on the build path. rust-values.mk maps the OpenWrt target to its Rust target triple and CPU flags; the mapping is derived from lang/rust in the packages feed by Luca Barbato and Donald Hoskins. The mips64 ABI comes from CONFIG_MIPS64_ABI, which every mips64 configuration sets, and n64 maps to the muslabi64 and gnuabi64 triples. These are hard-float, so soft-float mips64 with musl uses mips64-openwrt-linux-musl, the soft-float n64 target of rustc, and the other soft-float mips64 and mips64el configurations, which have no Rust target, get no Rust packages. The e500v2 of mpc85xx has no FPU but shares the hard-float powerpc triple, whose hard-float feature is turned off with CONFIG_SOFT_FLOAT. When the target triple is the build host's, as for x86_64 and aarch64 glibc targets, Cargo links build scripts with the target linker as well but keeps target rustflags off them, so the target linker is passed as a rustflag in that case. include/scan.mk rescans the package metadata when an include/rust-*.mk file changes, as for include/package*.mk. Co-developed-by: Brian Redbeard <redbeard@dead-city.org> Signed-off-by: Brian Redbeard <redbeard@dead-city.org> Co-developed-by: Aditya Nugraha <vortexilation@gmail.com> Signed-off-by: Aditya Nugraha <vortexilation@gmail.com> Signed-off-by: Daniel Golle <daniel@makrotopia.org> |
||
|---|---|---|
| .. | ||
| files | ||
| Config.in | ||
| Makefile | ||
| convert-config.pl | ||