Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8fc9aeb087 | |||
| 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.2.3
|
||||||
|
YOCTO_BRANCH: gatesgarth
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@@ -10,9 +13,9 @@ 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-$YOCTO_VERSION --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
|
||||||
@@ -20,4 +23,26 @@ jobs:
|
|||||||
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)
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ This OpenEmbedded layer provides the rust compiler, tools for building packages
|
|||||||
|
|
||||||
- cargo (built for target)
|
- cargo (built for target)
|
||||||
|
|
||||||
|
|
||||||
## Building a rust package
|
## Building a rust package
|
||||||
|
|
||||||
When building a rust package in bitbake, it's usually easiest to build with
|
When building a rust package in bitbake, it's usually easiest to build with
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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')} \
|
||||||
"
|
"
|
||||||
|
|
||||||
|
|||||||
@@ -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")
|
||||||
@@ -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,168 +1,21 @@
|
|||||||
|
|
||||||
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.
|
||||||
do_compile () {
|
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_${RUSTLIB_SRC_PN} = "Rust standard library sources for cross canadian toolchain"
|
||||||
SUMMARY_${PN} = "Rust crost canadian compiler"
|
SUMMARY_${PN} = "Rust crost canadian compiler"
|
||||||
|
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|
||||||
|
|||||||
@@ -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:"
|
||||||
|
|
||||||
@@ -117,11 +117,13 @@ python do_configure() {
|
|||||||
|
|
||||||
config.set("build", "vendor", e(True))
|
config.set("build", "vendor", e(True))
|
||||||
|
|
||||||
|
if not "targets" in locals():
|
||||||
targets = [d.getVar("TARGET_SYS", True)]
|
targets = [d.getVar("TARGET_SYS", True)]
|
||||||
config.set("build", "target", e(targets))
|
config.set("build", "target", e(targets))
|
||||||
|
|
||||||
|
if not "hosts" in locals():
|
||||||
hosts = [d.getVar("HOST_SYS", True)]
|
hosts = [d.getVar("HOST_SYS", True)]
|
||||||
config.set("build", "host", e(targets))
|
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