Skip to content

Commit

Permalink
Blindly copy random files because we don't know which one windows wil…
Browse files Browse the repository at this point in the history
…l generate!
  • Loading branch information
alexcrichton committed Nov 7, 2014
1 parent b389fe2 commit 236e885
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions libssh2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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();

Expand Down

0 comments on commit 236e885

Please sign in to comment.