Skip to content

Commit 6c2181c

Browse files
committed
Update build.rs
1 parent d51a818 commit 6c2181c

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

build.rs

+9-14
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,12 @@ fn byte_array_to_os_string(bytes: &[u8]) -> OsString {
8989
OsString::from_wide(&wide)
9090
}
9191

92-
9392
/// Runs the command `R RHOME` and returns the trimmed output if successful.
9493
/// Panics with a meaningful error message if the command fails.
9594
fn get_r_home() -> String {
9695
// 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+
10198
match output {
10299
Ok(output) if output.status.success() => {
103100
// Convert stdout to a String and trim it
@@ -186,29 +183,27 @@ fn get_libs_and_paths(strings: Vec<String>) -> (Vec<String>, Vec<String>) {
186183
(paths, libs)
187184
}
188185

189-
190186
fn main() {
191-
192187
let r_configs = build_r_cmd_configs();
193188
let (lib_paths, libs) = get_libs_and_paths(
194189
[
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"),
198193
]
199-
.to_vec(),
194+
.to_vec(),
200195
);
201-
196+
202197
for path in lib_paths.iter() {
203198
// Some R builds (e.g. homebrew) contain hardwired gfortran12
204199
// paths, which may or may not exist if one has upgraded
205200
// gfortran. So filter out non-existent ones, so that cargo
206201
// doesn't complain.
207202
if Path::new(path).exists() {
208-
println!("cargo:rustc-link-search={}", path);
203+
println!("cargo:rustc-link-search={}", path);
209204
}
210205
}
211-
206+
212207
for lib in libs.iter() {
213208
println!("cargo:rustc-link-lib=dylib={}", lib);
214209
}

0 commit comments

Comments
 (0)