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
2 changes: 1 addition & 1 deletion d4-hts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ repository = "https://github.com/38/d4-format"
[dependencies]

[build-dependencies]
bindgen = "0.55.1"
bindgen = "0.72.1"
pkg-config = "0.3.18"
19 changes: 12 additions & 7 deletions d4-hts/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ use std::process::Command;
fn create_hts_bindings(includes: &[PathBuf], version: &str, system: bool) -> Result<(), ()> {
let mut include_params: Vec<_> = includes
.iter()
.map(|x| format!("-I{}/htslib", x.to_str().unwrap()))
.map(|x| {
if system {
format!("-I{}", x.to_str().unwrap())
} else {
format!("-I{}/htslib", x.to_str().unwrap())
}
})
.collect();
if system {
include_params.push("-DUSE_SYSTEM_HTSLIB".to_string());
Expand All @@ -20,7 +26,8 @@ fn create_hts_bindings(includes: &[PathBuf], version: &str, system: bool) -> Res
.layout_tests(false)
.generate_comments(false)
.generate_inline_functions(false)
.generate()?
.generate()
.map_err(|_| ())?
.write_to_file("generated/hts.rs")
.expect("Unable to write the generated file");
}
Expand Down Expand Up @@ -55,13 +62,11 @@ fn main() -> Result<(), std::io::Error> {
let link_system_lib = env::var("HTSLIB").map_or(false, |htslib| htslib == "system");

let (htslib_includes, lib_version, system) = if link_system_lib {
pkg_config::Config::new()
let lib = pkg_config::Config::new()
.atleast_version("1.6")
.probe("htslib")
.map_or_else(
|_| build_own_htslib(),
|lib| (lib.include_paths, lib.version, true),
)
.expect("HTSLIB=system requested but htslib was not found via pkg-config");
(lib.include_paths, lib.version, true)
} else {
build_own_htslib()
};
Expand Down
2 changes: 2 additions & 0 deletions d4-hts/build_htslib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ git clone -b ${HTSLIB_VERSION} http://github.com/samtools/htslib.git

cd htslib

git submodule update --init --recursive

cat > config.h << CONFIG_H
#define HAVE_LIBBZ2 1
#define HAVE_DRAND48 1
Expand Down
Loading