Skip to content

Commit 4c97569

Browse files
committed
Move patched sysroot from build_sysroot/ to download/
1 parent 571405d commit 4c97569

File tree

8 files changed

+26
-26
lines changed

8 files changed

+26
-26
lines changed

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
target
1+
/target
22
**/*.rs.bk
33
*.rlib
44
*.o
@@ -11,9 +11,6 @@ perf.data.old
1111
/y.exe
1212
/y.pdb
1313
/build
14-
/build_sysroot/sysroot_src
15-
/build_sysroot/compiler-builtins
16-
/build_sysroot/rustc_version
1714
/dist
1815
/rust
1916
/download

build_system/build_sysroot.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,11 @@ pub(crate) fn build_sysroot(
146146
}
147147
}
148148

149-
// FIXME move to download/ or dist/
150-
pub(crate) static SYSROOT_RUSTC_VERSION: RelPath = RelPath::BUILD_SYSROOT.join("rustc_version");
151-
pub(crate) static SYSROOT_SRC: RelPath = RelPath::BUILD_SYSROOT.join("sysroot_src");
152-
static STANDARD_LIBRARY: CargoProject = CargoProject::new(&RelPath::BUILD_SYSROOT, "build_sysroot");
149+
pub(crate) static ORIG_BUILD_SYSROOT: RelPath = RelPath::SOURCE.join("build_sysroot");
150+
pub(crate) static BUILD_SYSROOT: RelPath = RelPath::DOWNLOAD.join("sysroot");
151+
pub(crate) static SYSROOT_RUSTC_VERSION: RelPath = BUILD_SYSROOT.join("rustc_version");
152+
pub(crate) static SYSROOT_SRC: RelPath = BUILD_SYSROOT.join("sysroot_src");
153+
static STANDARD_LIBRARY: CargoProject = CargoProject::new(&BUILD_SYSROOT, "build_sysroot");
153154

154155
fn build_clif_sysroot_for_triple(
155156
dirs: &Dirs,

build_system/path.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ impl RelPath {
4242
pub(crate) const DIST: RelPath = RelPath::Base(PathBase::Dist);
4343

4444
pub(crate) const SCRIPTS: RelPath = RelPath::SOURCE.join("scripts");
45-
pub(crate) const BUILD_SYSROOT: RelPath = RelPath::SOURCE.join("build_sysroot");
4645
pub(crate) const PATCHES: RelPath = RelPath::SOURCE.join("patches");
4746

4847
pub(crate) const fn join(&'static self, suffix: &'static str) -> RelPath {

build_system/prepare.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ use std::fs;
33
use std::path::{Path, PathBuf};
44
use std::process::Command;
55

6-
use super::build_sysroot::{SYSROOT_RUSTC_VERSION, SYSROOT_SRC};
6+
use crate::build_system::rustc_info::get_default_sysroot;
7+
8+
use super::build_sysroot::{BUILD_SYSROOT, ORIG_BUILD_SYSROOT, SYSROOT_RUSTC_VERSION, SYSROOT_SRC};
79
use super::path::{Dirs, RelPath};
8-
use super::rustc_info::{get_file_name, get_rustc_path, get_rustc_version};
10+
use super::rustc_info::{get_file_name, get_rustc_version};
911
use super::utils::{copy_dir_recursively, spawn_and_wait, Compiler};
1012

1113
pub(crate) fn prepare(dirs: &Dirs) {
@@ -49,27 +51,27 @@ pub(crate) fn prepare(dirs: &Dirs) {
4951
}
5052

5153
fn prepare_sysroot(dirs: &Dirs) {
52-
let rustc_path = get_rustc_path();
53-
let sysroot_src_orig = rustc_path.parent().unwrap().join("../lib/rustlib/src/rust");
54-
let sysroot_src = SYSROOT_SRC;
55-
54+
let sysroot_src_orig = get_default_sysroot().join("lib/rustlib/src/rust");
5655
assert!(sysroot_src_orig.exists());
5756

58-
sysroot_src.ensure_fresh(dirs);
59-
fs::create_dir_all(sysroot_src.to_path(dirs).join("library")).unwrap();
6057
eprintln!("[COPY] sysroot src");
58+
59+
BUILD_SYSROOT.ensure_fresh(dirs);
60+
copy_dir_recursively(&ORIG_BUILD_SYSROOT.to_path(dirs), &BUILD_SYSROOT.to_path(dirs));
61+
62+
fs::create_dir_all(SYSROOT_SRC.to_path(dirs).join("library")).unwrap();
6163
copy_dir_recursively(
6264
&sysroot_src_orig.join("library"),
63-
&sysroot_src.to_path(dirs).join("library"),
65+
&SYSROOT_SRC.to_path(dirs).join("library"),
6466
);
6567

6668
let rustc_version = get_rustc_version();
6769
fs::write(SYSROOT_RUSTC_VERSION.to_path(dirs), &rustc_version).unwrap();
6870

6971
eprintln!("[GIT] init");
70-
init_git_repo(&sysroot_src.to_path(dirs));
72+
init_git_repo(&SYSROOT_SRC.to_path(dirs));
7173

72-
apply_patches(dirs, "sysroot", &sysroot_src.to_path(dirs));
74+
apply_patches(dirs, "sysroot", &SYSROOT_SRC.to_path(dirs));
7375
}
7476

7577
pub(crate) struct GitRepo {

build_system/tests.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use crate::build_system::build_sysroot::SYSROOT_SRC;
2+
13
use super::build_sysroot;
24
use super::config;
35
use super::path::{Dirs, RelPath};
@@ -262,7 +264,7 @@ pub(crate) static SIMPLE_RAYTRACER: CargoProject =
262264
CargoProject::new(&SIMPLE_RAYTRACER_REPO.source_dir(), "simple_raytracer");
263265

264266
static LIBCORE_TESTS: CargoProject =
265-
CargoProject::new(&RelPath::BUILD_SYSROOT.join("sysroot_src/library/core/tests"), "core_tests");
267+
CargoProject::new(&SYSROOT_SRC.join("library/core/tests"), "core_tests");
266268

267269
const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
268270
TestCase::new("test.rust-random/rand", &|runner| {

clean_all.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#!/usr/bin/env bash
22
set -e
33

4-
rm -rf build_sysroot/{sysroot_src/,target/,compiler-builtins/,rustc_version}
5-
rm -rf target/ build/ dist/ perf.data{,.old} y.bin
6-
rm -rf download/
4+
rm -rf target/ download/ build/ dist/ y.bin y.exe
75

86
# Kept for now in case someone updates their checkout of cg_clif before running clean_all.sh
97
# FIXME remove at some point in the future
108
rm -rf rand/ regex/ simple-raytracer/ portable-simd/ abi-checker/ abi-cafe/
9+
rm -rf build_sysroot/{sysroot_src/,target/,compiler-builtins/,rustc_version}

scripts/rustup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ case $1 in
1717
done
1818

1919
./clean_all.sh
20-
./y.rs prepare
2120

2221
(cd build_sysroot && cargo update)
2322

23+
./y.rs prepare
2424
;;
2525
"commit")
2626
git add rust-toolchain build_sysroot/Cargo.lock

scripts/setup_rust_fork.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ popd
5151
# FIXME remove once inline asm is fully supported
5252
export RUSTFLAGS="$RUSTFLAGS --cfg=rustix_use_libc"
5353

54-
export CFG_VIRTUAL_RUST_SOURCE_BASE_DIR="$(cd build_sysroot/sysroot_src; pwd)"
54+
export CFG_VIRTUAL_RUST_SOURCE_BASE_DIR="$(cd download/sysroot/sysroot_src; pwd)"
5555

5656
# Allow the testsuite to use llvm tools
5757
host_triple=$(rustc -vV | grep host | cut -d: -f2 | tr -d " ")

0 commit comments

Comments
 (0)