Skip to content

Commit

Permalink
Fix zstd-sys in thin mode: Replace ZSTD_LIB_MINIFY with actual `#de…
Browse files Browse the repository at this point in the history
…fine`s (#197)

since `ZSTD_LIB_MINIFY` is only used in `Makefile` to enable other
`#define`s.

Signed-off-by: Jiahao XU <[email protected]>

Signed-off-by: Jiahao XU <[email protected]>
  • Loading branch information
NobodyXu authored Jan 27, 2023
1 parent 9d3e648 commit a855e61
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions zstd-safe/zstd-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,18 @@ fn compile_zstd() {
#[cfg(feature = "thin")]
{
// Here we try to build a lib as thin/small as possible.

// ZSTD_LIB_MINIFY implies:
// - HUF_FORCE_DECOMPRESS_X1
// - ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT
// - ZSTD_NO_INLINE
// - ZSTD_STRIP_ERROR_STRINGS, removes the error messages that are
// otherwise returned by ZSTD_getErrorName
config.define("ZSTD_LIB_MINIFY", Some("1"));
// We cannot use ZSTD_LIB_MINIFY since it is only
// used in Makefile to define other options.

config
.define("HUF_FORCE_DECOMPRESS_X1", Some("1"))
.define("HUF_FORCE_DECOMPRESS_X2", Some("0"))
.define("ZSTD_FORCE_DECOMPRESS_SEQUENCES_SHORT", Some("1"))
.define("ZSTD_FORCE_DECOMPRESS_SEQUENCES_LONG", Some("0"))
.define("ZSTD_NO_INLINE", Some("1"))
// removes the error messages that are
// otherwise returned by ZSTD_getErrorName
.define("ZSTD_STRIP_ERROR_STRINGS", Some("1"));

// Disable use of BMI2 instructions since it involves runtime checking
// of the feature and fallback if no BMI2 instruction is detected.
Expand Down

0 comments on commit a855e61

Please sign in to comment.