@@ -3,9 +3,11 @@ use std::fs;
3
3
use std:: path:: { Path , PathBuf } ;
4
4
use std:: process:: Command ;
5
5
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 } ;
7
9
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} ;
9
11
use super :: utils:: { copy_dir_recursively, spawn_and_wait, Compiler } ;
10
12
11
13
pub ( crate ) fn prepare ( dirs : & Dirs ) {
@@ -31,14 +33,14 @@ pub(crate) fn prepare(dirs: &Dirs) {
31
33
super :: tests:: RAND_REPO . fetch ( dirs) ;
32
34
super :: tests:: REGEX_REPO . fetch ( dirs) ;
33
35
super :: tests:: PORTABLE_SIMD_REPO . fetch ( dirs) ;
34
- super :: tests :: SIMPLE_RAYTRACER_REPO . fetch ( dirs) ;
36
+ super :: bench :: SIMPLE_RAYTRACER_REPO . fetch ( dirs) ;
35
37
36
38
eprintln ! ( "[LLVM BUILD] simple-raytracer" ) ;
37
39
let host_compiler = Compiler :: host ( ) ;
38
- let build_cmd = super :: tests :: SIMPLE_RAYTRACER . build ( & host_compiler, dirs) ;
40
+ let build_cmd = super :: bench :: SIMPLE_RAYTRACER . build ( & host_compiler, dirs) ;
39
41
spawn_and_wait ( build_cmd) ;
40
42
fs:: copy (
41
- super :: tests :: SIMPLE_RAYTRACER
43
+ super :: bench :: SIMPLE_RAYTRACER
42
44
. target_dir ( dirs)
43
45
. join ( & host_compiler. triple )
44
46
. join ( "debug" )
@@ -49,27 +51,27 @@ pub(crate) fn prepare(dirs: &Dirs) {
49
51
}
50
52
51
53
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" ) ;
56
55
assert ! ( sysroot_src_orig. exists( ) ) ;
57
56
58
- sysroot_src. ensure_fresh ( dirs) ;
59
- fs:: create_dir_all ( sysroot_src. to_path ( dirs) . join ( "library" ) ) . unwrap ( ) ;
60
57
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 ( ) ;
61
63
copy_dir_recursively (
62
64
& sysroot_src_orig. join ( "library" ) ,
63
- & sysroot_src . to_path ( dirs) . join ( "library" ) ,
65
+ & SYSROOT_SRC . to_path ( dirs) . join ( "library" ) ,
64
66
) ;
65
67
66
68
let rustc_version = get_rustc_version ( ) ;
67
69
fs:: write ( SYSROOT_RUSTC_VERSION . to_path ( dirs) , & rustc_version) . unwrap ( ) ;
68
70
69
71
eprintln ! ( "[GIT] init" ) ;
70
- init_git_repo ( & sysroot_src . to_path ( dirs) ) ;
72
+ init_git_repo ( & SYSROOT_SRC . to_path ( dirs) ) ;
71
73
72
- apply_patches ( dirs, "sysroot" , & sysroot_src . to_path ( dirs) ) ;
74
+ apply_patches ( dirs, "sysroot" , & SYSROOT_SRC . to_path ( dirs) ) ;
73
75
}
74
76
75
77
pub ( crate ) struct GitRepo {
0 commit comments