Skip to content

Commit

Permalink
*: introduce static features (#78)
Browse files Browse the repository at this point in the history
static features will require building static library from source.

Signed-off-by: Jay Lee <[email protected]>
  • Loading branch information
BusyJay authored Jun 7, 2021
1 parent e11f845 commit 2158f5a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ tokio-core = "0.1"

[features]
tokio = ["tokio-io", "futures"]
# Enable this feature if you want to have a statically linked bzip2
static = ["bzip2-sys/static"]
4 changes: 4 additions & 0 deletions bzip2-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,7 @@ libc = "0.2"
[build-dependencies]
pkg-config = "0.3.9"
cc = "1.0"

[features]
# Enable this feature if you want to have a statically linked bzip2
static = []
3 changes: 2 additions & 1 deletion bzip2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ fn main() {
if target.contains("windows") {
cfg.define("_WIN32", None);
cfg.define("BZ_EXPORT", None);
} else {
} else if !cfg!(feature = "static") {
// pkg-config doesn't guarantee static link
if pkg_config::Config::new()
.cargo_metadata(true)
.probe("bzip2")
Expand Down

0 comments on commit 2158f5a

Please sign in to comment.