summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/rust.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes-recipe/rust.bbclass')
-rw-r--r--meta/classes-recipe/rust.bbclass51
1 files changed, 51 insertions, 0 deletions
diff --git a/meta/classes-recipe/rust.bbclass b/meta/classes-recipe/rust.bbclass
new file mode 100644
index 0000000000..dae25cac2a
--- /dev/null
+++ b/meta/classes-recipe/rust.bbclass
@@ -0,0 +1,51 @@
1#
2# Copyright OpenEmbedded Contributors
3#
4# SPDX-License-Identifier: MIT
5#
6
7inherit rust-common
8
9RUSTC = "rustc"
10
11RUSTC_ARCHFLAGS += "--target=${RUST_HOST_SYS} ${RUSTFLAGS}"
12
13def 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
24DEPENDS: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.
41HOST_LDFLAGS ?= "${LDFLAGS}"
42HOST_CFLAGS ?= "${CFLAGS}"
43HOST_CXXFLAGS ?= "${CXXFLAGS}"
44HOST_CPPFLAGS ?= "${CPPFLAGS}"
45
46rustlib_suffix="${TUNE_ARCH}${TARGET_VENDOR}-${TARGET_OS}/rustlib/${RUST_HOST_SYS}/lib"
47# Native sysroot standard library path
48rustlib_src="${prefix}/lib/${rustlib_suffix}"
49# Host sysroot standard library path
50rustlib="${libdir}/${rustlib_suffix}"
51rustlib:class-native="${libdir}/rustlib/${BUILD_SYS}/lib"