extzstd 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/contrib/zstd/CHANGELOG +188 -1
  4. data/contrib/zstd/CONTRIBUTING.md +157 -74
  5. data/contrib/zstd/LICENSE +4 -4
  6. data/contrib/zstd/Makefile +81 -58
  7. data/contrib/zstd/Package.swift +36 -0
  8. data/contrib/zstd/README.md +59 -35
  9. data/contrib/zstd/TESTING.md +2 -3
  10. data/contrib/zstd/appveyor.yml +49 -136
  11. data/contrib/zstd/lib/BUCK +5 -7
  12. data/contrib/zstd/lib/Makefile +87 -181
  13. data/contrib/zstd/lib/README.md +23 -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 +33 -59
  17. data/contrib/zstd/lib/common/compiler.h +115 -45
  18. data/contrib/zstd/lib/common/cpu.h +1 -1
  19. data/contrib/zstd/lib/common/debug.c +1 -1
  20. data/contrib/zstd/lib/common/debug.h +1 -1
  21. data/contrib/zstd/lib/common/entropy_common.c +15 -37
  22. data/contrib/zstd/lib/common/error_private.c +9 -2
  23. data/contrib/zstd/lib/common/error_private.h +82 -3
  24. data/contrib/zstd/lib/common/fse.h +9 -85
  25. data/contrib/zstd/lib/common/fse_decompress.c +29 -111
  26. data/contrib/zstd/lib/common/huf.h +84 -172
  27. data/contrib/zstd/lib/common/mem.h +58 -49
  28. data/contrib/zstd/lib/common/pool.c +37 -16
  29. data/contrib/zstd/lib/common/pool.h +9 -3
  30. data/contrib/zstd/lib/common/portability_macros.h +156 -0
  31. data/contrib/zstd/lib/common/threading.c +68 -14
  32. data/contrib/zstd/lib/common/threading.h +5 -10
  33. data/contrib/zstd/lib/common/xxhash.c +7 -809
  34. data/contrib/zstd/lib/common/xxhash.h +5568 -167
  35. data/contrib/zstd/lib/common/zstd_common.c +1 -36
  36. data/contrib/zstd/lib/common/zstd_deps.h +1 -1
  37. data/contrib/zstd/lib/common/zstd_internal.h +64 -150
  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 +69 -150
  41. data/contrib/zstd/lib/compress/hist.c +1 -1
  42. data/contrib/zstd/lib/compress/hist.h +1 -1
  43. data/contrib/zstd/lib/compress/huf_compress.c +773 -251
  44. data/contrib/zstd/lib/compress/zstd_compress.c +2650 -826
  45. data/contrib/zstd/lib/compress/zstd_compress_internal.h +509 -180
  46. data/contrib/zstd/lib/compress/zstd_compress_literals.c +117 -40
  47. data/contrib/zstd/lib/compress/zstd_compress_literals.h +16 -6
  48. data/contrib/zstd/lib/compress/zstd_compress_sequences.c +28 -19
  49. data/contrib/zstd/lib/compress/zstd_compress_sequences.h +1 -1
  50. data/contrib/zstd/lib/compress/zstd_compress_superblock.c +33 -305
  51. data/contrib/zstd/lib/compress/zstd_compress_superblock.h +1 -1
  52. data/contrib/zstd/lib/compress/zstd_cwksp.h +266 -85
  53. data/contrib/zstd/lib/compress/zstd_double_fast.c +369 -132
  54. data/contrib/zstd/lib/compress/zstd_double_fast.h +3 -2
  55. data/contrib/zstd/lib/compress/zstd_fast.c +722 -258
  56. data/contrib/zstd/lib/compress/zstd_fast.h +3 -2
  57. data/contrib/zstd/lib/compress/zstd_lazy.c +1105 -360
  58. data/contrib/zstd/lib/compress/zstd_lazy.h +41 -1
  59. data/contrib/zstd/lib/compress/zstd_ldm.c +272 -208
  60. data/contrib/zstd/lib/compress/zstd_ldm.h +3 -2
  61. data/contrib/zstd/lib/compress/zstd_ldm_geartab.h +106 -0
  62. data/contrib/zstd/lib/compress/zstd_opt.c +324 -197
  63. data/contrib/zstd/lib/compress/zstd_opt.h +1 -1
  64. data/contrib/zstd/lib/compress/zstdmt_compress.c +109 -53
  65. data/contrib/zstd/lib/compress/zstdmt_compress.h +9 -6
  66. data/contrib/zstd/lib/decompress/huf_decompress.c +1071 -539
  67. data/contrib/zstd/lib/decompress/huf_decompress_amd64.S +576 -0
  68. data/contrib/zstd/lib/decompress/zstd_ddict.c +4 -4
  69. data/contrib/zstd/lib/decompress/zstd_ddict.h +1 -1
  70. data/contrib/zstd/lib/decompress/zstd_decompress.c +507 -82
  71. data/contrib/zstd/lib/decompress/zstd_decompress_block.c +962 -310
  72. data/contrib/zstd/lib/decompress/zstd_decompress_block.h +14 -3
  73. data/contrib/zstd/lib/decompress/zstd_decompress_internal.h +54 -6
  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 +44 -32
  79. data/contrib/zstd/lib/dictBuilder/cover.h +6 -5
  80. data/contrib/zstd/lib/dictBuilder/divsufsort.c +1 -1
  81. data/contrib/zstd/lib/dictBuilder/fastcover.c +24 -16
  82. data/contrib/zstd/lib/dictBuilder/zdict.c +88 -95
  83. data/contrib/zstd/lib/legacy/zstd_legacy.h +8 -1
  84. data/contrib/zstd/lib/legacy/zstd_v01.c +16 -53
  85. data/contrib/zstd/lib/legacy/zstd_v01.h +1 -1
  86. data/contrib/zstd/lib/legacy/zstd_v02.c +24 -69
  87. data/contrib/zstd/lib/legacy/zstd_v02.h +1 -1
  88. data/contrib/zstd/lib/legacy/zstd_v03.c +25 -72
  89. data/contrib/zstd/lib/legacy/zstd_v03.h +1 -1
  90. data/contrib/zstd/lib/legacy/zstd_v04.c +23 -69
  91. data/contrib/zstd/lib/legacy/zstd_v04.h +1 -1
  92. data/contrib/zstd/lib/legacy/zstd_v05.c +35 -85
  93. data/contrib/zstd/lib/legacy/zstd_v05.h +1 -1
  94. data/contrib/zstd/lib/legacy/zstd_v06.c +42 -87
  95. data/contrib/zstd/lib/legacy/zstd_v06.h +1 -1
  96. data/contrib/zstd/lib/legacy/zstd_v07.c +35 -82
  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 +4 -3
  100. data/contrib/zstd/lib/module.modulemap +35 -0
  101. data/contrib/zstd/lib/{dictBuilder/zdict.h → zdict.h} +202 -33
  102. data/contrib/zstd/lib/zstd.h +922 -293
  103. data/contrib/zstd/lib/{common/zstd_errors.h → zstd_errors.h} +27 -8
  104. data/ext/extconf.rb +7 -6
  105. data/ext/extzstd.c +13 -10
  106. data/ext/libzstd_conf.h +0 -1
  107. data/ext/zstd_decompress_asm.S +1 -0
  108. metadata +16 -5
