Skip to content

Commit 8b8bb4c

Browse files
danc86shr-project
authored andcommitted
add rust 1.49.0
Now it seems `./x.py install` is the only way to assemble a fully working stage 2 cross-built compiler. See rust-lang/rust#81702.
1 parent e070e1c commit 8b8bb4c

10 files changed

+192
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From 23c1e958ecb1d67adc63288359ff0f87f7a6ba32 Mon Sep 17 00:00:00 2001
2+
From: Johan Anderholm <[email protected]>
3+
Date: Sun, 27 Jan 2019 10:19:00 +0100
4+
Subject: [PATCH] Disable http2
5+
6+
http2 requires that curl is build with nghttp2 which in turn depends on
7+
many dependencies and ultimately a dependency loop in the case of
8+
curl-native. As long as multiplexing is disabled in cargo this should
9+
be fine.
10+
11+
Upstream-Status: Inappropriate
12+
---
13+
Cargo.toml | 2 +-
14+
1 file changed, 1 insertion(+), 1 deletion(-)
15+
16+
diff --git a/Cargo.toml b/Cargo.toml
17+
index 0ee089060..d5b069b2f 100644
18+
--- a/Cargo.toml
19+
+++ b/Cargo.toml
20+
@@ -25,7 +25,7 @@ cargo-platform = { path = "crates/cargo-platform", version = "0.1.1" }
21+
crates-io = { path = "crates/crates-io", version = "0.31.1" }
22+
crossbeam-utils = "0.7"
23+
crypto-hash = "0.3.1"
24+
-curl = { version = "0.4.23", features = ["http2"] }
25+
+curl = { version = "0.4.23" }
26+
curl-sys = "0.4.22"
27+
env_logger = "0.7.0"
28+
pretty_env_logger = { version = "0.4", optional = true }
29+
--
30+
2.28.0
31+
+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
require recipes-devtools/rust/rust-source-${PV}.inc
2+
require recipes-devtools/rust/rust-snapshot-${PV}.inc
3+
require cargo.inc
4+
5+
LIC_FILES_CHKSUM += " \
6+
file://LICENSE-APACHE;md5=71b224ca933f0676e26d5c2e2271331c \
7+
file://LICENSE-THIRD-PARTY;md5=f257ad009884cb88a3a87d6920e7180a \
8+
"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
require rust-source-${PV}.inc
2+
require libstd-rs.inc
3+
4+
# libstd moved from src/libstd to library/std in 1.47+
5+
S = "${RUSTSRC}/library/std"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require rust-cross.inc
2+
require rust-source-${PV}.inc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
require rust-source-${PV}.inc
2+
require rust-llvm.inc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## This is information on the rust-snapshot (binary) used to build our current release.
2+
## snapshot info is taken from rust/src/stage0.txt
3+
## TODO: find a way to add additional SRC_URIs based on the contents of an
4+
## earlier SRC_URI.
5+
RS_VERSION = "1.48.0"
6+
7+
RUSTC_SNAPSHOT = "rustc-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
8+
RUST_STD_SNAPSHOT = "rust-std-${RS_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
9+
CARGO_VERSION = "1.48.0"
10+
CARGO_SNAPSHOT = "cargo-${CARGO_VERSION}-${BUILD_ARCH}-unknown-linux-gnu"
11+
12+
SRC_URI += " \
13+
https://static.rust-lang.org/dist/${RUSTC_SNAPSHOT}.tar.xz;name=rustc-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
14+
https://static.rust-lang.org/dist/${RUST_STD_SNAPSHOT}.tar.xz;name=rust-std-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
15+
https://static.rust-lang.org/dist/${CARGO_SNAPSHOT}.tar.xz;name=cargo-snapshot-${BUILD_ARCH};subdir=rust-snapshot-components \
16+
"
17+
18+
# TODO: Add hashes for other architecture toolchains as well. Make a script?
19+
SRC_URI[rust-std-snapshot-x86_64.sha256sum] = "1c00a6a0dabbf6290728b09f9307d9fa6cc985487f727075c68acd4a600ef3f8"
20+
SRC_URI[rustc-snapshot-x86_64.sha256sum] = "fc4d292a52cbb6b84fb9f065d0d7596064a9b957381d639d5a750d6e2bf02483"
21+
SRC_URI[cargo-snapshot-x86_64.sha256sum] = "b11d595581e2580c069b5039214e1031a0e4f87ff6490ac39f92f77857e37055"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
SRC_URI += "https://static.rust-lang.org/dist/rustc-${PV}-src.tar.xz;name=rust"
2+
3+
SRC_URI[rust.sha256sum] = "ebe910edc824a0a037a10be443446a0511923ba8342fa3c331ec8a22481d5d15"
4+
5+
# later versions of rust change the directory that they unextract to
6+
RUSTSRC = "${WORKDIR}/rustc-${PV}-src"
7+
# set this as our default
8+
S = "${RUSTSRC}"
9+
10+
LIC_FILES_CHKSUM = "file://COPYRIGHT;md5=93a95682d51b4cb0a633a97046940ef0"

