@@ -89,15 +89,12 @@ fn byte_array_to_os_string(bytes: &[u8]) -> OsString {
89
89
OsString :: from_wide ( & wide)
90
90
}
91
91
92
-
93
92
/// Runs the command `R RHOME` and returns the trimmed output if successful.
94
93
/// Panics with a meaningful error message if the command fails.
95
94
fn get_r_home ( ) -> String {
96
95
// Attempt to run the command `R RHOME`
97
- let output = Command :: new ( "R" )
98
- . arg ( "RHOME" )
99
- . output ( ) ; // Capture the command's output
100
-
96
+ let output = Command :: new ( "R" ) . arg ( "RHOME" ) . output ( ) ; // Capture the command's output
97
+
101
98
match output {
102
99
Ok ( output) if output. status . success ( ) => {
103
100
// Convert stdout to a String and trim it
@@ -186,29 +183,27 @@ fn get_libs_and_paths(strings: Vec<String>) -> (Vec<String>, Vec<String>) {
186
183
( paths, libs)
187
184
}
188
185
189
-
190
186
fn main ( ) {
191
-
192
187
let r_configs = build_r_cmd_configs ( ) ;
193
188
let ( lib_paths, libs) = get_libs_and_paths (
194
189
[
195
- r_configs. get_r_cmd_config ( "BLAS_LIBS" ) ,
196
- r_configs. get_r_cmd_config ( "LAPACK_LIBS" ) ,
197
- r_configs. get_r_cmd_config ( "FLIBS" ) ,
190
+ r_configs. get_r_cmd_config ( "BLAS_LIBS" ) ,
191
+ r_configs. get_r_cmd_config ( "LAPACK_LIBS" ) ,
192
+ r_configs. get_r_cmd_config ( "FLIBS" ) ,
198
193
]
199
- . to_vec ( ) ,
194
+ . to_vec ( ) ,
200
195
) ;
201
-
196
+
202
197
for path in lib_paths. iter ( ) {
203
198
// Some R builds (e.g. homebrew) contain hardwired gfortran12
204
199
// paths, which may or may not exist if one has upgraded
205
200
// gfortran. So filter out non-existent ones, so that cargo
206
201
// doesn't complain.
207
202
if Path :: new ( path) . exists ( ) {
208
- println ! ( "cargo:rustc-link-search={}" , path) ;
203
+ println ! ( "cargo:rustc-link-search={}" , path) ;
209
204
}
210
205
}
211
-
206
+
212
207
for lib in libs. iter ( ) {
213
208
println ! ( "cargo:rustc-link-lib=dylib={}" , lib) ;
214
209
}
0 commit comments