]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_codegen_cranelift/scripts/setup_rust_fork.sh
drive-by: Fix path spans
[rust.git] / compiler / rustc_codegen_cranelift / scripts / setup_rust_fork.sh
1 #!/usr/bin/env bash
2 set -e
3
4 ./y.rs build --no-unstable-features
5
6 echo "[SETUP] Rust fork"
7 git clone https://github.com/rust-lang/rust.git || true
8 pushd rust
9 git fetch
10 git checkout -- .
11 git checkout "$(rustc -V | cut -d' ' -f3 | tr -d '(')"
12
13 git am ../patches/*-sysroot-*.patch
14
15 git apply - <<EOF
16 diff --git a/library/alloc/Cargo.toml b/library/alloc/Cargo.toml
17 index d95b5b7f17f..00b6f0e3635 100644
18 --- a/library/alloc/Cargo.toml
19 +++ b/library/alloc/Cargo.toml
20 @@ -8,7 +8,7 @@ edition = "2018"
21
22  [dependencies]
23  core = { path = "../core" }
24 -compiler_builtins = { version = "0.1.40", features = ['rustc-dep-of-std'] }
25 +compiler_builtins = { version = "0.1.66", features = ['rustc-dep-of-std', 'no-asm'] }
26
27  [dev-dependencies]
28  rand = "0.7"
29  rand_xorshift = "0.2"
30 diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
31 index 8431aa7b818..a3ff7e68ce5 100644
32 --- a/src/tools/compiletest/src/runtest.rs
33 +++ b/src/tools/compiletest/src/runtest.rs
34 @@ -3489,12 +3489,7 @@ fn normalize_output(&self, output: &str, custom_rules: &[(String, String)]) -> S
35          let compiler_src_dir = base_dir.join("compiler");
36          normalize_path(&compiler_src_dir, "$(echo '$COMPILER_DIR')");
37
38 -        if let Some(virtual_rust_source_base_dir) =
39 -            option_env!("CFG_VIRTUAL_RUST_SOURCE_BASE_DIR").map(PathBuf::from)
40 -        {
41 -            normalize_path(&virtual_rust_source_base_dir.join("library"), "$(echo '$SRC_DIR')");
42 -            normalize_path(&virtual_rust_source_base_dir.join("compiler"), "$(echo '$COMPILER_DIR')");
43 -        }
44 +        normalize_path(&Path::new("$(cd ../build_sysroot/sysroot_src/library; pwd)"), "$(echo '$SRC_DIR')");
45
46          // Paths into the build directory
47          let test_build_dir = &self.config.build_base;
48 EOF
49
50 cat > config.toml <<EOF
51 changelog-seen = 2
52
53 [llvm]
54 ninja = false
55
56 [build]
57 rustc = "$(pwd)/../build/rustc-clif"
58 cargo = "$(rustup which cargo)"
59 full-bootstrap = true
60 local-rebuild = true
61
62 [rust]
63 codegen-backends = ["cranelift"]
64 deny-warnings = false
65 verbose-tests = false
66 EOF
67 popd
68
69 # FIXME remove once inline asm is fully supported
70 export RUSTFLAGS="$RUSTFLAGS --cfg=rustix_use_libc"
71
72 # Allow the testsuite to use llvm tools
73 host_triple=$(rustc -vV | grep host | cut -d: -f2 | tr -d " ")
74 export LLVM_BIN_DIR="$(rustc --print sysroot)/lib/rustlib/$host_triple/bin"