extzstd 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY.ja.md +13 -0
  3. data/README.md +17 -14
  4. data/contrib/zstd/{NEWS → CHANGELOG} +115 -2
  5. data/contrib/zstd/CODE_OF_CONDUCT.md +5 -0
  6. data/contrib/zstd/Makefile +99 -53
  7. data/contrib/zstd/README.md +59 -39
  8. data/contrib/zstd/TESTING.md +1 -1
  9. data/contrib/zstd/appveyor.yml +17 -6
  10. data/contrib/zstd/lib/BUCK +29 -2
  11. data/contrib/zstd/lib/Makefile +118 -21
  12. data/contrib/zstd/lib/README.md +84 -44
  13. data/contrib/zstd/lib/common/bitstream.h +17 -33
  14. data/contrib/zstd/lib/common/compiler.h +62 -8
  15. data/contrib/zstd/lib/common/cpu.h +215 -0
  16. data/contrib/zstd/lib/common/debug.c +44 -0
  17. data/contrib/zstd/lib/common/debug.h +134 -0
  18. data/contrib/zstd/lib/common/entropy_common.c +16 -1
  19. data/contrib/zstd/lib/common/error_private.c +7 -0
  20. data/contrib/zstd/lib/common/fse.h +48 -44
  21. data/contrib/zstd/lib/common/fse_decompress.c +3 -3
  22. data/contrib/zstd/lib/common/huf.h +169 -113
  23. data/contrib/zstd/lib/common/mem.h +20 -2
  24. data/contrib/zstd/lib/common/pool.c +135 -49
  25. data/contrib/zstd/lib/common/pool.h +40 -21
  26. data/contrib/zstd/lib/common/threading.c +2 -2
  27. data/contrib/zstd/lib/common/threading.h +12 -12
  28. data/contrib/zstd/lib/common/xxhash.c +3 -2
  29. data/contrib/zstd/lib/common/zstd_common.c +3 -6
  30. data/contrib/zstd/lib/common/zstd_errors.h +17 -7
  31. data/contrib/zstd/lib/common/zstd_internal.h +76 -48
  32. data/contrib/zstd/lib/compress/fse_compress.c +89 -209
  33. data/contrib/zstd/lib/compress/hist.c +203 -0
  34. data/contrib/zstd/lib/compress/hist.h +95 -0
  35. data/contrib/zstd/lib/compress/huf_compress.c +188 -80
  36. data/contrib/zstd/lib/compress/zstd_compress.c +2500 -1203
  37. data/contrib/zstd/lib/compress/zstd_compress_internal.h +463 -62
  38. data/contrib/zstd/lib/compress/zstd_double_fast.c +321 -131
  39. data/contrib/zstd/lib/compress/zstd_double_fast.h +13 -4
  40. data/contrib/zstd/lib/compress/zstd_fast.c +335 -108
  41. data/contrib/zstd/lib/compress/zstd_fast.h +12 -6
  42. data/contrib/zstd/lib/compress/zstd_lazy.c +654 -313
  43. data/contrib/zstd/lib/compress/zstd_lazy.h +44 -16
  44. data/contrib/zstd/lib/compress/zstd_ldm.c +310 -420
  45. data/contrib/zstd/lib/compress/zstd_ldm.h +63 -26
  46. data/contrib/zstd/lib/compress/zstd_opt.c +773 -325
  47. data/contrib/zstd/lib/compress/zstd_opt.h +31 -5
  48. data/contrib/zstd/lib/compress/zstdmt_compress.c +1468 -518
  49. data/contrib/zstd/lib/compress/zstdmt_compress.h +96 -45
  50. data/contrib/zstd/lib/decompress/huf_decompress.c +518 -282
  51. data/contrib/zstd/lib/decompress/zstd_ddict.c +240 -0
  52. data/contrib/zstd/lib/decompress/zstd_ddict.h +44 -0
  53. data/contrib/zstd/lib/decompress/zstd_decompress.c +613 -1513
  54. data/contrib/zstd/lib/decompress/zstd_decompress_block.c +1311 -0
  55. data/contrib/zstd/lib/decompress/zstd_decompress_block.h +59 -0
  56. data/contrib/zstd/lib/decompress/zstd_decompress_internal.h +175 -0
  57. data/contrib/zstd/lib/dictBuilder/cover.c +194 -113
  58. data/contrib/zstd/lib/dictBuilder/cover.h +112 -0
  59. data/contrib/zstd/lib/dictBuilder/divsufsort.c +3 -3
  60. data/contrib/zstd/lib/dictBuilder/fastcover.c +740 -0
  61. data/contrib/zstd/lib/dictBuilder/zdict.c +142 -106
  62. data/contrib/zstd/lib/dictBuilder/zdict.h +115 -49
  63. data/contrib/zstd/lib/legacy/zstd_legacy.h +44 -12
  64. data/contrib/zstd/lib/legacy/zstd_v01.c +41 -10
  65. data/contrib/zstd/lib/legacy/zstd_v01.h +12 -7
  66. data/contrib/zstd/lib/legacy/zstd_v02.c +37 -12
  67. data/contrib/zstd/lib/legacy/zstd_v02.h +12 -7
  68. data/contrib/zstd/lib/legacy/zstd_v03.c +38 -12
  69. data/contrib/zstd/lib/legacy/zstd_v03.h +12 -7
  70. data/contrib/zstd/lib/legacy/zstd_v04.c +55 -174
  71. data/contrib/zstd/lib/legacy/zstd_v04.h +12 -7
  72. data/contrib/zstd/lib/legacy/zstd_v05.c +59 -31
  73. data/contrib/zstd/lib/legacy/zstd_v05.h +12 -7
  74. data/contrib/zstd/lib/legacy/zstd_v06.c +48 -20
  75. data/contrib/zstd/lib/legacy/zstd_v06.h +10 -5
  76. data/contrib/zstd/lib/legacy/zstd_v07.c +62 -29
  77. data/contrib/zstd/lib/legacy/zstd_v07.h +10 -5
  78. data/contrib/zstd/lib/zstd.h +1346 -832
  79. data/ext/extzstd.c +27 -19
  80. data/ext/extzstd_stream.c +20 -4
  81. data/ext/zstd_compress.c +1 -0
  82. data/ext/zstd_decompress.c +4 -0
  83. data/ext/zstd_dictbuilder.c +4 -0
  84. data/ext/zstd_dictbuilder_fastcover.c +5 -0
  85. data/lib/extzstd.rb +52 -220
  86. data/lib/extzstd/version.rb +1 -1
  87. metadata +21 -7
  88. data/contrib/zstd/circle.yml +0 -63
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac53f14163b10f2d2ff1043515de3ccc35dea14716a47d828c3f196fc936ba4c
4
- data.tar.gz: 70921d9089ababb5cba49de455f8918c304e9f74d6390b1a906ac82949695031
3
+ metadata.gz: c3ec6930c7601090d5974e8a9d163de8a28029b2effe8ebc8ccebe87a7227550
4
+ data.tar.gz: cd76622c5d838900587e0064b1fc16249ce3d708cd5e5096a9bcc804c2bcd0d2
5
5
  SHA512:
