@@ -22,9 +22,9 @@ pub(crate) fn build_sysroot(
22
22
23
23
eprintln ! ( "[BUILD] sysroot {:?}" , sysroot_kind) ;
24
24
25
- let dist_dir = RelPath :: DIST . to_path ( dirs) ;
25
+ let dist_dir = & dirs. dist_dir ;
26
26
27
- ensure_empty_dir ( & dist_dir) ;
27
+ ensure_empty_dir ( dist_dir) ;
28
28
fs:: create_dir_all ( dist_dir. join ( "bin" ) ) . unwrap ( ) ;
29
29
fs:: create_dir_all ( dist_dir. join ( "lib" ) ) . unwrap ( ) ;
30
30
@@ -55,7 +55,7 @@ pub(crate) fn build_sysroot(
55
55
let mut build_cargo_wrapper_cmd = Command :: new ( & bootstrap_host_compiler. rustc ) ;
56
56
let wrapper_path = dist_dir. join ( & wrapper_name) ;
57
57
build_cargo_wrapper_cmd
58
- . arg ( RelPath :: SCRIPTS . to_path ( dirs ) . join ( & format ! ( "{wrapper}.rs" ) ) )
58
+ . arg ( dirs . source_dir . join ( "scripts" ) . join ( & format ! ( "{wrapper}.rs" ) ) )
59
59
. arg ( "-o" )
60
60
. arg ( & wrapper_path)
61
61
. arg ( "-Cstrip=debuginfo" ) ;
@@ -85,7 +85,7 @@ pub(crate) fn build_sysroot(
85
85
& cg_clif_dylib_path,
86
86
sysroot_kind,
87
87
) ;
88
- host. install_into_sysroot ( & dist_dir) ;
88
+ host. install_into_sysroot ( dist_dir) ;
89
89
90
90
if !is_native {
91
91
build_sysroot_for_triple (
@@ -99,7 +99,7 @@ pub(crate) fn build_sysroot(
99
99
& cg_clif_dylib_path,
100
100
sysroot_kind,
101
101
)
102
- . install_into_sysroot ( & dist_dir) ;
102
+ . install_into_sysroot ( dist_dir) ;
103
103
}
104
104
105
105
let mut target_compiler = {
@@ -143,10 +143,10 @@ impl SysrootTarget {
143
143
}
144
144
}
145
145
146
- static STDLIB_SRC : RelPath = RelPath :: BUILD . join ( "stdlib" ) ;
146
+ static STDLIB_SRC : RelPath = RelPath :: build ( "stdlib" ) ;
147
147
static STANDARD_LIBRARY : CargoProject =
148
- CargoProject :: new ( & STDLIB_SRC . join ( " library/sysroot") , "stdlib_target" ) ;
149
- static RTSTARTUP_SYSROOT : RelPath = RelPath :: BUILD . join ( "rtstartup" ) ;
148
+ CargoProject :: new ( & RelPath :: build ( "stdlib/ library/sysroot") , "stdlib_target" ) ;
149
+ static RTSTARTUP_SYSROOT : RelPath = RelPath :: build ( "rtstartup" ) ;
150
150
151
151
fn build_sysroot_for_triple (
152
152
dirs : & Dirs ,
@@ -247,6 +247,7 @@ fn build_clif_sysroot_for_triple(
247
247
let mut build_cmd = STANDARD_LIBRARY . build ( & compiler, dirs) ;
248
248
build_cmd. arg ( "--release" ) ;
249
249
build_cmd. arg ( "--features" ) . arg ( "backtrace panic-unwind compiler-builtins-no-f16-f128" ) ;
250
+ build_cmd. arg ( format ! ( "-Zroot-dir={}" , STDLIB_SRC . to_path( dirs) . display( ) ) ) ;
250
251
build_cmd. env ( "CARGO_PROFILE_RELEASE_DEBUG" , "true" ) ;
251
252
build_cmd. env ( "__CARGO_DEFAULT_LIB_METADATA" , "cg_clif" ) ;
252
253
if compiler. triple . contains ( "apple" ) {
@@ -281,13 +282,14 @@ fn build_rtstartup(dirs: &Dirs, compiler: &Compiler) -> Option<SysrootTarget> {
281
282
return None ;
282
283
}
283
284
284
- RTSTARTUP_SYSROOT . ensure_fresh ( dirs) ;
285
+ let rtstartup_sysroot = RTSTARTUP_SYSROOT . to_path ( dirs) ;
286
+ ensure_empty_dir ( & rtstartup_sysroot) ;
285
287
286
288
let rtstartup_src = STDLIB_SRC . to_path ( dirs) . join ( "library" ) . join ( "rtstartup" ) ;
287
289
let mut target_libs = SysrootTarget { triple : compiler. triple . clone ( ) , libs : vec ! [ ] } ;
288
290
289
291
for file in [ "rsbegin" , "rsend" ] {
290
- let obj = RTSTARTUP_SYSROOT . to_path ( dirs ) . join ( format ! ( "{file}.o" ) ) ;
292
+ let obj = rtstartup_sysroot . join ( format ! ( "{file}.o" ) ) ;
291
293
let mut build_rtstartup_cmd = Command :: new ( & compiler. rustc ) ;
292
294
build_rtstartup_cmd
293
295
. arg ( "--target" )
0 commit comments