Skip to content

Fix libdeflate feature selection #219

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

Merged
merged 1 commit into from
Jun 23, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ bzip2 = ["hts-sys/bzip2"]
lzma = ["hts-sys/lzma"]
bindgen = ["hts-sys/bindgen"]
curl = ["hts-sys/curl"]
libdeflate = ["hts-sys/libdeflate-sys"]
libdeflate = ["hts-sys/libdeflate"]
s3 = ["hts-sys/s3"]
gcs = ["hts-sys/gcs"]
static = ["hts-sys/static"]
Expand Down
3 changes: 2 additions & 1 deletion hts-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ libz-sys = { version = "1.0.25", features = ["static"] }
bzip2-sys = { version = "0.1.8", optional = true }
lzma-sys = { version = "0.1.16", optional = true, features = ["static"] }
curl-sys = { version = "0.4.31", optional = true, features = ["static-curl", "static-ssl", "protocol-ftp"] }
libdeflate-sys = { version = "0.5", optional = true }
libdeflate-sys = { version = "0.5.0", optional = true }

[target.'cfg(all(unix, not(target_os = "macos")))'.dependencies]
openssl-sys = { version = "0.9", optional = true }
Expand All @@ -31,6 +31,7 @@ default = ["bzip2", "lzma", "curl"]
bzip2 = ["bzip2-sys"]
lzma = ["lzma-sys"]
curl = ["curl-sys", "openssl-sys"]
libdeflate = ["libdeflate-sys"]
gcs = ["curl"] # Google Cloud Storage support
s3 = ["curl"] # Amazon S3 support
static = [] # Don't dynamically link to other libraries
Expand Down
4 changes: 2 additions & 2 deletions hts-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ fn main() {
}
}

let use_libdeflater = env::var("CARGO_FEATURE_LIBDEFLATER").is_ok();
if use_libdeflater {
let use_libdeflate = env::var("CARGO_FEATURE_LIBDEFLATE").is_ok();
if use_libdeflate {
if let Ok(inc) = env::var("DEP_LIBDEFLATE_INCLUDE").map(PathBuf::from) {
cfg.include(inc);
config_lines.push("#define HAVE_LIBDEFLATE 1");
Expand Down
4 changes: 2 additions & 2 deletions hts-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
extern crate libz_sys;
#[cfg(feature = "bzip2")]
extern crate bzip2_sys;
#[cfg(feature = "libdeflater")]
extern crate libdeflater;
#[cfg(feature = "libdeflate")]
extern crate libdeflate_sys;
#[cfg(feature = "lzma")]
extern crate lzma_sys;
#[cfg(feature = "curl")]
Expand Down
6 changes: 3 additions & 3 deletions src/bam/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1687,12 +1687,12 @@ CCCCCCCCCCCCCCCCCCC"[..],
println!("testing compression leves: {:?}", levels_to_test);
println!("got compressed sizes: {:?}", file_sizes);

// libdeflater comes out with a slightly bigger file on Max compression
// libdeflate comes out with a slightly bigger file on Max compression
// than on Level(6), so skip that check
#[cfg(feature = "libdeflater")]
#[cfg(feature = "libdeflate")]
assert!(file_sizes[1..].windows(2).all(|size| size[0] <= size[1]));

#[cfg(not(feature = "libdeflater"))]
#[cfg(not(feature = "libdeflate"))]
assert!(file_sizes.windows(2).all(|size| size[0] <= size[1]));

tmp.close().expect("Failed to delete temp dir");
Expand Down