@@ -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
@@ -29,6 +29,7 @@ VOID = /dev/null
29
29
  # fail on other tested distros (ubuntu, debian) even
30
30
  # without manually specifying the TARGET_SYSTEM.
31
31
  TARGET_SYSTEM ?= $(OS)
32
+ CP ?= cp
32
33
 
33
34
  ifneq (,$(filter Windows%,$(TARGET_SYSTEM)))
34
35
  EXT =.exe
@@ -48,7 +49,7 @@ allmost: allzstd zlibwrapper
48
49
 
49
50
  # skip zwrapper, can't build that on alternate architectures without the proper zlib installed
50
51
  .PHONY: allzstd
51
- allzstd: lib-all
52
+ allzstd: lib
52
53
  $(Q)$(MAKE) -C $(PRGDIR) all
53
54
  $(Q)$(MAKE) -C $(TESTDIR) all
54
55
 
@@ -57,9 +58,8 @@ all32:
57
58
  $(MAKE) -C $(PRGDIR) zstd32
58
59
  $(MAKE) -C $(TESTDIR) all32
59
60
 
60
- .PHONY: lib lib-release libzstd.a
61
- lib-all : lib
62
- lib lib-release lib-all :
61
+ .PHONY: lib lib-release lib-mt lib-nomt
62
+ lib lib-release lib-mt lib-nomt:
63
63
  $(Q)$(MAKE) -C $(ZSTDDIR) $@
64
64
 
65
65
  .PHONY: zstd zstd-release
@@ -70,7 +70,7 @@ zstd zstd-release:
70
70
  .PHONY: zstdmt
71
71
  zstdmt:
72
72
  $(Q)$(MAKE) -C $(PRGDIR) $@
73
- $(Q)cp $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT)
73
+ $(Q)$(CP) $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT)
74
74
 
