18 Commits

Author SHA1 Message Date
Martin 'JaMa' Jansa
bf6705fb7f Convert to new override syntax (#357)
* Convert to new override syntax

This is the result of automated script (0.9.0) conversion:

oe-core/scripts/contrib/convert-overrides.py .

converting the metadata to use ":" as the override character instead of "_".

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>

* Manually fix the conversion

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>

* layer.conf: Update layer compatibility with only dunfell and newer.

Add honister to mark the layers as compatible with honister now that it uses
the new override syntax.

Drop zeus and older which are missing a support for newer override syntax which
was backported only to 1.46 branch (used by dunfell) and newer, e.g.:
https://git.openembedded.org/bitbake/commit/?h=1.46&id=c5418eae56cc50dbae7951c055434a0c456c53a4

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>

* CI: use YOCTO_BRANCH instead of yocto-${YOCTO_VERSION} for poky checkout

* using latest revision in branch is often better than sticking to
  some point releases

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>

* CI: switch to hardknott branch

* gatesgarth is already EOL, better to use something supported

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
2021-08-05 17:37:51 -04:00
Khem Raj
1b59fd4590 rust-common.inc: Use == operator instead of 'is'
literal is being checked here therefore == and != should be used instead
of 'is' or 'is not'

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2021-07-07 01:57:32 +02:00
Drew Reed
09605d2ea5 Added hashes for aarch64 binary snapshot packages 2021-06-25 12:02:21 +02:00
Anatol Belski
ab86e0a068 nativesdk: Add some tools in a separate recipe (#345)
* nativesdk: Add some tools in a separate recipe

This brings ATM:
- clippy
- rustfmt

Another approach might be to include these into the existing rust recipe,
but as we can't really use PACKAGECONFIG here it might just overload it.
This way, the tools will be built in parallel and still can be excluded
from the packgae group, if desired.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-06-05 13:42:18 -04:00
Anatol Belski
494d879a1d Merge pull request #344 from weltling/nativesk_std_src
nativesdk: Package rust sources
2021-05-06 18:09:00 +02:00
Anatol Belski
b4877e0be0 nativesdk: Fix rust-std source copy command
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-05-05 11:53:28 +00:00
Anatol Belski
3773dbcebd nativesdk: Package rust sources
This mimics what rustup packages into the toolchain contents. The
presence of the sources for the exact std lib can be useful for the
development and IDE integration.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-05-04 21:46:00 +02:00
Cody Schafer
02db606a96 Merge pull request #338 from aj-bagwell/armv4-alignement
rust.inc: add strict-align when target is ARMv4
2021-04-26 21:37:33 -04:00
Reto Schneider
25ee517ae2 rust: Add support for ARMv5 (#342)
At GARDENA, we are running our Rust based web interface and
overlayfs-purge tool successfully on our ARMv5, Atmel SAM9G25 SoC based
IoT gateway.
2021-04-24 16:54:42 -04:00
AJ Bagwell
031fc5406e rust.inc: add strict-align when target is ARMv4 2021-04-21 14:59:37 +01:00
Anatol Belski
920db7b045 workflows: Refactor yml to improve build time (#335)
* workflows: Refactor yml to improve build time and reduce size

- Split out the build configuration job
- Use the official sstate mirror
- Disable more of unnecessary features

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-04-04 20:53:28 -04:00
Steven Walter
0048ea8253 Merge pull request #333 from weltling/sdk_ci
workflows: Build and test SDK
2021-04-03 19:20:26 -04:00
Anatol Belski
e0180c565e workflows: Further reduce SDK size
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-04-03 14:33:11 +02:00
Anatol Belski
b637307219 workflows: Install SDK under the workspace path
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-04-03 14:14:04 +02:00
Steven Walter
742cd5c095 Merge pull request #334 from meta-rust/progress
cargo.bbclass: support cargo's progress indicator
2021-04-02 18:04:11 -04:00
Anatol Belski
2a9ee78d08 workflows: Check to reduce size
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-04-02 19:50:49 +02:00
Anatol Belski
3638b7da88 workflows: Ensure project dir doesn't exist 2021-04-02 19:20:35 +02:00
Anatol Belski
08c385c922 workflows: Build and test SDK
Closes #332.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-04-02 16:59:41 +02:00
27 changed files with 237 additions and 230 deletions

View File

@@ -1,6 +1,9 @@
on: [pull_request]
jobs:
build:
env:
YOCTO_VERSION: 3.3.2
YOCTO_BRANCH: hardknott
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
@@ -10,14 +13,36 @@ jobs:
run: |
mv poky/build/sstate-cache . || true
rm -rf poky meta-openembedded
git clone -b gatesgarth --single-branch git://git.yoctoproject.org/poky
git clone -b gatesgarth --single-branch git://git.openembedded.org/meta-openembedded
- name: Run bitbake
git clone -b $YOCTO_BRANCH --single-branch git://git.yoctoproject.org/poky
git clone -b $YOCTO_BRANCH --single-branch git://git.openembedded.org/meta-openembedded
- name: Configure build
run: |
cd poky
. oe-init-build-env
mv ../../sstate-cache . || true
bitbake-layers add-layer ../../meta-openembedded/meta-oe
bitbake-layers add-layer ../../meta-rust
echo 'PARALLEL_MAKE_pn-rust-llvm-native = "-j2"' >> conf/local.conf
echo 'PARALLEL_MAKE:pn-rust-llvm-native = "-j2"' >> conf/local.conf
echo 'TOOLCHAIN_HOST_TASK:append = " packagegroup-rust-cross-canadian-${MACHINE}"' >> conf/local.conf
echo "SSTATE_MIRRORS = \"file://.* http://sstate.yoctoproject.org/$YOCTO_VERSION/PATH;downloadfilename=PATH \\n\"" >> conf/local.conf
echo 'PREFERRED_PROVIDER_virtual/kernel = "linux-dummy"' >> conf/local.conf
- name: Run bitbake
run: |
cd poky
. oe-init-build-env
bitbake rust-hello-world
- name: Test SDK
run: |
SDK_DIR=$PWD/sdk-test
cd poky
. oe-init-build-env
bitbake core-image-minimal -c populate_sdk
rm -rf $SDK_DIR
./$(find ./tmp/deploy/sdk/ -name '*.sh') -d $SDK_DIR -y
. $(find $SDK_DIR -name 'environment-setup-*')
PROG=hello
rm -rf $PROG
cargo new $PROG
cd $PROG
cargo build
file $(find ./target -name $PROG)

View File

@@ -9,11 +9,11 @@ inherit cargo_common
CARGO = "cargo"
# We need cargo to compile for the target
BASEDEPENDS_append = " cargo-native"
BASEDEPENDS:append = " cargo-native"
# Ensure we get the right rust variant
DEPENDS_append_class-target = " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}"
DEPENDS_append_class-native = " rust-native"
DEPENDS:append:class-target = " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}"
DEPENDS:append:class-native = " rust-native"
# Enable build separation
B = "${WORKDIR}/build"

View File

@@ -1,6 +1,6 @@
inherit rust
RDEPENDS_${PN}_append_class-target = " ${RUSTLIB_DEP}"
RDEPENDS:${PN}:append:class-target = " ${RUSTLIB_DEP}"
RUSTC_ARCHFLAGS += "-C opt-level=3 -g -L ${STAGING_DIR_HOST}/${rustlibdir} -C linker=${RUST_TARGET_CCLD}"
EXTRA_OEMAKE += 'RUSTC_ARCHFLAGS="${RUSTC_ARCHFLAGS}"'

View File

@@ -1,8 +1,8 @@
# Common variables used by all Rust builds
export rustlibdir = "${libdir}/rust"
FILES_${PN} += "${rustlibdir}/*.so"
FILES_${PN}-dev += "${rustlibdir}/*.rlib ${rustlibdir}/*.rmeta"
FILES_${PN}-dbg += "${rustlibdir}/.debug"
FILES:${PN} += "${rustlibdir}/*.so"
FILES:${PN}-dev += "${rustlibdir}/*.rlib ${rustlibdir}/*.rmeta"
FILES:${PN}-dbg += "${rustlibdir}/.debug"
RUSTLIB = "-L ${STAGING_LIBDIR}/rust"
RUST_DEBUG_REMAP = "--remap-path-prefix=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
@@ -14,7 +14,7 @@ RUST_PANIC_STRATEGY ?= "unwind"
# Native builds are not effected by TCLIBC. Without this, rust-native
# thinks it's "target" (i.e. x86_64-linux) is a musl target.
RUST_LIBC = "${TCLIBC}"
RUST_LIBC_class-native = "glibc"
RUST_LIBC:class-native = "glibc"
def determine_libc(d, thing):
'''Determine which libc something should target'''
@@ -27,7 +27,7 @@ def determine_libc(d, thing):
elif thing == 'BUILD' and (d.getVar('HOST_SYS') != d.getVar('BUILD_SYS')):
libc = d.getVar('RUST_LIBC')
else:
libc = d.getVar('RUST_LIBC_class-native')
libc = d.getVar('RUST_LIBC:class-native')
return libc
@@ -103,7 +103,7 @@ def rust_base_triple(d, thing):
#
# Rust additionally will use two additional cases:
# - undecorated (e.g. CC) - equivalent to TARGET
# - triple suffix (e.g. CC_x86_64_unknown_linux_gnu) - both
# - triple suffix (e.g. CC:x86_64_unknown_linux_gnu) - both
# see: https://github.com/alexcrichton/gcc-rs
# The way that Rust's internal triples and Yocto triples are mapped together
# its likely best to not use the triple suffix due to potential confusion.
@@ -138,6 +138,12 @@ create_wrapper () {
chmod +x "${file}"
}
export WRAPPER_TARGET_CC = "${CC}"
export WRAPPER_TARGET_CXX = "${CXX}"
export WRAPPER_TARGET_CCLD = "${CCLD}"
export WRAPPER_TARGET_LDFLAGS = "${LDFLAGS}"
export WRAPPER_TARGET_AR = "${AR}"
# compiler is used by gcc-rs
# linker is used by rustc/cargo
# archiver is used by the build of libstd-rs
@@ -154,13 +160,14 @@ do_rust_create_wrappers () {
create_wrapper "${RUST_BUILD_AR}" "${BUILD_AR}"
# Yocto Target / Rust Target C compiler
create_wrapper "${RUST_TARGET_CC}" "${CC}"
create_wrapper "${RUST_TARGET_CC}" "${WRAPPER_TARGET_CC}"
# Yocto Target / Rust Target C++ compiler
create_wrapper "${RUST_TARGET_CXX}" "${CXX}"
create_wrapper "${RUST_TARGET_CXX}" "${WRAPPER_TARGET_CXX}"
# Yocto Target / Rust Target linker
create_wrapper "${RUST_TARGET_CCLD}" "${CCLD}" "${LDFLAGS}"
create_wrapper "${RUST_TARGET_CCLD}" "${WRAPPER_TARGET_CCLD}" "${WRAPPER_TARGET_LDFLAGS}"
# Yocto Target / Rust Target archiver
create_wrapper "${RUST_TARGET_AR}" "${AR}"
create_wrapper "${RUST_TARGET_AR}" "${WRAPPER_TARGET_AR}"
}
addtask rust_create_wrappers before do_configure after do_patch

View File

@@ -15,7 +15,7 @@ def rust_base_dep(d):
deps += " rust-native"
return deps
DEPENDS_append = " ${@rust_base_dep(d)}"
DEPENDS:append = " ${@rust_base_dep(d)}"
# BUILD_LDFLAGS
# ${STAGING_LIBDIR_NATIVE}
@@ -42,4 +42,4 @@ rustlib_suffix="${TUNE_ARCH}${TARGET_VENDOR}-${TARGET_OS}/rustlib/${HOST_SYS}/li
rustlib_src="${prefix}/lib/${rustlib_suffix}"
# Host sysroot standard library path
rustlib="${libdir}/${rustlib_suffix}"
rustlib_class-native="${libdir}/rustlib/${BUILD_SYS}/lib"
rustlib:class-native="${libdir}/rustlib/${BUILD_SYS}/lib"

View File

@@ -1,7 +1,7 @@
# Build errors with PIE options enabled
SECURITY_CFLAGS_pn-rust-native = "${SECURITY_NO_PIE_CFLAGS}"
SECURITY_CFLAGS_pn-rust-cross-${TARGET_ARCH} = "${SECURITY_NO_PIE_CFLAGS}"
SECURITY_CFLAGS_pn-rust = "${SECURITY_NO_PIE_CFLAGS}"
SECURITY_CFLAGS_pn-rust-llvm = "${SECURITY_NO_PIE_CFLAGS}"
SECURITY_CFLAGS:pn-rust-native = "${SECURITY_NO_PIE_CFLAGS}"
SECURITY_CFLAGS:pn-rust-cross-${TARGET_ARCH} = "${SECURITY_NO_PIE_CFLAGS}"
SECURITY_CFLAGS:pn-rust = "${SECURITY_NO_PIE_CFLAGS}"
SECURITY_CFLAGS:pn-rust-llvm = "${SECURITY_NO_PIE_CFLAGS}"
SECURITY_LDFLAGS_pn-rust-cross-arm = " -lssp_nonshared -lssp"
SECURITY_LDFLAGS:pn-rust-cross-arm = " -lssp_nonshared -lssp"

View File

@@ -9,7 +9,7 @@ BBFILE_PATTERN_rust-layer := "^${LAYERDIR}/"
BBFILE_PRIORITY_rust-layer = "7"
LAYERDEPENDS_rust-layer = "core openembedded-layer"
LAYERSERIES_COMPAT_rust-layer = "rocko sumo thud warrior zeus dunfell gatesgarth hardknott"
LAYERSERIES_COMPAT_rust-layer = "dunfell gatesgarth hardknott honister"
# Override security flags
require conf/distro/include/rust_security_flags.inc

View File

@@ -232,8 +232,8 @@ INHERIT += "own-mirrors rm_work"
# seen. The two lines below enable the SDL backend too. By default libsdl-native will
# be built, if you want to use your host's libSDL instead of the minimal libsdl built
# by libsdl-native then uncomment the ASSUME_PROVIDED line below.
PACKAGECONFIG_append_pn-qemu-native = " sdl"
PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
PACKAGECONFIG:append:pn-qemu-native = " sdl"
PACKAGECONFIG:append:pn-nativesdk-qemu = " sdl"
#ASSUME_PROVIDED += "libsdl-native"
# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to

View File

@@ -7,9 +7,12 @@ PACKAGEGROUP_DISABLE_COMPLEMENTARY = "1"
RUST="rust-cross-canadian-${TRANSLATED_TARGET_ARCH}"
CARGO="cargo-cross-canadian-${TRANSLATED_TARGET_ARCH}"
RUST_TOOLS="rust-tools-cross-canadian-${TRANSLATED_TARGET_ARCH}"
RDEPENDS_${PN} = " \
RDEPENDS:${PN} = " \
${@all_multilib_tune_values(d, 'RUST')} \
${@all_multilib_tune_values(d, 'CARGO')} \
rust-cross-canadian-src \
${@all_multilib_tune_values(d, 'RUST_TOOLS')} \
"

View File

@@ -9,7 +9,7 @@ require recipes-devtools/rust/rust-common.inc
require cargo.inc
CARGO = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo"
BASEDEPENDS_remove = "cargo-native"
BASEDEPENDS:remove = "cargo-native"
export RUST_TARGET_PATH="${WORKDIR}/targets/"
@@ -37,7 +37,7 @@ python do_rust_gen_targets () {
rust_gen_target(d, 'HOST', wd, "", "generic", d.getVar('HOST_ARCH'))
}
do_compile_prepend () {
do_compile:prepend () {
PKG_CONFIG_PATH="${RECIPE_SYSROOT_NATIVE}/usr/lib/pkgconfig:${PKG_CONFIG_PATH}"
}
@@ -70,5 +70,5 @@ do_install () {
}
PKG_SYS_BINDIR = "${SDKPATHNATIVE}/usr/bin"
FILES_${PN} += "${base_prefix}/environment-setup.d ${PKG_SYS_BINDIR}"
FILES:${PN} += "${base_prefix}/environment-setup.d ${PKG_SYS_BINDIR}"

View File

@@ -1,6 +1,6 @@
require recipes-devtools/rust/rust-source-${PV}.inc
require recipes-devtools/rust/rust-snapshot-${PV}.inc
FILESEXTRAPATHS_prepend := "${THISDIR}/cargo-${PV}:"
FILESEXTRAPATHS:prepend := "${THISDIR}/cargo-${PV}:"
require cargo-cross-canadian.inc

View File

@@ -1,6 +1,6 @@
require recipes-devtools/rust/rust-source-${PV}.inc
require recipes-devtools/rust/rust-snapshot-${PV}.inc
FILESEXTRAPATHS_prepend := "${THISDIR}/cargo-${PV}:"
FILESEXTRAPATHS:prepend := "${THISDIR}/cargo-${PV}:"
require cargo-cross-canadian.inc

View File

@@ -25,7 +25,7 @@ do_cargo_setup_snapshot () {
addtask cargo_setup_snapshot after do_unpack before do_configure
do_cargo_setup_snapshot[dirs] += "${WORKDIR}/${CARGO_SNAPSHOT}"
do_compile_prepend () {
do_compile:prepend () {
export RUSTC_BOOTSTRAP="1"
}
@@ -47,5 +47,5 @@ BBCLASSEXTEND = "native nativesdk"
# When building cargo-native we don't have cargo-native to use and depend on,
# so we must use the locally set up snapshot to bootstrap the build.
BASEDEPENDS_remove_class-native = "cargo-native"
CARGO_class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo"
BASEDEPENDS:remove:class-native = "cargo-native"
CARGO:class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo"

View File

@@ -7,10 +7,10 @@ LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0"
RUSTLIB_DEP = ""
inherit cargo
DEPENDS_append_libc-musl = " libunwind"
DEPENDS:append:libc-musl = " libunwind"
# rv32 does not have libunwind ported yet
DEPENDS_remove_riscv32 = "libunwind"
DEPENDS_remove_riscv64 = "libunwind"
DEPENDS:remove:riscv32 = "libunwind"
DEPENDS:remove:riscv64 = "libunwind"
# Embed bitcode in order to allow compiling both with and without LTO
RUSTFLAGS += "-Cembed-bitcode=yes"
@@ -23,7 +23,7 @@ CARGO_FEATURES ?= "panic-unwind backtrace"
CARGO_BUILD_FLAGS += "--features '${CARGO_FEATURES}'"
CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
do_compile_prepend () {
do_compile:prepend () {
export CARGO_TARGET_DIR="${B}"
# For Rust 1.13.0 and newer
export RUSTC_BOOTSTRAP="1"

View File

@@ -38,12 +38,21 @@ def llvm_features_from_tune(d):
if ('armv6' in mach_overrides) or ('armv6' in feat):
f.append("+v6")
if 'armv5te' in feat:
f.append("+strict-align")
f.append("+v5te")
elif 'armv5' in feat:
f.append("+strict-align")
f.append("+v5")
if ('armv4' in mach_overrides) or ('armv4' in feat):
f.append("+strict-align")
if 'dsp' in feat:
f.append("+dsp")
if 'thumb' in feat:
if d.getVar('ARM_THUMB_OPT') is "thumb":
if d.getVar('ARM_THUMB_OPT') == "thumb":
if target_is_armv7(d):
f.append('+thumb2')
f.append("+thumb-mode")
@@ -278,7 +287,7 @@ TARGET_LLVM_FEATURES = "${@llvm_features(d)}"
# class-native implies TARGET=HOST, and TUNE_FEATURES only describes the real
# (original) target.
TARGET_LLVM_FEATURES_class-native = "${@','.join(llvm_features_from_cc_arch(d))}"
TARGET_LLVM_FEATURES:class-native = "${@','.join(llvm_features_from_cc_arch(d))}"
def rust_gen_target(d, thing, wd, features, cpu, arch):
import json
@@ -311,7 +320,7 @@ def rust_gen_target(d, thing, wd, features, cpu, arch):
tspec['linker'] = "{}{}gcc".format(d.getVar('CCACHE'), prefix)
tspec['ar'] = "{}ar".format(prefix)
tspec['cpu'] = cpu
if features is not "":
if features != "":
tspec['features'] = features
tspec['dynamic-linking'] = True
tspec['executables'] = True

View File

@@ -0,0 +1,53 @@
RUST_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config"
require rust-target.inc
inherit cross-canadian
DEPENDS += " \
virtual/${HOST_PREFIX}gcc-crosssdk \
virtual/nativesdk-libc rust-llvm-native \
virtual/${TARGET_PREFIX}compilerlibs \
virtual/nativesdk-${HOST_PREFIX}compilerlibs \
gcc-cross-${TARGET_ARCH} \
"
# The host tools are likely not to be able to do the necessary operation on
# the target architecturea. Alternatively one could check compatibility
# between host/target.
EXCLUDE_FROM_SHLIBS_${RUSTLIB_TARGET_PN} = "1"
DEBUG_PREFIX_MAP = "-fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
-fdebug-prefix-map=${STAGING_DIR_HOST}= \
-fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
"
LLVM_TARGET[x86_64] = "${RUST_HOST_SYS}"
python do_rust_gen_targets () {
wd = d.getVar('WORKDIR') + '/targets/'
rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_LLVM_FEATURES') or "", d.getVar('TARGET_LLVM_CPU'), d.getVar('TARGET_ARCH'))
rust_gen_target(d, 'HOST', wd, "", "generic", d.getVar('HOST_ARCH'))
rust_gen_target(d, 'BUILD', wd, "", "generic", d.getVar('BUILD_ARCH'))
}
INHIBIT_DEFAULT_RUST_DEPS = "1"
export WRAPPER_TARGET_CC = "${CCACHE}${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TARGET_CC_ARCH} ${SECURITY_NOPIE_CFLAGS}"
export WRAPPER_TARGET_CXX = "${CCACHE}${TARGET_PREFIX}g++ --sysroot=${STAGING_DIR_TARGET} ${TARGET_CC_ARCH} ${SECURITY_NOPIE_CFLAGS}"
export WRAPPER_TARGET_CCLD = "${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TARGET_CC_ARCH} ${SECURITY_NOPIE_CFLAGS}"
export WRAPPER_TARGET_LDFLAGS = "${TARGET_LDFLAGS}"
export WRAPPER_TARGET_AR = "${TARGET_PREFIX}ar"
python do_configure:prepend() {
targets = [d.getVar("TARGET_SYS", True), "{}-unknown-linux-gnu".format(d.getVar("HOST_ARCH", True))]
hosts = ["{}-unknown-linux-gnu".format(d.getVar("HOST_ARCH", True))]
}
INSANE_SKIP:${RUSTLIB_TARGET_PN} = "file-rdeps arch ldflags"
SKIP_FILEDEPS:${RUSTLIB_TARGET_PN} = "1"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_SYSROOT_STRIP = "1"

View File

@@ -1,44 +1,14 @@
RUST_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-config"
require rust-cross-canadian-common.inc
require rust-target.inc
inherit cross-canadian
DEPENDS += " \
virtual/${HOST_PREFIX}gcc-crosssdk \
virtual/nativesdk-libc rust-llvm-native \
virtual/${TARGET_PREFIX}compilerlibs \
virtual/nativesdk-${HOST_PREFIX}compilerlibs \
gcc-cross-${TARGET_ARCH} \
"
RUSTLIB_TARGET_PN = "rust-cross-canadian-rustlib-target-${TRANSLATED_TARGET_ARCH}"
RUSTLIB_HOST_PN = "rust-cross-canadian-rustlib-host-${TRANSLATED_TARGET_ARCH}"
RUSTLIB_PKGS = "${RUSTLIB_TARGET_PN} ${RUSTLIB_HOST_PN}"
RUSTLIB_SRC_PN = "rust-cross-canadian-src"
RUSTLIB_PKGS = "${RUSTLIB_SRC_PN} ${RUSTLIB_TARGET_PN} ${RUSTLIB_HOST_PN}"
PN = "rust-cross-canadian-${TRANSLATED_TARGET_ARCH}"
PACKAGES = "${RUSTLIB_PKGS} ${PN}"
RDEPENDS_${PN} += "${RUSTLIB_PKGS}"
# The host tools are likely not to be able to do the necessary operation on
# the target architecturea. Alternatively one could check compatibility
# between host/target.
EXCLUDE_FROM_SHLIBS_${RUSTLIB_TARGET_PN} = "1"
DEBUG_PREFIX_MAP = "-fdebug-prefix-map=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR} \
-fdebug-prefix-map=${STAGING_DIR_HOST}= \
-fdebug-prefix-map=${STAGING_DIR_NATIVE}= \
"
LLVM_TARGET[x86_64] = "${RUST_HOST_SYS}"
python do_rust_gen_targets () {
wd = d.getVar('WORKDIR') + '/targets/'
rust_gen_target(d, 'TARGET', wd, d.getVar('TARGET_LLVM_FEATURES') or "", d.getVar('TARGET_LLVM_CPU'), d.getVar('TARGET_ARCH'))
rust_gen_target(d, 'HOST', wd, "", "generic", d.getVar('HOST_ARCH'))
rust_gen_target(d, 'BUILD', wd, "", "generic", d.getVar('BUILD_ARCH'))
}
INHIBIT_DEFAULT_RUST_DEPS = "1"
RDEPENDS:${PN} += "${RUSTLIB_PKGS}"
# The default behaviour of x.py changed in 1.47+ so now we need to
# explicitly ask for the stage 2 compiler to be assembled.
@@ -46,123 +16,6 @@ do_compile () {
rust_runx build --stage 2
}
export TARGET_CC = "${CCACHE}${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TARGET_CC_ARCH} ${SECURITY_NOPIE_CFLAGS}"
export TARGET_CXX = "${CCACHE}${TARGET_PREFIX}g++ --sysroot=${STAGING_DIR_TARGET} ${TARGET_CC_ARCH} ${SECURITY_NOPIE_CFLAGS}"
export TARGET_CCLD = "${TARGET_PREFIX}gcc --sysroot=${STAGING_DIR_TARGET} ${TARGET_CC_ARCH} ${SECURITY_NOPIE_CFLAGS}"
export TARGET_AR = "${TARGET_PREFIX}ar"
do_rust_create_wrappers () {
mkdir -p "${WRAPPER_DIR}"
# Yocto Build / Rust Host C compiler
create_wrapper "${RUST_BUILD_CC}" "${BUILD_CC}"
# Yocto Build / Rust Host C++ compiler
create_wrapper "${RUST_BUILD_CXX}" "${BUILD_CXX}"
# Yocto Build / Rust Host linker
create_wrapper "${RUST_BUILD_CCLD}" "${BUILD_CCLD}" "${BUILD_LDFLAGS}"
# Yocto Build / Rust Host archiver
create_wrapper "${RUST_BUILD_AR}" "${BUILD_AR}"
# Yocto Target / Rust Target C compiler
create_wrapper "${RUST_TARGET_CC}" "${TARGET_CC}"
# Yocto Target / Rust Target C++ compiler
create_wrapper "${RUST_TARGET_CXX}" "${TARGET_CXX}"
# Yocto Target / Rust Target linker
create_wrapper "${RUST_TARGET_CCLD}" "${TARGET_CCLD}" "${TARGET_LDFLAGS}"
# Yocto Target / Rust Target archiver
create_wrapper "${RUST_TARGET_AR}" "${TARGET_AR}"
}
python do_configure() {
import json
from distutils.version import LooseVersion
try:
import configparser
except ImportError:
import ConfigParser as configparser
# toml is rather similar to standard ini like format except it likes values
# that look more JSON like. So for our purposes simply escaping all values
# as JSON seem to work fine.
e = lambda s: json.dumps(s)
config = configparser.RawConfigParser()
# [target.ARCH-poky-linux]
target_section = "target.{}".format(d.getVar('TARGET_SYS', True))
config.add_section(target_section)
llvm_config = d.expand("${YOCTO_ALTERNATE_EXE_PATH}")
config.set(target_section, "llvm-config", e(llvm_config))
config.set(target_section, "cxx", e(d.expand("${RUST_TARGET_CXX}")))
config.set(target_section, "cc", e(d.expand("${RUST_TARGET_CC}")))
config.set(target_section, "ar", e(d.expand("${RUST_TARGET_AR}")))
# If we don't do this rust-native will compile it's own llvm for BUILD.
# [target.${BUILD_ARCH}-unknown-linux-gnu]
target_section = "target.{}".format(d.getVar('SNAPSHOT_BUILD_SYS', True))
config.add_section(target_section)
config.set(target_section, "llvm-config", e(llvm_config))
config.set(target_section, "cxx", e(d.expand("${RUST_BUILD_CXX}")))
config.set(target_section, "cc", e(d.expand("${RUST_BUILD_CC}")))
config.set(target_section, "ar", e(d.expand("${RUST_BUILD_AR}")))
# [rust]
config.add_section("rust")
config.set("rust", "rpath", e(True))
config.set("rust", "channel", e("stable"))
if LooseVersion(d.getVar("PV")) < LooseVersion("1.32.0"):
config.set("rust", "use-jemalloc", e(False))
# Whether or not to optimize the compiler and standard library
config.set("rust", "optimize", e(True))
# [build]
config.add_section("build")
config.set("build", "submodules", e(False))
config.set("build", "docs", e(False))
rustc = d.expand("${WORKDIR}/rust-snapshot/bin/rustc")
config.set("build", "rustc", e(rustc))
cargo = d.expand("${WORKDIR}/rust-snapshot/bin/cargo")
config.set("build", "cargo", e(cargo))
config.set("build", "vendor", e(True))
targets = [d.getVar("TARGET_SYS", True), "{}-unknown-linux-gnu".format(d.getVar("HOST_ARCH", True))]
config.set("build", "target", e(targets))
hosts = ["{}-unknown-linux-gnu".format(d.getVar("HOST_ARCH", True))]
config.set("build", "host", e(hosts))
# We can't use BUILD_SYS since that is something the rust snapshot knows
# nothing about when trying to build some stage0 tools (like fabricate)
config.set("build", "build", e(d.getVar("SNAPSHOT_BUILD_SYS", True)))
# [install]
config.add_section("install")
# ./x.py install doesn't have any notion of "destdir"
# but we can prepend ${D} to all the directories instead
config.set("install", "prefix", e(d.getVar("D", True) + d.getVar("prefix", True)))
config.set("install", "bindir", e(d.getVar("D", True) + d.getVar("bindir", True)))
config.set("install", "libdir", e(d.getVar("D", True) + d.getVar("libdir", True)))
config.set("install", "datadir", e(d.getVar("D", True) + d.getVar("datadir", True)))
config.set("install", "mandir", e(d.getVar("D", True) + d.getVar("mandir", True)))
with open("config.toml", "w") as f:
f.write('changelog-seen = 2\n\n')
config.write(f)
# set up ${WORKDIR}/cargo_home
bb.build.exec_func("setup_cargo_environment", d)
}
do_install () {
# Rust requires /usr/lib to contain the libs.
# Similar story is with /usr/bin ruquiring `lib` to be at the same level.
@@ -190,7 +43,13 @@ do_install () {
install -m 0644 "${WORKDIR}/targets/${TARGET_SYS}.json" "${RUSTLIB_DIR}"
# TODO package the sources.
SRC_DIR=${RUSTLIB_DIR}/src/rust
install -d ${SRC_DIR}/src/llvm-project
cp -R --no-dereference build/${SNAPSHOT_BUILD_SYS}/stage2/lib/rustlib/src/rust/src/llvm-project/libunwind ${SRC_DIR}/src/llvm-project
cp -R --no-dereference build/${SNAPSHOT_BUILD_SYS}/stage2/lib/rustlib/src/rust/library ${SRC_DIR}
cp --no-dereference build/${SNAPSHOT_BUILD_SYS}/stage2/lib/rustlib/src/rust/Cargo.lock ${SRC_DIR}
# Remove executable bit from any files so then SDK doesn't try to relocate.
chmod -R -x+X ${SRC_DIR}
ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d
mkdir "${ENV_SETUP_DIR}"
@@ -204,21 +63,16 @@ do_install () {
chown -R root.root ${D}
}
INSANE_SKIP_${RUSTLIB_TARGET_PN} = "file-rdeps arch ldflags"
SKIP_FILEDEPS_${RUSTLIB_TARGET_PN} = "1"
INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
INHIBIT_PACKAGE_STRIP = "1"
INHIBIT_SYSROOT_STRIP = "1"
PKG_SYS_LIBDIR = "${SDKPATHNATIVE}/usr/lib"
PKG_SYS_BINDIR = "${SDKPATHNATIVE}/usr/bin"
PKG_RUSTLIB_DIR = "${PKG_SYS_LIBDIR}/${TARGET_SYS}/rustlib"
FILES_${PN} = "${PKG_SYS_LIBDIR}/*.so ${PKG_SYS_BINDIR} ${base_prefix}/environment-setup.d"
FILES_${RUSTLIB_TARGET_PN} = "${PKG_RUSTLIB_DIR}/${TARGET_SYS} ${PKG_RUSTLIB_DIR}/${TARGET_SYS}.json"
FILES_${RUSTLIB_HOST_PN} = "${PKG_RUSTLIB_DIR}/${BUILD_ARCH}-unknown-linux-gnu"
FILES:${PN} = "${PKG_SYS_LIBDIR}/*.so ${PKG_SYS_BINDIR} ${base_prefix}/environment-setup.d"
FILES:${RUSTLIB_TARGET_PN} = "${PKG_RUSTLIB_DIR}/${TARGET_SYS} ${PKG_RUSTLIB_DIR}/${TARGET_SYS}.json"
FILES:${RUSTLIB_HOST_PN} = "${PKG_RUSTLIB_DIR}/${BUILD_ARCH}-unknown-linux-gnu"
FILES:${RUSTLIB_SRC_PN} = "${PKG_RUSTLIB_DIR}/src"
SUMMARY_${RUSTLIB_TARGET_PN} = "Rust cross canadian libaries for ${TARGET_SYS}"
SUMMARY_${RUSTLIB_HOST_PN} = "Rust cross canadian libaries for ${HOST_SYS}"
SUMMARY_${PN} = "Rust crost canadian compiler"
SUMMARY:${RUSTLIB_TARGET_PN} = "Rust cross canadian libaries for ${TARGET_SYS}"
SUMMARY:${RUSTLIB_HOST_PN} = "Rust cross canadian libaries for ${HOST_SYS}"
SUMMARY:${RUSTLIB_SRC_PN} = "Rust standard library sources for cross canadian toolchain"
SUMMARY:${PN} = "Rust crost canadian compiler"

View File

@@ -2,7 +2,7 @@ require rust-cross-canadian.inc
require rust-source-${PV}.inc
require rust-snapshot-${PV}.inc
FILESEXTRAPATHS_prepend := "${THISDIR}/rust:"
FILESEXTRAPATHS:prepend := "${THISDIR}/rust:"
SRC_URI += " \
file://0001-rustc_target-Fix-dash-vs-underscore-mismatches-in-op.patch \

View File

@@ -2,5 +2,5 @@ require rust-cross-canadian.inc
require rust-source-${PV}.inc
require rust-snapshot-${PV}.inc
FILESEXTRAPATHS_prepend := "${THISDIR}/rust:"
FILESEXTRAPATHS:prepend := "${THISDIR}/rust:"

View File

@@ -45,11 +45,11 @@ PN = "rust-cross-${TARGET_ARCH}"
# FIXME: this should really be fixed in rust itself.
# FIXME: using hard-coded relative paths is wrong, we should ask bitbake for
# the relative path between 2 of it's vars.
HOST_POST_LINK_ARGS_append = " -Wl,-rpath=../../lib"
BUILD_POST_LINK_ARGS_append = " -Wl,-rpath=../../lib"
HOST_POST_LINK_ARGS:append = " -Wl,-rpath=../../lib"
BUILD_POST_LINK_ARGS:append = " -Wl,-rpath=../../lib"
# We need the same thing for the calls to the compiler when building the runtime crap
TARGET_CC_ARCH_append = " --sysroot=${STAGING_DIR_TARGET}"
TARGET_CC_ARCH:append = " --sysroot=${STAGING_DIR_TARGET}"
do_rust_setup_snapshot () {
}

View File

@@ -13,8 +13,8 @@ inherit cmake python3native
DEPENDS += "ninja-native rust-llvm-native"
ARM_INSTRUCTION_SET_armv5 = "arm"
ARM_INSTRUCTION_SET_armv4t = "arm"
ARM_INSTRUCTION_SET:armv5 = "arm"
ARM_INSTRUCTION_SET:armv4t = "arm"
LLVM_DIR = "llvm${LLVM_RELEASE}"
@@ -34,7 +34,7 @@ EXTRA_OECMAKE = " \
-DLLVM_TARGET_ARCH=${TARGET_ARCH} \
-DCMAKE_INSTALL_PREFIX:PATH=${libdir}/llvm-rust \
"
EXTRA_OECMAKE_append_class-target = "\
EXTRA_OECMAKE:append:class-target = "\
-DCMAKE_CROSSCOMPILING:BOOL=ON \
-DLLVM_BUILD_TOOLS=OFF \
-DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \
@@ -47,7 +47,7 @@ INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm-rust/bin/llvm-config"
do_install_append () {
do_install:append () {
# we don't need any of this stuff to build Rust
rm -rf "${D}/usr/lib/cmake"
}
@@ -55,11 +55,11 @@ do_install_append () {
PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liblto"
# Add the extra locations to avoid the complaints about unpackaged files
FILES_${PN}-bugpointpasses = "${libdir}/llvm-rust/lib/BugpointPasses.so"
FILES_${PN}-llvmhello = "${libdir}/llvm-rust/lib/LLVMHello.so"
FILES_${PN}-liblto = "${libdir}/llvm-rust/lib/libLTO.so.*"
FILES_${PN}-staticdev =+ "${libdir}/llvm-rust/*/*.a"
FILES_${PN} += "${libdir}/libLLVM*.so.* ${libdir}/llvm-rust/lib/*.so.* ${libdir}/llvm-rust/bin"
FILES_${PN}-dev += "${datadir}/llvm ${libdir}/llvm-rust/lib/*.so ${libdir}/llvm-rust/include ${libdir}/llvm-rust/share ${libdir}/llvm-rust/lib/cmake"
FILES:${PN}-bugpointpasses = "${libdir}/llvm-rust/lib/BugpointPasses.so"
FILES:${PN}-llvmhello = "${libdir}/llvm-rust/lib/LLVMHello.so"
FILES:${PN}-liblto = "${libdir}/llvm-rust/lib/libLTO.so.*"
FILES:${PN}-staticdev =+ "${libdir}/llvm-rust/*/*.a"
FILES:${PN} += "${libdir}/libLLVM*.so.* ${libdir}/llvm-rust/lib/*.so.* ${libdir}/llvm-rust/bin"
FILES:${PN}-dev += "${datadir}/llvm ${libdir}/llvm-rust/lib/*.so ${libdir}/llvm-rust/include ${libdir}/llvm-rust/share ${libdir}/llvm-rust/lib/cmake"
BBCLASSEXTEND = "native"

View File

@@ -11,3 +11,8 @@ CARGO_VERSION = "1.48.0"
SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "1c00a6a0dabbf6290728b09f9307d9fa6cc985487f727075c68acd4a600ef3f8"
SRC_URI[rustc-snapshot-x86_64.sha256sum] = "fc4d292a52cbb6b84fb9f065d0d7596064a9b957381d639d5a750d6e2bf02483"
SRC_URI[cargo-snapshot-x86_64.sha256sum] = "b11d595581e2580c069b5039214e1031a0e4f87ff6490ac39f92f77857e37055"
SRC_URI[rust-std-snapshot-aarch64.sha256sum] = "3a50eeb64a63a09f79bee49e01f72410d455b9ae1c7f07ebdb6dc0d40e9aa0bc"
SRC_URI[rustc-snapshot-aarch64.sha256sum] = "ad2ca472b4abf228afd28e16840524a4f08a5efaeaae1d046ff1855c00f3994d"
SRC_URI[cargo-snapshot-aarch64.sha256sum] = "9ea440709cf51cf28110847fd769e7fc937a01d03500edec5232408c4459fc80"

View File

@@ -11,3 +11,8 @@ CARGO_VERSION = "1.50.0"
SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "f1eb68db2b28a56ed8701edba7cf3688011d903ca12ff9d85bd21d3f8f614792"
SRC_URI[rustc-snapshot-x86_64.sha256sum] = "9bebd360bcd9b5bb58f2a02930b9db4ae291adef259c96377f1f4cbd240bcf86"
SRC_URI[cargo-snapshot-x86_64.sha256sum] = "3cb2c68e987e5681fca9c930973f408a71151b1b255e69669a08e54d446ee803"
SRC_URI[rust-std-snapshot-aarch64.sha256sum] = "1a1b1a540d531c89e866083f84ef67125dee108844e4e415b07c3a1000006544"
SRC_URI[rustc-snapshot-aarch64.sha256sum] = "9b956d97d7e428ecd8634d467659ebdb5bd79c387b88363be8749eddd7f98756"
SRC_URI[cargo-snapshot-aarch64.sha256sum] = "f3c772f455406f67991ac20cff56a4fcd2d01454e29280c566119ab5180307ea"

View File

@@ -3,8 +3,8 @@ require rust.inc
DEPENDS += "rust-llvm (=${PV})"
# Otherwise we'll depend on what we provide
INHIBIT_DEFAULT_RUST_DEPS_class-native = "1"
INHIBIT_DEFAULT_RUST_DEPS:class-native = "1"
# We don't need to depend on gcc-native because yocto assumes it exists
PROVIDES_class-native = "virtual/${TARGET_PREFIX}rust"
PROVIDES:class-native = "virtual/${TARGET_PREFIX}rust"
BBCLASSEXTEND = "native"

View File

@@ -0,0 +1,38 @@
require rust-cross-canadian-common.inc
RUST_TOOLS_CLIPPY_PN = "rust-tools-clippy-cross-canadian-${TRANSLATED_TARGET_ARCH}"
RUST_TOOLS_RUSTFMT_PN = "rust-tools-rustfmt-cross-canadian-${TRANSLATED_TARGET_ARCH}"
RUST_TOOLS_PKGS = "${RUST_TOOLS_CLIPPY_PN} ${RUST_TOOLS_RUSTFMT_PN}"
PN = "rust-tools-cross-canadian-${TRANSLATED_TARGET_ARCH}"
PACKAGES = "${RUST_TOOLS_CLIPPY_PN} ${RUST_TOOLS_RUSTFMT_PN} ${PN}"
RDEPENDS:${PN} += "${RUST_TOOLS_PKGS}"
do_compile () {
rust_runx build --stage 2 src/tools/clippy
rust_runx build --stage 2 src/tools/rustfmt
}
do_install () {
SYS_BINDIR=$(dirname ${D}${bindir})
install -d "${SYS_BINDIR}"
cp build/${SNAPSHOT_BUILD_SYS}/stage2-tools-bin/* ${SYS_BINDIR}
for i in ${SYS_BINDIR}/*; do
chrpath -r "\$ORIGIN/../lib" ${i}
done
chown -R root.root ${D}
}
ALLOW_EMPTY:${PN} = "1"
PKG_SYS_BINDIR = "${SDKPATHNATIVE}/usr/bin"
FILES:${RUST_TOOLS_CLIPPY_PN} = "${PKG_SYS_BINDIR}/cargo-clippy ${PKG_SYS_BINDIR}/clippy-driver"
FILES:${RUST_TOOLS_RUSTFMT_PN} = "${PKG_SYS_BINDIR}/rustfmt"
SUMMARY:${PN} = "Rust helper tools"
SUMMARY:${RUST_TOOLS_CLIPPY_PN} = "A collection of lints to catch common mistakes and improve your Rust code"
SUMMARY:${RUST_TOOLS_RUSTFMT_PN} = "A tool for formatting Rust code according to style guidelines"

View File

@@ -0,0 +1,6 @@
require rust-tools-cross-canadian.inc
require rust-source-${PV}.inc
require rust-snapshot-${PV}.inc
FILESEXTRAPATHS:prepend := "${THISDIR}/rust:"

View File

@@ -11,7 +11,7 @@ SRC_URI += "file://riscv-march.patch"
SRC_URI += "file://rv64gc.patch"
DEPENDS += "file-native python3-native"
DEPENDS_append_class-native = " rust-llvm-native"
DEPENDS:append:class-native = " rust-llvm-native"
S = "${RUSTSRC}"
@@ -117,11 +117,13 @@ python do_configure() {
config.set("build", "vendor", e(True))
targets = [d.getVar("TARGET_SYS", True)]
if not "targets" in locals():
targets = [d.getVar("TARGET_SYS", True)]
config.set("build", "target", e(targets))
hosts = [d.getVar("HOST_SYS", True)]
config.set("build", "host", e(targets))
if not "hosts" in locals():
hosts = [d.getVar("HOST_SYS", True)]
config.set("build", "host", e(hosts))
# We can't use BUILD_SYS since that is something the rust snapshot knows
# nothing about when trying to build some stage0 tools (like fabricate)