Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bf6705fb7f | |||
| 1b59fd4590 | |||
| 09605d2ea5 | |||
| ab86e0a068 | |||
| 494d879a1d | |||
| b4877e0be0 | |||
| 3773dbcebd | |||
| 02db606a96 | |||
| 25ee517ae2 | |||
| 031fc5406e | |||
| 920db7b045 | |||
| 0048ea8253 | |||
| e0180c565e | |||
| b637307219 | |||
| 742cd5c095 | |||
| 2a9ee78d08 | |||
| 3638b7da88 | |||
| 08c385c922 |
@@ -1,6 +1,9 @@
|
|||||||
on: [pull_request]
|
on: [pull_request]
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
env:
|
||||||
|
YOCTO_VERSION: 3.3.2
|
||||||
|
YOCTO_BRANCH: hardknott
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@@ -10,14 +13,36 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mv poky/build/sstate-cache . || true
|
mv poky/build/sstate-cache . || true
|
||||||
rm -rf poky meta-openembedded
|
rm -rf poky meta-openembedded
|
||||||
git clone -b gatesgarth --single-branch git://git.yoctoproject.org/poky
|
git clone -b $YOCTO_BRANCH --single-branch git://git.yoctoproject.org/poky
|
||||||
git clone -b gatesgarth --single-branch git://git.openembedded.org/meta-openembedded
|
git clone -b $YOCTO_BRANCH --single-branch git://git.openembedded.org/meta-openembedded
|
||||||
- name: Run bitbake
|
- name: Configure build
|
||||||
run: |
|
run: |
|
||||||
cd poky
|
cd poky
|
||||||
. oe-init-build-env
|
. oe-init-build-env
|
||||||
mv ../../sstate-cache . || true
|
mv ../../sstate-cache . || true
|
||||||
bitbake-layers add-layer ../../meta-openembedded/meta-oe
|
bitbake-layers add-layer ../../meta-openembedded/meta-oe
|
||||||
bitbake-layers add-layer ../../meta-rust
|
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
|
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)
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ inherit cargo_common
|
|||||||
CARGO = "cargo"
|
CARGO = "cargo"
|
||||||
|
|
||||||
# We need cargo to compile for the target
|
# We need cargo to compile for the target
|
||||||
BASEDEPENDS_append = " cargo-native"
|
BASEDEPENDS:append = " cargo-native"
|
||||||
|
|
||||||
# Ensure we get the right rust variant
|
# Ensure we get the right rust variant
|
||||||
DEPENDS_append_class-target = " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}"
|
DEPENDS:append:class-target = " virtual/${TARGET_PREFIX}rust ${RUSTLIB_DEP}"
|
||||||
DEPENDS_append_class-native = " rust-native"
|
DEPENDS:append:class-native = " rust-native"
|
||||||
|
|
||||||
# Enable build separation
|
# Enable build separation
|
||||||
B = "${WORKDIR}/build"
|
B = "${WORKDIR}/build"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
inherit rust
|
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}"
|
RUSTC_ARCHFLAGS += "-C opt-level=3 -g -L ${STAGING_DIR_HOST}/${rustlibdir} -C linker=${RUST_TARGET_CCLD}"
|
||||||
EXTRA_OEMAKE += 'RUSTC_ARCHFLAGS="${RUSTC_ARCHFLAGS}"'
|
EXTRA_OEMAKE += 'RUSTC_ARCHFLAGS="${RUSTC_ARCHFLAGS}"'
|
||||||
|
|||||||
+17
-10
@@ -1,8 +1,8 @@
|
|||||||
# Common variables used by all Rust builds
|
# Common variables used by all Rust builds
|
||||||
export rustlibdir = "${libdir}/rust"
|
export rustlibdir = "${libdir}/rust"
|
||||||
FILES_${PN} += "${rustlibdir}/*.so"
|
FILES:${PN} += "${rustlibdir}/*.so"
|
||||||
FILES_${PN}-dev += "${rustlibdir}/*.rlib ${rustlibdir}/*.rmeta"
|
FILES:${PN}-dev += "${rustlibdir}/*.rlib ${rustlibdir}/*.rmeta"
|
||||||
FILES_${PN}-dbg += "${rustlibdir}/.debug"
|
FILES:${PN}-dbg += "${rustlibdir}/.debug"
|
||||||
|
|
||||||
RUSTLIB = "-L ${STAGING_LIBDIR}/rust"
|
RUSTLIB = "-L ${STAGING_LIBDIR}/rust"
|
||||||
RUST_DEBUG_REMAP = "--remap-path-prefix=${WORKDIR}=/usr/src/debug/${PN}/${EXTENDPE}${PV}-${PR}"
|
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
|
# Native builds are not effected by TCLIBC. Without this, rust-native
|
||||||
# thinks it's "target" (i.e. x86_64-linux) is a musl target.
|
# thinks it's "target" (i.e. x86_64-linux) is a musl target.
|
||||||
RUST_LIBC = "${TCLIBC}"
|
RUST_LIBC = "${TCLIBC}"
|
||||||
RUST_LIBC_class-native = "glibc"
|
RUST_LIBC:class-native = "glibc"
|
||||||
|
|
||||||
def determine_libc(d, thing):
|
def determine_libc(d, thing):
|
||||||
'''Determine which libc something should target'''
|
'''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')):
|
elif thing == 'BUILD' and (d.getVar('HOST_SYS') != d.getVar('BUILD_SYS')):
|
||||||
libc = d.getVar('RUST_LIBC')
|
libc = d.getVar('RUST_LIBC')
|
||||||
else:
|
else:
|
||||||
libc = d.getVar('RUST_LIBC_class-native')
|
libc = d.getVar('RUST_LIBC:class-native')
|
||||||
|
|
||||||
return libc
|
return libc
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ def rust_base_triple(d, thing):
|
|||||||
#
|
#
|
||||||
# Rust additionally will use two additional cases:
|
# Rust additionally will use two additional cases:
|
||||||
# - undecorated (e.g. CC) - equivalent to TARGET
|
# - 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
|
# see: https://github.com/alexcrichton/gcc-rs
|
||||||
# The way that Rust's internal triples and Yocto triples are mapped together
|
# 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.
|
# its likely best to not use the triple suffix due to potential confusion.
|
||||||
@@ -138,6 +138,12 @@ create_wrapper () {
|
|||||||
chmod +x "${file}"
|
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
|
# compiler is used by gcc-rs
|
||||||
# linker is used by rustc/cargo
|
# linker is used by rustc/cargo
|
||||||
# archiver is used by the build of libstd-rs
|
# archiver is used by the build of libstd-rs
|
||||||
@@ -154,13 +160,14 @@ do_rust_create_wrappers () {
|
|||||||
create_wrapper "${RUST_BUILD_AR}" "${BUILD_AR}"
|
create_wrapper "${RUST_BUILD_AR}" "${BUILD_AR}"
|
||||||
|
|
||||||
# Yocto Target / Rust Target C compiler
|
# 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
|
# 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
|
# 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
|
# 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
|
addtask rust_create_wrappers before do_configure after do_patch
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ def rust_base_dep(d):
|
|||||||
deps += " rust-native"
|
deps += " rust-native"
|
||||||
return deps
|
return deps
|
||||||
|
|
||||||
DEPENDS_append = " ${@rust_base_dep(d)}"
|
DEPENDS:append = " ${@rust_base_dep(d)}"
|
||||||
|
|
||||||
# BUILD_LDFLAGS
|
# BUILD_LDFLAGS
|
||||||
# ${STAGING_LIBDIR_NATIVE}
|
# ${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}"
|
rustlib_src="${prefix}/lib/${rustlib_suffix}"
|
||||||
# Host sysroot standard library path
|
# Host sysroot standard library path
|
||||||
rustlib="${libdir}/${rustlib_suffix}"
|
rustlib="${libdir}/${rustlib_suffix}"
|
||||||
rustlib_class-native="${libdir}/rustlib/${BUILD_SYS}/lib"
|
rustlib:class-native="${libdir}/rustlib/${BUILD_SYS}/lib"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Build errors with PIE options enabled
|
# Build errors with PIE options enabled
|
||||||
SECURITY_CFLAGS_pn-rust-native = "${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-cross-${TARGET_ARCH} = "${SECURITY_NO_PIE_CFLAGS}"
|
||||||
SECURITY_CFLAGS_pn-rust = "${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-llvm = "${SECURITY_NO_PIE_CFLAGS}"
|
||||||
|
|
||||||
SECURITY_LDFLAGS_pn-rust-cross-arm = " -lssp_nonshared -lssp"
|
SECURITY_LDFLAGS:pn-rust-cross-arm = " -lssp_nonshared -lssp"
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@ BBFILE_PATTERN_rust-layer := "^${LAYERDIR}/"
|
|||||||
BBFILE_PRIORITY_rust-layer = "7"
|
BBFILE_PRIORITY_rust-layer = "7"
|
||||||
|
|
||||||
LAYERDEPENDS_rust-layer = "core openembedded-layer"
|
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
|
# Override security flags
|
||||||
require conf/distro/include/rust_security_flags.inc
|
require conf/distro/include/rust_security_flags.inc
|
||||||
|
|||||||
@@ -232,8 +232,8 @@ INHERIT += "own-mirrors rm_work"
|
|||||||
# seen. The two lines below enable the SDL backend too. By default libsdl-native will
|
# 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
|
# 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.
|
# by libsdl-native then uncomment the ASSUME_PROVIDED line below.
|
||||||
PACKAGECONFIG_append_pn-qemu-native = " sdl"
|
PACKAGECONFIG:append:pn-qemu-native = " sdl"
|
||||||
PACKAGECONFIG_append_pn-nativesdk-qemu = " sdl"
|
PACKAGECONFIG:append:pn-nativesdk-qemu = " sdl"
|
||||||
#ASSUME_PROVIDED += "libsdl-native"
|
#ASSUME_PROVIDED += "libsdl-native"
|
||||||
|
|
||||||
# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to
|
# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to
|
||||||
|
|||||||
@@ -7,9 +7,12 @@ PACKAGEGROUP_DISABLE_COMPLEMENTARY = "1"
|
|||||||
|
|
||||||
RUST="rust-cross-canadian-${TRANSLATED_TARGET_ARCH}"
|
RUST="rust-cross-canadian-${TRANSLATED_TARGET_ARCH}"
|
||||||
CARGO="cargo-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, 'RUST')} \
|
||||||
${@all_multilib_tune_values(d, 'CARGO')} \
|
${@all_multilib_tune_values(d, 'CARGO')} \
|
||||||
|
rust-cross-canadian-src \
|
||||||
|
${@all_multilib_tune_values(d, 'RUST_TOOLS')} \
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ require recipes-devtools/rust/rust-common.inc
|
|||||||
require cargo.inc
|
require cargo.inc
|
||||||
|
|
||||||
CARGO = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo"
|
CARGO = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo"
|
||||||
BASEDEPENDS_remove = "cargo-native"
|
BASEDEPENDS:remove = "cargo-native"
|
||||||
|
|
||||||
export RUST_TARGET_PATH="${WORKDIR}/targets/"
|
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'))
|
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}"
|
PKG_CONFIG_PATH="${RECIPE_SYSROOT_NATIVE}/usr/lib/pkgconfig:${PKG_CONFIG_PATH}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,5 +70,5 @@ do_install () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PKG_SYS_BINDIR = "${SDKPATHNATIVE}/usr/bin"
|
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}"
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
require recipes-devtools/rust/rust-source-${PV}.inc
|
require recipes-devtools/rust/rust-source-${PV}.inc
|
||||||
require recipes-devtools/rust/rust-snapshot-${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
|
require cargo-cross-canadian.inc
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
require recipes-devtools/rust/rust-source-${PV}.inc
|
require recipes-devtools/rust/rust-source-${PV}.inc
|
||||||
require recipes-devtools/rust/rust-snapshot-${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
|
require cargo-cross-canadian.inc
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ do_cargo_setup_snapshot () {
|
|||||||
addtask cargo_setup_snapshot after do_unpack before do_configure
|
addtask cargo_setup_snapshot after do_unpack before do_configure
|
||||||
do_cargo_setup_snapshot[dirs] += "${WORKDIR}/${CARGO_SNAPSHOT}"
|
do_cargo_setup_snapshot[dirs] += "${WORKDIR}/${CARGO_SNAPSHOT}"
|
||||||
|
|
||||||
do_compile_prepend () {
|
do_compile:prepend () {
|
||||||
export RUSTC_BOOTSTRAP="1"
|
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,
|
# 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.
|
# so we must use the locally set up snapshot to bootstrap the build.
|
||||||
BASEDEPENDS_remove_class-native = "cargo-native"
|
BASEDEPENDS:remove:class-native = "cargo-native"
|
||||||
CARGO_class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo"
|
CARGO:class-native = "${WORKDIR}/${CARGO_SNAPSHOT}/bin/cargo"
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ LIC_FILES_CHKSUM = "file://../../COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0"
|
|||||||
RUSTLIB_DEP = ""
|
RUSTLIB_DEP = ""
|
||||||
inherit cargo
|
inherit cargo
|
||||||
|
|
||||||
DEPENDS_append_libc-musl = " libunwind"
|
DEPENDS:append:libc-musl = " libunwind"
|
||||||
# rv32 does not have libunwind ported yet
|
# rv32 does not have libunwind ported yet
|
||||||
DEPENDS_remove_riscv32 = "libunwind"
|
DEPENDS:remove:riscv32 = "libunwind"
|
||||||
DEPENDS_remove_riscv64 = "libunwind"
|
DEPENDS:remove:riscv64 = "libunwind"
|
||||||
|
|
||||||
# Embed bitcode in order to allow compiling both with and without LTO
|
# Embed bitcode in order to allow compiling both with and without LTO
|
||||||
RUSTFLAGS += "-Cembed-bitcode=yes"
|
RUSTFLAGS += "-Cembed-bitcode=yes"
|
||||||
@@ -23,7 +23,7 @@ CARGO_FEATURES ?= "panic-unwind backtrace"
|
|||||||
CARGO_BUILD_FLAGS += "--features '${CARGO_FEATURES}'"
|
CARGO_BUILD_FLAGS += "--features '${CARGO_FEATURES}'"
|
||||||
CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
|
CARGO_VENDORING_DIRECTORY = "${RUSTSRC}/vendor"
|
||||||
|
|
||||||
do_compile_prepend () {
|
do_compile:prepend () {
|
||||||
export CARGO_TARGET_DIR="${B}"
|
export CARGO_TARGET_DIR="${B}"
|
||||||
# For Rust 1.13.0 and newer
|
# For Rust 1.13.0 and newer
|
||||||
export RUSTC_BOOTSTRAP="1"
|
export RUSTC_BOOTSTRAP="1"
|
||||||
|
|||||||
@@ -38,12 +38,21 @@ def llvm_features_from_tune(d):
|
|||||||
|
|
||||||
if ('armv6' in mach_overrides) or ('armv6' in feat):
|
if ('armv6' in mach_overrides) or ('armv6' in feat):
|
||||||
f.append("+v6")
|
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:
|
if 'dsp' in feat:
|
||||||
f.append("+dsp")
|
f.append("+dsp")
|
||||||
|
|
||||||
if 'thumb' in feat:
|
if 'thumb' in feat:
|
||||||
if d.getVar('ARM_THUMB_OPT') is "thumb":
|
if d.getVar('ARM_THUMB_OPT') == "thumb":
|
||||||
if target_is_armv7(d):
|
if target_is_armv7(d):
|
||||||
f.append('+thumb2')
|
f.append('+thumb2')
|
||||||
f.append("+thumb-mode")
|
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
|
# class-native implies TARGET=HOST, and TUNE_FEATURES only describes the real
|
||||||
# (original) target.
|
# (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):
|
def rust_gen_target(d, thing, wd, features, cpu, arch):
|
||||||
import json
|
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['linker'] = "{}{}gcc".format(d.getVar('CCACHE'), prefix)
|
||||||
tspec['ar'] = "{}ar".format(prefix)
|
tspec['ar'] = "{}ar".format(prefix)
|
||||||
tspec['cpu'] = cpu
|
tspec['cpu'] = cpu
|
||||||
if features is not "":
|
if features != "":
|
||||||
tspec['features'] = features
|
tspec['features'] = features
|
||||||
tspec['dynamic-linking'] = True
|
tspec['dynamic-linking'] = True
|
||||||
tspec['executables'] = True
|
tspec['executables'] = True
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|
||||||
@@ -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_TARGET_PN = "rust-cross-canadian-rustlib-target-${TRANSLATED_TARGET_ARCH}"
|
||||||
RUSTLIB_HOST_PN = "rust-cross-canadian-rustlib-host-${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}"
|
PN = "rust-cross-canadian-${TRANSLATED_TARGET_ARCH}"
|
||||||
|
|
||||||
PACKAGES = "${RUSTLIB_PKGS} ${PN}"
|
PACKAGES = "${RUSTLIB_PKGS} ${PN}"
|
||||||
RDEPENDS_${PN} += "${RUSTLIB_PKGS}"
|
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"
|
|
||||||
|
|
||||||
# The default behaviour of x.py changed in 1.47+ so now we need to
|
# 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.
|
# explicitly ask for the stage 2 compiler to be assembled.
|
||||||
@@ -46,123 +16,6 @@ do_compile () {
|
|||||||
rust_runx build --stage 2
|
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 () {
|
do_install () {
|
||||||
# Rust requires /usr/lib to contain the libs.
|
# Rust requires /usr/lib to contain the libs.
|
||||||
# Similar story is with /usr/bin ruquiring `lib` to be at the same level.
|
# 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}"
|
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
|
ENV_SETUP_DIR=${D}${base_prefix}/environment-setup.d
|
||||||
mkdir "${ENV_SETUP_DIR}"
|
mkdir "${ENV_SETUP_DIR}"
|
||||||
@@ -204,21 +63,16 @@ do_install () {
|
|||||||
chown -R root.root ${D}
|
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_LIBDIR = "${SDKPATHNATIVE}/usr/lib"
|
||||||
PKG_SYS_BINDIR = "${SDKPATHNATIVE}/usr/bin"
|
PKG_SYS_BINDIR = "${SDKPATHNATIVE}/usr/bin"
|
||||||
PKG_RUSTLIB_DIR = "${PKG_SYS_LIBDIR}/${TARGET_SYS}/rustlib"
|
PKG_RUSTLIB_DIR = "${PKG_SYS_LIBDIR}/${TARGET_SYS}/rustlib"
|
||||||
FILES_${PN} = "${PKG_SYS_LIBDIR}/*.so ${PKG_SYS_BINDIR} ${base_prefix}/environment-setup.d"
|
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_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_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_TARGET_PN} = "Rust cross canadian libaries for ${TARGET_SYS}"
|
||||||
SUMMARY_${RUSTLIB_HOST_PN} = "Rust cross canadian libaries for ${HOST_SYS}"
|
SUMMARY:${RUSTLIB_HOST_PN} = "Rust cross canadian libaries for ${HOST_SYS}"
|
||||||
SUMMARY_${PN} = "Rust crost canadian compiler"
|
SUMMARY:${RUSTLIB_SRC_PN} = "Rust standard library sources for cross canadian toolchain"
|
||||||
|
SUMMARY:${PN} = "Rust crost canadian compiler"
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ require rust-cross-canadian.inc
|
|||||||
require rust-source-${PV}.inc
|
require rust-source-${PV}.inc
|
||||||
require rust-snapshot-${PV}.inc
|
require rust-snapshot-${PV}.inc
|
||||||
|
|
||||||
FILESEXTRAPATHS_prepend := "${THISDIR}/rust:"
|
FILESEXTRAPATHS:prepend := "${THISDIR}/rust:"
|
||||||
|
|
||||||
SRC_URI += " \
|
SRC_URI += " \
|
||||||
file://0001-rustc_target-Fix-dash-vs-underscore-mismatches-in-op.patch \
|
file://0001-rustc_target-Fix-dash-vs-underscore-mismatches-in-op.patch \
|
||||||
|
|||||||
@@ -2,5 +2,5 @@ require rust-cross-canadian.inc
|
|||||||
require rust-source-${PV}.inc
|
require rust-source-${PV}.inc
|
||||||
require rust-snapshot-${PV}.inc
|
require rust-snapshot-${PV}.inc
|
||||||
|
|
||||||
FILESEXTRAPATHS_prepend := "${THISDIR}/rust:"
|
FILESEXTRAPATHS:prepend := "${THISDIR}/rust:"
|
||||||
|
|
||||||
|
|||||||
@@ -45,11 +45,11 @@ PN = "rust-cross-${TARGET_ARCH}"
|
|||||||
# FIXME: this should really be fixed in rust itself.
|
# FIXME: this should really be fixed in rust itself.
|
||||||
# FIXME: using hard-coded relative paths is wrong, we should ask bitbake for
|
# FIXME: using hard-coded relative paths is wrong, we should ask bitbake for
|
||||||
# the relative path between 2 of it's vars.
|
# the relative path between 2 of it's vars.
|
||||||
HOST_POST_LINK_ARGS_append = " -Wl,-rpath=../../lib"
|
HOST_POST_LINK_ARGS:append = " -Wl,-rpath=../../lib"
|
||||||
BUILD_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
|
# 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 () {
|
do_rust_setup_snapshot () {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ inherit cmake python3native
|
|||||||
|
|
||||||
DEPENDS += "ninja-native rust-llvm-native"
|
DEPENDS += "ninja-native rust-llvm-native"
|
||||||
|
|
||||||
ARM_INSTRUCTION_SET_armv5 = "arm"
|
ARM_INSTRUCTION_SET:armv5 = "arm"
|
||||||
ARM_INSTRUCTION_SET_armv4t = "arm"
|
ARM_INSTRUCTION_SET:armv4t = "arm"
|
||||||
|
|
||||||
LLVM_DIR = "llvm${LLVM_RELEASE}"
|
LLVM_DIR = "llvm${LLVM_RELEASE}"
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ EXTRA_OECMAKE = " \
|
|||||||
-DLLVM_TARGET_ARCH=${TARGET_ARCH} \
|
-DLLVM_TARGET_ARCH=${TARGET_ARCH} \
|
||||||
-DCMAKE_INSTALL_PREFIX:PATH=${libdir}/llvm-rust \
|
-DCMAKE_INSTALL_PREFIX:PATH=${libdir}/llvm-rust \
|
||||||
"
|
"
|
||||||
EXTRA_OECMAKE_append_class-target = "\
|
EXTRA_OECMAKE:append:class-target = "\
|
||||||
-DCMAKE_CROSSCOMPILING:BOOL=ON \
|
-DCMAKE_CROSSCOMPILING:BOOL=ON \
|
||||||
-DLLVM_BUILD_TOOLS=OFF \
|
-DLLVM_BUILD_TOOLS=OFF \
|
||||||
-DLLVM_TABLEGEN=${STAGING_LIBDIR_NATIVE}/llvm-rust/bin/llvm-tblgen \
|
-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"
|
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
|
# we don't need any of this stuff to build Rust
|
||||||
rm -rf "${D}/usr/lib/cmake"
|
rm -rf "${D}/usr/lib/cmake"
|
||||||
}
|
}
|
||||||
@@ -55,11 +55,11 @@ do_install_append () {
|
|||||||
PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liblto"
|
PACKAGES =+ "${PN}-bugpointpasses ${PN}-llvmhello ${PN}-liblto"
|
||||||
|
|
||||||
# Add the extra locations to avoid the complaints about unpackaged files
|
# Add the extra locations to avoid the complaints about unpackaged files
|
||||||
FILES_${PN}-bugpointpasses = "${libdir}/llvm-rust/lib/BugpointPasses.so"
|
FILES:${PN}-bugpointpasses = "${libdir}/llvm-rust/lib/BugpointPasses.so"
|
||||||
FILES_${PN}-llvmhello = "${libdir}/llvm-rust/lib/LLVMHello.so"
|
FILES:${PN}-llvmhello = "${libdir}/llvm-rust/lib/LLVMHello.so"
|
||||||
FILES_${PN}-liblto = "${libdir}/llvm-rust/lib/libLTO.so.*"
|
FILES:${PN}-liblto = "${libdir}/llvm-rust/lib/libLTO.so.*"
|
||||||
FILES_${PN}-staticdev =+ "${libdir}/llvm-rust/*/*.a"
|
FILES:${PN}-staticdev =+ "${libdir}/llvm-rust/*/*.a"
|
||||||
FILES_${PN} += "${libdir}/libLLVM*.so.* ${libdir}/llvm-rust/lib/*.so.* ${libdir}/llvm-rust/bin"
|
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}-dev += "${datadir}/llvm ${libdir}/llvm-rust/lib/*.so ${libdir}/llvm-rust/include ${libdir}/llvm-rust/share ${libdir}/llvm-rust/lib/cmake"
|
||||||
|
|
||||||
BBCLASSEXTEND = "native"
|
BBCLASSEXTEND = "native"
|
||||||
|
|||||||
@@ -11,3 +11,8 @@ CARGO_VERSION = "1.48.0"
|
|||||||
SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "1c00a6a0dabbf6290728b09f9307d9fa6cc985487f727075c68acd4a600ef3f8"
|
SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "1c00a6a0dabbf6290728b09f9307d9fa6cc985487f727075c68acd4a600ef3f8"
|
||||||
SRC_URI[rustc-snapshot-x86_64.sha256sum] = "fc4d292a52cbb6b84fb9f065d0d7596064a9b957381d639d5a750d6e2bf02483"
|
SRC_URI[rustc-snapshot-x86_64.sha256sum] = "fc4d292a52cbb6b84fb9f065d0d7596064a9b957381d639d5a750d6e2bf02483"
|
||||||
SRC_URI[cargo-snapshot-x86_64.sha256sum] = "b11d595581e2580c069b5039214e1031a0e4f87ff6490ac39f92f77857e37055"
|
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"
|
||||||
|
|
||||||
|
|||||||
@@ -11,3 +11,8 @@ CARGO_VERSION = "1.50.0"
|
|||||||
SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "f1eb68db2b28a56ed8701edba7cf3688011d903ca12ff9d85bd21d3f8f614792"
|
SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "f1eb68db2b28a56ed8701edba7cf3688011d903ca12ff9d85bd21d3f8f614792"
|
||||||
SRC_URI[rustc-snapshot-x86_64.sha256sum] = "9bebd360bcd9b5bb58f2a02930b9db4ae291adef259c96377f1f4cbd240bcf86"
|
SRC_URI[rustc-snapshot-x86_64.sha256sum] = "9bebd360bcd9b5bb58f2a02930b9db4ae291adef259c96377f1f4cbd240bcf86"
|
||||||
SRC_URI[cargo-snapshot-x86_64.sha256sum] = "3cb2c68e987e5681fca9c930973f408a71151b1b255e69669a08e54d446ee803"
|
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"
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ require rust.inc
|
|||||||
DEPENDS += "rust-llvm (=${PV})"
|
DEPENDS += "rust-llvm (=${PV})"
|
||||||
|
|
||||||
# Otherwise we'll depend on what we provide
|
# 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
|
# 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"
|
BBCLASSEXTEND = "native"
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
require rust-tools-cross-canadian.inc
|
||||||
|
require rust-source-${PV}.inc
|
||||||
|
require rust-snapshot-${PV}.inc
|
||||||
|
|
||||||
|
FILESEXTRAPATHS:prepend := "${THISDIR}/rust:"
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ SRC_URI += "file://riscv-march.patch"
|
|||||||
SRC_URI += "file://rv64gc.patch"
|
SRC_URI += "file://rv64gc.patch"
|
||||||
|
|
||||||
DEPENDS += "file-native python3-native"
|
DEPENDS += "file-native python3-native"
|
||||||
DEPENDS_append_class-native = " rust-llvm-native"
|
DEPENDS:append:class-native = " rust-llvm-native"
|
||||||
|
|
||||||
S = "${RUSTSRC}"
|
S = "${RUSTSRC}"
|
||||||
|
|
||||||
@@ -117,11 +117,13 @@ python do_configure() {
|
|||||||
|
|
||||||
config.set("build", "vendor", e(True))
|
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))
|
config.set("build", "target", e(targets))
|
||||||
|
|
||||||
hosts = [d.getVar("HOST_SYS", True)]
|
if not "hosts" in locals():
|
||||||
config.set("build", "host", e(targets))
|
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
|
# 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)
|
# nothing about when trying to build some stage0 tools (like fabricate)
|
||||||
|
|||||||
Reference in New Issue
Block a user