75
75
  .PHONY: zlibwrapper
76
76
  zlibwrapper: lib
@@ -123,8 +123,9 @@ contrib: lib
123
123
  $(MAKE) -C contrib/seekable_format/examples all
124
124
  $(MAKE) -C contrib/seekable_format/tests test
125
125
  $(MAKE) -C contrib/largeNbDicts all
126
- cd contrib/single_file_libs/ ; ./build_decoder_test.sh
127
- 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
128
129
 
129
130
  .PHONY: cleanTabs
130
131
  cleanTabs:
@@ -142,6 +143,7 @@ clean:
142
143
  $(Q)$(MAKE) -C contrib/seekable_format/examples $@ > $(VOID)
143
144
  $(Q)$(MAKE) -C contrib/seekable_format/tests $@ > $(VOID)
144
145
  $(Q)$(MAKE) -C contrib/largeNbDicts $@ > $(VOID)
146
+ $(Q)$(MAKE) -C contrib/externalSequenceProducer $@ > $(VOID)
145
147
  $(Q)$(RM) zstd$(EXT) zstdmt$(EXT) tmp*
146
148
  $(Q)$(RM) -r lz4
147
149
  @echo Cleaning completed
@@ -149,14 +151,15 @@ clean:
149
151
  #------------------------------------------------------------------------------
150
152
  # make install is validated only for Linux, macOS, Hurd and some BSD targets
151
153
  #------------------------------------------------------------------------------
152
- 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))
153
155
 
154
156
  HOST_OS = POSIX
155
- 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
156
159
 
157
160
  HAVE_COLORNEVER = $(shell echo a | egrep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0)
158
161
  EGREP_OPTIONS ?=
159
- ifeq ($HAVE_COLORNEVER, 1)
162
+ ifeq ($(HAVE_COLORNEVER), 1)
160
163
  EGREP_OPTIONS += --color=never
161
164
  endif
162
165
  EGREP = egrep $(EGREP_OPTIONS)
@@ -180,7 +183,7 @@ list:
180
183
  done \
181
184
  } | column -t -s $$'\t'
182
185
 
183
- .PHONY: install armtest usan asan uasan
186
+ .PHONY: install armtest usan asan uasan msan asan32
184
187
  install:
185
188
  $(Q)$(MAKE) -C $(ZSTDDIR) $@
186
189
  $(Q)$(MAKE) -C $(PRGDIR) $@
@@ -194,22 +197,19 @@ uninstall:
194
197
  travis-install:
195
198
  $(MAKE) install PREFIX=~/install_test_dir
196
199
 
197
- .PHONY: gcc5build
200
+ .PHONY: gcc5build gcc6build gcc7build clangbuild m32build armbuild aarch64build ppcbuild ppc64build
198
201
  gcc5build: clean
199
202
  gcc-5 -v
200
- CC=gcc-5 $(MAKE) all MOREFLAGS="-Werror"
203
+ CC=gcc-5 $(MAKE) all MOREFLAGS="-Werror $(MOREFLAGS)"
201
204
 
202
- .PHONY: gcc6build
203
205
  gcc6build: clean
204
206
  gcc-6 -v
205
- CC=gcc-6 $(MAKE) all MOREFLAGS="-Werror"
207
+ CC=gcc-6 $(MAKE) all MOREFLAGS="-Werror $(MOREFLAGS)"
206
208
 
207
- .PHONY: gcc7build
208
209
  gcc7build: clean
209
210
  gcc-7 -v
210
- CC=gcc-7 $(MAKE) all MOREFLAGS="-Werror"
211
+ CC=gcc-7 $(MAKE) all MOREFLAGS="-Werror $(MOREFLAGS)"
211
212
 
212
- .PHONY: clangbuild
213
213
  clangbuild: clean
214
214
  clang -v
215
215
  CXX=clang++ CC=clang CFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation" $(MAKE) all
@@ -222,61 +222,63 @@ armbuild: clean
222
222
  CC=arm-linux-gnueabi-gcc CFLAGS="-Werror" $(MAKE) allzstd
223
223
 
224
224
  aarch64build: clean
225
- CC=aarch64-linux-gnu-gcc CFLAGS="-Werror" $(MAKE) allzstd
225
+ CC=aarch64-linux-gnu-gcc CFLAGS="-Werror -O0" $(MAKE) allzstd
226
226
 
227
227
  ppcbuild: clean
228
- 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
229
229
 
230
230
  ppc64build: clean
