summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-08-13 19:39:07 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-08-13 19:39:07 -0700
commit887f4a3847b4b5a80e6878df3f6e34ce8305998d (patch)
tree265b7c30ef92ee76d9bd12a29945c43afd6456bd
parentc758089ac48cbda1e409d2936ad840358227a9be (diff)
downloadssh2-rs-887f4a3847b4b5a80e6878df3f6e34ce8305998d.zip
Add back zlib-removal from pc file
-rw-r--r--libssh2-sys/build.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/libssh2-sys/build.rs b/libssh2-sys/build.rs
index d264c56..1af465d 100644
--- a/libssh2-sys/build.rs
+++ b/libssh2-sys/build.rs
@@ -2,6 +2,8 @@ extern crate pkg_config;
extern crate cmake;
use std::env;
+use std::fs::File;
+use std::io::prelude::*;
use std::path::PathBuf;
fn main() {
@@ -52,6 +54,21 @@ fn main() {
.register_dep("Z")
.build();
+ // Unfortunately the pkg-config file generated for libssh2 indicates
+ // that it depends on zlib, but most systems don't actually have a
+ // zlib.pc, so pkg-config will say that libssh2 doesn't exist. We
+ // generally take care of the zlib dependency elsewhere, so we just
+ // remove that part from the pkg-config file
+ let mut pc = String::new();
+ let pkgconfig = dst.join("lib/pkgconfig/libssh2.pc");
+ if let Ok(mut f) = File::open(&pkgconfig) {
+ f.read_to_string(&mut pc).unwrap();;
+ drop(f);
+ let pc = pc.replace(",zlib", "");
+ let bytes = pc.as_bytes();
+ File::create(pkgconfig).unwrap().write_all(bytes).unwrap();
+ }
+
if target.contains("windows") {
println!("cargo:rustc-link-lib=ws2_32");
println!("cargo:rustc-link-lib=bcrypt");