Skip to content

Commit

Permalink
Add no_wasm_shim feature
Browse files Browse the repository at this point in the history
  • Loading branch information
gyscos committed Oct 13, 2023
1 parent 49fb724 commit 92f87dc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions zstd-safe/zstd-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ debug = [] # Enable zstd debug logs
experimental = [] # Expose experimental ZSTD API
legacy = [] # Enable legacy ZSTD support (for versions < zstd-0.8)
non-cargo = [] # Silence cargo-specific build flags
pkg-config = []
pkg-config = [] # Use pkg-config to build the zstd C library.
std = [] # Deprecated: we never use types from std.
zstdmt = [] # Enable multi-thread support (with pthread)
thin = [] # Optimize binary by size
no_asm = [] # Disable ASM files (only on amd64 for decompression)
zdict_builder = []
zdict_builder = [] # Enable dictionary building (dictionary _using_ is always supported).
no_wasm_shim = [] # Disable wasm shims (in case your wasm toolchain includes a C stdlib).

# These two are for cross-language LTO.
# Will only work if `clang` is used to build the C library.
Expand Down
7 changes: 4 additions & 3 deletions zstd-safe/zstd-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,10 @@ fn compile_zstd() {
// Note that Emscripten already provides its own C standard library so
// wasm32-unknown-emscripten should not be included here.
// See: https://github.com/gyscos/zstd-rs/pull/209
let need_wasm_shim = env::var("TARGET").map_or(false, |target| {
target == "wasm32-unknown-unknown" || target == "wasm32-wasi"
});
let need_wasm_shim = !cfg!(feature = "no_wasm_shim")
&& env::var("TARGET").map_or(false, |target| {
target == "wasm32-unknown-unknown" || target == "wasm32-wasi"
});

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

0 comments on commit 92f87dc

Please sign in to comment.