recipes-devtools/rust/rust.inc

+14
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,18 @@ python do_configure() {
470470
# nothing about when trying to build some stage0 tools (like fabricate)
471471
config.set("build", "build", e(d.getVar("SNAPSHOT_BUILD_SYS", True)))
472472

473+
# [install]
474+
config.add_section("install")
475+
# ./x.py install doesn't have any notion of "destdir"
476+
# but we can prepend ${D} to all the directories instead
477+
config.set("install", "prefix", e(d.getVar("D", True) + d.getVar("prefix", True)))
478+
config.set("install", "bindir", e(d.getVar("D", True) + d.getVar("bindir", True)))
479+
config.set("install", "libdir", e(d.getVar("D", True) + d.getVar("libdir", True)))
480+
config.set("install", "datadir", e(d.getVar("D", True) + d.getVar("datadir", True)))
481+
config.set("install", "mandir", e(d.getVar("D", True) + d.getVar("mandir", True)))
482+
473483
with open("config.toml", "w") as f:
484+
f.write('changelog-seen = 2\n\n')
474485
config.write(f)
475486

476487
# set up ${WORKDIR}/cargo_home
@@ -507,7 +518,9 @@ rust_do_install () {
507518
cp -pRd build/${HOST_SYS}/stage2/lib/* ${D}${libdir}
508519
# Remove absolute symlink so bitbake doesn't complain
509520
rm -f ${D}${libdir}/rustlib/src/rust
521+
}
510522

523+
rust_install_targets() {
511524
# Install our custom target.json files
512525
local td="${D}${libdir}/rustlib/"
513526
install -d "$td"
@@ -519,5 +532,6 @@ rust_do_install () {
519532

520533
do_install () {
521534
rust_do_install
535+
rust_install_targets
522536
}
523537
# ex: sts=4 et sw=4 ts=8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
From dd682cb48c8b667859dded98a4bbfbd891a1eca4 Mon Sep 17 00:00:00 2001
2+
From: Vadim Petrochenkov <[email protected]>
3+
Date: Thu, 12 Nov 2020 19:16:59 +0300
4+
Subject: [PATCH] rustc_target: Fix dash vs underscore mismatches in option
5+
names
6+
7+
---
8+
compiler/rustc_target/src/spec/mod.rs | 16 ++++++++--------
9+
1 file changed, 8 insertions(+), 8 deletions(-)
10+
11+
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
12+
index f949bf95a50..f837114ee74 100644
13+
--- a/compiler/rustc_target/src/spec/mod.rs
14+
+++ b/compiler/rustc_target/src/spec/mod.rs
15+
@@ -1428,8 +1428,8 @@ pub fn from_json(obj: Json) -> Result<Target, String> {
16+
}
17+
18+
key!(is_builtin, bool);
19+
- key!(endian = "target_endian");
20+
- key!(c_int_width = "target_c_int_width");
21+
+ key!(endian = "target-endian");
22+
+ key!(c_int_width = "target-c-int-width");
23+
key!(os);
24+
key!(env);
25+
key!(vendor);
26+
@@ -1466,7 +1466,7 @@ pub fn from_json(obj: Json) -> Result<Target, String> {
27+
key!(exe_suffix);
28+
key!(staticlib_prefix);
29+
key!(staticlib_suffix);
30+
- key!(os_family = "target_family", optional);
31+
+ key!(os_family = "target-family", optional);
32+
key!(abi_return_struct_as_int, bool);
33+
key!(is_like_osx, bool);
34+
key!(is_like_solaris, bool);
35+
@@ -1511,7 +1511,7 @@ pub fn from_json(obj: Json) -> Result<Target, String> {
36+
key!(limit_rdylib_exports, bool);
37+
key!(override_export_symbols, opt_list);
38+
key!(merge_functions, MergeFunctions)?;
39+
- key!(mcount = "target_mcount");
40+
+ key!(mcount = "target-mcount");
41+
key!(llvm_abiname);
42+
key!(relax_elf_relocations, bool);
43+
key!(llvm_args, list);
44+
@@ -1663,8 +1663,8 @@ fn to_json(&self) -> Json {
45+
target_val!(data_layout);
46+
47+
target_option_val!(is_builtin);
48+
- target_option_val!(endian, "target_endian");
49+
- target_option_val!(c_int_width, "target_c_int_width");
50+
+ target_option_val!(endian, "target-endian");
51+
+ target_option_val!(c_int_width, "target-c-int-width");
52+
target_option_val!(os);
53+
target_option_val!(env);
54+
target_option_val!(vendor);
55+
@@ -1701,7 +1701,7 @@ fn to_json(&self) -> Json {
56+
target_option_val!(exe_suffix);
57+
target_option_val!(staticlib_prefix);
58+
target_option_val!(staticlib_suffix);
59+
- target_option_val!(os_family, "target_family");
60+
+ target_option_val!(os_family, "target-family");
61+
target_option_val!(abi_return_struct_as_int);
62+
target_option_val!(is_like_osx);
63+
target_option_val!(is_like_solaris);
64+
@@ -1746,7 +1746,7 @@ fn to_json(&self) -> Json {
65+
target_option_val!(limit_rdylib_exports);
66+
target_option_val!(override_export_symbols);
67+
target_option_val!(merge_functions);
68+
- target_option_val!(mcount, "target_mcount");
69+
+ target_option_val!(mcount, "target-mcount");
70+
target_option_val!(llvm_abiname);
71+
target_option_val!(relax_elf_relocations);
72+
target_option_val!(llvm_args);
73+
--
74+
2.28.0
75+

recipes-devtools/rust/rust_1.49.0.bb

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
require rust.inc
2+
require rust-source-${PV}.inc
3+
require rust-snapshot-${PV}.inc
4+
5+
SRC_URI += "\
6+
file://0001-rustc_target-Fix-dash-vs-underscore-mismatches-in-op.patch \
7+
"
8+
9+
DEPENDS += "rust-llvm (=${PV})"
10+
11+
# Otherwise we'll depend on what we provide
12+
INHIBIT_DEFAULT_RUST_DEPS_class-native = "1"
13+
# We don't need to depend on gcc-native because yocto assumes it exists
14+
PROVIDES_class-native = "virtual/${TARGET_PREFIX}rust"
15+
16+
do_compile () {
17+
rust_runx build --stage 2
18+
}
19+
20+
rust_do_install() {
21+
rust_runx install
22+
}
23+
24+
BBCLASSEXTEND = "native"

0 commit comments

Comments
 (0)