Skip to content

Commit 45be990

Browse files
committed
Inline prepare_stdlib into the sysroot build code
Also reduce visibility of a couple of statics
1 parent ade0e38 commit 45be990

File tree

4 files changed

+14
-20
lines changed

4 files changed

+14
-20
lines changed

build_system/build_backend.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::rustc_info::get_file_name;
66
use crate::shared_utils::{rustflags_from_env, rustflags_to_cmd_env};
77
use crate::utils::{CargoProject, Compiler, LogGroup};
88

9-
pub(crate) static CG_CLIF: CargoProject = CargoProject::new(&RelPath::SOURCE, "cg_clif");
9+
static CG_CLIF: CargoProject = CargoProject::new(&RelPath::SOURCE, "cg_clif");
1010

1111
pub(crate) fn build_backend(
1212
dirs: &Dirs,

build_system/build_sysroot.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use std::process::Command;
33
use std::{env, fs};
44

55
use crate::path::{Dirs, RelPath};
6-
use crate::rustc_info::get_file_name;
6+
use crate::prepare::apply_patches;
7+
use crate::rustc_info::{get_default_sysroot, get_file_name};
78
use crate::utils::{
89
remove_dir_if_exists, spawn_and_wait, try_hard_link, CargoProject, Compiler, LogGroup,
910
};
@@ -157,10 +158,10 @@ impl SysrootTarget {
157158
}
158159
}
159160

160-
pub(crate) static STDLIB_SRC: RelPath = RelPath::BUILD.join("stdlib");
161-
pub(crate) static STANDARD_LIBRARY: CargoProject =
161+
static STDLIB_SRC: RelPath = RelPath::BUILD.join("stdlib");
162+
static STANDARD_LIBRARY: CargoProject =
162163
CargoProject::new(&STDLIB_SRC.join("library/sysroot"), "stdlib_target");
163-
pub(crate) static RTSTARTUP_SYSROOT: RelPath = RelPath::BUILD.join("rtstartup");
164+
static RTSTARTUP_SYSROOT: RelPath = RelPath::BUILD.join("rtstartup");
164165

165166
fn build_sysroot_for_triple(
166167
dirs: &Dirs,
@@ -285,7 +286,10 @@ fn build_clif_sysroot_for_triple(
285286

286287
fn build_rtstartup(dirs: &Dirs, compiler: &Compiler) -> Option<SysrootTarget> {
287288
if !config::get_bool("keep_sysroot") {
288-
crate::prepare::prepare_stdlib(dirs, &compiler.rustc);
289+
let sysroot_src_orig = get_default_sysroot(&compiler.rustc).join("lib/rustlib/src/rust");
290+
assert!(sysroot_src_orig.exists());
291+
292+
apply_patches(dirs, "stdlib", &sysroot_src_orig, &STDLIB_SRC.to_path(dirs));
289293
}
290294

291295
if !compiler.triple.ends_with("windows-gnu") {

build_system/prepare.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ use std::hash::{Hash, Hasher};
44
use std::path::{Path, PathBuf};
55
use std::process::Command;
66

7-
use crate::build_sysroot::STDLIB_SRC;
87
use crate::path::{Dirs, RelPath};
9-
use crate::rustc_info::get_default_sysroot;
108
use crate::utils::{
119
copy_dir_recursively, remove_dir_if_exists, retry_spawn_and_wait, spawn_and_wait,
1210
};
@@ -17,13 +15,6 @@ pub(crate) fn prepare(dirs: &Dirs) {
1715
crate::tests::REGEX_REPO.fetch(dirs);
1816
}
1917

20-
pub(crate) fn prepare_stdlib(dirs: &Dirs, rustc: &Path) {
21-
let sysroot_src_orig = get_default_sysroot(rustc).join("lib/rustlib/src/rust");
22-
assert!(sysroot_src_orig.exists());
23-
24-
apply_patches(dirs, "stdlib", &sysroot_src_orig, &STDLIB_SRC.to_path(dirs));
25-
}
26-
2718
pub(crate) struct GitRepo {
2819
url: GitRepoUrl,
2920
rev: &'static str,

build_system/tests.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ pub(crate) static RAND_REPO: GitRepo = GitRepo::github(
117117
"rand",
118118
);
119119

120-
pub(crate) static RAND: CargoProject = CargoProject::new(&RAND_REPO.source_dir(), "rand_target");
120+
static RAND: CargoProject = CargoProject::new(&RAND_REPO.source_dir(), "rand_target");
121121

122122
pub(crate) static REGEX_REPO: GitRepo = GitRepo::github(
123123
"rust-lang",
@@ -127,12 +127,11 @@ pub(crate) static REGEX_REPO: GitRepo = GitRepo::github(
127127
"regex",
128128
);
129129

130-
pub(crate) static REGEX: CargoProject = CargoProject::new(&REGEX_REPO.source_dir(), "regex_target");
130+
static REGEX: CargoProject = CargoProject::new(&REGEX_REPO.source_dir(), "regex_target");
131131

132-
pub(crate) static PORTABLE_SIMD_SRC: RelPath = RelPath::BUILD.join("portable-simd");
132+
static PORTABLE_SIMD_SRC: RelPath = RelPath::BUILD.join("portable-simd");
133133

134-
pub(crate) static PORTABLE_SIMD: CargoProject =
135-
CargoProject::new(&PORTABLE_SIMD_SRC, "portable-simd_target");
134+
static PORTABLE_SIMD: CargoProject = CargoProject::new(&PORTABLE_SIMD_SRC, "portable-simd_target");
136135

137136
static LIBCORE_TESTS_SRC: RelPath = RelPath::BUILD.join("coretests");
138137

0 commit comments

Comments
 (0)