231
- CC=powerpc-linux-gnu-gcc CFLAGS="-m64 -Werror" $(MAKE) allzstd
231
+ CC=powerpc-linux-gnu-gcc CFLAGS="-m64 -Werror" $(MAKE) -j allzstd
232
232
 
233
+ .PHONY: armfuzz aarch64fuzz ppcfuzz ppc64fuzz
233
234
  armfuzz: clean
234
- 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
235
236
 
236
237
  aarch64fuzz: clean
237
238
  ld -v
238
- 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
239
240
 
240
241
  ppcfuzz: clean
241
- 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
242
243
 
243
244
  ppc64fuzz: clean
244
- 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
245
246
 
246
- .PHONY: cxxtest
247
+ .PHONY: cxxtest gcc5test gcc6test armtest aarch64test ppctest ppc64test
247
248
  cxxtest: CXXFLAGS += -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror
248
249
  cxxtest: clean
249
250
  $(MAKE) -C $(PRGDIR) all CC="$(CXX) -Wno-deprecated" CFLAGS="$(CXXFLAGS)" # adding -Wno-deprecated to avoid clang++ warning on dealing with C files directly
250
251
 
251
252
  gcc5test: clean
252
253
  gcc-5 -v
253
- $(MAKE) all CC=gcc-5 MOREFLAGS="-Werror"
254
+ $(MAKE) all CC=gcc-5 MOREFLAGS="-Werror $(MOREFLAGS)"
254
255
 
255
256
  gcc6test: clean
256
257
  gcc-6 -v
257
- $(MAKE) all CC=gcc-6 MOREFLAGS="-Werror"
258
+ $(MAKE) all CC=gcc-6 MOREFLAGS="-Werror $(MOREFLAGS)"
258
259
 
259
260
  armtest: clean
260
261
  $(MAKE) -C $(TESTDIR) datagen # use native, faster
261
- $(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)"
262
263
 
263
264
  aarch64test:
264
265
  $(MAKE) -C $(TESTDIR) datagen # use native, faster
265
- $(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)"
266
267
 
267
268
  ppctest: clean
268
269
  $(MAKE) -C $(TESTDIR) datagen # use native, faster
269
- $(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)"
270
271
 
271
272
  ppc64test: clean
272
273
  $(MAKE) -C $(TESTDIR) datagen # use native, faster
273
- $(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)"
274
275
 
276
+ .PHONY: arm-ppc-compilation
275
277
  arm-ppc-compilation:
276
- $(MAKE) -C $(PRGDIR) clean zstd CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static"
277
- $(MAKE) -C $(PRGDIR) clean zstd CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static ZSTDRTTEST= MOREFLAGS="-Werror -static"
278
- $(MAKE) -C $(PRGDIR) clean zstd CC=powerpc-linux-gnu-gcc QEMU_SYS=qemu-ppc-static ZSTDRTTEST= MOREFLAGS="-Werror -Wno-attributes -static"
279
- $(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)"
280
282
 
281
283
  regressiontest:
282
284
  $(MAKE) -C $(FUZZDIR) regressiontest
@@ -287,44 +289,63 @@ uasanregressiontest:
287
289
  msanregressiontest:
288
290
  $(MAKE) -C $(FUZZDIR) regressiontest CC=clang CXX=clang++ CFLAGS="-O3 -fsanitize=memory" CXXFLAGS="-O3 -fsanitize=memory"
289
291
 
290
- # run UBsan with -fsanitize-recover=signed-integer-overflow
291
- # due to a bug in UBsan when doing pointer subtraction
292
- # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63303
293
-
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+
294
310
  usan: clean
295
- $(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)"
296
312
 
297
313
  asan: clean
298
- $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address -Werror"
314
+ $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address -Werror $(MOREFLAGS)"
299
315
 
300
316
  asan-%: clean
301
- 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) $*
302
318
 
303
319
  msan: clean
304
- $(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
305
321
 
306
322
  msan-%: clean
307
- 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 $*
308
324
 
309
325
  asan32: clean
310
- $(MAKE) -C $(TESTDIR) test32 CC=clang MOREFLAGS="-g -fsanitize=address"
326
+ $(MAKE) -C $(TESTDIR) test32 CC=clang MOREFLAGS="-g -fsanitize=address $(MOREFLAGS)"
311
327
 
312
328
  uasan: clean
313
- $(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)"
314
330
 
315
331
  uasan-%: clean
316
- 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) $*
317
333
 
318
334
  tsan-%: clean
319
- 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)"
320
336
 
337
+ .PHONY: apt-install
321
338
  apt-install:
339
+ # TODO: uncomment once issue 3011 is resolved and remove hack from Github Actions .yml
340
+ # sudo apt-get update
322
341
  sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install $(APT_PACKAGES)
