cargo is picky too :(
This commit is contained in:
+34
-2
@@ -15,6 +15,35 @@ def rust_base_dep(d):
|
|||||||
|
|
||||||
BASEDEPENDS_append = " ${@rust_base_dep(d)}"
|
BASEDEPENDS_append = " ${@rust_base_dep(d)}"
|
||||||
|
|
||||||
|
def rust_base_triple(d, thing):
|
||||||
|
'''
|
||||||
|
Mangle bitbake's *_SYS into something that rust might support (see
|
||||||
|
rust/mk/cfg/* for a list)
|
||||||
|
|
||||||
|
Note that os is assumed to be some linux form
|
||||||
|
'''
|
||||||
|
|
||||||
|
arch = d.getVar('{}_ARCH'.format(thing), True)
|
||||||
|
vendor = d.getVar('{}_VENDOR'.format(thing), True)
|
||||||
|
os = d.getVar('{}_OS'.format(thing), True)
|
||||||
|
|
||||||
|
vendor = "-unknown"
|
||||||
|
|
||||||
|
if arch.startswith("arm"):
|
||||||
|
if os.endswith("gnueabi"):
|
||||||
|
os += bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'hf', '', d)
|
||||||
|
elif arch.startswith("x86_64"):
|
||||||
|
os = "linux-gnu"
|
||||||
|
elif arch.startswith("i586"):
|
||||||
|
arch = "i686"
|
||||||
|
os = "linux-gnu"
|
||||||
|
return arch + vendor + '-' + os
|
||||||
|
|
||||||
|
RUST_BUILD_SYS = "${@rust_base_triple(d, 'BUILD')}"
|
||||||
|
RUST_HOST_SYS = "${@rust_base_triple(d, 'HOST')}"
|
||||||
|
RUST_TARGET_SYS = "${@rust_base_triple(d, 'TARGET')}"
|
||||||
|
|
||||||
|
|
||||||
# BUILD_LDFLAGS
|
# BUILD_LDFLAGS
|
||||||
# ${STAGING_LIBDIR_NATIVE}
|
# ${STAGING_LIBDIR_NATIVE}
|
||||||
# ${STAGING_BASE_LIBDIR_NATIVE}
|
# ${STAGING_BASE_LIBDIR_NATIVE}
|
||||||
@@ -28,7 +57,9 @@ BASEDEPENDS_append = " ${@rust_base_dep(d)}"
|
|||||||
# -L${STAGING_BASE_LIBDIR_NATIVE} \
|
# -L${STAGING_BASE_LIBDIR_NATIVE} \
|
||||||
#"
|
#"
|
||||||
|
|
||||||
RUST_PATH_NATIVE="${STAGING_LIBDIR_NATIVE}:${STAGING_BASE_LIBDIR_NATIVE}"
|
|
||||||
|
# FIXME: the 'rustlib' element of this is to workaround rustc forgetting the libdir it was built with.
|
||||||
|
RUST_PATH_NATIVE="${STAGING_LIBDIR_NATIVE}:${STAGING_BASE_LIBDIR_NATIVE}:${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/rustlib/${TARGET_SYS}/lib"
|
||||||
|
|
||||||
# FIXME: set based on whether we are native vs cross vs buildsdk, etc
|
# FIXME: set based on whether we are native vs cross vs buildsdk, etc
|
||||||
export RUST_PATH ??= "${RUST_PATH_NATIVE}"
|
export RUST_PATH ??= "${RUST_PATH_NATIVE}"
|
||||||
@@ -36,7 +67,7 @@ export RUST_PATH ??= "${RUST_PATH_NATIVE}"
|
|||||||
# FIXME: set this to something (sysroot?) for each of target,native,cross
|
# FIXME: set this to something (sysroot?) for each of target,native,cross
|
||||||
# For now, tuned so target builds are correct. -native happens to work because
|
# For now, tuned so target builds are correct. -native happens to work because
|
||||||
# the target specs happen to match.
|
# the target specs happen to match.
|
||||||
export RUST_TARGET_PATH = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/rust/targets"
|
export RUST_TARGET_PATH = "${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/rust/targets:${STAGING_LIBDIR_NATIVE}/rust/targets"
|
||||||
|
|
||||||
CARGO = "cargo"
|
CARGO = "cargo"
|
||||||
|
|
||||||
@@ -76,6 +107,7 @@ oe_runcargo_build () {
|
|||||||
# FIXME: if there is already an entry for this target, in an existing
|
# FIXME: if there is already an entry for this target, in an existing
|
||||||
# cargo/config, this won't work.
|
# cargo/config, this won't work.
|
||||||
which cargo
|
which cargo
|
||||||
|
which rust
|
||||||
bbnote ${CARGO} build --target ${TARGET_SYS} "$@"
|
bbnote ${CARGO} build --target ${TARGET_SYS} "$@"
|
||||||
oe_cargo_config
|
oe_cargo_config
|
||||||
"${CARGO}" build -v --target "${TARGET_SYS}" --release "$@"
|
"${CARGO}" build -v --target "${TARGET_SYS}" --release "$@"
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
inherit rust
|
||||||
|
|
||||||
SRC_URI = "git://github.com/jmesmon/rust-hello-world.git;protocol=https"
|
SRC_URI = "git://github.com/jmesmon/rust-hello-world.git;protocol=https"
|
||||||
SRCREV="e0fa23f1a3cb1eb1407165bd2fc36d2f6e6ad728"
|
SRCREV="e0fa23f1a3cb1eb1407165bd2fc36d2f6e6ad728"
|
||||||
LIC_FILES_CHKSUM="file://COPYRIGHT;md5=e6b2207ac3740d2d01141c49208c2147"
|
LIC_FILES_CHKSUM="file://COPYRIGHT;md5=e6b2207ac3740d2d01141c49208c2147"
|
||||||
@@ -6,9 +8,10 @@ SUMMARY = "Hello World by Cargo for Rust"
|
|||||||
HOMEPAGE = "https://github.com/jmesmon/rust-hello-world"
|
HOMEPAGE = "https://github.com/jmesmon/rust-hello-world"
|
||||||
LICENSE = "MIT | Apache-2.0"
|
LICENSE = "MIT | Apache-2.0"
|
||||||
|
|
||||||
DEPENDS = "cargo-native"
|
# FIXME: we really depend on cargo-native, but avoid it for now as building it
|
||||||
|
# is more painful than it should be
|
||||||
|
#DEPENDS = "cargo-native"
|
||||||
|
|
||||||
inherit rust
|
|
||||||
S = "${WORKDIR}/git"
|
S = "${WORKDIR}/git"
|
||||||
B = "${S}"
|
B = "${S}"
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ HOMEPAGE = "http://crates.io"
|
|||||||
SECTION = "devel"
|
SECTION = "devel"
|
||||||
LICENSE = "MIT | Apache-2.0"
|
LICENSE = "MIT | Apache-2.0"
|
||||||
|
|
||||||
DEPENDS = "openssl-native rust-native zlib-native libgit2-native curl-native ca-certificates-native"
|
DEPENDS = "openssl zlib libgit2 curl ca-certificates"
|
||||||
|
|
||||||
SRC_URI = "git://github.com/rust-lang/cargo.git;protocol=https;name=cargo"
|
SRC_URI = "git://github.com/rust-lang/cargo.git;protocol=https;name=cargo"
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +1,7 @@
|
|||||||
SRCREV_cargo = "56852db802e8ae3fd6aa1626a31b6a5e6e8df12c"
|
SRCREV_cargo = "56852db802e8ae3fd6aa1626a31b6a5e6e8df12c"
|
||||||
|
|
||||||
|
SRC_URI_append = "\
|
||||||
|
file://0001-dl-snapshot-be-more-forgiving-to-triples.patch \
|
||||||
|
"
|
||||||
|
|
||||||
require cargo.inc
|
require cargo.inc
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
From e097e84e4d0f1315d7b20b7c8a59b0060b1343ed Mon Sep 17 00:00:00 2001
|
||||||
|
From: Cody P Schafer <dev@codyps.com>
|
||||||
|
Date: Sun, 16 Nov 2014 21:35:19 -0500
|
||||||
|
Subject: [PATCH] dl-snapshot: be more forgiving to triples
|
||||||
|
|
||||||
|
---
|
||||||
|
src/etc/dl-snapshot.py | 50 +++++++++++++++++++++++++++++++++++++-------------
|
||||||
|
1 file changed, 37 insertions(+), 13 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/etc/dl-snapshot.py b/src/etc/dl-snapshot.py
|
||||||
|
index 64329ac..31ada37 100644
|
||||||
|
--- a/src/etc/dl-snapshot.py
|
||||||
|
+++ b/src/etc/dl-snapshot.py
|
||||||
|
@@ -18,20 +18,44 @@ win32 = lines[5]
|
||||||
|
win64 = lines[6]
|
||||||
|
triple = sys.argv[1]
|
||||||
|
|
||||||
|
-if triple == 'i686-unknown-linux-gnu':
|
||||||
|
- me = linux32
|
||||||
|
-elif triple == 'x86_64-unknown-linux-gnu':
|
||||||
|
- me = linux64
|
||||||
|
-elif triple == 'i686-apple-darwin':
|
||||||
|
- me = mac32
|
||||||
|
-elif triple == 'x86_64-apple-darwin':
|
||||||
|
- me = mac64
|
||||||
|
-elif triple == 'i686-pc-windows-gnu':
|
||||||
|
- me = win32
|
||||||
|
-elif triple == 'x86_64-pc-windows-gnu':
|
||||||
|
- me = win64
|
||||||
|
+ts = triple.split('-')
|
||||||
|
+arch = ts[0]
|
||||||
|
+if len(ts) == 2:
|
||||||
|
+ vendor = 'unknown'
|
||||||
|
+ target_os = ts[1]
|
||||||
|
else:
|
||||||
|
- raise Exception("no snapshot for the triple: " + triple)
|
||||||
|
+ vendor = ts[1]
|
||||||
|
+ target_os = ts[2]
|
||||||
|
+
|
||||||
|
+intel32 = (arch is 'i686') or (arch is 'i586')
|
||||||
|
+
|
||||||
|
+me = None
|
||||||
|
+if target_os == 'linux':
|
||||||
|
+ if intel32:
|
||||||
|
+ me = linux32
|
||||||
|
+ new_triple = 'i686-unknown-linux-gnu'
|
||||||
|
+ elif arch == 'x86_64':
|
||||||
|
+ me = linux64
|
||||||
|
+ new_triple = 'x86_64-unknown-linux-gnu'
|
||||||
|
+elif target_os == 'darwin':
|
||||||
|
+ if intel32:
|
||||||
|
+ me = mac32
|
||||||
|
+ new_triple = 'i686-apple-darwin'
|
||||||
|
+ elif arch == 'x86_64':
|
||||||
|
+ me = mac64
|
||||||
|
+ new_triple = 'x86_64-apple-darwin'
|
||||||
|
+elif target_os == 'windows':
|
||||||
|
+ if intel32:
|
||||||
|
+ me = win32
|
||||||
|
+ new_triple = 'i686-pc-windows-gnu'
|
||||||
|
+ elif arch == 'x86_64':
|
||||||
|
+ me = win64
|
||||||
|
+ new_triple = 'x86_64-pc-windows-gnu'
|
||||||
|
+
|
||||||
|
+if me is None:
|
||||||
|
+ raise Exception("no snapshot for the triple: " + triple + ", target_os: " + target_os + ", arch: " + arch + ", intel32=" + str(intel32))
|
||||||
|
+
|
||||||
|
+triple = new_triple
|
||||||
|
|
||||||
|
platform, hash = me.strip().split(' ')
|
||||||
|
|
||||||
|
--
|
||||||
|
2.0.4
|
||||||
|
|
||||||
@@ -83,7 +83,6 @@ def arch_to_rust_target_arch(arch):
|
|||||||
else:
|
else:
|
||||||
return arch
|
return arch
|
||||||
|
|
||||||
|
|
||||||
def as_json(list_):
|
def as_json(list_):
|
||||||
a = '['
|
a = '['
|
||||||
for e in list_:
|
for e in list_:
|
||||||
@@ -156,29 +155,6 @@ python do_rust_gen_targets () {
|
|||||||
}
|
}
|
||||||
addtask do_rust_gen_targets after do_patch before do_compile
|
addtask do_rust_gen_targets after do_patch before do_compile
|
||||||
|
|
||||||
def rust_base_triple(d, thing):
|
|
||||||
'''
|
|
||||||
Mangle bitbake's *_SYS into something that rust might support (see
|
|
||||||
rust/mk/cfg/* for a list)
|
|
||||||
|
|
||||||
Note that os is assumed to be some linux form
|
|
||||||
'''
|
|
||||||
|
|
||||||
arch = d.getVar('{}_ARCH'.format(thing), True)
|
|
||||||
vendor = d.getVar('{}_VENDOR'.format(thing), True)
|
|
||||||
os = d.getVar('{}_OS'.format(thing), True)
|
|
||||||
|
|
||||||
vendor = "-unknown"
|
|
||||||
|
|
||||||
if arch.startswith("arm"):
|
|
||||||
if os.endswith("gnueabi"):
|
|
||||||
os += bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'hf', '', d)
|
|
||||||
elif arch.startswith("x86_64"):
|
|
||||||
os = "linux-gnu"
|
|
||||||
elif arch.startswith("i586"):
|
|
||||||
arch = "i686"
|
|
||||||
os = "linux-gnu"
|
|
||||||
return arch + vendor + '-' + os
|
|
||||||
|
|
||||||
def rust_gen_mk_cfg(d, thing):
|
def rust_gen_mk_cfg(d, thing):
|
||||||
''''
|
''''
|
||||||
|
|||||||
Reference in New Issue
Block a user