From e3b28f8d35ed1f7c7779d62043ce10833068556d Mon Sep 17 00:00:00 2001 From: "maarten.vandersande" Date: Mon, 17 Aug 2026 10:19:28 +0200 Subject: [PATCH 1/2] Fix htslib include path for HTSLIB=system builds --- d4-hts/build.rs | 8 +++++++- d4-hts/build_htslib.sh | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/d4-hts/build.rs b/d4-hts/build.rs index 8c36b9c..499b5ca 100644 --- a/d4-hts/build.rs +++ b/d4-hts/build.rs @@ -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()); diff --git a/d4-hts/build_htslib.sh b/d4-hts/build_htslib.sh index 80b540e..0721736 100644 --- a/d4-hts/build_htslib.sh +++ b/d4-hts/build_htslib.sh @@ -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 From 17c84455394b26371588b3dbaebf6c4aa98f795a Mon Sep 17 00:00:00 2001 From: "maarten.vandersande" Date: Mon, 17 Aug 2026 22:27:03 +0200 Subject: [PATCH 2/2] cleanup --- d4-hts/Cargo.toml | 2 +- d4-hts/build.rs | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/d4-hts/Cargo.toml b/d4-hts/Cargo.toml index 7822769..b244660 100644 --- a/d4-hts/Cargo.toml +++ b/d4-hts/Cargo.toml @@ -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" diff --git a/d4-hts/build.rs b/d4-hts/build.rs index 499b5ca..f130667 100644 --- a/d4-hts/build.rs +++ b/d4-hts/build.rs @@ -26,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"); } @@ -61,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() };