blob: 5c8938d09fe59d26d8ac503f2ad31db33653fa7c [file] [log] [blame]
Andrew Geisslerd159c7f2021-09-02 21:05:58 -05001inherit rust-common
2
3RUSTC = "rustc"
4
5RUSTC_ARCHFLAGS += "--target=${HOST_SYS} ${RUSTFLAGS}"
6
7def 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
18DEPENDS: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.
35HOST_LDFLAGS ?= "${LDFLAGS}"
36HOST_CFLAGS ?= "${CFLAGS}"
37HOST_CXXFLAGS ?= "${CXXFLAGS}"
38HOST_CPPFLAGS ?= "${CPPFLAGS}"
39
40rustlib_suffix="${TUNE_ARCH}${TARGET_VENDOR}-${TARGET_OS}/rustlib/${HOST_SYS}/lib"
41# Native sysroot standard library path
42rustlib_src="${prefix}/lib/${rustlib_suffix}"
43# Host sysroot standard library path
44rustlib="${libdir}/${rustlib_suffix}"
45rustlib:class-native="${libdir}/rustlib/${BUILD_SYS}/lib"