Move patched sysroot from build_sysroot/ to download/

This commit is contained in:
bjorn3 2023-01-05 17:26:54 +00:00
parent 571405deea
commit 4c97569a54
8 changed files with 26 additions and 26 deletions

5
.gitignore vendored
View File

@ -1,4 +1,4 @@
target
/target
**/*.rs.bk
*.rlib
*.o
@ -11,9 +11,6 @@ perf.data.old
/y.exe
/y.pdb
/build
/build_sysroot/sysroot_src
/build_sysroot/compiler-builtins
/build_sysroot/rustc_version
/dist
/rust
/download

View File

@ -146,10 +146,11 @@ pub(crate) fn build_sysroot(
}
}
// FIXME move to download/ or dist/
pub(crate) static SYSROOT_RUSTC_VERSION: RelPath = RelPath::BUILD_SYSROOT.join("rustc_version");
pub(crate) static SYSROOT_SRC: RelPath = RelPath::BUILD_SYSROOT.join("sysroot_src");
static STANDARD_LIBRARY: CargoProject = CargoProject::new(&RelPath::BUILD_SYSROOT, "build_sysroot");
pub(crate) static ORIG_BUILD_SYSROOT: RelPath = RelPath::SOURCE.join("build_sysroot");
pub(crate) static BUILD_SYSROOT: RelPath = RelPath::DOWNLOAD.join("sysroot");
pub(crate) static SYSROOT_RUSTC_VERSION: RelPath = BUILD_SYSROOT.join("rustc_version");
pub(crate) static SYSROOT_SRC: RelPath = BUILD_SYSROOT.join("sysroot_src");
static STANDARD_LIBRARY: CargoProject = CargoProject::new(&BUILD_SYSROOT, "build_sysroot");
fn build_clif_sysroot_for_triple(
dirs: &Dirs,

View File

@ -42,7 +42,6 @@ impl RelPath {
pub(crate) const DIST: RelPath = RelPath::Base(PathBase::Dist);
pub(crate) const SCRIPTS: RelPath = RelPath::SOURCE.join("scripts");
pub(crate) const BUILD_SYSROOT: RelPath = RelPath::SOURCE.join("build_sysroot");
pub(crate) const PATCHES: RelPath = RelPath::SOURCE.join("patches");
pub(crate) const fn join(&'static self, suffix: &'static str) -> RelPath {

View File

@ -3,9 +3,11 @@
use std::path::{Path, PathBuf};
use std::process::Command;
use super::build_sysroot::{SYSROOT_RUSTC_VERSION, SYSROOT_SRC};
use crate::build_system::rustc_info::get_default_sysroot;
use super::build_sysroot::{BUILD_SYSROOT, ORIG_BUILD_SYSROOT, SYSROOT_RUSTC_VERSION, SYSROOT_SRC};
use super::path::{Dirs, RelPath};
use super::rustc_info::{get_file_name, get_rustc_path, get_rustc_version};
use super::rustc_info::{get_file_name, get_rustc_version};
use super::utils::{copy_dir_recursively, spawn_and_wait, Compiler};
pub(crate) fn prepare(dirs: &Dirs) {
@ -49,27 +51,27 @@ pub(crate) fn prepare(dirs: &Dirs) {
}
fn prepare_sysroot(dirs: &Dirs) {
let rustc_path = get_rustc_path();
let sysroot_src_orig = rustc_path.parent().unwrap().join("../lib/rustlib/src/rust");
let sysroot_src = SYSROOT_SRC;
let sysroot_src_orig = get_default_sysroot().join("lib/rustlib/src/rust");
assert!(sysroot_src_orig.exists());
sysroot_src.ensure_fresh(dirs);
fs::create_dir_all(sysroot_src.to_path(dirs).join("library")).unwrap();
eprintln!("[COPY] sysroot src");
BUILD_SYSROOT.ensure_fresh(dirs);
copy_dir_recursively(&ORIG_BUILD_SYSROOT.to_path(dirs), &BUILD_SYSROOT.to_path(dirs));
fs::create_dir_all(SYSROOT_SRC.to_path(dirs).join("library")).unwrap();
copy_dir_recursively(
&sysroot_src_orig.join("library"),
&sysroot_src.to_path(dirs).join("library"),
&SYSROOT_SRC.to_path(dirs).join("library"),
);
let rustc_version = get_rustc_version();
fs::write(SYSROOT_RUSTC_VERSION.to_path(dirs), &rustc_version).unwrap();
eprintln!("[GIT] init");
init_git_repo(&sysroot_src.to_path(dirs));
init_git_repo(&SYSROOT_SRC.to_path(dirs));
apply_patches(dirs, "sysroot", &sysroot_src.to_path(dirs));
apply_patches(dirs, "sysroot", &SYSROOT_SRC.to_path(dirs));
}
pub(crate) struct GitRepo {

View File

@ -1,3 +1,5 @@
use crate::build_system::build_sysroot::SYSROOT_SRC;
use super::build_sysroot;
use super::config;
use super::path::{Dirs, RelPath};
@ -262,7 +264,7 @@ const fn new(config: &'static str, func: &'static dyn Fn(&TestRunner)) -> Self {
CargoProject::new(&SIMPLE_RAYTRACER_REPO.source_dir(), "simple_raytracer");
static LIBCORE_TESTS: CargoProject =
CargoProject::new(&RelPath::BUILD_SYSROOT.join("sysroot_src/library/core/tests"), "core_tests");
CargoProject::new(&SYSROOT_SRC.join("library/core/tests"), "core_tests");
const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
TestCase::new("test.rust-random/rand", &|runner| {

View File

@ -1,10 +1,9 @@
#!/usr/bin/env bash
set -e
rm -rf build_sysroot/{sysroot_src/,target/,compiler-builtins/,rustc_version}
rm -rf target/ build/ dist/ perf.data{,.old} y.bin
rm -rf download/
rm -rf target/ download/ build/ dist/ y.bin y.exe
# Kept for now in case someone updates their checkout of cg_clif before running clean_all.sh
# FIXME remove at some point in the future
rm -rf rand/ regex/ simple-raytracer/ portable-simd/ abi-checker/ abi-cafe/
rm -rf build_sysroot/{sysroot_src/,target/,compiler-builtins/,rustc_version}

View File

@ -17,10 +17,10 @@ case $1 in
done
./clean_all.sh
./y.rs prepare
(cd build_sysroot && cargo update)
./y.rs prepare
;;
"commit")
git add rust-toolchain build_sysroot/Cargo.lock

View File

@ -51,7 +51,7 @@ popd
# FIXME remove once inline asm is fully supported
export RUSTFLAGS="$RUSTFLAGS --cfg=rustix_use_libc"
export CFG_VIRTUAL_RUST_SOURCE_BASE_DIR="$(cd build_sysroot/sysroot_src; pwd)"
export CFG_VIRTUAL_RUST_SOURCE_BASE_DIR="$(cd download/sysroot/sysroot_src; pwd)"
# Allow the testsuite to use llvm tools
host_triple=$(rustc -vV | grep host | cut -d: -f2 | tr -d " ")