summaryrefslogtreecommitdiff
path: root/libssh2-sys/build.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-11-11 10:12:54 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-11-11 10:12:54 -0800
commit27d760680cf7b756298c8cb61fabe3aaefe0e84a (patch)
tree0a104bbaea442d2113bc5e5ca48b0500ad0544bc /libssh2-sys/build.rs
parentcb6a56021282af938f6d82ab0901428eef0b3e96 (diff)
downloadssh2-rs-27d760680cf7b756298c8cb61fabe3aaefe0e84a.zip
Fix tests and build on windows
Diffstat (limited to 'libssh2-sys/build.rs')
-rw-r--r--libssh2-sys/build.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/libssh2-sys/build.rs b/libssh2-sys/build.rs
index d6d2344..4886782 100644
--- a/libssh2-sys/build.rs
+++ b/libssh2-sys/build.rs
@@ -55,8 +55,12 @@ fn main() {
// Windows-style paths (those starting with C:\), but it chokes on those.
// For that reason we build up a shell script with paths converted to
// posix versions hopefully...
+ //
+ // Also apparently the buildbots choke unless we manually set LD, who knows
+ // why?!
run(Command::new("sh")
.env("CFLAGS", cflags)
+ .env("LD", which("ld").unwrap())
.cwd(&dst.join("build"))
.arg("-c")
.arg(format!("{} {}", root.join("configure").display(),
@@ -116,3 +120,9 @@ fn run(cmd: &mut Command) {
.success());
}
+
+fn which(cmd: &str) -> Option<Path> {
+ let cmd = format!("{}{}", cmd, os::consts::EXE_SUFFIX);
+ let paths = os::split_paths(os::getenv("PATH").unwrap());
+ paths.iter().map(|p| p.join(&cmd)).find(|p| p.exists())
+}