Patrick Williams | db4c27e | 2022-08-05 08:10:29 -0500 | [diff] [blame] | 1 | RUST_TARGETGENS = "BUILD HOST TARGET" |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 2 | |
| 3 | # Otherwise we'll depend on what we provide |
| 4 | INHIBIT_DEFAULT_RUST_DEPS = "1" |
| 5 | |
| 6 | # Unlike native (which nicely maps it's DEPENDS) cross wipes them out completely. |
| 7 | # Generally, we (and cross in general) need the same things that native needs, |
| 8 | # so it might make sense to take it's mapping. For now, though, we just mention |
| 9 | # the bits we need explicitly. |
| 10 | DEPENDS += "rust-llvm-native" |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 11 | DEPENDS += "rust-native" |
| 12 | |
Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 13 | # In the cross compilation case, rustc doesn't seem to get the rpath quite |
| 14 | # right. It manages to include '../../lib/${TARGET_PREFIX}', but doesn't |
| 15 | # include the '../../lib' (ie: relative path from cross_bindir to normal |
| 16 | # libdir. As a result, we end up not being able to properly reference files in normal ${libdir}. |
| 17 | # Most of the time this happens to work fine as the systems libraries are |
| 18 | # subsituted, but sometimes a host system will lack a library, or the right |
| 19 | # version of a library (libtinfo was how I noticed this). |
| 20 | # |
| 21 | # FIXME: this should really be fixed in rust itself. |
| 22 | # FIXME: using hard-coded relative paths is wrong, we should ask bitbake for |
| 23 | # the relative path between 2 of it's vars. |
| 24 | HOST_POST_LINK_ARGS:append = " -Wl,-rpath=../../lib" |
| 25 | BUILD_POST_LINK_ARGS:append = " -Wl,-rpath=../../lib" |
| 26 | |
| 27 | # We need the same thing for the calls to the compiler when building the runtime crap |
| 28 | TARGET_CC_ARCH:append = " --sysroot=${STAGING_DIR_TARGET}" |
| 29 | |
| 30 | do_rust_setup_snapshot () { |
| 31 | } |
| 32 | |
| 33 | do_configure () { |
| 34 | } |
| 35 | |
| 36 | do_compile () { |
| 37 | } |
| 38 | |
| 39 | do_install () { |
| 40 | mkdir -p ${D}${prefix}/${base_libdir_native}/rustlib |
| 41 | cp ${WORKDIR}/targets/${TARGET_SYS}.json ${D}${prefix}/${base_libdir_native}/rustlib |
| 42 | } |
| 43 | |
| 44 | rust_cross_sysroot_preprocess() { |
| 45 | sysroot_stage_dir ${D}${prefix}/${base_libdir_native}/rustlib ${SYSROOT_DESTDIR}${prefix}/${base_libdir_native}/rustlib |
| 46 | } |
| 47 | SYSROOT_PREPROCESS_FUNCS += "rust_cross_sysroot_preprocess" |