6
- metadata.gz: 1c44f1d339939af1b33c3beb719d2d1c31eaae0880d363527266c5e27170d6f45b4b00d5d0215e56d97398af85795db994f05a8ae1c55967952a974a3bb8c0b7
7
- data.tar.gz: 61d55f2d24cf363d0c2ce7485448528a0876f6cf3694d82c5ff93b51594edffccd8c60293b72d5b0bac51917cdc106e8cd055277169c81b2424d65145261a8b4
6
+ metadata.gz: 50c5d80163a87da20da9ed94eb9c639dab474af89b8dbddc5676b8e607ca0dd2a5dc3ab3aa0dce06a4997918411d8562c4b23ad3eeeacc18d7c6644caacbfc42
7
+ data.tar.gz: c93ca3099b708d7f55b41a6156067a9ceaddebc6eb2e0700740d4fbd19983bd9f456108fa23027e6891966aef287469f24b89f6598be414bca924793ac878c1e
@@ -1,5 +1,18 @@
1
1
  # extzstd の更新履歴
2
2
 
3
+ ## extzstd-0.3 (平成31年4月)
4
+
5
+ * zstd-1.4.0 への更新
6
+ * Zstd::Encoder#write に文字列以外を与えた場合でも文字列に変換するようにして受け入れるように修正
7
+ * Zstd::Decoder#read の buf 引数として nil を与えた場合例外が発生していたため修正
8
+ * zstd に関する例外が発生する時、例外オブジェクトの生成に失敗していたため修正
9
+ * Zstd::EncodeParameter.new に新しいキーワード引数を追加
10
+ * Zstd::Encoder に #close と #pos メソッドを追加
11
+ * `.to_zstd` / `.unzstd` メソッドを `Zstd` リファインメントとして追加
12
+ * `encode` の別名として `compress` を追加
13
+ * `decode` の別名として `decompress` / `uncompress` を追加
14
+
15
+
3
16
  ## extzstd-0.2 (平成30年2月1日 木曜日)
