Skip to content

Commit 92f87dc

Browse files
committed
Add no_wasm_shim feature
1 parent 49fb724 commit 92f87dc

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

zstd-safe/zstd-sys/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,13 @@ debug = [] # Enable zstd debug logs
6969
experimental = [] # Expose experimental ZSTD API
7070
legacy = [] # Enable legacy ZSTD support (for versions < zstd-0.8)
7171
non-cargo = [] # Silence cargo-specific build flags
72-
pkg-config = []
72+
pkg-config = [] # Use pkg-config to build the zstd C library.
7373
std = [] # Deprecated: we never use types from std.
7474
zstdmt = [] # Enable multi-thread support (with pthread)
7575
thin = [] # Optimize binary by size
7676
no_asm = [] # Disable ASM files (only on amd64 for decompression)
77-
zdict_builder = []
77+
zdict_builder = [] # Enable dictionary building (dictionary _using_ is always supported).
78+
no_wasm_shim = [] # Disable wasm shims (in case your wasm toolchain includes a C stdlib).
7879

7980
# These two are for cross-language LTO.
8081
# Will only work if `clang` is used to build the C library.

zstd-safe/zstd-sys/build.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,10 @@ fn compile_zstd() {
133133
// Note that Emscripten already provides its own C standard library so
134134
// wasm32-unknown-emscripten should not be included here.
135135
// See: https://github.com/gyscos/zstd-rs/pull/209
136-
let need_wasm_shim = env::var("TARGET").map_or(false, |target| {
137-
target == "wasm32-unknown-unknown" || target == "wasm32-wasi"
138-
});
136+
let need_wasm_shim = !cfg!(feature = "no_wasm_shim")
137+
&& env::var("TARGET").map_or(false, |target| {
138+
target == "wasm32-unknown-unknown" || target == "wasm32-wasi"
139+
});
139140

140141
if need_wasm_shim {
141142
cargo_print(&"rerun-if-changed=wasm-shim/stdlib.h");

0 commit comments

Comments
 (0)