Skip to content

Commit

Permalink
support libbz2-rs-sys (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
folkertdev authored Dec 5, 2024
1 parent 84d7188 commit b397f2a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ categories = ["compression", "api-bindings"]

[dependencies]
libc = "0.2"
bzip2-sys = { version = "0.1.11", path = "bzip2-sys" }
bzip2-sys = { version = "0.1.11", path = "bzip2-sys", optional = true }
libbz2-rs-sys = { version = "0.1.0", optional = true }

[dev-dependencies]
rand = "0.8"
partial-io = { version = "0.5.4", features = ["quickcheck1"] }
quickcheck = "1.0"

[features]
default = ["dep:bzip2-sys"]
# Use `libbz2-rs-sys` instead of the C FFI bindings of `bzip2-sys`
# Using the rust implementation is always static
libbz2-rs-sys = ["dep:libbz2-rs-sys", "static"]
# Enable this feature if you want to have a statically linked bzip2
static = ["bzip2-sys/static"]
static = ["bzip2-sys?/static"]
3 changes: 3 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@
#![deny(missing_docs)]
#![doc(html_root_url = "https://docs.rs/bzip2/")]

#[cfg(not(feature = "libbz2-rs-sys"))]
extern crate bzip2_sys as ffi;
#[cfg(feature = "libbz2-rs-sys")]
extern crate libbz2_rs_sys as ffi;
extern crate libc;
#[cfg(test)]
extern crate partial_io;
Expand Down

0 comments on commit b397f2a

Please sign in to comment.