4
17
 
5
18
  * zstd-1.3.3 への更新
data/README.md CHANGED
@@ -3,20 +3,6 @@
3
3
  This is unofficial ruby bindings for the data compression library
4
4
  [Zstd (Zstandard)](https://github.com/facebook/zstd).
5
5
 
6
- * package name: extzstd
7
- * version: 0.2
8
- * product quality: TECHNICAL PREVIEW, UNSTABLE
9
- * license: [BSD-2-clause License](LICENSE)
10
- * author: dearblue <mailto:dearblue@users.noreply.github.com>
11
- * project page: <https://github.com/dearblue/ruby-extzstd>
12
- * support ruby: ruby-2.2+
13
- * dependency ruby gems: (none)
14
- * dependency library: (none)
15
- * bundled external C library:
16
- * [zstd-1.3.3](https://github.com/facebook/zstd)
17
- under selectable dual licensed ([BSD-3-clause License](https://github.com/facebook/zstd/blob/v1.3.3/LICENSE) and [GNU General Public License, version 2](https://github.com/facebook/zstd/blob/v1.3.3/COPYING))
18
- by [facebook](https://github.com/facebook)
19
-
20
6
  "extzstd" is supported decompression with the legacy formats (zstd-0.1 - 0.7).
21
7
 
22
8
  * [HISTORY (in Japanese)](HISTORY.ja.md)
@@ -85,3 +71,20 @@ File.open("sample.zst", "rb") do |file|
85
71
  end
86
72
  end
87
73
  ```
74
+
75
+
76
+ ## Specification
77
+
78
+ * package name: extzstd
79
+ * version: 0.3
80
+ * product quality: TECHNICAL PREVIEW, UNSTABLE
81
+ * license: [BSD-2-clause License](LICENSE)
82
+ * author: dearblue <mailto:dearblue@users.noreply.github.com>
83
+ * project page: <https://github.com/dearblue/ruby-extzstd>
84
+ * support ruby: ruby-2.4+
85
+ * dependency ruby gems: (none)
86
+ * dependency library: (none)
87
+ * bundled external C library (git submodules):
88
+ * [zstd-1.4.0](https://github.com/facebook/zstd)
89
+ under selectable dual licensed ([BSD-3-clause License](https://github.com/facebook/zstd/blob/v1.4.0/LICENSE) and [GNU General Public License, version 2](https://github.com/facebook/zstd/blob/v1.4.0/COPYING))
90
+ by [facebook](https://github.com/facebook)
@@ -1,5 +1,118 @@
1
+ v1.4.0
2
+ perf: Improve level 1 compression speed in most scenarios by 6% by @gbtucker and @terrelln
3
+ api: Move the advanced API, including all functions in the staging section, to the stable section
4
+ api: Make ZSTD_e_flush and ZSTD_e_end block for maximum forward progress
5
+ api: Rename ZSTD_CCtxParam_getParameter to ZSTD_CCtxParams_getParameter
6
+ api: Rename ZSTD_CCtxParam_setParameter to ZSTD_CCtxParams_setParameter
7
+ api: Don't export ZSTDMT functions from the shared library by default
8
+ api: Require ZSTD_MULTITHREAD to be defined to use ZSTDMT
9
+ api: Add ZSTD_decompressBound() to provide an upper bound on decompressed size by @shakeelrao
10
+ api: Fix ZSTD_decompressDCtx() corner cases with a dictionary
11
+ api: Move ZSTD_getDictID_*() functions to the stable section
12
+ api: Add ZSTD_c_literalCompressionMode flag to enable or disable literal compression by @terrelln
13
+ api: Allow compression parameters to be set when a dictionary is used
14
+ api: Allow setting parameters before or after ZSTD_CCtx_loadDictionary() is called
15
+ api: Fix ZSTD_estimateCStreamSize_usingCCtxParams()
16
+ api: Setting ZSTD_d_maxWindowLog to 0 means use the default
17
+ cli: Ensure that a dictionary is not used to compress itself by @shakeelrao
18
+ cli: Add --[no-]compress-literals flag to enable or disable literal compression
19
+ doc: Update the examples to use the advanced API
20
+ doc: Explain how to transition from old streaming functions to the advanced API in the header
21
+ build: Improve the Windows release packages
22
+ build: Improve CMake build by @hjmjohnson
23
+ build: Build fixes for FreeBSD by @lwhsu
24
+ build: Remove redundant warnings by @thatsafunnyname
25
+ build: Fix tests on OpenBSD by @bket
26
+ build: Extend fuzzer build system to work with the new clang engine
27
+ build: CMake now creates the libzstd.so.1 symlink
28
+ build: Improve Menson build by @lzutao
29
+ misc: Fix symbolic link detection on FreeBSD
30
+ misc: Use physical core count for -T0 on FreeBSD by @cemeyer
31
+ misc: Fix zstd --list on truncated files by @kostmo
32
+ misc: Improve logging in debug mode by @felixhandte
33
+ misc: Add CirrusCI tests by @lwhsu
34
+ misc: Optimize dictionary memory usage in corner cases
35
+ misc: Improve the dictionary builder on small or homogeneous data
36
+ misc: Fix spelling across the repo by @jsoref
37
+
38
+ v1.3.8
39
+ perf: better decompression speed on large files (+7%) and cold dictionaries (+15%)
40
+ perf: slightly better compression ratio at high compression modes
41
+ api : finalized advanced API, last stage before "stable" status
42
+ api : new --rsyncable mode, by @terrelln
43
+ api : support decompression of empty frames into NULL (used to be an error) (#1385)
44
+ build: new set of macros to build a minimal size decoder, by @felixhandte
45
+ build: fix compilation on MIPS32, reported by @clbr (#1441)
46
+ build: fix compilation with multiple -arch flags, by @ryandesign
47
+ build: highly upgraded meson build, by @lzutao
48
+ build: improved buck support, by @obelisk
49
+ build: fix cmake script : can create debug build, by @pitrou
50
+ build: Makefile : grep works on both colored consoles and systems without color support
51
+ build: fixed zstd-pgo, by @bmwiedemann
52
+ cli : support ZSTD_CLEVEL environment variable, by @yijinfb (#1423)
53
+ cli : --no-progress flag, preserving final summary (#1371), by @terrelln
54
+ cli : ensure destination file is not source file (#1422)
55
+ cli : clearer error messages, especially when input file not present
56
+ doc : clarified zstd_compression_format.md, by @ulikunitz
57
+ misc: fixed zstdgrep, returns 1 on failure, by @lzutao
58
+ misc: NEWS renamed as CHANGELOG, in accordance with fboss
59
+
60
+ v1.3.7
61
+ perf: slightly better decompression speed on clang (depending on hardware target)
62
+ fix : performance of dictionary compression for small input < 4 KB at levels 9 and 10
63
+ build: no longer build backtrace by default in release mode; restrict further automatic mode
64
+ build: control backtrace support through build macro BACKTRACE
65
+ misc: added man pages for zstdless and zstdgrep, by @samrussell
66
+
67
+ v1.3.6
68
+ perf: much faster dictionary builder, by @jenniferliu
69
+ perf: faster dictionary compression on small data when using multiple contexts, by @felixhandte
70
+ perf: faster dictionary decompression when using a very large number of dictionaries simultaneously
71
+ cli : fix : does no longer overwrite destination when source does not exist (#1082)
72
+ cli : new command --adapt, for automatic compression level adaptation
73
+ api : fix : block api can be streamed with > 4 GB, reported by @catid
74
+ api : reduced ZSTD_DDict size by 2 KB
75
+ api : minimum negative compression level is defined, and can be queried using ZSTD_minCLevel().
76
+ build: support Haiku target, by @korli
77
+ build: Read Legacy format is limited to v0.5+ by default. Can be changed at compile time with macro ZSTD_LEGACY_SUPPORT.
78
+ doc : zstd_compression_format.md updated to match wording in IETF RFC 8478
79
+ misc: tests/paramgrill, a parameter optimizer, by @GeorgeLu97
80
+
81
+ v1.3.5
82
+ perf: much faster dictionary compression, by @felixhandte
83
+ perf: small quality improvement for dictionary generation, by @terrelln
84
+ perf: slightly improved high compression levels (notably level 19)
85
+ mem : automatic memory release for long duration contexts
86
+ cli : fix : overlapLog can be manually set
87
+ cli : fix : decoding invalid lz4 frames
88
+ api : fix : performance degradation for dictionary compression when using advanced API, by @terrelln
89
+ api : change : clarify ZSTD_CCtx_reset() vs ZSTD_CCtx_resetParameters(), by @terrelln
90
+ build: select custom libzstd scope through control macros, by @GeorgeLu97
91
+ build: OpenBSD patch, by @bket
92
+ build: make and make all are compatible with -j
93
+ doc : clarify zstd_compression_format.md, updated for IETF RFC process
94
+ misc: pzstd compatible with reproducible compilation, by @lamby
95
+
96
+ v1.3.4
97
+ perf: faster speed (especially decoding speed) on recent cpus (haswell+)
98
+ perf: much better performance associating --long with multi-threading, by @terrelln
99
+ perf: better compression at levels 13-15
100
+ cli : asynchronous compression by default, for faster experience (use --single-thread for former behavior)
101
+ cli : smoother status report in multi-threading mode
102
+ cli : added command --fast=#, for faster compression modes
103
+ cli : fix crash when not overwriting existing files, by Pádraig Brady (@pixelb)
104
+ api : `nbThreads` becomes `nbWorkers` : 1 triggers asynchronous mode
105
+ api : compression levels can be negative, for even more speed
106
+ api : ZSTD_getFrameProgression() : get precise progress status of ZSTDMT anytime
107
+ api : ZSTDMT can accept new compression parameters during compression
108
+ api : implemented all advanced dictionary decompression prototypes
109
+ build: improved meson recipe, by Shawn Landden (@shawnl)
110
+ build: VS2017 scripts, by @HaydnTrigg
111
+ misc: all /contrib projects fixed
112
+ misc: added /contrib/docker script by @gyscos
113
+
1
114
  v1.3.3
2
- perf: faster zstd_opt strategy (levels 17-19)
115
+ perf: faster zstd_opt strategy (levels 16-19)
3
116
  fix : bug #944 : multithreading with shared ditionary and large data, reported by @gsliepen
4
117
  cli : fix : content size written in header by default
5
118
  cli : fix : improved LZ4 format support, by @felixhandte
@@ -163,7 +276,7 @@ v1.0.0
163
276
  Change Licensing, all project is now BSD, Copyright Facebook
164
277
  Small decompression speed improvement
165
278
  API : Streaming API supports legacy format
166
- API : ZDICT_getDictID(), ZSTD_sizeof_{CCtx, DCtx, CStream, DStream}(), ZSTD_setDStreamParamter()
279
+ API : ZDICT_getDictID(), ZSTD_sizeof_{CCtx, DCtx, CStream, DStream}(), ZSTD_setDStreamParameter()
167
280
  CLI supports legacy formats v0.4+
168
281
  Fixed : compression fails on certain huge files, reported by Jesse McGrew
169
282
  Enhanced documentation, by Przemyslaw Skibinski
@@ -0,0 +1,5 @@
1
+ # Code of Conduct
2
+
3
+ Facebook has adopted a Code of Conduct that we expect project participants to adhere to.
4
+ Please read the [full text](https://code.fb.com/codeofconduct/)
5
+ so that you can understand what actions will and will not be tolerated.
@@ -23,20 +23,19 @@ else
23
23
  EXT =
24
24
  endif
25
25
 
26
+ ## default: Build lib-release and zstd-release
26
27
  .PHONY: default
27
28
  default: lib-release zstd-release
28
29
 
29
30
  .PHONY: all
30
- all: | allmost examples manual
31
+ all: allmost examples manual contrib
31
32
 
32
33
  .PHONY: allmost
33
- allmost: allzstd
34
- $(MAKE) -C $(ZWRAPDIR) all
34
+ allmost: allzstd zlibwrapper
35
35
 
36
- #skip zwrapper, can't build that on alternate architectures without the proper zlib installed
36
+ # skip zwrapper, can't build that on alternate architectures without the proper zlib installed
37
37
  .PHONY: allzstd
38
- allzstd:
39
- $(MAKE) -C $(ZSTDDIR) all
38
+ allzstd: lib
40
39
  $(MAKE) -C $(PRGDIR) all
41
40
  $(MAKE) -C $(TESTDIR) all
42
41
 
@@ -45,49 +44,64 @@ all32:
45
44
  $(MAKE) -C $(PRGDIR) zstd32
46
45
  $(MAKE) -C $(TESTDIR) all32
47
46
 
48
- .PHONY: lib
49
- lib:
47
+ .PHONY: lib lib-release libzstd.a
48
+ lib lib-release :
50
49
  @$(MAKE) -C $(ZSTDDIR) $@
51
50
 
52
- .PHONY: lib-release
53
- lib-release:
54
- @$(MAKE) -C $(ZSTDDIR)
55
-
56
- .PHONY: zstd
57
- zstd:
51
+ .PHONY: zstd zstd-release
52
+ zstd zstd-release:
58
53
  @$(MAKE) -C $(PRGDIR) $@
59
54
  cp $(PRGDIR)/zstd$(EXT) .
60
55
 
61
- .PHONY: zstd-release
62
- zstd-release:
63
- @$(MAKE) -C $(PRGDIR)
64
- cp $(PRGDIR)/zstd$(EXT) .
65
-
66
56
  .PHONY: zstdmt
67
57
  zstdmt:
68
58
  @$(MAKE) -C $(PRGDIR) $@
69
59
  cp $(PRGDIR)/zstd$(EXT) ./zstdmt$(EXT)
70
60
 
71
61
  .PHONY: zlibwrapper
72
- zlibwrapper:
73
- $(MAKE) -C $(ZWRAPDIR) test
62
+ zlibwrapper: lib
63
+ $(MAKE) -C $(ZWRAPDIR) all
74
64
 
75
- .PHONY: check
76
- check: shortest
65
+ ## test: run long-duration tests
66
+ .PHONY: test
67
+ DEBUGLEVEL ?= 1
68
+ test: MOREFLAGS += -g -DDEBUGLEVEL=$(DEBUGLEVEL) -Werror
69
+ test:
70
+ MOREFLAGS="$(MOREFLAGS)" $(MAKE) -j -C $(PRGDIR) allVariants
71
+ $(MAKE) -C $(TESTDIR) $@
77
72
 
78
- .PHONY: test shortest
79
- test shortest:
80
- $(MAKE) -C $(PRGDIR) allVariants MOREFLAGS="-g -DZSTD_DEBUG=1"
73
+ ## shortest: same as `make check`
74
+ .PHONY: shortest
75
+ shortest:
81
76
  $(MAKE) -C $(TESTDIR) $@
82
77
 
78
+ ## check: run basic tests for `zstd` cli
79
+ .PHONY: check
80
+ check: shortest
81
+
82
+ ## examples: build all examples in `/examples` directory
83
83
  .PHONY: examples
84
- examples:
84
+ examples: lib
85
85
  CPPFLAGS=-I../lib LDFLAGS=-L../lib $(MAKE) -C examples/ all
86
86
 
87
+ ## manual: generate API documentation in html format
87
88
  .PHONY: manual
88
89
  manual:
89
90
  $(MAKE) -C contrib/gen_html $@
90
91
 
92
+ ## man: generate man page
93
+ .PHONY: man
94
+ man:
95
+ $(MAKE) -C programs $@
96
+
97
+ ## contrib: build all supported projects in `/contrib` directory
98
+ .PHONY: contrib
99
+ contrib: lib
100
+ $(MAKE) -C contrib/pzstd all
101
+ $(MAKE) -C contrib/seekable_format/examples all
102
+ $(MAKE) -C contrib/adaptive-compression all
103
+ $(MAKE) -C contrib/largeNbDicts all
104
+
91
105
  .PHONY: cleanTabs
92
106
  cleanTabs:
93
107
  cd contrib; ./cleanTabs
@@ -100,23 +114,49 @@ clean:
100
114
  @$(MAKE) -C $(ZWRAPDIR) $@ > $(VOID)
101
115
  @$(MAKE) -C examples/ $@ > $(VOID)
102
116
  @$(MAKE) -C contrib/gen_html $@ > $(VOID)
117
+ @$(MAKE) -C contrib/pzstd $@ > $(VOID)
118
+ @$(MAKE) -C contrib/seekable_format/examples $@ > $(VOID)
119
+ @$(MAKE) -C contrib/adaptive-compression $@ > $(VOID)
120
+ @$(MAKE) -C contrib/largeNbDicts $@ > $(VOID)
103
121
  @$(RM) zstd$(EXT) zstdmt$(EXT) tmp*
104
122
  @$(RM) -r lz4
105
123
  @echo Cleaning completed
106
124
 
107
125
  #------------------------------------------------------------------------------
108
- # make install is validated only for Linux, OSX, Hurd and some BSD targets
126
+ # make install is validated only for Linux, macOS, Hurd and some BSD targets
109
127
  #------------------------------------------------------------------------------
110
- ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU FreeBSD DragonFly NetBSD MSYS_NT))
128
+ ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD DragonFly NetBSD MSYS_NT Haiku))
111
129
 
112
130
  HOST_OS = POSIX
113
- 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
131
+ 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
114
132
 
133
+ HAVE_COLORNEVER = $(shell echo a | egrep --color=never a > /dev/null 2> /dev/null && echo 1 || echo 0)
134
+ EGREP_OPTIONS ?=
135
+ ifeq ($HAVE_COLORNEVER, 1)
136
+ EGREP_OPTIONS += --color=never
137
+ endif
138
+ EGREP = egrep $(EGREP_OPTIONS)
139
+
140
+ # Print a two column output of targets and their description. To add a target description, put a
141
+ # comment in the Makefile with the format "## <TARGET>: <DESCRIPTION>". For example:
142
+ #
143
+ ## list: Print all targets and their descriptions (if provided)
115
144
  .PHONY: list
116
145
  list:
117
- @$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs
118
-
119
- .PHONY: install clangtest armtest usan asan uasan
146
+ @TARGETS=$$($(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null \
147
+ | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' \
148
+ | $(EGREP) -v -e '^[^[:alnum:]]' | sort); \
149
+ { \
150
+ printf "Target Name\tDescription\n"; \
151
+ printf "%0.s-" {1..16}; printf "\t"; printf "%0.s-" {1..40}; printf "\n"; \
152
+ for target in $$TARGETS; do \
153
+ line=$$($(EGREP) "^##[[:space:]]+$$target:" $(lastword $(MAKEFILE_LIST))); \
154
+ description=$$(echo $$line | awk '{i=index($$0,":"); print substr($$0,i+1)}' | xargs); \
155
+ printf "$$target\t$$description\n"; \
156
+ done \
157
+ } | column -t -s $$'\t'
158
+
159
+ .PHONY: install armtest usan asan uasan
120
160
  install:
121
161
  @$(MAKE) -C $(ZSTDDIR) $@
122
162
  @$(MAKE) -C $(PRGDIR) $@
@@ -148,7 +188,7 @@ gcc7build: clean
148
188
  .PHONY: clangbuild
149
189
  clangbuild: clean
150
190
  clang -v
151
- CXX=clang++ CC=clang $(MAKE) all MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation"
191
+ CXX=clang++ CC=clang CFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation" $(MAKE) all
152
192
 
153
193
  m32build: clean
154
194
  gcc -v
@@ -170,6 +210,7 @@ armfuzz: clean
170
210
  CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
171
211
 
172
212
  aarch64fuzz: clean
213
+ ld -v
173
214
  CC=aarch64-linux-gnu-gcc QEMU_SYS=qemu-aarch64-static MOREFLAGS="-static" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) fuzztest
174
215
 
175
216
  ppcfuzz: clean
@@ -191,10 +232,6 @@ gcc6test: clean
191
232
  gcc-6 -v
192
233
  $(MAKE) all CC=gcc-6 MOREFLAGS="-Werror"
193
234
 
194
- clangtest: clean
195
- clang -v
196
- $(MAKE) all CXX=clang-++ CC=clang MOREFLAGS="-Werror -Wconversion -Wno-sign-conversion -Wdocumentation"
197
-
198
235
  armtest: clean
199
236
  $(MAKE) -C $(TESTDIR) datagen # use native, faster
200
237
  $(MAKE) -C $(TESTDIR) test CC=arm-linux-gnueabi-gcc QEMU_SYS=qemu-arm-static ZSTDRTTEST= MOREFLAGS="-Werror -static" FUZZER_FLAGS=--no-big-tests
@@ -231,31 +268,31 @@ msanregressiontest:
231
268
  # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63303
232
269
 
233
270
  usan: clean
234
- $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=undefined"
271
+ $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=undefined -Werror"
235
272
 
236
273
  asan: clean
237
- $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address"
274
+ $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=address -Werror"
238
275
 
239
276
  asan-%: clean
240
- LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=address" $(MAKE) -C $(TESTDIR) $*
277
+ LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=address -Werror" $(MAKE) -C $(TESTDIR) $*
241
278
 
242
279
  msan: clean
243
- $(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=memory -fno-omit-frame-pointer" HAVE_LZMA=0 # datagen.c fails this test for no obvious reason
280
+ $(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
244
281
 
245
282
  msan-%: clean
246
- LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=memory -fno-omit-frame-pointer" FUZZER_FLAGS=--no-big-tests $(MAKE) -C $(TESTDIR) HAVE_LZMA=0 $*
283
+ 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 $*
247
284
 
248
285
  asan32: clean
249
286
  $(MAKE) -C $(TESTDIR) test32 CC=clang MOREFLAGS="-g -fsanitize=address"
250
287
 
251
288
  uasan: clean
252
- $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined"
289
+ $(MAKE) test CC=clang MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined -Werror"
253
290
 
254
291
  uasan-%: clean
255
- LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined" $(MAKE) -C $(TESTDIR) $*
292
+ LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize-recover=signed-integer-overflow -fsanitize=address,undefined -Werror" $(MAKE) -C $(TESTDIR) $*
256
293
 
257
294
  tsan-%: clean
258
- LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=thread" $(MAKE) -C $(TESTDIR) $* FUZZER_FLAGS=--no-big-tests
295
+ LDFLAGS=-fuse-ld=gold MOREFLAGS="-g -fno-sanitize-recover=all -fsanitize=thread -Werror" $(MAKE) -C $(TESTDIR) $* FUZZER_FLAGS=--no-big-tests
259
296
 
260
297
  apt-install:
261
298
  sudo apt-get -yq --no-install-suggests --no-install-recommends --force-yes install $(APT_PACKAGES)
@@ -279,6 +316,12 @@ libc6install:
279
316
  gcc6install: apt-add-repo
280
317
  APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-6 gcc-6-multilib" $(MAKE) apt-install
281
318
 
319
+ gcc7install: apt-add-repo
320
+ APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-7 gcc-7-multilib" $(MAKE) apt-install
321
+
322
+ gcc8install: apt-add-repo
323
+ APT_PACKAGES="libc6-dev-i386 gcc-multilib gcc-8 gcc-8-multilib" $(MAKE) apt-install
324
+
282
325
  gpp6install: apt-add-repo
283
326
  APT_PACKAGES="libc6-dev-i386 g++-multilib gcc-6 g++-6 g++-6-multilib" $(MAKE) apt-install
284
327
 
@@ -310,23 +353,23 @@ cmakebuild:
310
353
 
311
354
  c90build: clean
312
355
  $(CC) -v
313
- CFLAGS="-std=c90" $(MAKE) allmost # will fail, due to missing support for `long long`
356
+ CFLAGS="-std=c90 -Werror" $(MAKE) allmost # will fail, due to missing support for `long long`
314
357
 
315
358
  gnu90build: clean
316
359
  $(CC) -v
317
- CFLAGS="-std=gnu90" $(MAKE) allmost
360
+ CFLAGS="-std=gnu90 -Werror" $(MAKE) allmost
318
361
 
319
362
  c99build: clean
320
363
  $(CC) -v
321
- CFLAGS="-std=c99" $(MAKE) allmost
364
+ CFLAGS="-std=c99 -Werror" $(MAKE) allmost
322
365
 
323
366
  gnu99build: clean
324
367
  $(CC) -v
325
- CFLAGS="-std=gnu99" $(MAKE) allmost
368
+ CFLAGS="-std=gnu99 -Werror" $(MAKE) allmost
326
369
 
327
370
  c11build: clean
328
371
  $(CC) -v
329
- CFLAGS="-std=c11" $(MAKE) allmost
372
+ CFLAGS="-std=c11 -Werror" $(MAKE) allmost
330
373
 
331
374
  bmix64build: clean
332
375
  $(CC) -v
@@ -340,7 +383,10 @@ bmi32build: clean
340
383
  $(CC) -v
341
384
  CFLAGS="-O3 -mbmi -m32 -Werror" $(MAKE) -C $(TESTDIR) test
342
385
 
343
- staticAnalyze: clean
386
+ # static analyzer test uses clang's scan-build
387
+ # does not analyze zlibWrapper, due to detected issues in zlib source code
388
+ staticAnalyze: SCANBUILD ?= scan-build
389
+ staticAnalyze:
344
390
  $(CC) -v
345
- CPPFLAGS=-g scan-build --status-bugs -v $(MAKE) all
391
+ CC=$(CC) CPPFLAGS=-g $(SCANBUILD) --status-bugs -v $(MAKE) allzstd examples contrib
346
392
  endif