Skip to content

Commit

Permalink
Merge 8de248e into 75542e0
Browse files Browse the repository at this point in the history
  • Loading branch information
lucab committed Aug 9, 2015
2 parents 75542e0 + 8de248e commit 0d0935c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions libgit2-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ libz-sys = "0.1.0"

[build-dependencies]
pkg-config = "0.3"
semver = "0.1"
cmake = "0.1.2"

[target.i686-unknown-linux-gnu.dependencies]
Expand Down
9 changes: 7 additions & 2 deletions libgit2-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
extern crate pkg_config;
extern crate semver;
extern crate cmake;

use std::env;
Expand All @@ -12,8 +13,12 @@ fn main() {
register_dep("OPENSSL");
let has_pkgconfig = Command::new("pkg-config").output().is_ok();

if env::var("LIBGIT2_SYS_USE_PKG_CONFIG").is_ok() {
if pkg_config::find_library("libgit2").is_ok() {
// Try to find if a compatible ligbit2 is available, via pkg-config
let git2_pc = pkg_config::find_library("libgit2");
if git2_pc.is_ok() {
let req_vers = semver::VersionReq::parse("0.23").unwrap();
let git2_vers = semver::Version::parse(git2_pc.unwrap().version.as_ref());
if git2_vers.is_ok() && req_vers.matches(&git2_vers.unwrap()) {
return
}
}
Expand Down

0 comments on commit 0d0935c

Please sign in to comment.