diff options
author | Alex Crichton <alex@alexcrichton.com> | 2015-04-29 16:36:57 -0700 |
---|---|---|
committer | Alex Crichton <alex@alexcrichton.com> | 2015-04-29 16:36:57 -0700 |
commit | 91cb180c04eb11199b542db8582b042ecf03e3a9 (patch) | |
tree | da1ebbae6e7efc0246657dbc01d14b6f0288d26a | |
parent | af0d10659e26f42296162e485629e50fe1ffaee7 (diff) | |
download | ssh2-rs-91cb180c04eb11199b542db8582b042ecf03e3a9.zip |
Don't let zlib end up in the pkg-config deps
Ends up causing havoc on OSX
-rw-r--r-- | libssh2-sys/build.rs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/libssh2-sys/build.rs b/libssh2-sys/build.rs index 50338de..2a11462 100644 --- a/libssh2-sys/build.rs +++ b/libssh2-sys/build.rs @@ -1,7 +1,8 @@ extern crate pkg_config; use std::env; -use std::fs; +use std::fs::{self, File}; +use std::io::prelude::*; use std::path::PathBuf; use std::process::Command; @@ -90,8 +91,17 @@ fn main() { } else { t!(fs::copy(&p2, &dst.join("lib/libssh2.a"))); } - t!(fs::rename(&dst.join("build/libssh2.pc"), - &dst.join("lib/pkgconfig/libssh2.pc"))); + + // 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(); + t!(t!(File::open(dst.join("build/libssh2.pc"))).read_to_string(&mut pc)); + let pc = pc.replace(",zlib", ""); + let bytes = pc.as_bytes(); + t!(t!(File::create(dst.join("lib/pkgconfig/libssh2.pc"))).write_all(bytes)); { let root = root.join("include"); |