323
342
 
343
+ .PHONY: apt-add-repo
324
344
  apt-add-repo:
325
345
  sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
326
346
  sudo apt-get update -y -qq
327
347
 
348
+ .PHONY: ppcinstall arminstall valgrindinstall libc6install gcc6install gcc7install gcc8install gpp6install clang38install lz4install
328
349
  ppcinstall:
329
350
  APT_PACKAGES="qemu-system-ppc qemu-user-static gcc-powerpc-linux-gnu" $(MAKE) apt-install
330
351
 
@@ -359,20 +380,22 @@ lz4install:
359
380
  endif
360
381
 
361
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
+
362
385
  ifneq (,$(filter MSYS%,$(shell uname)))
363
386
  HOST_OS = MSYS
364
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
365
388
  endif
366
389
 
367
-
368
390
  #------------------------------------------------------------------------
369
391
  # target specific tests
370
392
  #------------------------------------------------------------------------
371
393
  ifneq (,$(filter $(HOST_OS),MSYS POSIX))
394
+ .PHONY: cmakebuild c89build gnu90build c99build gnu99build c11build bmix64build bmix32build bmi32build staticAnalyze
372
395
  cmakebuild:
373
396
  cmake --version
374
397
  $(RM) -r $(BUILDIR)/cmake/build
375
- mkdir $(BUILDIR)/cmake/build
398
+ $(MKDIR) $(BUILDIR)/cmake/build
376
399
  cd $(BUILDIR)/cmake/build; cmake -DCMAKE_INSTALL_PREFIX:PATH=~/install_test_dir $(CMAKE_PARAMS) ..
377
400
  $(MAKE) -C $(BUILDIR)/cmake/build -j4;
378
401
  $(MAKE) -C $(BUILDIR)/cmake/build install;
@@ -381,23 +404,23 @@ cmakebuild:
381
404
 
382
405
  c89build: clean
383
406
  $(CC) -v
384
- 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
385
408
 
386
409
  gnu90build: clean
387
410
  $(CC) -v
388
- CFLAGS="-std=gnu90 -Werror" $(MAKE) allmost
411
+ CFLAGS="-std=gnu90 -Werror -O0" $(MAKE) allmost
389
412
 
390
413
  c99build: clean
391
414
  $(CC) -v
392
- CFLAGS="-std=c99 -Werror" $(MAKE) allmost
415
+ CFLAGS="-std=c99 -Werror -O0" $(MAKE) allmost
393
416
 
394
417
  gnu99build: clean
395
418
  $(CC) -v
396
- CFLAGS="-std=gnu99 -Werror" $(MAKE) allmost
419
+ CFLAGS="-std=gnu99 -Werror -O0" $(MAKE) allmost
397
420
 
398
421
  c11build: clean
399
422
  $(CC) -v
400
- CFLAGS="-std=c11 -Werror" $(MAKE) allmost
423
+ CFLAGS="-std=c11 -Werror -O0" $(MAKE) allmost
401
424
 
402
425
  bmix64build: clean
403
426
  $(CC) -v
@@ -416,5 +439,5 @@ bmi32build: clean
416
439
  staticAnalyze: SCANBUILD ?= scan-build
417
440
  staticAnalyze:
418
441
  $(CC) -v
419
- CC=$(CC) CPPFLAGS=-g $(SCANBUILD) --status-bugs -v $(MAKE) allzstd examples contrib
442
+ CC=$(CC) CPPFLAGS=-g $(SCANBUILD) --status-bugs -v $(MAKE) zstd
420
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
@@ -178,13 +200,15 @@ The output binary will be in `buck-out/gen/programs/`.
178
200
 
179
201
  ## Testing
180
202
 
181
- You can run quick local smoke tests by executing the `playTest.sh` script from the `src/tests` directory.
182
- Two env variables `$ZSTD_BIN` and `$DATAGEN_BIN` are needed for the test script to locate the zstd and datagen binary.
183
- For information on CI testing, please refer to TESTING.md
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`.
184
207
 
185
208
  ## Status
186
209
 
187
- 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.
188
212
  Zstandard is considered safe for production environments.
189
213
 
190
214
  ## License
@@ -193,7 +217,7 @@ Zstandard is dual-licensed under [BSD](LICENSE) and [GPLv2](COPYING).
193
217
 
194
218
  ## Contributing
195
219
 
196
- The "dev" branch is the one where all contributions are merged before reaching "master".
197
- If you plan to propose a patch, please commit into the "dev" branch, or its own feature branch.
198
- 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.
199
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