summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-07-22 12:30:38 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-07-22 13:49:21 -0700
commit5688e2bd912bb1ad8de261e5849f58b4857a6818 (patch)
tree998252cd07214fb7d81cb11ba1d4fb110623b787
parent8f7703ba695d7b254a9ac2e91c58cdfc6a0cbda4 (diff)
downloadssh2-rs-5688e2bd912bb1ad8de261e5849f58b4857a6818.zip
Use gcc's support to find nmake
-rw-r--r--libssh2-sys/Cargo.toml1
-rw-r--r--libssh2-sys/build.rs20
2 files changed, 12 insertions, 9 deletions
diff --git a/libssh2-sys/Cargo.toml b/libssh2-sys/Cargo.toml
index f7da679..c86635c 100644
--- a/libssh2-sys/Cargo.toml
+++ b/libssh2-sys/Cargo.toml
@@ -41,3 +41,4 @@ openssl-sys = "0.6.0"
[build-dependencies]
pkg-config = "0.3"
+gcc = "0.3.10"
diff --git a/libssh2-sys/build.rs b/libssh2-sys/build.rs
index bf13104..8cc3024 100644
--- a/libssh2-sys/build.rs
+++ b/libssh2-sys/build.rs
@@ -1,4 +1,5 @@
extern crate pkg_config;
+extern crate gcc;
use std::env;
use std::fs::{self, File};
@@ -105,15 +106,16 @@ fn main() {
t!(fs::create_dir(dst.join("lib")));
if target.contains("msvc") {
- run(Command::new("nmake")
- .current_dir(&root)
- .arg("/nologo")
- // see above for why we set CC here
- .env("CC", env::current_exe().unwrap())
- .env_remove("TARGET")
- .arg("/fNMakefile")
- .arg("BUILD_STATIC_LIB=1")
- .arg("WITH_WINCNG=1"));
+ let nmake = gcc::windows_registry::find(&target, "nmake.exe");
+ let mut nmake = nmake.unwrap_or(Command::new("nmake.exe"));
+ run(nmake.current_dir(&root)
+ .arg("/nologo")
+ // see above for why we set CC here
+ .env("CC", env::current_exe().unwrap())
+ .env_remove("TARGET")
+ .arg("/fNMakefile")
+ .arg("BUILD_STATIC_LIB=1")
+ .arg("WITH_WINCNG=1"));
t!(fs::copy(root.join("Release/src/libssh2.lib"),
dst.join("lib/libssh2.a")));
t!(fs::remove_dir_all(root.join("Release")));