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