xref: /openbmc/openbmc/poky/meta/recipes-devtools/rust/libstd-rs_1.80.1.bb (revision 8460358c3d24c71d9d38fd126c745854a6301564)
1*8460358cSPatrick WilliamsSUMMARY = "Rust standard libaries"
2*8460358cSPatrick WilliamsHOMEPAGE = "http://www.rust-lang.org"
3*8460358cSPatrick WilliamsSECTION = "devel"
4*8460358cSPatrick WilliamsLICENSE = "(MIT | Apache-2.0) & Unicode-TOU"
5*8460358cSPatrick WilliamsLIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=c2cccf560306876da3913d79062a54b9"
6*8460358cSPatrick Williams
7*8460358cSPatrick Williamsrequire rust-source.inc
8*8460358cSPatrick Williams
9*8460358cSPatrick Williams# The dummy crate named `sysroot` represents the standard library target.
10*8460358cSPatrick Williams#
11*8460358cSPatrick Williams# See fd4c81f4c19e ("Add a `sysroot` crate to represent the standard library crates")
12*8460358cSPatrick Williams# https://github.com/rust-lang/rust/pull/108865/
13*8460358cSPatrick WilliamsS = "${RUSTSRC}/library/sysroot"
14*8460358cSPatrick Williams
15*8460358cSPatrick WilliamsRUSTLIB_DEP = ""
16*8460358cSPatrick Williamsinherit cargo
17*8460358cSPatrick Williams
18*8460358cSPatrick WilliamsCVE_PRODUCT = "rust"
19*8460358cSPatrick Williams
20*8460358cSPatrick WilliamsDEPENDS:append:libc-musl = " libunwind"
21*8460358cSPatrick Williams# rv32 does not have libunwind ported yet
22*8460358cSPatrick WilliamsDEPENDS:remove:riscv32 = "libunwind"
23*8460358cSPatrick WilliamsDEPENDS:remove:riscv64 = "libunwind"
24*8460358cSPatrick Williams
25*8460358cSPatrick Williams# Embed bitcode in order to allow compiling both with and without LTO
26*8460358cSPatrick WilliamsRUSTFLAGS += "-Cembed-bitcode=yes"
27*8460358cSPatrick Williams# Needed so cargo can find libbacktrace
28*8460358cSPatrick WilliamsRUSTFLAGS += "-L ${STAGING_LIBDIR} -C link-arg=-Wl,-soname,libstd.so"
29*8460358cSPatrick Williams
30*8460358cSPatrick WilliamsCARGO_FEATURES ?= "panic-unwind backtrace"
31*8460358cSPatrick WilliamsCARGO_BUILD_FLAGS += "--features '${CARGO_FEATURES}'"
32*8460358cSPatrick WilliamsCARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
33*8460358cSPatrick Williams
34*8460358cSPatrick Williamsdo_compile:prepend () {
35*8460358cSPatrick Williams    export CARGO_TARGET_DIR="${B}"
36*8460358cSPatrick Williams    # For Rust 1.13.0 and newer
37*8460358cSPatrick Williams    export RUSTC_BOOTSTRAP="1"
38*8460358cSPatrick Williams}
39*8460358cSPatrick Williams
40*8460358cSPatrick Williamsdo_install () {
41*8460358cSPatrick Williams    mkdir -p ${D}${rustlibdir}
42*8460358cSPatrick Williams
43*8460358cSPatrick Williams    # With the incremental build support added in 1.24, the libstd deps directory also includes dependency
44*8460358cSPatrick Williams    # files that get installed. Those are really only needed to incrementally rebuild the libstd library
45*8460358cSPatrick Williams    # itself and don't need to be installed.
46*8460358cSPatrick Williams    rm -f ${B}/${RUST_TARGET_SYS}/${BUILD_DIR}/deps/*.d
47*8460358cSPatrick Williams    cp ${B}/${RUST_TARGET_SYS}/${BUILD_DIR}/deps/* ${D}${rustlibdir}
48*8460358cSPatrick Williams}
49*8460358cSPatrick Williams
50*8460358cSPatrick WilliamsBBCLASSEXTEND = "nativesdk"
51*8460358cSPatrick Williams
52*8460358cSPatrick Williams# Since 1.70.0 upgrade this fails to build with gold:
53*8460358cSPatrick Williams# http://errors.yoctoproject.org/Errors/Details/708194/
54*8460358cSPatrick Williams# ld: error: version script assignment of  to symbol __rust_alloc_error_handler_should_panic failed: symbol not defined
55*8460358cSPatrick WilliamsLDFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-gold', '-fuse-ld=bfd', '', d)}"
56