Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,9 @@ fn main() {
}

cfg.include(out.join("htslib"));

if target_os == "windows" {
cfg.include(out.join("win32"));
}
let want_static = cfg!(feature = "static") || env::var("HTS_STATIC").is_ok();

if want_static {
Expand All @@ -107,12 +109,14 @@ fn main() {
cfg.include(z_inc);
lib_list += " -lz";
}

let mut config_lines = vec!["/* Default config.h generated by build.rs */"];
// We build a config.h ourselves, rather than rely on Makefile or ./configure
let mut config_lines = vec![
"/* Default config.h generated by build.rs */",
"#define HAVE_DRAND48 1",
];
if target_os == "windows" {
config_lines.push("//#define HAVE_DRAND48 1");
}
else {
config_lines.push("#define HAVE_DRAND48 1");
}

let use_bzip2 = env::var("CARGO_FEATURE_BZIP2").is_ok();
if use_bzip2 {
Expand Down Expand Up @@ -226,7 +230,7 @@ fn main() {

// write out version.h
{
let version = std::process::Command::new(out.join("htslib").join("version.sh"))
let version = std::process::Command::new("sh").args(["-c", "htslib/version.sh"])
.output()
.expect("failed to execute process");
let version_str = std::str::from_utf8(&version.stdout).unwrap().trim();
Expand Down Expand Up @@ -284,6 +288,11 @@ fn main() {
fs::copy("osx_prebuilt_bindings.rs", out.join("bindings.rs"))
.expect("couldn't copy prebuilt bindings");
println!("cargo:rerun-if-changed=osx_prebuilt_bindings.rs");
}
else if target_os == "windows" {
fs::copy("windows_prebuilt_bindings.rs", out.join("bindings.rs"))
.expect("couldn't copy prebuilt bindings");
println!("cargo:rerun-if-changed=windows_prebuilt_bindings.rs");
} else {
fs::copy("linux_prebuilt_bindings.rs", out.join("bindings.rs"))
.expect("couldn't copy prebuilt bindings");
Expand Down
Loading
Loading