Andrew Geissler | d159c7f | 2021-09-02 21:05:58 -0500 | [diff] [blame] | 1 | inherit rust-common |
| 2 | |
| 3 | RUSTC = "rustc" |
| 4 | |
| 5 | RUSTC_ARCHFLAGS += "--target=${HOST_SYS} ${RUSTFLAGS}" |
| 6 | |
| 7 | def rust_base_dep(d): |
| 8 | # Taken from meta/classes/base.bbclass `base_dep_prepend` and modified to |
| 9 | # use rust instead of gcc |
| 10 | deps = "" |
| 11 | if not d.getVar('INHIBIT_DEFAULT_RUST_DEPS'): |
| 12 | if (d.getVar('HOST_SYS') != d.getVar('BUILD_SYS')): |
| 13 | deps += " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}" |
| 14 | else: |
| 15 | deps += " rust-native" |
| 16 | return deps |
| 17 | |
| 18 | DEPENDS:append = " ${@rust_base_dep(d)}" |
| 19 | |
| 20 | # BUILD_LDFLAGS |
| 21 | # ${STAGING_LIBDIR_NATIVE} |
| 22 | # ${STAGING_BASE_LIBDIR_NATIVE} |
| 23 | # BUILDSDK_LDFLAGS |
| 24 | # ${STAGING_LIBDIR} |
| 25 | # #{STAGING_DIR_HOST} |
| 26 | # TARGET_LDFLAGS ????? |
| 27 | #RUSTC_BUILD_LDFLAGS = "\ |
| 28 | # --sysroot ${STAGING_DIR_NATIVE} \ |
| 29 | # -L${STAGING_LIBDIR_NATIVE} \ |
| 30 | # -L${STAGING_BASE_LIBDIR_NATIVE} \ |
| 31 | #" |
| 32 | |
| 33 | # XXX: for some reason bitbake sets BUILD_* & TARGET_* but uses the bare |
| 34 | # variables for HOST. Alias things to make it easier for us. |
| 35 | HOST_LDFLAGS ?= "${LDFLAGS}" |
| 36 | HOST_CFLAGS ?= "${CFLAGS}" |
| 37 | HOST_CXXFLAGS ?= "${CXXFLAGS}" |
| 38 | HOST_CPPFLAGS ?= "${CPPFLAGS}" |
| 39 | |
| 40 | rustlib_suffix="${TUNE_ARCH}${TARGET_VENDOR}-${TARGET_OS}/rustlib/${HOST_SYS}/lib" |
| 41 | # Native sysroot standard library path |
| 42 | rustlib_src="${prefix}/lib/${rustlib_suffix}" |
| 43 | # Host sysroot standard library path |
| 44 | rustlib="${libdir}/${rustlib_suffix}" |
| 45 | rustlib:class-native="${libdir}/rustlib/${BUILD_SYS}/lib" |