diff options
author | Alex Crichton <alex@alexcrichton.com> | 2014-11-07 15:28:12 -0800 |
---|---|---|
committer | Alex Crichton <alex@alexcrichton.com> | 2014-11-07 15:28:12 -0800 |
commit | 236e885d17305360b6211ca84fd1a2b1cb93e656 (patch) | |
tree | 5462ff013109bd75adc06e1d6e8f976b5e4d54e9 /libssh2-sys/build.rs | |
parent | b389fe2bf3967f6f0216d0fc14fae585a07c769a (diff) | |
download | ssh2-rs-236e885d17305360b6211ca84fd1a2b1cb93e656.zip |
Blindly copy random files because we don't know which one windows will generate!
Diffstat (limited to 'libssh2-sys/build.rs')
-rw-r--r-- | libssh2-sys/build.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libssh2-sys/build.rs b/libssh2-sys/build.rs index fff510a..0b0a704 100644 --- a/libssh2-sys/build.rs +++ b/libssh2-sys/build.rs @@ -3,6 +3,7 @@ extern crate "pkg-config" as pkg_config; use std::os; use std::io::{mod, fs, Command}; use std::io::process::InheritFd; +use std::io::fs::PathExtensions; fn main() { match pkg_config::find_library("libssh2") { @@ -61,9 +62,15 @@ fn main() { // Don't run `make install` because apparently it's a little buggy on mingw // for windows. fs::mkdir_recursive(&dst.join("lib/pkgconfig"), io::USER_DIR).unwrap(); - let filename = if windows {"libssh2.lib"} else {"libssh2.a"}; - fs::rename(&dst.join("build/src/.libs").join(filename), - &dst.join("lib/libssh2.a")).unwrap(); + + // Which one does windows generate? Who knows! + let p1 = dst.join("build/src/.libs/libssh2.a"); + let p2 = dst.join("build/src/.libs/libssh2.lib"); + if p1.exists() { + fs::rename(&p1, &dst.join("lib/libssh2.a")).unwrap(); + } else { + fs::rename(&p2, &dst.join("lib/libssh2.a")).unwrap(); + } fs::rename(&dst.join("build/libssh2.pc"), &dst.join("lib/pkgconfig/libssh2.pc")).unwrap(); |