@@ -10,10 +10,6 @@ use crate::utils::{
10
10
} ;
11
11
use crate :: { config, CodegenBackend , SysrootKind } ;
12
12
13
- static DIST_DIR : RelPath = RelPath :: dist ( "." ) ;
14
- static BIN_DIR : RelPath = RelPath :: dist ( "bin" ) ;
15
- static LIB_DIR : RelPath = RelPath :: dist ( "lib" ) ;
16
-
17
13
pub ( crate ) fn build_sysroot (
18
14
dirs : & Dirs ,
19
15
sysroot_kind : SysrootKind ,
@@ -28,8 +24,8 @@ pub(crate) fn build_sysroot(
28
24
29
25
remove_dir_if_exists ( & dirs. dist_dir ) ;
30
26
fs:: create_dir_all ( & dirs. dist_dir ) . unwrap ( ) ;
31
- fs:: create_dir_all ( BIN_DIR . to_path ( dirs ) ) . unwrap ( ) ;
32
- fs:: create_dir_all ( LIB_DIR . to_path ( dirs ) ) . unwrap ( ) ;
27
+ fs:: create_dir_all ( dirs . dist_dir . join ( "bin" ) ) . unwrap ( ) ;
28
+ fs:: create_dir_all ( dirs . dist_dir . join ( "lib" ) ) . unwrap ( ) ;
33
29
34
30
let is_native = bootstrap_host_compiler. triple == target_triple;
35
31
@@ -39,11 +35,10 @@ pub(crate) fn build_sysroot(
39
35
let cg_clif_dylib_path = if cfg ! ( windows) {
40
36
// Windows doesn't have rpath support, so the cg_clif dylib needs to be next to the
41
37
// binaries.
42
- BIN_DIR
38
+ dirs . dist_dir . join ( "bin" )
43
39
} else {
44
- LIB_DIR
40
+ dirs . dist_dir . join ( "lib" )
45
41
}
46
- . to_path ( dirs)
47
42
. join ( src_path. file_name ( ) . unwrap ( ) ) ;
48
43
try_hard_link ( src_path, & cg_clif_dylib_path) ;
49
44
CodegenBackend :: Local ( cg_clif_dylib_path)
@@ -57,7 +52,7 @@ pub(crate) fn build_sysroot(
57
52
let wrapper_name = wrapper_base_name. replace ( "____" , wrapper) ;
58
53
59
54
let mut build_cargo_wrapper_cmd = Command :: new ( & bootstrap_host_compiler. rustc ) ;
60
- let wrapper_path = DIST_DIR . to_path ( dirs) . join ( & wrapper_name) ;
55
+ let wrapper_path = dirs. dist_dir . join ( & wrapper_name) ;
61
56
build_cargo_wrapper_cmd
62
57
. arg ( dirs. source_dir . join ( "scripts" ) . join ( & format ! ( "{wrapper}.rs" ) ) )
63
58
. arg ( "-o" )
@@ -80,7 +75,7 @@ pub(crate) fn build_sysroot(
80
75
build_cargo_wrapper_cmd. env ( "BUILTIN_BACKEND" , name) ;
81
76
}
82
77
spawn_and_wait ( build_cargo_wrapper_cmd) ;
83
- try_hard_link ( wrapper_path, BIN_DIR . to_path ( dirs ) . join ( wrapper_name) ) ;
78
+ try_hard_link ( wrapper_path, dirs . dist_dir . join ( "bin" ) . join ( wrapper_name) ) ;
84
79
}
85
80
86
81
let host = build_sysroot_for_triple (
@@ -89,7 +84,7 @@ pub(crate) fn build_sysroot(
89
84
& cg_clif_dylib_path,
90
85
sysroot_kind,
91
86
) ;
92
- host. install_into_sysroot ( & DIST_DIR . to_path ( dirs) ) ;
87
+ host. install_into_sysroot ( & dirs. dist_dir ) ;
93
88
94
89
if !is_native {
95
90
build_sysroot_for_triple (
@@ -103,20 +98,19 @@ pub(crate) fn build_sysroot(
103
98
& cg_clif_dylib_path,
104
99
sysroot_kind,
105
100
)
106
- . install_into_sysroot ( & DIST_DIR . to_path ( dirs) ) ;
101
+ . install_into_sysroot ( & dirs. dist_dir ) ;
107
102
}
108
103
109
104
// Copy std for the host to the lib dir. This is necessary for the jit mode to find
110
105
// libstd.
111
106
for lib in host. libs {
112
107
let filename = lib. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
113
108
if filename. contains ( "std-" ) && !filename. contains ( ".rlib" ) {
114
- try_hard_link ( & lib, LIB_DIR . to_path ( dirs ) . join ( lib. file_name ( ) . unwrap ( ) ) ) ;
109
+ try_hard_link ( & lib, dirs . dist_dir . join ( "lib" ) . join ( lib. file_name ( ) . unwrap ( ) ) ) ;
115
110
}
116
111
}
117
112
118
113
let mut target_compiler = {
119
- let dirs: & Dirs = & dirs;
120
114
let rustc_clif = dirs. dist_dir . join ( wrapper_base_name. replace ( "____" , "rustc-clif" ) ) ;
121
115
let rustdoc_clif = dirs. dist_dir . join ( wrapper_base_name. replace ( "____" , "rustdoc-clif" ) ) ;
122
116
0 commit comments