]> git.lizzy.rs Git - rust.git/blobdiff - src/build_helper/lib.rs
Disconnect ar from cc on OpenBSD
[rust.git] / src / build_helper / lib.rs
index 838cc4f07a9a175397c253dbec2ab730413926b8..bd036fae689559e5523d5d2b4aadf4a6520b7498 100644 (file)
@@ -21,11 +21,14 @@ pub fn run(cmd: &mut Command) {
 pub fn run_silent(cmd: &mut Command) {
     let status = match cmd.status() {
         Ok(status) => status,
-        Err(e) => fail(&format!("failed to execute command: {}", e)),
+        Err(e) => fail(&format!("failed to execute command: {:?}\nerror: {}",
+                                cmd, e)),
     };
     if !status.success() {
         fail(&format!("command did not execute successfully: {:?}\n\
-                       expected success, got: {}", cmd, status));
+                       expected success, got: {}",
+                      cmd,
+                      status));
     }
 }
 
@@ -44,6 +47,8 @@ pub fn cc2ar(cc: &Path, target: &str) -> Option<PathBuf> {
         None
     } else if target.contains("musl") {
         Some(PathBuf::from("ar"))
+    } else if target.contains("openbsd") {
+        Some(PathBuf::from("ar"))
     } else {
         let parent = cc.parent().unwrap();
         let file = cc.file_name().unwrap().to_str().unwrap();
@@ -61,11 +66,14 @@ pub fn cc2ar(cc: &Path, target: &str) -> Option<PathBuf> {
 pub fn output(cmd: &mut Command) -> String {
     let output = match cmd.stderr(Stdio::inherit()).output() {
         Ok(status) => status,
-        Err(e) => fail(&format!("failed to execute command: {}", e)),
+        Err(e) => fail(&format!("failed to execute command: {:?}\nerror: {}",
+                                cmd, e)),
     };
     if !output.status.success() {
         panic!("command did not execute successfully: {:?}\n\
-                expected success, got: {}", cmd, output.status);
+                expected success, got: {}",
+               cmd,
+               output.status);
     }
     String::from_utf8(output.stdout).unwrap()
 }