summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/cargo.bbclass3
-rw-r--r--meta/classes/rust-bin.bbclass1
-rw-r--r--meta/classes/rust-common.bbclass2
-rw-r--r--meta/classes/rust-target-config.bbclass18
4 files changed, 12 insertions, 12 deletions
diff --git a/meta/classes/cargo.bbclass b/meta/classes/cargo.bbclass
index 539ff03ec7..2475d05b3d 100644
--- a/meta/classes/cargo.bbclass
+++ b/meta/classes/cargo.bbclass
@@ -4,6 +4,7 @@
4## Cargo. 4## Cargo.
5 5
6inherit cargo_common 6inherit cargo_common
7inherit rust-target-config
7 8
8# the binary we will use 9# the binary we will use
9CARGO = "cargo" 10CARGO = "cargo"
@@ -40,7 +41,7 @@ BUILD_DIR = "${@['release', 'debug'][d.getVar('DEBUG_BUILD') == '1']}"
40CARGO_TARGET_SUBDIR="${RUST_HOST_SYS}/${BUILD_DIR}" 41CARGO_TARGET_SUBDIR="${RUST_HOST_SYS}/${BUILD_DIR}"
41oe_cargo_build () { 42oe_cargo_build () {
42 export RUSTFLAGS="${RUSTFLAGS}" 43 export RUSTFLAGS="${RUSTFLAGS}"
43 export RUST_TARGET_PATH="${RUST_TARGET_PATH}" 44 bbnote "Using rust targets from ${RUST_TARGET_PATH}"
44 bbnote "cargo = $(which ${CARGO})" 45 bbnote "cargo = $(which ${CARGO})"
45 bbnote "rustc = $(which ${RUSTC})" 46 bbnote "rustc = $(which ${RUSTC})"
46 bbnote "${CARGO} build ${CARGO_BUILD_FLAGS} $@" 47 bbnote "${CARGO} build ${CARGO_BUILD_FLAGS} $@"
diff --git a/meta/classes/rust-bin.bbclass b/meta/classes/rust-bin.bbclass
index c87343b3cf..7a70a7b6ba 100644
--- a/meta/classes/rust-bin.bbclass
+++ b/meta/classes/rust-bin.bbclass
@@ -93,7 +93,6 @@ do_configure () {
93} 93}
94 94
95oe_runrustc () { 95oe_runrustc () {
96 export RUST_TARGET_PATH="${RUST_TARGET_PATH}"
97 bbnote ${RUSTC} ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@" 96 bbnote ${RUSTC} ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@"
98 "${RUSTC}" ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@" 97 "${RUSTC}" ${RUSTC_ARCHFLAGS} ${RUSTC_FLAGS} "$@"
99} 98}
diff --git a/meta/classes/rust-common.bbclass b/meta/classes/rust-common.bbclass
index 1bce7761ab..adcf96f0cd 100644
--- a/meta/classes/rust-common.bbclass
+++ b/meta/classes/rust-common.bbclass
@@ -1,4 +1,5 @@
1inherit python3native 1inherit python3native
2inherit rust-target-config
2 3
3# Common variables used by all Rust builds 4# Common variables used by all Rust builds
4export rustlibdir = "${libdir}/rust" 5export rustlibdir = "${libdir}/rust"
@@ -10,7 +11,6 @@ RUSTLIB = "-L ${STAGING_LIBDIR}/rust"
10RUST_DEBUG_REMAP = "--remap-path-prefix=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}" 11RUST_DEBUG_REMAP = "--remap-path-prefix=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
11RUSTFLAGS += "${RUSTLIB} ${RUST_DEBUG_REMAP}" 12RUSTFLAGS += "${RUSTLIB} ${RUST_DEBUG_REMAP}"
12RUSTLIB_DEP ?= "libstd-rs" 13RUSTLIB_DEP ?= "libstd-rs"
13export RUST_TARGET_PATH = "${STAGING_LIBDIR_NATIVE}/rustlib"
14RUST_PANIC_STRATEGY ?= "unwind" 14RUST_PANIC_STRATEGY ?= "unwind"
15 15
16# Native builds are not effected by TCLIBC. Without this, rust-native 16# Native builds are not effected by TCLIBC. Without this, rust-native
diff --git a/meta/classes/rust-target-config.bbclass b/meta/classes/rust-target-config.bbclass
index ab177cf59f..bc6bd77abb 100644
--- a/meta/classes/rust-target-config.bbclass
+++ b/meta/classes/rust-target-config.bbclass
@@ -292,6 +292,7 @@ def rust_gen_target(d, thing, wd, arch):
292 import json 292 import json
293 sys = d.getVar('{}_SYS'.format(thing)) 293 sys = d.getVar('{}_SYS'.format(thing))
294 prefix = d.getVar('{}_PREFIX'.format(thing)) 294 prefix = d.getVar('{}_PREFIX'.format(thing))
295 rustsys = d.getVar('RUST_{}_SYS'.format(thing))
295 296
296 abi = None 297 abi = None
297 cpu = "generic" 298 cpu = "generic"
@@ -318,13 +319,9 @@ def rust_gen_target(d, thing, wd, arch):
318 features = features or d.getVarFlag('FEATURES', arch_abi) or "" 319 features = features or d.getVarFlag('FEATURES', arch_abi) or ""
319 features = features.strip() 320 features = features.strip()
320 321
321 llvm_target = d.getVar('RUST_TARGET_SYS')
322 if thing == "BUILD":
323 llvm_target = d.getVar('RUST_HOST_SYS')
324
325 # build tspec 322 # build tspec
326 tspec = {} 323 tspec = {}
327 tspec['llvm-target'] = llvm_target 324 tspec['llvm-target'] = rustsys
328 tspec['data-layout'] = d.getVarFlag('DATA_LAYOUT', arch_abi) 325 tspec['data-layout'] = d.getVarFlag('DATA_LAYOUT', arch_abi)
329 if tspec['data-layout'] is None: 326 if tspec['data-layout'] is None:
330 bb.fatal("No rust target defined for %s" % arch_abi) 327 bb.fatal("No rust target defined for %s" % arch_abi)
@@ -358,7 +355,7 @@ def rust_gen_target(d, thing, wd, arch):
358 tspec['panic-strategy'] = d.getVar("RUST_PANIC_STRATEGY") 355 tspec['panic-strategy'] = d.getVar("RUST_PANIC_STRATEGY")
359 356
360 # write out the target spec json file 357 # write out the target spec json file
361 with open(wd + sys + '.json', 'w') as f: 358 with open(wd + rustsys + '.json', 'w') as f:
362 json.dump(tspec, f, indent=4) 359 json.dump(tspec, f, indent=4)
363 360
364# These are accounted for in tmpdir path names so don't need to be in the task sig 361# These are accounted for in tmpdir path names so don't need to be in the task sig
@@ -366,10 +363,13 @@ rust_gen_target[vardepsexclude] += "ABIEXTENSION llvm_cpu"
366 363
367do_rust_gen_targets[vardeps] += "DATA_LAYOUT TARGET_ENDIAN TARGET_POINTER_WIDTH TARGET_C_INT_WIDTH MAX_ATOMIC_WIDTH FEATURES" 364do_rust_gen_targets[vardeps] += "DATA_LAYOUT TARGET_ENDIAN TARGET_POINTER_WIDTH TARGET_C_INT_WIDTH MAX_ATOMIC_WIDTH FEATURES"
368 365
369RUST_TARGETGENS = "BUILD" 366RUST_TARGETS_DIR = "${WORKDIR}/rust-targets/"
367export RUST_TARGET_PATH = "${RUST_TARGETS_DIR}"
368
369RUST_TARGETGENS = "BUILD HOST TARGET"
370 370
371python do_rust_gen_targets () { 371python do_rust_gen_targets () {
372 wd = d.getVar('WORKDIR') + '/targets/' 372 wd = d.getVar('RUST_TARGETS_DIR')
373 # Order of BUILD, HOST, TARGET is important in case the files overwrite, most specific last 373 # Order of BUILD, HOST, TARGET is important in case the files overwrite, most specific last
374 rust_gen_target(d, 'BUILD', wd, d.getVar('BUILD_ARCH')) 374 rust_gen_target(d, 'BUILD', wd, d.getVar('BUILD_ARCH'))
375 if "HOST" in d.getVar("RUST_TARGETGENS"): 375 if "HOST" in d.getVar("RUST_TARGETGENS"):
@@ -379,5 +379,5 @@ python do_rust_gen_targets () {
379} 379}
380 380
381addtask rust_gen_targets after do_patch before do_compile 381addtask rust_gen_targets after do_patch before do_compile
382do_rust_gen_targets[dirs] += "${WORKDIR}/targets" 382do_rust_gen_targets[dirs] += "${RUST_TARGETS_DIR}"
383 383