@@ -1161,14 +1161,7 @@ impl<'a> Builder<'a> {
1161
1161
self . ensure ( compile:: Sysroot :: new ( compiler) )
1162
1162
}
1163
1163
1164
- /// Returns the bindir for a compiler's sysroot.
1165
- pub fn sysroot_target_bindir ( & self , compiler : Compiler , target : TargetSelection ) -> PathBuf {
1166
- self . sysroot_target_libdir ( compiler, target) . parent ( ) . unwrap ( ) . join ( "bin" )
1167
- }
1168
-
1169
- /// Returns the libdir where the standard library and other artifacts are
1170
- /// found for a compiler's sysroot.
1171
- pub fn sysroot_target_libdir ( & self , compiler : Compiler , target : TargetSelection ) -> PathBuf {
1164
+ fn ensure_sysroot_target_dir ( & self , compiler : Compiler , target : TargetSelection ) -> PathBuf {
1172
1165
#[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
1173
1166
struct Libdir {
1174
1167
compiler : Compiler ,
@@ -1183,25 +1176,26 @@ impl<'a> Builder<'a> {
1183
1176
1184
1177
fn run ( self , builder : & Builder < ' _ > ) -> PathBuf {
1185
1178
let lib = builder. sysroot_libdir_relative ( self . compiler ) ;
1186
- let sysroot = builder
1187
- . sysroot ( self . compiler )
1188
- . join ( lib)
1189
- . join ( "rustlib" )
1190
- . join ( self . target )
1191
- . join ( "lib" ) ;
1192
- // Avoid deleting the rustlib/ directory we just copied
1193
- // (in `impl Step for Sysroot`).
1179
+ let sysroot = builder. sysroot ( self . compiler ) . join ( lib) . join ( "rustlib" ) ;
1180
+
1181
+ // Avoid deleting the `rustlib/` directory we just copied (in `impl Step for
1182
+ // Sysroot`).
1194
1183
if !builder. download_rustc ( ) {
1184
+ let sysroot_target_libdir = sysroot. join ( self . target ) . join ( "lib" ) ;
1195
1185
builder. verbose ( || {
1196
- println ! ( "Removing sysroot {} to avoid caching bugs" , sysroot. display( ) )
1186
+ println ! (
1187
+ "Removing sysroot {} to avoid caching bugs" ,
1188
+ sysroot_target_libdir. display( )
1189
+ )
1197
1190
} ) ;
1198
- let _ = fs:: remove_dir_all ( & sysroot ) ;
1199
- t ! ( fs:: create_dir_all( & sysroot ) ) ;
1191
+ let _ = fs:: remove_dir_all ( & sysroot_target_libdir ) ;
1192
+ t ! ( fs:: create_dir_all( & sysroot_target_libdir ) ) ;
1200
1193
}
1201
1194
1202
1195
if self . compiler . stage == 0 {
1203
- // The stage 0 compiler for the build triple is always pre-built.
1204
- // Ensure that `libLLVM.so` ends up in the target libdir, so that ui-fulldeps tests can use it when run.
1196
+ // The stage 0 compiler for the build triple is always pre-built. Ensure that
1197
+ // `libLLVM.so` ends up in the target libdir, so that ui-fulldeps tests can use
1198
+ // it when run.
1205
1199
dist:: maybe_install_llvm_target (
1206
1200
builder,
1207
1201
self . compiler . host ,
@@ -1212,9 +1206,21 @@ impl<'a> Builder<'a> {
1212
1206
sysroot
1213
1207
}
1214
1208
}
1209
+
1215
1210
self . ensure ( Libdir { compiler, target } )
1216
1211
}
1217
1212
1213
+ /// Returns the bindir for a compiler's sysroot.
1214
+ pub fn sysroot_target_bindir ( & self , compiler : Compiler , target : TargetSelection ) -> PathBuf {
1215
+ self . ensure_sysroot_target_dir ( compiler, target) . join ( target) . join ( "bin" )
1216
+ }
1217
+
1218
+ /// Returns the libdir where the standard library and other artifacts are
1219
+ /// found for a compiler's sysroot.
1220
+ pub fn sysroot_target_libdir ( & self , compiler : Compiler , target : TargetSelection ) -> PathBuf {
1221
+ self . ensure_sysroot_target_dir ( compiler, target) . join ( target) . join ( "lib" )
1222
+ }
1223
+
1218
1224
pub fn sysroot_codegen_backends ( & self , compiler : Compiler ) -> PathBuf {
1219
1225
self . sysroot_target_libdir ( compiler, compiler. host ) . with_file_name ( "codegen-backends" )
1220
1226
}
0 commit comments