File tree Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Expand file tree Collapse file tree 3 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,7 @@ pub struct Target {
161
161
pub cc : Option < PathBuf > ,
162
162
pub cxx : Option < PathBuf > ,
163
163
pub ar : Option < PathBuf > ,
164
+ pub ranlib : Option < PathBuf > ,
164
165
pub linker : Option < PathBuf > ,
165
166
pub ndk : Option < PathBuf > ,
166
167
pub crt_static : Option < bool > ,
@@ -321,6 +322,7 @@ struct TomlTarget {
321
322
cc : Option < String > ,
322
323
cxx : Option < String > ,
323
324
ar : Option < String > ,
325
+ ranlib : Option < String > ,
324
326
linker : Option < String > ,
325
327
android_ndk : Option < String > ,
326
328
crt_static : Option < bool > ,
@@ -569,6 +571,7 @@ impl Config {
569
571
target. cc = cfg. cc . clone ( ) . map ( PathBuf :: from) ;
570
572
target. cxx = cfg. cxx . clone ( ) . map ( PathBuf :: from) ;
571
573
target. ar = cfg. ar . clone ( ) . map ( PathBuf :: from) ;
574
+ target. ranlib = cfg. ranlib . clone ( ) . map ( PathBuf :: from) ;
572
575
target. linker = cfg. linker . clone ( ) . map ( PathBuf :: from) ;
573
576
target. crt_static = cfg. crt_static . clone ( ) ;
574
577
target. musl_root = cfg. musl_root . clone ( ) . map ( PathBuf :: from) ;
Original file line number Diff line number Diff line change @@ -265,6 +265,7 @@ pub struct Build {
265
265
cc : HashMap < Interned < String > , cc:: Tool > ,
266
266
cxx : HashMap < Interned < String > , cc:: Tool > ,
267
267
ar : HashMap < Interned < String > , PathBuf > ,
268
+ ranlib : HashMap < Interned < String > , PathBuf > ,
268
269
// Misc
269
270
crates : HashMap < Interned < String > , Crate > ,
270
271
is_sudo : bool ,
@@ -366,6 +367,7 @@ impl Build {
366
367
cc : HashMap :: new ( ) ,
367
368
cxx : HashMap :: new ( ) ,
368
369
ar : HashMap :: new ( ) ,
370
+ ranlib : HashMap :: new ( ) ,
369
371
crates : HashMap :: new ( ) ,
370
372
lldb_version : None ,
371
373
lldb_python_dir : None ,
@@ -725,6 +727,11 @@ impl Build {
725
727
self . ar . get ( & target) . map ( |p| & * * p)
726
728
}
727
729
730
+ /// Returns the path to the `ranlib` utility for the target specified.
731
+ fn ranlib ( & self , target : Interned < String > ) -> Option < & Path > {
732
+ self . ranlib . get ( & target) . map ( |p| & * * p)
733
+ }
734
+
728
735
/// Returns the path to the C++ compiler for the target specified.
729
736
fn cxx ( & self , target : Interned < String > ) -> Result < & Path , String > {
730
737
match self . cxx . get ( & target) {
Original file line number Diff line number Diff line change @@ -352,6 +352,14 @@ fn configure_cmake(builder: &Builder,
352
352
}
353
353
}
354
354
355
+ if let Some ( ranlib) = builder. ranlib ( target) {
356
+ if ranlib. is_absolute ( ) {
357
+ // LLVM build breaks if `CMAKE_RANLIB` is a relative path, for some reason it
358
+ // tries to resolve this path in the LLVM build directory.
359
+ cfg. define ( "CMAKE_RANLIB" , sanitize_cc ( ranlib) ) ;
360
+ }
361
+ }
362
+
355
363
if env:: var_os ( "SCCACHE_ERROR_LOG" ) . is_some ( ) {
356
364
cfg. env ( "RUST_LOG" , "sccache=warn" ) ;
357
365
}
You can’t perform that action at this time.
0 commit comments