Skip to content

Commit f545a21

Browse files
committed
Split rust fork setup out of test_bootstrap.sh
1 parent 78d0b77 commit f545a21

File tree

2 files changed

+69
-61
lines changed

2 files changed

+69
-61
lines changed

scripts/setup_rust_fork.sh

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/bin/bash
2+
set -e
3+
4+
./build.sh
5+
source build/config.sh
6+
7+
echo "[SETUP] Rust fork"
8+
git clone https://github.com/rust-lang/rust.git || true
9+
pushd rust
10+
git fetch
11+
git checkout -- .
12+
git checkout "$(rustc -V | cut -d' ' -f3 | tr -d '(')"
13+
14+
git apply - <<EOF
15+
diff --git a/Cargo.toml b/Cargo.toml
16+
index 5bd1147cad5..10d68a2ff14 100644
17+
--- a/Cargo.toml
18+
+++ b/Cargo.toml
19+
@@ -111,5 +111,7 @@ rustc-std-workspace-std = { path = 'library/rustc-std-workspace-std' }
20+
rustc-std-workspace-alloc = { path = 'library/rustc-std-workspace-alloc' }
21+
rustc-std-workspace-std = { path = 'library/rustc-std-workspace-std' }
22+
23+
+compiler_builtins = { path = "../build_sysroot/compiler-builtins" }
24+
+
25+
[patch."https://github.com/rust-lang/rust-clippy"]
26+
clippy_lints = { path = "src/tools/clippy/clippy_lints" }
27+
diff --git a/compiler/rustc_data_structures/Cargo.toml b/compiler/rustc_data_structures/Cargo.toml
28+
index 23e689fcae7..5f077b765b6 100644
29+
--- a/compiler/rustc_data_structures/Cargo.toml
30+
+++ b/compiler/rustc_data_structures/Cargo.toml
31+
@@ -32,7 +32,6 @@ tempfile = "3.0.5"
32+
33+
[dependencies.parking_lot]
34+
version = "0.11"
35+
-features = ["nightly"]
36+
37+
[target.'cfg(windows)'.dependencies]
38+
winapi = { version = "0.3", features = ["fileapi", "psapi"] }
39+
diff --git a/library/alloc/Cargo.toml b/library/alloc/Cargo.toml
40+
index d95b5b7f17f..00b6f0e3635 100644
41+
--- a/library/alloc/Cargo.toml
42+
+++ b/library/alloc/Cargo.toml
43+
@@ -8,7 +8,7 @@ edition = "2018"
44+
45+
[dependencies]
46+
core = { path = "../core" }
47+
-compiler_builtins = { version = "0.1.39", features = ['rustc-dep-of-std'] }
48+
+compiler_builtins = { version = "0.1.39", features = ['rustc-dep-of-std', 'no-asm'] }
49+
50+
[dev-dependencies]
51+
rand = "0.7"
52+
EOF
53+
54+
cat > config.toml <<EOF
55+
[llvm]
56+
ninja = false
57+
58+
[build]
59+
rustc = "$(pwd)/../build/bin/cg_clif"
60+
cargo = "$(rustup which cargo)"
61+
full-bootstrap = true
62+
local-rebuild = true
63+
64+
[rust]
65+
codegen-backends = ["cranelift"]
66+
deny-warnings = false
67+
EOF
68+
popd

scripts/test_bootstrap.sh

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -3,70 +3,10 @@ set -e
33

44
cd "$(dirname "$0")/../"
55

6-
./build.sh
7-
source build/config.sh
6+
source ./scripts/setup_rust_fork.sh
87

98
echo "[TEST] Bootstrap of rustc"
10-
git clone https://github.com/rust-lang/rust.git || true
119
pushd rust
12-
git fetch
13-
git checkout -- .
14-
git checkout "$(rustc -V | cut -d' ' -f3 | tr -d '(')"
15-
16-
git apply - <<EOF
17-
diff --git a/Cargo.toml b/Cargo.toml
18-
index 5bd1147cad5..10d68a2ff14 100644
19-
--- a/Cargo.toml
20-
+++ b/Cargo.toml
21-
@@ -111,5 +111,7 @@ rustc-std-workspace-std = { path = 'library/rustc-std-workspace-std' }
22-
rustc-std-workspace-alloc = { path = 'library/rustc-std-workspace-alloc' }
23-
rustc-std-workspace-std = { path = 'library/rustc-std-workspace-std' }
24-
25-
+compiler_builtins = { path = "../build_sysroot/compiler-builtins" }
26-
+
27-
[patch."https://github.com/rust-lang/rust-clippy"]
28-
clippy_lints = { path = "src/tools/clippy/clippy_lints" }
29-
diff --git a/compiler/rustc_data_structures/Cargo.toml b/compiler/rustc_data_structures/Cargo.toml
30-
index 23e689fcae7..5f077b765b6 100644
31-
--- a/compiler/rustc_data_structures/Cargo.toml
32-
+++ b/compiler/rustc_data_structures/Cargo.toml
33-
@@ -32,7 +32,6 @@ tempfile = "3.0.5"
34-
35-
[dependencies.parking_lot]
36-
version = "0.11"
37-
-features = ["nightly"]
38-
39-
[target.'cfg(windows)'.dependencies]
40-
winapi = { version = "0.3", features = ["fileapi", "psapi"] }
41-
diff --git a/library/alloc/Cargo.toml b/library/alloc/Cargo.toml
42-
index d95b5b7f17f..00b6f0e3635 100644
43-
--- a/library/alloc/Cargo.toml
44-
+++ b/library/alloc/Cargo.toml
45-
@@ -8,7 +8,7 @@ edition = "2018"
46-
47-
[dependencies]
48-
core = { path = "../core" }
49-
-compiler_builtins = { version = "0.1.39", features = ['rustc-dep-of-std'] }
50-
+compiler_builtins = { version = "0.1.39", features = ['rustc-dep-of-std', 'no-asm'] }
51-
52-
[dev-dependencies]
53-
rand = "0.7"
54-
EOF
55-
56-
cat > config.toml <<EOF
57-
[llvm]
58-
ninja = false
59-
60-
[build]
61-
rustc = "$(pwd)/../build/bin/cg_clif"
62-
cargo = "$(rustup which cargo)"
63-
full-bootstrap = true
64-
local-rebuild = true
65-
66-
[rust]
67-
codegen-backends = ["cranelift"]
68-
EOF
69-
7010
rm -r compiler/rustc_codegen_cranelift/{Cargo.*,src}
7111
cp ../Cargo.* compiler/rustc_codegen_cranelift/
7212
cp -r ../src compiler/rustc_codegen_cranelift/src

0 commit comments

Comments
 (0)