Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bzip2-sys] use the system bzip2 if found via pkg-config #58

Merged
merged 2 commits into from
May 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions bzip2-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ path = "lib.rs"
libc = "0.2"

[build-dependencies]
pkg-config = "0.3.9"
cc = "1.0"
12 changes: 11 additions & 1 deletion bzip2-sys/build.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
extern crate cc;
extern crate pkg_config;

use std::path::PathBuf;
use std::{env, fs};

fn main() {
let mut cfg = cc::Build::new();
let target = env::var("TARGET").unwrap();
cfg.warnings(false);

if env::var("TARGET").unwrap().contains("windows") {
if target.contains("windows") {
cfg.define("_WIN32", None);
cfg.define("BZ_EXPORT", None);
} else {
if pkg_config::Config::new()
.cargo_metadata(true)
.probe("bzip2")
.is_ok()
{
return;
}
}

let dst = PathBuf::from(env::var_os("OUT_DIR").unwrap());
Expand Down