File tree 4 files changed +22
-0
lines changed
4 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 388
388
# Note: an absolute path should be used, otherwise LLVM build will break.
389
389
#ar = "ar"
390
390
391
+ # Ranlib to be used to assemble static libraries compiled from C/C++ code.
392
+ # Note: an absolute path should be used, otherwise LLVM build will break.
393
+ #ranlib = "ranlib"
394
+
391
395
# Linker to be used to link Rust code. Note that the
392
396
# default value is platform specific, and if not specified it may also depend on
393
397
# what platform is crossing to what platform.
Original file line number Diff line number Diff line change @@ -163,6 +163,7 @@ pub struct Target {
163
163
pub cc : Option < PathBuf > ,
164
164
pub cxx : Option < PathBuf > ,
165
165
pub ar : Option < PathBuf > ,
166
+ pub ranlib : Option < PathBuf > ,
166
167
pub linker : Option < PathBuf > ,
167
168
pub ndk : Option < PathBuf > ,
168
169
pub crt_static : Option < bool > ,
@@ -327,6 +328,7 @@ struct TomlTarget {
327
328
cc : Option < String > ,
328
329
cxx : Option < String > ,
329
330
ar : Option < String > ,
331
+ ranlib : Option < String > ,
330
332
linker : Option < String > ,
331
333
android_ndk : Option < String > ,
332
334
crt_static : Option < bool > ,
@@ -581,6 +583,7 @@ impl Config {
581
583
target. cc = cfg. cc . clone ( ) . map ( PathBuf :: from) ;
582
584
target. cxx = cfg. cxx . clone ( ) . map ( PathBuf :: from) ;
583
585
target. ar = cfg. ar . clone ( ) . map ( PathBuf :: from) ;
586
+ target. ranlib = cfg. ranlib . clone ( ) . map ( PathBuf :: from) ;
584
587
target. linker = cfg. linker . clone ( ) . map ( PathBuf :: from) ;
585
588
target. crt_static = cfg. crt_static . clone ( ) ;
586
589
target. musl_root = cfg. musl_root . clone ( ) . map ( PathBuf :: from) ;
Original file line number Diff line number Diff line change @@ -281,6 +281,7 @@ pub struct Build {
281
281
cc : HashMap < Interned < String > , cc:: Tool > ,
282
282
cxx : HashMap < Interned < String > , cc:: Tool > ,
283
283
ar : HashMap < Interned < String > , PathBuf > ,
284
+ ranlib : HashMap < Interned < String > , PathBuf > ,
284
285
// Misc
285
286
crates : HashMap < Interned < String > , Crate > ,
286
287
is_sudo : bool ,
@@ -406,6 +407,7 @@ impl Build {
406
407
cc : HashMap :: new ( ) ,
407
408
cxx : HashMap :: new ( ) ,
408
409
ar : HashMap :: new ( ) ,
410
+ ranlib : HashMap :: new ( ) ,
409
411
crates : HashMap :: new ( ) ,
410
412
lldb_version : None ,
411
413
lldb_python_dir : None ,
@@ -772,6 +774,11 @@ impl Build {
772
774
self . ar . get ( & target) . map ( |p| & * * p)
773
775
}
774
776
777
+ /// Returns the path to the `ranlib` utility for the target specified.
778
+ fn ranlib ( & self , target : Interned < String > ) -> Option < & Path > {
779
+ self . ranlib . get ( & target) . map ( |p| & * * p)
780
+ }
781
+
775
782
/// Returns the path to the C++ compiler for the target specified.
776
783
fn cxx ( & self , target : Interned < String > ) -> Result < & Path , String > {
777
784
match self . cxx . get ( & target) {
Original file line number Diff line number Diff line change @@ -379,6 +379,14 @@ fn configure_cmake(builder: &Builder,
379
379
}
380
380
}
381
381
382
+ if let Some ( ranlib) = builder. ranlib ( target) {
383
+ if ranlib. is_absolute ( ) {
384
+ // LLVM build breaks if `CMAKE_RANLIB` is a relative path, for some reason it
385
+ // tries to resolve this path in the LLVM build directory.
386
+ cfg. define ( "CMAKE_RANLIB" , sanitize_cc ( ranlib) ) ;
387
+ }
388
+ }
389
+
382
390
if env:: var_os ( "SCCACHE_ERROR_LOG" ) . is_some ( ) {
383
391
cfg. env ( "RUST_LOG" , "sccache=warn" ) ;
384
392
}
You can’t perform that action at this time.
0 commit comments