@@ -74,22 +74,22 @@ pub fn dylib_env_var() -> &'static str {
74
74
}
75
75
}
76
76
77
- /// The platform-specific library file extension
78
- pub fn lib_extension ( dylib : bool ) -> & ' static str {
77
+ /// The platform-specific library name
78
+ pub fn get_lib_name ( lib : & str , dylib : bool ) -> String {
79
79
// In some casess (e.g. MUSL), we build a static
80
80
// library, rather than a dynamic library.
81
81
// In this case, the only path we can pass
82
82
// with '--extern-meta' is the '.lib' file
83
83
if !dylib {
84
- return " .rlib"
84
+ return format ! ( "lib{} .rlib", lib ) ;
85
85
}
86
86
87
87
if cfg ! ( windows) {
88
- " .dll"
88
+ format ! ( "{} .dll", lib )
89
89
} else if cfg ! ( target_os = "macos" ) {
90
- " .dylib"
90
+ format ! ( "lib{} .dylib", lib )
91
91
} else {
92
- " .so"
92
+ format ! ( "lib{} .so", lib )
93
93
}
94
94
}
95
95
@@ -1608,7 +1608,7 @@ impl<'test> TestCx<'test> {
1608
1608
let mut extern_priv = self . props . extern_private . clone ( ) ;
1609
1609
1610
1610
let mut add_extern_priv = |priv_dep : & str , dylib : bool | {
1611
- let lib_name = format ! ( "lib{}{}" , priv_dep, lib_extension ( dylib) ) ;
1611
+ let lib_name = get_lib_name ( priv_dep, dylib) ;
1612
1612
rustc
1613
1613
. arg ( "--extern-private" )
1614
1614
. arg ( format ! ( "{}={}" , priv_dep, aux_dir. join( lib_name) . to_str( ) . unwrap( ) ) ) ;
0 commit comments