@@ -9,21 +9,21 @@ use super::SysrootKind;
9
9
pub ( crate ) fn build_sysroot (
10
10
channel : & str ,
11
11
sysroot_kind : SysrootKind ,
12
- target_dir : & Path ,
12
+ dist_dir : & Path ,
13
13
cg_clif_dylib_src : & Path ,
14
14
host_triple : & str ,
15
15
target_triple : & str ,
16
16
) {
17
17
eprintln ! ( "[BUILD] sysroot {:?}" , sysroot_kind) ;
18
18
19
- if target_dir . exists ( ) {
20
- fs:: remove_dir_all ( target_dir ) . unwrap ( ) ;
19
+ if dist_dir . exists ( ) {
20
+ fs:: remove_dir_all ( dist_dir ) . unwrap ( ) ;
21
21
}
22
- fs:: create_dir_all ( target_dir . join ( "bin" ) ) . unwrap ( ) ;
23
- fs:: create_dir_all ( target_dir . join ( "lib" ) ) . unwrap ( ) ;
22
+ fs:: create_dir_all ( dist_dir . join ( "bin" ) ) . unwrap ( ) ;
23
+ fs:: create_dir_all ( dist_dir . join ( "lib" ) ) . unwrap ( ) ;
24
24
25
25
// Copy the backend
26
- let cg_clif_dylib_path = target_dir
26
+ let cg_clif_dylib_path = dist_dir
27
27
. join ( if cfg ! ( windows) {
28
28
// Windows doesn't have rpath support, so the cg_clif dylib needs to be next to the
29
29
// binaries.
@@ -42,14 +42,14 @@ pub(crate) fn build_sysroot(
42
42
build_cargo_wrapper_cmd
43
43
. arg ( PathBuf :: from ( "scripts" ) . join ( format ! ( "{wrapper}.rs" ) ) )
44
44
. arg ( "-o" )
45
- . arg ( target_dir . join ( wrapper_name) )
45
+ . arg ( dist_dir . join ( wrapper_name) )
46
46
. arg ( "-g" ) ;
47
47
spawn_and_wait ( build_cargo_wrapper_cmd) ;
48
48
}
49
49
50
50
let default_sysroot = super :: rustc_info:: get_default_sysroot ( ) ;
51
51
52
- let rustlib = target_dir . join ( "lib" ) . join ( "rustlib" ) ;
52
+ let rustlib = dist_dir . join ( "lib" ) . join ( "rustlib" ) ;
53
53
let host_rustlib_lib = rustlib. join ( host_triple) . join ( "lib" ) ;
54
54
let target_rustlib_lib = rustlib. join ( target_triple) . join ( "lib" ) ;
55
55
fs:: create_dir_all ( & host_rustlib_lib) . unwrap ( ) ;
@@ -114,7 +114,7 @@ pub(crate) fn build_sysroot(
114
114
SysrootKind :: Clif => {
115
115
build_clif_sysroot_for_triple (
116
116
channel,
117
- target_dir ,
117
+ dist_dir ,
118
118
host_triple,
119
119
& cg_clif_dylib_path,
120
120
None ,
@@ -129,7 +129,7 @@ pub(crate) fn build_sysroot(
129
129
} ;
130
130
build_clif_sysroot_for_triple (
131
131
channel,
132
- target_dir ,
132
+ dist_dir ,
133
133
target_triple,
134
134
& cg_clif_dylib_path,
135
135
linker,
@@ -142,7 +142,7 @@ pub(crate) fn build_sysroot(
142
142
let file = file. unwrap ( ) . path ( ) ;
143
143
let filename = file. file_name ( ) . unwrap ( ) . to_str ( ) . unwrap ( ) ;
144
144
if filename. contains ( "std-" ) && !filename. contains ( ".rlib" ) {
145
- try_hard_link ( & file, target_dir . join ( "lib" ) . join ( file. file_name ( ) . unwrap ( ) ) ) ;
145
+ try_hard_link ( & file, dist_dir . join ( "lib" ) . join ( file. file_name ( ) . unwrap ( ) ) ) ;
146
146
}
147
147
}
148
148
}
@@ -153,7 +153,7 @@ static STANDARD_LIBRARY: CargoProject = CargoProject::local("build_sysroot");
153
153
154
154
fn build_clif_sysroot_for_triple (
155
155
channel : & str ,
156
- target_dir : & Path ,
156
+ dist_dir : & Path ,
157
157
triple : & str ,
158
158
cg_clif_dylib_path : & Path ,
159
159
linker : Option < & str > ,
@@ -189,7 +189,7 @@ fn build_clif_sysroot_for_triple(
189
189
// Build sysroot
190
190
let mut rustflags = "-Zforce-unstable-if-unmarked -Cpanic=abort" . to_string ( ) ;
191
191
rustflags. push_str ( & format ! ( " -Zcodegen-backend={}" , cg_clif_dylib_path. to_str( ) . unwrap( ) ) ) ;
192
- rustflags. push_str ( & format ! ( " --sysroot={}" , target_dir . to_str( ) . unwrap( ) ) ) ;
192
+ rustflags. push_str ( & format ! ( " --sysroot={}" , dist_dir . to_str( ) . unwrap( ) ) ) ;
193
193
if channel == "release" {
194
194
rustflags. push_str ( " -Zmir-opt-level=3" ) ;
195
195
}
@@ -221,7 +221,7 @@ fn build_clif_sysroot_for_triple(
221
221
} ;
222
222
try_hard_link (
223
223
entry. path ( ) ,
224
- target_dir . join ( "lib" ) . join ( "rustlib" ) . join ( triple) . join ( "lib" ) . join ( entry. file_name ( ) ) ,
224
+ dist_dir . join ( "lib" ) . join ( "rustlib" ) . join ( triple) . join ( "lib" ) . join ( entry. file_name ( ) ) ,
225
225
) ;
226
226
}
227
227
}
0 commit comments