fixes, catch some bugs earlier, reindent python
This commit is contained in:
@@ -17,6 +17,11 @@ This openembedded layer provides the rust compiler, tools for building packages
|
|||||||
|
|
||||||
cargo, rust (built for target)
|
cargo, rust (built for target)
|
||||||
|
|
||||||
|
## TODO
|
||||||
|
|
||||||
|
- Use rust-native when building rust & rust-cross
|
||||||
|
- Include downloaded stage0 snapshot in `SRC_URI`
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
|
|
||||||
On the host:
|
On the host:
|
||||||
@@ -27,6 +32,8 @@ On the target:
|
|||||||
|
|
||||||
## Maintainer(s) & Patch policy
|
## Maintainer(s) & Patch policy
|
||||||
|
|
||||||
|
Open a Pull Request
|
||||||
|
|
||||||
## Copyright
|
## Copyright
|
||||||
|
|
||||||
MIT/Apache-2.0 - Same as rust
|
MIT/Apache-2.0 - Same as rust
|
||||||
|
|||||||
@@ -1,3 +1,18 @@
|
|||||||
inherit cross
|
inherit cross
|
||||||
DEPENDS += "virtual/${TARGET_PREFIX}gcc"
|
|
||||||
PN = "rust-cross"
|
# Otherwise we'll depend on what we provide
|
||||||
|
INHIBIT_DEFAULT_DEPS = "1"
|
||||||
|
|
||||||
|
|
||||||
|
DEPENDS += "virtual/${TARGET_PREFIX}gcc rust-native"
|
||||||
|
PROVIDES = "virtual/${TARGET_PREFIX}rust"
|
||||||
|
PN = "rust-cross-${TARGET_ARCH}"
|
||||||
|
|
||||||
|
## gcc-cross settings
|
||||||
|
# INHIBIT_DEFAULT_DEPS = "1"
|
||||||
|
# INHIBIT_PACKAGE_STRIP = "1"
|
||||||
|
# ARCH_FLAGS_FOR_TARGET += "-isystem${STAGING_DIR_NATIVE}${target_includedir}"
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: use rust-native instead of a snapshot
|
||||||
|
EXTRA_OECONF += ""
|
||||||
|
|||||||
@@ -1,6 +1,18 @@
|
|||||||
RUSTC = "rustc"
|
RUSTC = "rustc"
|
||||||
RUSTC_ARCHFLAGS += "--target=${TARGET_SYS} -C rpath"
|
RUSTC_ARCHFLAGS += "--target=${TARGET_SYS} -C rpath"
|
||||||
|
|
||||||
|
def rust_base_dep(d):
|
||||||
|
# Taken from meta/classes/base.bbclass `base_dep_prepend` and modified to
|
||||||
|
# use rust instead of gcc
|
||||||
|
|
||||||
|
deps = ""
|
||||||
|
if not d.getVar('INHIBIT_DEFAULT_DEPS'):
|
||||||
|
if (d.getVar('HOST_SYS', True) != d.getVar('BUILD_SYS', True)):
|
||||||
|
deps += " virtual/${TARGET_PREFIX}rust"
|
||||||
|
return deps
|
||||||
|
|
||||||
|
BASEDEPENDS_append = " ${@rust_base_dep(d)}"
|
||||||
|
|
||||||
# BUILD_LDFLAGS
|
# BUILD_LDFLAGS
|
||||||
# ${STAGING_LIBDIR_NATIVE}
|
# ${STAGING_LIBDIR_NATIVE}
|
||||||
# ${STAGING_BASE_LIBDIR_NATIVE}
|
# ${STAGING_BASE_LIBDIR_NATIVE}
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
SRCREV_cargo = "56852db802e8ae3fd6aa1626a31b6a5e6e8df12c"
|
||||||
|
require cargo.inc
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
From 33ed066e368b4d87bfabbfdb64f4fbcd8821a2ff Mon Sep 17 00:00:00 2001
|
||||||
|
From: Cody P Schafer <dev@codyps.com>
|
||||||
|
Date: Sat, 15 Nov 2014 14:16:39 -0500
|
||||||
|
Subject: [PATCH] get-snapshot-debug
|
||||||
|
|
||||||
|
---
|
||||||
|
src/etc/get-snapshot.py | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/src/etc/get-snapshot.py b/src/etc/get-snapshot.py
|
||||||
|
index 886a84b..6043ee2 100755
|
||||||
|
--- a/src/etc/get-snapshot.py
|
||||||
|
+++ b/src/etc/get-snapshot.py
|
||||||
|
@@ -35,6 +35,7 @@ def unpack_snapshot(triple, dl_path):
|
||||||
|
print("extracting " + p)
|
||||||
|
tar.extract(p, download_unpack_base)
|
||||||
|
tp = os.path.join(download_unpack_base, p)
|
||||||
|
+ print("Path is " + tp + "; fp = " + fp)
|
||||||
|
if os.path.isdir(tp) and os.path.exists(fp):
|
||||||
|
continue
|
||||||
|
shutil.move(tp, fp)
|
||||||
|
--
|
||||||
|
2.0.4
|
||||||
|
|
||||||
+66
-47
@@ -26,7 +26,21 @@ DATA_LAYOUT[x86_64] = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-
|
|||||||
LLVM_TARGET[x86_64] = "x86_64-unknown-linux-gnu"
|
LLVM_TARGET[x86_64] = "x86_64-unknown-linux-gnu"
|
||||||
TARGET_ENDIAN[x86_64] = "little"
|
TARGET_ENDIAN[x86_64] = "little"
|
||||||
TARGET_WORD_SIZE[x86_64] = "64"
|
TARGET_WORD_SIZE[x86_64] = "64"
|
||||||
PRE_LINK_ARGS[x86_64] = "-m64 -Wl,--as-needed"
|
PRE_LINK_ARGS[x86_64] = "-Wl,--as-needed -m64"
|
||||||
|
|
||||||
|
## i686-unknown-linux-gnu
|
||||||
|
DATA_LAYOUT[i686] = "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32"
|
||||||
|
LLVM_TARGET[i686] = "i686-unknown-linux-gnu"
|
||||||
|
TARGET_ENDIAN[i686] = "little"
|
||||||
|
TARGET_WORD_SIZE[i686] = "32"
|
||||||
|
PRE_LINK_ARGS[i686] = "-Wl,--as-needed -m32"
|
||||||
|
|
||||||
|
## XXX: a bit of a hack so qemux86 builds, clone of i686-unknown-linux-gnu above
|
||||||
|
DATA_LAYOUT[i586] = "e-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32"
|
||||||
|
LLVM_TARGET[i586] = "i586-unknown-linux-gnu"
|
||||||
|
TARGET_ENDIAN[i586] = "little"
|
||||||
|
TARGET_WORD_SIZE[i586] = "32"
|
||||||
|
PRE_LINK_ARGS[i586] = "-Wl,--as-needed -m32"
|
||||||
|
|
||||||
def ldflags_for(d, thing):
|
def ldflags_for(d, thing):
|
||||||
cc_arch = d.getVar('{}_CC_ARCH'.format(thing), True) or ""
|
cc_arch = d.getVar('{}_CC_ARCH'.format(thing), True) or ""
|
||||||
@@ -70,48 +84,50 @@ def as_json(list_):
|
|||||||
return a
|
return a
|
||||||
|
|
||||||
def rust_gen_target(d, thing, wd):
|
def rust_gen_target(d, thing, wd):
|
||||||
arch = arch_for(d, thing)
|
arch = arch_for(d, thing)
|
||||||
ldflags = ldflags_for(d, thing)
|
ldflags = ldflags_for(d, thing)
|
||||||
sys = sys_for(d, thing)
|
sys = sys_for(d, thing)
|
||||||
prefix = prefix_for(d, thing)
|
prefix = prefix_for(d, thing)
|
||||||
o = open(wd + sys + '.json', 'w')
|
o = open(wd + sys + '.json', 'w')
|
||||||
|
|
||||||
data_layout = d.getVarFlag('DATA_LAYOUT', arch, True)
|
data_layout = d.getVarFlag('DATA_LAYOUT', arch, True)
|
||||||
llvm_target = d.getVarFlag('LLVM_TARGET', arch, True)
|
if not data_layout:
|
||||||
target_word_size = d.getVarFlag('TARGET_WORD_SIZE', arch, True)
|
bb.utils.fatal("DATA_LAYOUT[{}] required but not set for {}".format(arch, thing))
|
||||||
prefix = d.getVar('{}_PREFIX'.format(thing), True)
|
llvm_target = d.getVarFlag('LLVM_TARGET', arch, True)
|
||||||
ccache = d.getVar('CCACHE', True)
|
target_word_size = d.getVarFlag('TARGET_WORD_SIZE', arch, True)
|
||||||
linker = "{}{}gcc".format(ccache, prefix)
|
prefix = d.getVar('{}_PREFIX'.format(thing), True)
|
||||||
features = d.getVarFlag('FEATURES', arch, True) or ""
|
ccache = d.getVar('CCACHE', True)
|
||||||
|
linker = "{}{}gcc".format(ccache, prefix)
|
||||||
|
features = d.getVarFlag('FEATURES', arch, True) or ""
|
||||||
|
|
||||||
pre_link_args = (d.getVarFlag('PRE_LINK_ARGS', arch, True) or "").split()
|
pre_link_args = (d.getVarFlag('PRE_LINK_ARGS', arch, True) or "").split()
|
||||||
|
|
||||||
o.write('''{{
|
o.write('''{{
|
||||||
"data-layout": "{}",
|
"data-layout": "{}",
|
||||||
"llvm-target": "{}",
|
"llvm-target": "{}",
|
||||||
"target-endian": "little",
|
"target-endian": "little",
|
||||||
"target-word-size": "{}",
|
"target-word-size": "{}",
|
||||||
"arch": "{}",
|
"arch": "{}",
|
||||||
"os": "linux",
|
"os": "linux",
|
||||||
"linker": "{}",
|
"linker": "{}",
|
||||||
"features": "{}",
|
"features": "{}",
|
||||||
"dynamic-linking": true,
|
"dynamic-linking": true,
|
||||||
"executables": true,
|
"executables": true,
|
||||||
"morestack": true,
|
"morestack": true,
|
||||||
"linker-is-gnu": true,
|
"linker-is-gnu": true,
|
||||||
"has-rpath": true,
|
"has-rpath": true,
|
||||||
"position-independent-executables": true,
|
"position-independent-executables": true,
|
||||||
"pre-link-args": {}
|
"pre-link-args": {}
|
||||||
}}'''.format(
|
}}'''.format(
|
||||||
data_layout,
|
data_layout,
|
||||||
llvm_target,
|
llvm_target,
|
||||||
target_word_size,
|
target_word_size,
|
||||||
arch,
|
arch,
|
||||||
linker,
|
linker,
|
||||||
features,
|
features,
|
||||||
as_json(pre_link_args)
|
as_json(pre_link_args)
|
||||||
))
|
))
|
||||||
o.close()
|
o.close()
|
||||||
|
|
||||||
python do_rust_gen_targets () {
|
python do_rust_gen_targets () {
|
||||||
import os
|
import os
|
||||||
@@ -131,20 +147,24 @@ def rust_base_triple(d, thing):
|
|||||||
'''
|
'''
|
||||||
Mangle bitbake's *_SYS into something that rust might support (see
|
Mangle bitbake's *_SYS into something that rust might support (see
|
||||||
rust/mk/cfg/* for a list)
|
rust/mk/cfg/* for a list)
|
||||||
|
|
||||||
|
Note that os is assumed to be some linux form
|
||||||
'''
|
'''
|
||||||
|
|
||||||
arch = d.getVar('{}_ARCH'.format(thing), True)
|
arch = d.getVar('{}_ARCH'.format(thing), True)
|
||||||
vendor = d.getVar('{}_VENDOR'.format(thing), True)
|
vendor = d.getVar('{}_VENDOR'.format(thing), True)
|
||||||
os = d.getVar('{}_OS'.format(thing), True)
|
os = d.getVar('{}_OS'.format(thing), True)
|
||||||
|
|
||||||
|
vendor = "-unknown"
|
||||||
|
|
||||||
if arch.startswith("arm"):
|
if arch.startswith("arm"):
|
||||||
vendor = "-unknown"
|
|
||||||
if os.endswith("gnueabi"):
|
if os.endswith("gnueabi"):
|
||||||
os += bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'hf', '', d)
|
os += bb.utils.contains('TUNE_FEATURES', 'callconvention-hard', 'hf', '', d)
|
||||||
elif arch.startswith("x86_64"):
|
elif arch.startswith("x86_64"):
|
||||||
vendor = "-unknown"
|
os = "linux-gnu"
|
||||||
if os == "linux":
|
elif arch.startswith("i586"):
|
||||||
os = "linux-gnu"
|
arch = "i686"
|
||||||
|
os = "linux-gnu"
|
||||||
return arch + vendor + '-' + os
|
return arch + vendor + '-' + os
|
||||||
|
|
||||||
def rust_gen_mk_cfg(d, thing):
|
def rust_gen_mk_cfg(d, thing):
|
||||||
@@ -169,6 +189,7 @@ def rust_gen_mk_cfg(d, thing):
|
|||||||
p = d.getVar('S', True) + '/mk/cfg/'
|
p = d.getVar('S', True) + '/mk/cfg/'
|
||||||
|
|
||||||
o = open(p + sys_for(d, thing), 'w')
|
o = open(p + sys_for(d, thing), 'w')
|
||||||
|
i = open(p + rust_base_sys, 'r')
|
||||||
|
|
||||||
r = subprocess.call(['sed',
|
r = subprocess.call(['sed',
|
||||||
# update all triplets to the new one
|
# update all triplets to the new one
|
||||||
@@ -186,9 +207,7 @@ def rust_gen_mk_cfg(d, thing):
|
|||||||
'-e', '/^CFG_GCCISH_CFLAGS/ s;$; {};'.format(cflags_for(d, thing)),
|
'-e', '/^CFG_GCCISH_CFLAGS/ s;$; {};'.format(cflags_for(d, thing)),
|
||||||
'-e', '/^CFG_GCCISH_CXXFLAGS/ s;$; {};'.format(cxxflags_for(d, thing)),
|
'-e', '/^CFG_GCCISH_CXXFLAGS/ s;$; {};'.format(cxxflags_for(d, thing)),
|
||||||
'-e', '/^CFG_GCCISH_LINK_FLAGS/ s;$; {};'.format(" ".join(ldflags_for(d, thing))),
|
'-e', '/^CFG_GCCISH_LINK_FLAGS/ s;$; {};'.format(" ".join(ldflags_for(d, thing))),
|
||||||
|
], stdout=o, stdin=i)
|
||||||
p + rust_base_sys
|
|
||||||
], stdout=o)
|
|
||||||
if r:
|
if r:
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
SRCREV = "1e4e55aebc1a71b6674c00b8604efa6b1e2e52cd"
|
||||||
|
require rust-git.inc
|
||||||
|
|
||||||
|
SRC_URI_append = "\
|
||||||
|
file://0001-src-etc-snapshot-support-triples-lacking-a-vendor.patch \
|
||||||
|
file://0001-get-snapshot-debug.patch \
|
||||||
|
"
|
||||||
Reference in New Issue
Block a user