@@ -78,6 +78,7 @@ pub(crate) fn main() {
7878    let  mut  channel = "release" ; 
7979    let  mut  sysroot_kind = SysrootKind :: Clif ; 
8080    let  mut  use_unstable_features = true ; 
81+     let  mut  frozen = false ; 
8182    while  let  Some ( arg)  = args. next ( ) . as_deref ( )  { 
8283        match  arg { 
8384            "--out-dir"  => { 
@@ -96,17 +97,38 @@ pub(crate) fn main() {
9697                } 
9798            } 
9899            "--no-unstable-features"  => use_unstable_features = false , 
100+             "--frozen"  => frozen = true , 
99101            flag if  flag. starts_with ( "-" )  => arg_error ! ( "Unknown flag {}" ,  flag) , 
100102            arg => arg_error ! ( "Unexpected argument {}" ,  arg) , 
101103        } 
102104    } 
103105
104-     let  bootstrap_host_compiler = Compiler :: bootstrap_with_triple ( 
105-         std:: env:: var ( "HOST_TRIPLE" ) 
106+     let  rustup_toolchain_name = match  ( env:: var ( "CARGO" ) ,  env:: var ( "RUSTC" ) ,  env:: var ( "RUSTDOC" ) )  { 
107+         ( Ok ( _) ,  Ok ( _) ,  Ok ( _) )  => None , 
108+         ( Err ( _) ,  Err ( _) ,  Err ( _) )  => Some ( rustc_info:: get_toolchain_name ( ) ) , 
109+         _ => { 
110+             eprintln ! ( "All of CARGO, RUSTC and RUSTDOC need to be set or none must be set" ) ; 
111+             process:: exit ( 1 ) ; 
112+         } 
113+     } ; 
114+     let  bootstrap_host_compiler = { 
115+         let  cargo = rustc_info:: get_cargo_path ( ) ; 
116+         let  rustc = rustc_info:: get_rustc_path ( ) ; 
117+         let  rustdoc = rustc_info:: get_rustdoc_path ( ) ; 
118+         let  triple = std:: env:: var ( "HOST_TRIPLE" ) 
106119            . ok ( ) 
107120            . or_else ( || config:: get_value ( "host" ) ) 
108-             . unwrap_or_else ( || rustc_info:: get_host_triple ( ) ) , 
109-     ) ; 
121+             . unwrap_or_else ( || rustc_info:: get_host_triple ( & rustc) ) ; 
122+         Compiler  { 
123+             cargo, 
124+             rustc, 
125+             rustdoc, 
126+             rustflags :  String :: new ( ) , 
127+             rustdocflags :  String :: new ( ) , 
128+             triple, 
129+             runner :  vec ! [ ] , 
130+         } 
131+     } ; 
110132    let  target_triple = std:: env:: var ( "TARGET_TRIPLE" ) 
111133        . ok ( ) 
112134        . or_else ( || config:: get_value ( "target" ) ) 
@@ -120,6 +142,7 @@ pub(crate) fn main() {
120142        download_dir :  out_dir. join ( "download" ) , 
121143        build_dir :  out_dir. join ( "build" ) , 
122144        dist_dir :  out_dir. join ( "dist" ) , 
145+         frozen, 
123146    } ; 
124147
125148    path:: RelPath :: BUILD . ensure_exists ( & dirs) ; 
@@ -134,7 +157,7 @@ pub(crate) fn main() {
134157    } 
135158
136159    if  command == Command :: Prepare  { 
137-         prepare:: prepare ( & dirs) ; 
160+         prepare:: prepare ( & dirs,   & bootstrap_host_compiler . rustc ) ; 
138161        process:: exit ( 0 ) ; 
139162    } 
140163
@@ -158,6 +181,7 @@ pub(crate) fn main() {
158181                sysroot_kind, 
159182                & cg_clif_dylib, 
160183                & bootstrap_host_compiler, 
184+                 rustup_toolchain_name. as_deref ( ) , 
161185                target_triple. clone ( ) , 
162186            ) ; 
163187        } 
@@ -166,7 +190,14 @@ pub(crate) fn main() {
166190                eprintln ! ( "Abi-cafe doesn't support cross-compilation" ) ; 
167191                process:: exit ( 1 ) ; 
168192            } 
169-             abi_cafe:: run ( channel,  sysroot_kind,  & dirs,  & cg_clif_dylib,  & bootstrap_host_compiler) ; 
193+             abi_cafe:: run ( 
194+                 channel, 
195+                 sysroot_kind, 
196+                 & dirs, 
197+                 & cg_clif_dylib, 
198+                 rustup_toolchain_name. as_deref ( ) , 
199+                 & bootstrap_host_compiler, 
200+             ) ; 
170201        } 
171202        Command :: Build  => { 
172203            build_sysroot:: build_sysroot ( 
@@ -175,6 +206,7 @@ pub(crate) fn main() {
175206                sysroot_kind, 
176207                & cg_clif_dylib, 
177208                & bootstrap_host_compiler, 
209+                 rustup_toolchain_name. as_deref ( ) , 
178210                target_triple, 
179211            ) ; 
180212        } 
@@ -185,9 +217,10 @@ pub(crate) fn main() {
185217                sysroot_kind, 
186218                & cg_clif_dylib, 
187219                & bootstrap_host_compiler, 
220+                 rustup_toolchain_name. as_deref ( ) , 
188221                target_triple, 
189222            ) ; 
190-             bench:: benchmark ( & dirs) ; 
223+             bench:: benchmark ( & dirs,   & bootstrap_host_compiler ) ; 
191224        } 
192225    } 
193226} 
0 commit comments