Repository: wcampbell0x2a/backhand (language: rust)

Issue:
`libz-sys` should be optional
Currently, the dependency on `libz-sys` is not marked optional, causing it to be included even if a build only enables unrelated features (e.g. `zstd`).

https://github.com/wcampbell0x2a/backhand/blob/76894937f5927f53b4fbd61d92edb74bff679d61/backhand/Cargo.toml#L32


Discussion / hints:

Fix patch:
diff --git a/Cargo.lock b/Cargo.lock
index a469482b..a51cdf1b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -115,8 +115,6 @@ dependencies = [
  "document-features",
  "flate2",
  "libdeflater",
- "libz-ng-sys",
- "libz-sys",
  "rust-lzo",
  "solana-nohash-hasher",
  "tempfile",
@@ -341,15 +339,6 @@ version = "0.7.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6"
 
-[[package]]
-name = "cmake"
-version = "0.1.52"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c682c223677e0e5b6b7f63a64b9351844c3f1b1678a68b7ee617e30fb082620e"
-dependencies = [
- "cc",
-]
-
 [[package]]
 name = "color-print"
 version = "0.3.7"
@@ -1051,16 +1040,6 @@ dependencies = [
  "libdeflate-sys",
 ]
 
-[[package]]
-name = "libz-ng-sys"
-version = "1.1.16"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4436751a01da56f1277f323c80d584ffad94a3d14aecd959dd0dff75aa73a438"
-dependencies = [
- "cmake",
- "libc",
-]
-
 [[package]]
 name = "libz-rs-sys"
 version = "0.4.2"
@@ -1070,18 +1049,6 @@ dependencies = [
  "zlib-rs",
 ]
 
-[[package]]
-name = "libz-sys"
-version = "1.1.20"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d2d16453e800a8cf6dd2fc3eb4bc99b786a9b90c663b8559a5b1a041bf89e472"
-dependencies = [
- "cc",
- "libc",
- "pkg-config",
- "vcpkg",
-]
-
 [[package]]
 name = "linux-raw-sys"
 version = "0.4.14"
@@ -2050,12 +2017,6 @@ dependencies = [
  "sval_serde",
 ]
 
-[[package]]
-name = "vcpkg"
-version = "0.2.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
-
 [[package]]
 name = "version_check"
 version = "0.9.5"
diff --git a/backhand/Cargo.toml b/backhand/Cargo.toml
index 03570ade..601fc3d6 100644
--- a/backhand/Cargo.toml
+++ b/backhand/Cargo.toml
@@ -27,10 +27,6 @@ zstd-safe = { version = "7.2.1", optional = true }
 document-features = { version = "0.2.10", optional = true }
 xxhash-rust = { version = "0.8.12", features = ["xxh64"] }
 solana-nohash-hasher = "0.2.1"
-# Use the fastest implementation (libz-ng) for flate2 but remove dependence on CMake
-libz-sys = { version = "1.1.20", features = ["zlib-ng-no-cmake-experimental-community-maintained"], default-features = false }
-# Temporary workaround for https://github.com/rust-lang/libz-sys/issues/225
-libz-ng-sys = { version = "<1.1.20", optional = true }
 
 [features]
 default = ["xz", "gzip", "zstd"]


Test patch: