extzstd 0.3.1 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +28 -14
  3. data/contrib/zstd/CHANGELOG +301 -56
  4. data/contrib/zstd/CONTRIBUTING.md +169 -72
  5. data/contrib/zstd/LICENSE +4 -4
  6. data/contrib/zstd/Makefile +116 -87
  7. data/contrib/zstd/Package.swift +36 -0
  8. data/contrib/zstd/README.md +62 -32
  9. data/contrib/zstd/TESTING.md +2 -3
  10. data/contrib/zstd/appveyor.yml +52 -136
  11. data/contrib/zstd/lib/BUCK +5 -7
  12. data/contrib/zstd/lib/Makefile +225 -222
  13. data/contrib/zstd/lib/README.md +51 -6
  14. data/contrib/zstd/lib/common/allocations.h +55 -0
  15. data/contrib/zstd/lib/common/bits.h +200 -0
  16. data/contrib/zstd/lib/common/bitstream.h +45 -62
  17. data/contrib/zstd/lib/common/compiler.h +205 -22
  18. data/contrib/zstd/lib/common/cpu.h +1 -3
  19. data/contrib/zstd/lib/common/debug.c +1 -1
  20. data/contrib/zstd/lib/common/debug.h +12 -19
  21. data/contrib/zstd/lib/common/entropy_common.c +172 -48
  22. data/contrib/zstd/lib/common/error_private.c +10 -2
  23. data/contrib/zstd/lib/common/error_private.h +82 -3
  24. data/contrib/zstd/lib/common/fse.h +37 -86
  25. data/contrib/zstd/lib/common/fse_decompress.c +117 -92
  26. data/contrib/zstd/lib/common/huf.h +99 -166
  27. data/contrib/zstd/lib/common/mem.h +124 -142
  28. data/contrib/zstd/lib/common/pool.c +54 -27
  29. data/contrib/zstd/lib/common/pool.h +10 -4
  30. data/contrib/zstd/lib/common/portability_macros.h +156 -0
  31. data/contrib/zstd/lib/common/threading.c +74 -19
  32. data/contrib/zstd/lib/common/threading.h +5 -10
  33. data/contrib/zstd/lib/common/xxhash.c +7 -847
  34. data/contrib/zstd/lib/common/xxhash.h +5568 -167
  35. data/contrib/zstd/lib/common/zstd_common.c +2 -37
  36. data/contrib/zstd/lib/common/zstd_deps.h +111 -0
  37. data/contrib/zstd/lib/common/zstd_internal.h +132 -187
  38. data/contrib/zstd/lib/common/zstd_trace.h +163 -0
  39. data/contrib/zstd/lib/compress/clevels.h +134 -0
  40. data/contrib/zstd/lib/compress/fse_compress.c +83 -157
  41. data/contrib/zstd/lib/compress/hist.c +27 -29
  42. data/contrib/zstd/lib/compress/hist.h +2 -2
  43. data/contrib/zstd/lib/compress/huf_compress.c +916 -279
  44. data/contrib/zstd/lib/compress/zstd_compress.c +3773 -1019
  45. data/contrib/zstd/lib/compress/zstd_compress_internal.h +610 -203
  46. data/contrib/zstd/lib/compress/zstd_compress_literals.c +119 -42
  47. data/contrib/zstd/lib/compress/zstd_compress_literals.h +16 -6
  48. data/contrib/zstd/lib/compress/zstd_compress_sequences.c +42 -19
  49. data/contrib/zstd/lib/compress/zstd_compress_sequences.h +1 -1
  50. data/contrib/zstd/lib/compress/zstd_compress_superblock.c +49 -317
  51. data/contrib/zstd/lib/compress/zstd_compress_superblock.h +1 -1
  52. data/contrib/zstd/lib/compress/zstd_cwksp.h +320 -103
  53. data/contrib/zstd/lib/compress/zstd_double_fast.c +388 -151
  54. data/contrib/zstd/lib/compress/zstd_double_fast.h +3 -2
  55. data/contrib/zstd/lib/compress/zstd_fast.c +729 -265
  56. data/contrib/zstd/lib/compress/zstd_fast.h +3 -2
  57. data/contrib/zstd/lib/compress/zstd_lazy.c +1270 -251
  58. data/contrib/zstd/lib/compress/zstd_lazy.h +61 -1
  59. data/contrib/zstd/lib/compress/zstd_ldm.c +324 -219
  60. data/contrib/zstd/lib/compress/zstd_ldm.h +9 -2
  61. data/contrib/zstd/lib/compress/zstd_ldm_geartab.h +106 -0
  62. data/contrib/zstd/lib/compress/zstd_opt.c +481 -209
  63. data/contrib/zstd/lib/compress/zstd_opt.h +1 -1
  64. data/contrib/zstd/lib/compress/zstdmt_compress.c +181 -457
  65. data/contrib/zstd/lib/compress/zstdmt_compress.h +34 -113
  66. data/contrib/zstd/lib/decompress/huf_decompress.c +1199 -565
  67. data/contrib/zstd/lib/decompress/huf_decompress_amd64.S +576 -0
  68. data/contrib/zstd/lib/decompress/zstd_ddict.c +12 -12
  69. data/contrib/zstd/lib/decompress/zstd_ddict.h +2 -2
  70. data/contrib/zstd/lib/decompress/zstd_decompress.c +627 -157
  71. data/contrib/zstd/lib/decompress/zstd_decompress_block.c +1086 -326
  72. data/contrib/zstd/lib/decompress/zstd_decompress_block.h +19 -5
  73. data/contrib/zstd/lib/decompress/zstd_decompress_internal.h +62 -13
  74. data/contrib/zstd/lib/deprecated/zbuff.h +1 -1
  75. data/contrib/zstd/lib/deprecated/zbuff_common.c +1 -1
  76. data/contrib/zstd/lib/deprecated/zbuff_compress.c +24 -4
  77. data/contrib/zstd/lib/deprecated/zbuff_decompress.c +3 -1
  78. data/contrib/zstd/lib/dictBuilder/cover.c +73 -52
  79. data/contrib/zstd/lib/dictBuilder/cover.h +7 -6
  80. data/contrib/zstd/lib/dictBuilder/divsufsort.c +1 -1
  81. data/contrib/zstd/lib/dictBuilder/fastcover.c +44 -35
  82. data/contrib/zstd/lib/dictBuilder/zdict.c +103 -111
  83. data/contrib/zstd/lib/legacy/zstd_legacy.h +8 -1
  84. data/contrib/zstd/lib/legacy/zstd_v01.c +21 -54
  85. data/contrib/zstd/lib/legacy/zstd_v01.h +1 -1
  86. data/contrib/zstd/lib/legacy/zstd_v02.c +29 -70
  87. data/contrib/zstd/lib/legacy/zstd_v02.h +1 -1
  88. data/contrib/zstd/lib/legacy/zstd_v03.c +30 -73
  89. data/contrib/zstd/lib/legacy/zstd_v03.h +1 -1
  90. data/contrib/zstd/lib/legacy/zstd_v04.c +29 -71
  91. data/contrib/zstd/lib/legacy/zstd_v04.h +1 -1
  92. data/contrib/zstd/lib/legacy/zstd_v05.c +40 -86
  93. data/contrib/zstd/lib/legacy/zstd_v05.h +1 -1
  94. data/contrib/zstd/lib/legacy/zstd_v06.c +47 -88
  95. data/contrib/zstd/lib/legacy/zstd_v06.h +1 -1
  96. data/contrib/zstd/lib/legacy/zstd_v07.c +40 -83
  97. data/contrib/zstd/lib/legacy/zstd_v07.h +1 -1
  98. data/contrib/zstd/lib/libzstd.mk +214 -0
  99. data/contrib/zstd/lib/libzstd.pc.in +7 -6
  100. data/contrib/zstd/lib/module.modulemap +35 -0
  101. data/contrib/zstd/lib/{dictBuilder/zdict.h → zdict.h} +203 -34
  102. data/contrib/zstd/lib/zstd.h +1217 -287
  103. data/contrib/zstd/lib/{common/zstd_errors.h → zstd_errors.h} +28 -8
  104. data/ext/extconf.rb +7 -6
  105. data/ext/extzstd.c +19 -10
  106. data/ext/extzstd.h +6 -0
  107. data/ext/libzstd_conf.h +0 -1
  108. data/ext/zstd_decompress_asm.S +1 -0
  109. data/gemstub.rb +3 -21
  110. data/lib/extzstd/version.rb +6 -1
  111. data/lib/extzstd.rb +0 -2
  112. data/test/test_basic.rb +0 -5
  113. metadata +18 -6
@@ -1,5 +1,5 @@
1
1
  # ################################################################
2
- # Copyright (c) 2015-2020, Yann Collet, Facebook, Inc.
2
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
3
3
  # All rights reserved.
4
4
  #
5
5
  # This source code is licensed under both the BSD-style license (found in the
@@ -8,6 +8,9 @@
8
8
  # You may select, at your option, one of the above-listed licenses.
9
9
  # ################################################################
10
10
 
11
+ # verbose mode (print commands) on V=1 or VERBOSE=1
12
+ Q = $(if $(filter 1,$(V) $(VERBOSE)),,@)
13
+
11
14
  PRGDIR = programs
12
15
  ZSTDDIR = lib
13
16
  BUILDIR = build
@@ -26,11 +29,12 @@ VOID = /dev/null
26
29
  # fail on other tested distros (ubuntu, debian) even
27
30
  # without manually specifying the TARGET_SYSTEM.
28
31
  TARGET_SYSTEM ?= $(OS)
32
+ CP ?= cp
29
33
 
30
34
  ifneq (,$(filter Windows%,$(TARGET_SYSTEM)))
31
- EXT =.exe
35
+ EXT =.exe
32
36
  else
33
- EXT =
37
+ EXT =
34
38
  endif
35
39
 
36
40
  ## default: Build lib-release and zstd-release
@@ -45,28 +49,28 @@ allmost: allzstd zlibwrapper
45
49
 
46
50
  # skip zwrapper, can't build that on alternate architectures without the proper zlib installed
47
51
  .PHONY: allzstd
48
- allzstd: lib-all
49
- $(MAKE) -C $(PRGDIR) all
50
- $(MAKE) -C $(TESTDIR) all
52
+ allzstd: lib
53
+ $(Q)$(MAKE) -C $(PRGDIR) all
54
+ $(Q)$(MAKE) -C $(TESTDIR) all
51
55
 
52
56
  .PHONY: all32
53
57
  all32:
54
58
  $(MAKE) -C $(PRGDIR) zstd32
55
59
  $(MAKE) -C $(TESTDIR) all32
56
60
 
57
- .PHONY: lib lib-release libzstd.a
58
- lib lib-release lib-all :
59
- @$(MAKE) -C $(ZSTDDIR) $@
61
+ .PHONY: lib lib-release lib-mt lib-nomt
62
+ lib lib-release lib-mt lib-nomt:
63
+ $(Q)$(MAKE) -C $(ZSTDDIR) $@
60
64
 
61
65
  .PHONY: zstd zstd-release
62
66
  zstd zstd-release:
63
- @$(MAKE) -C $(PRGDIR) $@
64
- cp $(PRGDIR)/zstd$(EXT) .
67
+ $(Q)$(MAKE) -C $(PRGDIR) $@
68
+ $(Q)ln -sf $(PRGDIR)/zstd$(EXT) zstd$(EXT)
65
69
 
66
70
  .PHONY: zstdmt
67
71
  zstdmt:
68
- @$(MAKE) -C $(PRGDIR) $@
69
- cp $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT)
72
+ $(Q)$(MAKE) -C $(PRGDIR) $@
73
+ $(Q)$(CP) $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT)
70
74
 
71
75
  .PHONY: zlibwrapper
72
76
  zlibwrapper: lib
@@ -75,16 +79,16 @@ zlibwrapper: lib
75
79
  ## test: run long-duration tests
76
80
  .PHONY: test
77
81
  DEBUGLEVEL ?= 1
78
- test: MOREFLAGS += -g -DDEBUGLEVEL=$(DEBUGLEVEL) -Werror
82
+ test: MOREFLAGS += -g -Werror
79
83
  test:
80
- MOREFLAGS="$(MOREFLAGS)" $(MAKE) -j -C $(PRGDIR) allVariants
84
+ DEBUGLEVEL=$(DEBUGLEVEL) MOREFLAGS="$(MOREFLAGS)" $(MAKE) -j -C $(PRGDIR) allVariants
81
85
  $(MAKE) -C $(TESTDIR) $@
82
- ZSTD=../../programs/zstd $(MAKE) -C doc/educational_decoder test
86
+ ZSTD=../../programs/zstd $(MAKE) -C doc/educational_decoder $@
83
87
 
84
88
  ## shortest: same as `make check`
85
89
  .PHONY: shortest
86
90
  shortest:
87
- $(MAKE) -C $(TESTDIR) $@
91
+ $(Q)$(MAKE) -C $(TESTDIR) $@
88
92
 
89
93
  ## check: run basic tests for `zstd` cli
90
94
  .PHONY: check
@@ -97,10 +101,10 @@ automated_benchmarking:
97
101
  .PHONY: benchmarking
98
102
  benchmarking: automated_benchmarking
99
103
 
100
- ## examples: build all examples in `/examples` directory
104
+ ## examples: build all examples in `examples/` directory
101
105
  .PHONY: examples
102
106
  examples: lib
103
- CPPFLAGS=-I../lib LDFLAGS=-L../lib $(MAKE) -C examples/ all
107
+ $(MAKE) -C examples all
104
108
 
105
109
  ## manual: generate API documentation in html format
106
110
  .PHONY: manual
@@ -117,9 +121,11 @@ man:
117
121
  contrib: lib
118
122
  $(MAKE) -C contrib/pzstd all
119
123
  $(MAKE) -C contrib/seekable_format/examples all
124
+ $(MAKE) -C contrib/seekable_format/tests test
120
125
  $(MAKE) -C contrib/largeNbDicts all
121
- cd contrib/single_file_libs/ ; ./build_decoder_test.sh
122
- cd contrib/single_file_libs/ ; ./build_library_test.sh
126
+ $(MAKE) -C contrib/externalSequenceProducer all
127
+ cd build/single_file_libs/ ; ./build_decoder_test.sh
128
+ cd build/single_file_libs/ ; ./build_library_test.sh
123
129
 
124
130
  .PHONY: cleanTabs
125
131
  cleanTabs:
@@ -127,30 +133,33 @@ cleanTabs:
127
133
 
128
134
  .PHONY: clean
129
135
  clean:
130
- @$(MAKE) -C $(ZSTDDIR) $@ > $(VOID)
131
- @$(MAKE) -C $(PRGDIR) $@ > $(VOID)
132
- @$(MAKE) -C $(TESTDIR) $@ > $(VOID)
133
- @$(MAKE) -C $(ZWRAPDIR) $@ > $(VOID)
134
- @$(MAKE) -C examples/ $@ > $(VOID)
135
- @$(MAKE) -C contrib/gen_html $@ > $(VOID)
136
- @$(MAKE) -C contrib/pzstd $@ > $(VOID)
137
- @$(MAKE) -C contrib/seekable_format/examples $@ > $(VOID)
138
- @$(MAKE) -C contrib/largeNbDicts $@ > $(VOID)
139
- @$(RM) zstd$(EXT) zstdmt$(EXT) tmp*
140
- @$(RM) -r lz4
136
+ $(Q)$(MAKE) -C $(ZSTDDIR) $@ > $(VOID)
137
+ $(Q)$(MAKE) -C $(PRGDIR) $@ > $(VOID)
138
+ $(Q)$(MAKE) -C $(TESTDIR) $@ > $(VOID)
139
+ $(Q)$(MAKE) -C $(ZWRAPDIR) $@ > $(VOID)
140
+ $(Q)$(MAKE) -C examples/ $@ > $(VOID)
141
+ $(Q)$(MAKE) -C contrib/gen_html $@ > $(VOID)
142
+ $(Q)$(MAKE) -C contrib/pzstd $@ > $(VOID)
143
+ $(Q)$(MAKE) -C contrib/seekable_format/examples $@ > $(VOID)
144
+ $(Q)$(MAKE) -C contrib/seekable_format/tests $@ > $(VOID)
145
+ $(Q)$(MAKE) -C contrib/largeNbDicts $@ > $(VOID)
146
+ $(Q)$(MAKE) -C contrib/externalSequenceProducer $@ > $(VOID)
147
+ $(Q)$(RM) zstd$(EXT) zstdmt$(EXT) tmp*
148
+ $(Q)$(RM) -r lz4
141
149
  @echo Cleaning completed
142
150
 
143
151
  #------------------------------------------------------------------------------
144
152
  # make install is validated only for Linux, macOS, Hurd and some BSD targets
145
153
  #------------------------------------------------------------------------------
146
- ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly NetBSD MSYS_NT Haiku))
154
+ ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly NetBSD MSYS_NT Haiku AIX))
147
155
 
148
156
  HOST_OS = POSIX
149
- CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON -DCMAKE_BUILD_TYPE=Release
157
+
158
+ MKDIR ?= mkdir -p
150
159
 
151
160
  HAVE_COLORNEVER = $(shell echo a | egrep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0)
152
161
  EGREP_OPTIONS ?=
153
- ifeq ($HAVE_COLORNEVER, 1)
162
+ ifeq ($(HAVE_COLORNEVER), 1)
154
163
  EGREP_OPTIONS += --color=never
155
164
  endif
156
165
  EGREP = egrep $(EGREP_OPTIONS)
@@ -161,7 +170,7 @@ EGREP = egrep $(EGREP_OPTIONS)
161
170
  ## list: Print all targets and their descriptions (if provided)
162
171
  .PHONY: list
163
172
  list:
164
- @TARGETS=$$($(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null \
173
+ $(Q)TARGETS=$$($(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null \
165
174
  | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
166
175
  | $(EGREP) -v -e '^[^[:alnum:]]' | sort); \
167
176
  { \
@@ -174,36 +183,33 @@ list:
174
183
  done \
175
184
  } | column -t -s $$'\t'
176
185
 
177
- .PHONY: install armtest usan asan uasan
186
+ .PHONY: install armtest usan asan uasan msan asan32
178
187
  install:
179
- @$(MAKE) -C $(ZSTDDIR) $@
180
- @$(MAKE) -C $(PRGDIR) $@
188
+ $(Q)$(MAKE) -C $(ZSTDDIR) $@
189
+ $(Q)$(MAKE) -C $(PRGDIR) $@
181
190
 
182
191
  .PHONY: uninstall
183
192
  uninstall:
184
- @$(MAKE) -C $(ZSTDDIR) $@
185
- @$(MAKE) -C $(PRGDIR) $@
193
+ $(Q)$(MAKE) -C $(ZSTDDIR) $@
194
+ $(Q)$(MAKE) -C $(PRGDIR) $@
186
195
 
187
196
  .PHONY: travis-install
188
197
  travis-install:
189
198
  $(MAKE) install PREFIX=~/install_test_dir
190
199
 
191
- .PHONY: gcc5build
200
+ .PHONY: gcc5build gcc6build gcc7build clangbuild m32build armbuild aarch64build ppcbuild ppc64build
192
201
  gcc5build: clean
193
202
  gcc-5 -v
194
- CC=gcc-5 $(MAKE) all MOREFLAGS="-Werror"
203
+ CC=gcc-5 $(MAKE) all MOREFLAGS="-Werror $(MOREFLAGS)"
195
204
 
196
- .PHONY: gcc6build
197
205
  gcc6build: clean
198
206
  gcc-6 -v
199
- CC=gcc-6 $(MAKE) all MOREFLAGS="-Werror"
207
+ CC=gcc-6 $(MAKE) all MOREFLAGS="-Werror $(MOREFLAGS)"
200
208
 
201
- .PHONY: gcc7build
202
209
  gcc7build: clean
203
210
  gcc-7 -v
204
- CC=gcc-7 $(MAKE) all MOREFLAGS="-Werror"
211
+ CC=gcc-7 $(MAKE) all MOREFLAGS="-Werror $(MOREFLAGS)"
205
212
 
206
- .PHONY: clangbuild
207
213
  clangbuild: clean
208
214
  clang -v
209
215
  CXX=clang++ CC=clang CFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation" $(MAKE) all
@@ -216,61 +222,63 @@ armbuild: clean
216
222
  CC=arm-linux-gnueabi-gcc CFLAGS="-Werror" $(MAKE) allzstd
217
223
 
218
224
  aarch64build: clean
219
- CC=aarch64-linux-gnu-gcc CFLAGS="-Werror" $(MAKE) allzstd
225
+ CC=aarch64-linux-gnu-gcc CFLAGS="-Werror -O0" $(MAKE) allzstd
220
226
 
221
227
  ppcbuild: clean
222
- CC=powerpc-linux-gnu-gcc CFLAGS="-m32 -Wno-attributes -Werror" $(MAKE) allzstd
228
+ CC=powerpc-linux-gnu-gcc CFLAGS="-m32 -Wno-attributes -Werror" $(MAKE) -j allzstd
223
229
 
224
230
  ppc64build: clean
225
- CC=powerpc-linux-gnu-gcc CFLAGS="-m64 -Werror" $(MAKE) allzstd
231
+ CC=powerpc-linux-gnu-gcc CFLAGS="-m64 -Werror" $(MAKE) -j allzstd
226
232
 
233
+ .PHONY: armfuzz aarch64fuzz ppcfuzz ppc64fuzz
227
234
  armfuzz: clean
228
- CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
235
+ CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static MOREFLAGS="-static $(MOREFLAGS)" FUZZER_FLAGS="--no-big-tests $(FUZZER_FLAGS)" $(MAKE) -C $(TESTDIR) fuzztest
229
236
 
230
237
  aarch64fuzz: clean
231
238
  ld -v
232
- CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
239
+ CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static MOREFLAGS="-static $(MOREFLAGS)" FUZZER_FLAGS="--no-big-tests $(FUZZER_FLAGS)" $(MAKE) -C $(TESTDIR) fuzztest
233
240
 
234
241
  ppcfuzz: clean
235
- CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
242
+ CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static MOREFLAGS="-static $(MOREFLAGS)" FUZZER_FLAGS="--no-big-tests $(FUZZER_FLAGS)" $(MAKE) -C $(TESTDIR) fuzztest
236
243
 
237
244
  ppc64fuzz: clean
238
- CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
245
+ CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static MOREFLAGS="-m64 -static $(MOREFLAGS)" FUZZER_FLAGS="--no-big-tests $(FUZZER_FLAGS)" $(MAKE) -C $(TESTDIR) fuzztest
239
246
 
240
- .PHONY: cxxtest
247
+ .PHONY: cxxtest gcc5test gcc6test armtest aarch64test ppctest ppc64test
241
248
  cxxtest: CXXFLAGS += -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror
242
249
  cxxtest: clean
243
250
  $(MAKE) -C $(PRGDIR) all CC="$(CXX) -Wno-deprecated" CFLAGS="$(CXXFLAGS)" # adding -Wno-deprecated to avoid clang++ warning on dealing with C files directly
244
251
 
245
252
  gcc5test: clean
246
253
  gcc-5 -v
247
- $(MAKE) all CC=gcc-5 MOREFLAGS="-Werror"
254
+ $(MAKE) all CC=gcc-5 MOREFLAGS="-Werror $(MOREFLAGS)"
248
255
 
249
256
  gcc6test: clean
250
257
  gcc-6 -v
251
- $(MAKE) all CC=gcc-6 MOREFLAGS="-Werror"
258
+ $(MAKE) all CC=gcc-6 MOREFLAGS="-Werror $(MOREFLAGS)"
252
259
 
253
260
  armtest: clean
254
261
  $(MAKE) -C $(TESTDIR) datagen # use native, faster
255
- $(MAKE) -C $(TESTDIR) test CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static" FUZZER_FLAGS=--no-big-tests
262
+ $(MAKE) -C $(TESTDIR) test CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static $(MOREFLAGS)" FUZZER_FLAGS="--no-big-tests $(FUZZER_FLAGS)"
256
263
 
257
264
  aarch64test:
258
265
  $(MAKE) -C $(TESTDIR) datagen # use native, faster
259
- $(MAKE) -C $(TESTDIR) test CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static" FUZZER_FLAGS=--no-big-tests
266
+ $(MAKE) -C $(TESTDIR) test CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static $(MOREFLAGS)" FUZZER_FLAGS="--no-big-tests $(FUZZER_FLAGS)"
260
267
 
261
268
  ppctest: clean
262
269
  $(MAKE) -C $(TESTDIR) datagen # use native, faster
263
- $(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static" FUZZER_FLAGS=--no-big-tests
270
+ $(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static $(MOREFLAGS)" FUZZER_FLAGS="--no-big-tests $(FUZZER_FLAGS)"
264
271
 
265
272
  ppc64test: clean
266
273
  $(MAKE) -C $(TESTDIR) datagen # use native, faster
267
- $(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static" FUZZER_FLAGS=--no-big-tests
274
+ $(MAKE) -C $(TESTDIR) test CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static $(MOREFLAGS)" FUZZER_FLAGS="--no-big-tests $(FUZZER_FLAGS)"
268
275
 
276
+ .PHONY: arm-ppc-compilation
269
277
  arm-ppc-compilation:
270
- $(MAKE) -C $(PRGDIR) clean zstd CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static"
271
- $(MAKE) -C $(PRGDIR) clean zstd CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static"
272
- $(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static"
273
- $(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static"
278
+ $(MAKE) -C $(PRGDIR) clean zstd CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static $(MOREFLAGS)"
279
+ $(MAKE) -C $(PRGDIR) clean zstd CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static $(MOREFLAGS)"
280
+ $(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static $(MOREFLAGS)"
281
+ $(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc64-static ZSTDRTTEST= MOREFLAGS="-m64 -static $(MOREFLAGS)"
274
282
 
275
283
  regressiontest:
276
284
  $(MAKE) -C $(FUZZDIR) regressiontest
@@ -281,44 +289,63 @@ uasanregressiontest:
281
289
  msanregressiontest:
282
290
  $(MAKE) -C $(FUZZDIR) regressiontest CC=clang CXX=clang++ CFLAGS="-O3 -fsanitize=memory" CXXFLAGS="-O3 -fsanitize=memory"
283
291
 
284
- # run UBsan with -fsanitize-recover=signed-integer-overflow
285
- # due to a bug in UBsan when doing pointer subtraction
286
- # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63303
287
-
292
+ update_regressionResults : REGRESS_RESULTS_DIR := /tmp/regress_results_dir/
293
+ update_regressionResults:
294
+ $(MAKE) -C programs zstd
295
+ $(MAKE) -C tests/regression test
296
+ $(RM) -rf $(REGRESS_RESULTS_DIR)
297
+ $(MKDIR) $(REGRESS_RESULTS_DIR)
298
+ ./tests/regression/test \
299
+ --cache tests/regression/cache \
300
+ --output $(REGRESS_RESULTS_DIR)/results.csv \
301
+ --zstd programs/zstd
302
+ echo "Showing results differences"
303
+ ! diff tests/regression/results.csv $(REGRESS_RESULTS_DIR)/results.csv
304
+ echo "Updating results.csv"
305
+ $(CP) $(REGRESS_RESULTS_DIR)/results.csv tests/regression/results.csv
306
+
307
+
308
+ # run UBsan with -fsanitize-recover=pointer-overflow
309
+ # this only works with recent compilers such as gcc 8+
288
310
  usan: clean
289
- $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=undefined -Werror"
311
+ $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=pointer-overflow -fsanitize=undefined -Werror $(MOREFLAGS)"
290
312
 
291
313
  asan: clean
292
- $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address -Werror"
314
+ $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address -Werror $(MOREFLAGS)"
293
315
 
294
316
  asan-%: clean
295
- LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=address -Werror" $(MAKE) -C $(TESTDIR) $*
317
+ LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=address -Werror $(MOREFLAGS)" $(MAKE) -C $(TESTDIR) $*
296
318
 
297
319
  msan: clean
298
- $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=memory -fno-omit-frame-pointer -Werror" HAVE_LZMA=0 # datagen.c fails this test for no obvious reason
320
+ $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=memory -fno-omit-frame-pointer -Werror $(MOREFLAGS)" HAVE_LZMA=0 # datagen.c fails this test for no obvious reason
299
321
 
300
322
  msan-%: clean
301
- LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=memory -fno-omit-frame-pointer -Werror" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) HAVE_LZMA=0 $*
323
+ LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=memory -fno-omit-frame-pointer -Werror $(MOREFLAGS)" FUZZER_FLAGS="--no-big-tests $(FUZZER_FLAGS)" $(MAKE) -C $(TESTDIR) HAVE_LZMA=0 $*
302
324
 
303
325
  asan32: clean
304
- $(MAKE) -C $(TESTDIR) test32 CC=clang MOREFLAGS="-g -fsanitize=address"
326
+ $(MAKE) -C $(TESTDIR) test32 CC=clang MOREFLAGS="-g -fsanitize=address $(MOREFLAGS)"
305
327
 
306
328
  uasan: clean
307
- $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined -Werror"
329
+ $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=pointer-overflow -fsanitize=address,undefined -Werror $(MOREFLAGS)"
308
330
 
309
331
  uasan-%: clean
310
- LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined -Werror" $(MAKE) -C $(TESTDIR) $*
332
+ LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=pointer-overflow -fsanitize=address,undefined -Werror $(MOREFLAGS)" $(MAKE) -C $(TESTDIR) $*
311
333
 
312
334
  tsan-%: clean
313
- LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=thread -Werror" $(MAKE) -C $(TESTDIR) $* FUZZER_FLAGS=--no-big-tests
335
+ LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=thread -Werror $(MOREFLAGS)" $(MAKE) -C $(TESTDIR) $* FUZZER_FLAGS="--no-big-tests $(FUZZER_FLAGS)"
314
336
 
337
+ .PHONY: apt-install
315
338
  apt-install:
339
+ # TODO: uncomment once issue 3011 is resolved and remove hack from Github Actions .yml
340
+ # sudo apt-get update
316
341
  sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install $(APT_PACKAGES)
317
342
 
343
+ .PHONY: apt-add-repo
318
344
  apt-add-repo:
319
345
  sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
320
346
  sudo apt-get update -y -qq
321
347
 
348
+ .PHONY: ppcinstall arminstall valgrindinstall libc6install gcc6install gcc7install gcc8install gpp6install clang38install lz4install
322
349
  ppcinstall:
323
350
  APT_PACKAGES="qemu-system-ppc qemu-user-static gcc-powerpc-linux-gnu" $(MAKE) apt-install
324
351
 
@@ -353,20 +380,22 @@ lz4install:
353
380
  endif
354
381
 
355
382
 
383
+ CMAKE_PARAMS = -DZSTD_BUILD_CONTRIB:BOOL=ON -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_ZLIB_SUPPORT:BOOL=ON -DZSTD_LZMA_SUPPORT:BOOL=ON -DCMAKE_BUILD_TYPE=Release
384
+
356
385
  ifneq (,$(filter MSYS%,$(shell uname)))
357
386
  HOST_OS = MSYS
358
387
  CMAKE_PARAMS = -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug -DZSTD_MULTITHREAD_SUPPORT:BOOL=OFF -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON
359
388
  endif
360
389
 
361
-
362
390
  #------------------------------------------------------------------------
363
391
  # target specific tests
364
392
  #------------------------------------------------------------------------
365
393
  ifneq (,$(filter $(HOST_OS),MSYS POSIX))
394
+ .PHONY: cmakebuild c89build gnu90build c99build gnu99build c11build bmix64build bmix32build bmi32build staticAnalyze
366
395
  cmakebuild:
367
396
  cmake --version
368
397
  $(RM) -r $(BUILDIR)/cmake/build
369
- mkdir $(BUILDIR)/cmake/build
398
+ $(MKDIR) $(BUILDIR)/cmake/build
370
399
  cd $(BUILDIR)/cmake/build; cmake -DCMAKE_INSTALL_PREFIX:PATH=~/install_test_dir $(CMAKE_PARAMS) ..
371
400
  $(MAKE) -C $(BUILDIR)/cmake/build -j4;
372
401
  $(MAKE) -C $(BUILDIR)/cmake/build install;
@@ -375,23 +404,23 @@ cmakebuild:
375
404
 
376
405
  c89build: clean
377
406
  $(CC) -v
378
- CFLAGS="-std=c89 -Werror" $(MAKE) allmost # will fail, due to missing support for `long long`
407
+ CFLAGS="-std=c89 -Werror -Wno-attributes -Wpedantic -Wno-long-long -Wno-variadic-macros -O0" $(MAKE) lib zstd
379
408
 
380
409
  gnu90build: clean
381
410
  $(CC) -v
382
- CFLAGS="-std=gnu90 -Werror" $(MAKE) allmost
411
+ CFLAGS="-std=gnu90 -Werror -O0" $(MAKE) allmost
383
412
 
384
413
  c99build: clean
385
414
  $(CC) -v
386
- CFLAGS="-std=c99 -Werror" $(MAKE) allmost
415
+ CFLAGS="-std=c99 -Werror -O0" $(MAKE) allmost
387
416
 
388
417
  gnu99build: clean
389
418
  $(CC) -v
390
- CFLAGS="-std=gnu99 -Werror" $(MAKE) allmost
419
+ CFLAGS="-std=gnu99 -Werror -O0" $(MAKE) allmost
391
420
 
392
421
  c11build: clean
393
422
  $(CC) -v
394
- CFLAGS="-std=c11 -Werror" $(MAKE) allmost
423
+ CFLAGS="-std=c11 -Werror -O0" $(MAKE) allmost
395
424
 
396
425
  bmix64build: clean
397
426
  $(CC) -v
@@ -410,5 +439,5 @@ bmi32build: clean
410
439
  staticAnalyze: SCANBUILD ?= scan-build
411
440
  staticAnalyze:
412
441
  $(CC) -v
413
- CC=$(CC) CPPFLAGS=-g $(SCANBUILD) --status-bugs -v $(MAKE) allzstd examples contrib
442
+ CC=$(CC) CPPFLAGS=-g $(SCANBUILD) --status-bugs -v $(MAKE) zstd
414
443
  endif
@@ -0,0 +1,36 @@
1
+ // swift-tools-version:5.0
2
+ // The swift-tools-version declares the minimum version of Swift required to build this package.
3
+
4
+ import PackageDescription
5
+
6
+ let package = Package(
7
+ name: "zstd",
8
+ platforms: [
9
+ .macOS(.v10_10), .iOS(.v9), .tvOS(.v9)
10
+ ],
11
+ products: [
12
+ // Products define the executables and libraries a package produces, and make them visible to other packages.
13
+ .library(
14
+ name: "libzstd",
15
+ targets: [ "libzstd" ])
16
+ ],
17
+ dependencies: [
18
+ // Dependencies declare other packages that this package depends on.
19
+ // .package(url: /* package url */, from: "1.0.0"),
20
+ ],
21
+ targets: [
22
+ // Targets are the basic building blocks of a package. A target can define a module or a test suite.
23
+ // Targets can depend on other targets in this package, and on products in packages this package depends on.
24
+ .target(
25
+ name: "libzstd",
26
+ path: "lib",
27
+ sources: [ "common", "compress", "decompress", "dictBuilder" ],
28
+ publicHeadersPath: ".",
29
+ cSettings: [
30
+ .headerSearchPath(".")
31
+ ])
32
+ ],
33
+ swiftLanguageVersions: [.v5],
34
+ cLanguageStandard: .gnu11,
35
+ cxxLanguageStandard: .gnucxx14
36
+ )
@@ -4,23 +4,21 @@ __Zstandard__, or `zstd` as short version, is a fast lossless compression algori
4
4
  targeting real-time compression scenarios at zlib-level and better compression ratios.
5
5
  It's backed by a very fast entropy stage, provided by [Huff0 and FSE library](https://github.com/Cyan4973/FiniteStateEntropy).
6
6
 
7
- The project is provided as an open-source dual [BSD](LICENSE) and [GPLv2](COPYING) licensed **C** library,
7
+ Zstandard's format is stable and documented in [RFC8878](https://datatracker.ietf.org/doc/html/rfc8878). Multiple independent implementations are already available.
8
+ This repository represents the reference implementation, provided as an open-source dual [BSD](LICENSE) and [GPLv2](COPYING) licensed **C** library,
8
9
  and a command line utility producing and decoding `.zst`, `.gz`, `.xz` and `.lz4` files.
9
10
  Should your project require another programming language,
10
- a list of known ports and bindings is provided on [Zstandard homepage](http://www.zstd.net/#other-languages).
11
+ a list of known ports and bindings is provided on [Zstandard homepage](https://facebook.github.io/zstd/#other-languages).
11
12
 
12
13
  **Development branch status:**
13
14
 
14
15
  [![Build Status][travisDevBadge]][travisLink]
15
- [![Build status][AppveyorDevBadge]][AppveyorLink]
16
16
  [![Build status][CircleDevBadge]][CircleLink]
17
17
  [![Build status][CirrusDevBadge]][CirrusLink]
18
18
  [![Fuzzing Status][OSSFuzzBadge]][OSSFuzzLink]
19
19
 
20
- [travisDevBadge]: https://travis-ci.org/facebook/zstd.svg?branch=dev "Continuous Integration test suite"
21
- [travisLink]: https://travis-ci.org/facebook/zstd
22
- [AppveyorDevBadge]: https://ci.appveyor.com/api/projects/status/xt38wbdxjk5mrbem/branch/dev?svg=true "Windows test suite"
23
- [AppveyorLink]: https://ci.appveyor.com/project/YannCollet/zstd-p0yf0
20
+ [travisDevBadge]: https://api.travis-ci.com/facebook/zstd.svg?branch=dev "Continuous Integration test suite"
21
+ [travisLink]: https://travis-ci.com/facebook/zstd
24
22
  [CircleDevBadge]: https://circleci.com/gh/facebook/zstd/tree/dev.svg?style=shield "Short test suite"
25
23
  [CircleLink]: https://circleci.com/gh/facebook/zstd
26
24
  [CirrusDevBadge]: https://api.cirrus-ci.com/github/facebook/zstd.svg?branch=dev
@@ -31,37 +29,36 @@ a list of known ports and bindings is provided on [Zstandard homepage](http://ww
31
29
  ## Benchmarks
32
30
 
33
31
  For reference, several fast compression algorithms were tested and compared
34
- on a server running Arch Linux (`Linux version 5.5.11-arch1-1`),
35
- with a Core i9-9900K CPU @ 5.0GHz,
32
+ on a desktop running Ubuntu 20.04 (`Linux 5.11.0-41-generic`),
33
+ with a Core i7-9700K CPU @ 4.9GHz,
36
34
  using [lzbench], an open-source in-memory benchmark by @inikep
37
35
  compiled with [gcc] 9.3.0,
38
36
  on the [Silesia compression corpus].
39
37
 
40
38
  [lzbench]: https://github.com/inikep/lzbench
41
- [Silesia compression corpus]: http://sun.aei.polsl.pl/~sdeor/index.php?page=silesia
39
+ [Silesia compression corpus]: https://sun.aei.polsl.pl//~sdeor/index.php?page=silesia
42
40
  [gcc]: https://gcc.gnu.org/
43
41
 
44
42
  | Compressor name | Ratio | Compression| Decompress.|
45
43
  | --------------- | ------| -----------| ---------- |
46
- | **zstd 1.4.5 -1** | 2.884 | 500 MB/s | 1660 MB/s |
47
- | zlib 1.2.11 -1 | 2.743 | 90 MB/s | 400 MB/s |
48
- | brotli 1.0.7 -0 | 2.703 | 400 MB/s | 450 MB/s |
49
- | **zstd 1.4.5 --fast=1** | 2.434 | 570 MB/s | 2200 MB/s |
50
- | **zstd 1.4.5 --fast=3** | 2.312 | 640 MB/s | 2300 MB/s |
51
- | quicklz 1.5.0 -1 | 2.238 | 560 MB/s | 710 MB/s |
52
- | **zstd 1.4.5 --fast=5** | 2.178 | 700 MB/s | 2420 MB/s |
53
- | lzo1x 2.10 -1 | 2.106 | 690 MB/s | 820 MB/s |
54
- | lz4 1.9.2 | 2.101 | 740 MB/s | 4530 MB/s |
55
- | **zstd 1.4.5 --fast=7** | 2.096 | 750 MB/s | 2480 MB/s |
56
- | lzf 3.6 -1 | 2.077 | 410 MB/s | 860 MB/s |
57
- | snappy 1.1.8 | 2.073 | 560 MB/s | 1790 MB/s |
58
-
59
- [zlib]: http://www.zlib.net/
60
- [LZ4]: http://www.lz4.org/
44
+ | **zstd 1.5.1 -1** | 2.887 | 530 MB/s | 1700 MB/s |
45
+ | [zlib] 1.2.11 -1 | 2.743 | 95 MB/s | 400 MB/s |
46
+ | brotli 1.0.9 -0 | 2.702 | 395 MB/s | 450 MB/s |
47
+ | **zstd 1.5.1 --fast=1** | 2.437 | 600 MB/s | 2150 MB/s |
48
+ | **zstd 1.5.1 --fast=3** | 2.239 | 670 MB/s | 2250 MB/s |
49
+ | quicklz 1.5.0 -1 | 2.238 | 540 MB/s | 760 MB/s |
50
+ | **zstd 1.5.1 --fast=4** | 2.148 | 710 MB/s | 2300 MB/s |
51
+ | lzo1x 2.10 -1 | 2.106 | 660 MB/s | 845 MB/s |
52
+ | [lz4] 1.9.3 | 2.101 | 740 MB/s | 4500 MB/s |
53
+ | lzf 3.6 -1 | 2.077 | 410 MB/s | 830 MB/s |
54
+ | snappy 1.1.9 | 2.073 | 550 MB/s | 1750 MB/s |
55
+
56
+ [zlib]: https://www.zlib.net/
57
+ [lz4]: https://lz4.github.io/lz4/
61
58
 
62
59
  The negative compression levels, specified with `--fast=#`,
63
- offer faster compression and decompression speed in exchange for some loss in
64
- compression ratio compared to level 1, as seen in the table above.
60
+ offer faster compression and decompression speed
61
+ at the cost of compression ratio (compared to level 1).
65
62
 
66
63
  Zstd can also offer stronger compression ratios at the cost of compression speed.
67
64
  Speed vs Compression trade-off is configurable by small increments.
@@ -124,14 +121,27 @@ Dictionary gains are mostly effective in the first few KB. Then, the compression
124
121
 
125
122
  ## Build instructions
126
123
 
124
+ `make` is the officially maintained build system of this project.
125
+ All other build systems are "compatible" and 3rd-party maintained,
126
+ they may feature small differences in advanced options.
127
+ When your system allows it, prefer using `make` to build `zstd` and `libzstd`.
128
+
127
129
  ### Makefile
128
130
 
129
131
  If your system is compatible with standard `make` (or `gmake`),
130
132
  invoking `make` in root directory will generate `zstd` cli in root directory.
133
+ It will also create `libzstd` into `lib/`.
131
134
 
132
135
  Other available options include:
133
136
  - `make install` : create and install zstd cli, library and man pages
134
- - `make check` : create and run `zstd`, tests its behavior on local platform
137
+ - `make check` : create and run `zstd`, test its behavior on local platform
138
+
139
+ The `Makefile` follows the [GNU Standard Makefile conventions](https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html),
140
+ allowing staged install, standard flags, directory variables and command variables.
141
+
142
+ For advanced use cases, specialized compilation flags which control binary generation
143
+ are documented in [`lib/README.md`](lib/README.md#modular-build) for the `libzstd` library
144
+ and in [`programs/README.md`](programs/README.md#compilation-variables) for the `zstd` CLI.
135
145
 
136
146
  ### cmake
137
147
 
@@ -141,6 +151,18 @@ to create `zstd` binary, and `libzstd` dynamic and static libraries.
141
151
 
142
152
  By default, `CMAKE_BUILD_TYPE` is set to `Release`.
143
153
 
154
+ #### Support for Fat (Universal2) Output
155
+
156
+ `zstd` can be built and installed with support for both Apple Silicon (M1/M2) as well as Intel by using CMake's Universal2 support.
157
+ To perform a Fat/Universal2 build and install use the following commands:
158
+
159
+ ```bash
160
+ cmake -B build-cmake-debug -S build/cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="x86_64;x86_64h;arm64"
161
+ cd build-cmake-debug
162
+ ninja
163
+ sudo ninja install
164
+ ```
165
+
144
166
  ### Meson
145
167
 
146
168
  A Meson project is provided within [`build/meson`](build/meson). Follow
@@ -176,9 +198,17 @@ Going into `build` directory, you will find additional possibilities:
176
198
  You can build the zstd binary via buck by executing: `buck build programs:zstd` from the root of the repo.
177
199
  The output binary will be in `buck-out/gen/programs/`.
178
200
 
201
+ ## Testing
202
+
203
+ You can run quick local smoke tests by running `make check`.
204
+ If you can't use `make`, execute the `playTest.sh` script from the `src/tests` directory.
205
+ Two env variables `$ZSTD_BIN` and `$DATAGEN_BIN` are needed for the test script to locate the `zstd` and `datagen` binary.
206
+ For information on CI testing, please refer to `TESTING.md`.
207
+
179
208
  ## Status
180
209
 
181
- Zstandard is currently deployed within Facebook. It is used continuously to compress large amounts of data in multiple formats and use cases.
210
+ Zstandard is currently deployed within Facebook and many other large cloud infrastructures.
211
+ It is run continuously to compress large amounts of data in multiple formats and use cases.
182
212
  Zstandard is considered safe for production environments.
183
213
 
184
214
  ## License
@@ -187,7 +217,7 @@ Zstandard is dual-licensed under [BSD](LICENSE) and [GPLv2](COPYING).
187
217
 
188
218
  ## Contributing
189
219
 
190
- The "dev" branch is the one where all contributions are merged before reaching "master".
191
- If you plan to propose a patch, please commit into the "dev" branch, or its own feature branch.
192
- Direct commit to "master" are not permitted.
220
+ The `dev` branch is the one where all contributions are merged before reaching `release`.
221
+ If you plan to propose a patch, please commit into the `dev` branch, or its own feature branch.
222
+ Direct commit to `release` are not permitted.
193
223
  For more information, please read [CONTRIBUTING](CONTRIBUTING.md).
@@ -22,12 +22,12 @@ They consist of the following tests:
22
22
  - `tests/playTests.sh --test-large-data`
23
23
  - Fuzzer tests: `tests/fuzzer.c`, `tests/zstreamtest.c`, and `tests/decodecorpus.c`
24
24
  - `tests/zstreamtest.c` under Tsan (streaming mode, including multithreaded mode)
25
- - Valgrind Test (`make -C tests valgrindTest`) (testing CLI and fuzzer under valgrind)
25
+ - Valgrind Test (`make -C tests test-valgrind`) (testing CLI and fuzzer under `valgrind`)
26
26
  - Fuzzer tests (see above) on ARM, AArch64, PowerPC, and PowerPC64
27
27
 
28
28
  Long Tests
29
29
  ----------
30
- Long tests run on all commits to `master` branch,
30
+ Long tests run on all commits to `release` branch,
31
31
  and once a day on the current version of `dev` branch,
32
32
  on TravisCI.
33
33
  They consist of the following tests:
@@ -40,5 +40,4 @@ They consist of the following tests:
40
40
  - Versions test (ensuring `zstd` can decode files from all previous versions)
41
41
  - `pzstd` with asan and tsan, as well as in 32-bits mode
42
42
  - Testing `zstd` with legacy mode off
43
- - Testing `zbuff` (old streaming API)
44
43
  - Entire test suite and make install on macOS