extzstd 0.3 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.ja.md +8 -0
- data/README.md +1 -1
- data/contrib/zstd/CHANGELOG +94 -0
- data/contrib/zstd/CONTRIBUTING.md +351 -1
- data/contrib/zstd/Makefile +32 -10
- data/contrib/zstd/README.md +33 -10
- data/contrib/zstd/TESTING.md +2 -2
- data/contrib/zstd/appveyor.yml +42 -4
- data/contrib/zstd/lib/Makefile +128 -60
- data/contrib/zstd/lib/README.md +47 -16
- data/contrib/zstd/lib/common/bitstream.h +38 -39
- data/contrib/zstd/lib/common/compiler.h +40 -5
- data/contrib/zstd/lib/common/cpu.h +1 -1
- data/contrib/zstd/lib/common/debug.c +11 -31
- data/contrib/zstd/lib/common/debug.h +11 -31
- data/contrib/zstd/lib/common/entropy_common.c +13 -33
- data/contrib/zstd/lib/common/error_private.c +2 -1
- data/contrib/zstd/lib/common/error_private.h +6 -2
- data/contrib/zstd/lib/common/fse.h +12 -32
- data/contrib/zstd/lib/common/fse_decompress.c +12 -35
- data/contrib/zstd/lib/common/huf.h +15 -33
- data/contrib/zstd/lib/common/mem.h +75 -2
- data/contrib/zstd/lib/common/pool.c +8 -4
- data/contrib/zstd/lib/common/pool.h +2 -2
- data/contrib/zstd/lib/common/threading.c +50 -4
- data/contrib/zstd/lib/common/threading.h +36 -4
- data/contrib/zstd/lib/common/xxhash.c +23 -35
- data/contrib/zstd/lib/common/xxhash.h +11 -31
- data/contrib/zstd/lib/common/zstd_common.c +1 -1
- data/contrib/zstd/lib/common/zstd_errors.h +2 -1
- data/contrib/zstd/lib/common/zstd_internal.h +154 -26
- data/contrib/zstd/lib/compress/fse_compress.c +17 -40
- data/contrib/zstd/lib/compress/hist.c +15 -35
- data/contrib/zstd/lib/compress/hist.h +12 -32
- data/contrib/zstd/lib/compress/huf_compress.c +92 -92
- data/contrib/zstd/lib/compress/zstd_compress.c +1191 -1330
- data/contrib/zstd/lib/compress/zstd_compress_internal.h +317 -55
- data/contrib/zstd/lib/compress/zstd_compress_literals.c +158 -0
- data/contrib/zstd/lib/compress/zstd_compress_literals.h +29 -0
- data/contrib/zstd/lib/compress/zstd_compress_sequences.c +419 -0
- data/contrib/zstd/lib/compress/zstd_compress_sequences.h +54 -0
- data/contrib/zstd/lib/compress/zstd_compress_superblock.c +845 -0
- data/contrib/zstd/lib/compress/zstd_compress_superblock.h +32 -0
- data/contrib/zstd/lib/compress/zstd_cwksp.h +525 -0
- data/contrib/zstd/lib/compress/zstd_double_fast.c +65 -43
- data/contrib/zstd/lib/compress/zstd_double_fast.h +2 -2
- data/contrib/zstd/lib/compress/zstd_fast.c +92 -66
- data/contrib/zstd/lib/compress/zstd_fast.h +2 -2
- data/contrib/zstd/lib/compress/zstd_lazy.c +74 -42
- data/contrib/zstd/lib/compress/zstd_lazy.h +1 -1
- data/contrib/zstd/lib/compress/zstd_ldm.c +32 -10
- data/contrib/zstd/lib/compress/zstd_ldm.h +7 -2
- data/contrib/zstd/lib/compress/zstd_opt.c +81 -114
- data/contrib/zstd/lib/compress/zstd_opt.h +1 -1
- data/contrib/zstd/lib/compress/zstdmt_compress.c +95 -51
- data/contrib/zstd/lib/compress/zstdmt_compress.h +3 -2
- data/contrib/zstd/lib/decompress/huf_decompress.c +76 -60
- data/contrib/zstd/lib/decompress/zstd_ddict.c +12 -8
- data/contrib/zstd/lib/decompress/zstd_ddict.h +2 -2
- data/contrib/zstd/lib/decompress/zstd_decompress.c +292 -172
- data/contrib/zstd/lib/decompress/zstd_decompress_block.c +459 -338
- data/contrib/zstd/lib/decompress/zstd_decompress_block.h +3 -3
- data/contrib/zstd/lib/decompress/zstd_decompress_internal.h +18 -4
- data/contrib/zstd/lib/deprecated/zbuff.h +9 -8
- data/contrib/zstd/lib/deprecated/zbuff_common.c +2 -2
- data/contrib/zstd/lib/deprecated/zbuff_compress.c +1 -1
- data/contrib/zstd/lib/deprecated/zbuff_decompress.c +1 -1
- data/contrib/zstd/lib/dictBuilder/cover.c +164 -54
- data/contrib/zstd/lib/dictBuilder/cover.h +52 -7
- data/contrib/zstd/lib/dictBuilder/fastcover.c +60 -43
- data/contrib/zstd/lib/dictBuilder/zdict.c +43 -19
- data/contrib/zstd/lib/dictBuilder/zdict.h +56 -28
- data/contrib/zstd/lib/legacy/zstd_legacy.h +8 -4
- data/contrib/zstd/lib/legacy/zstd_v01.c +110 -110
- data/contrib/zstd/lib/legacy/zstd_v01.h +1 -1
- data/contrib/zstd/lib/legacy/zstd_v02.c +23 -13
- data/contrib/zstd/lib/legacy/zstd_v02.h +1 -1
- data/contrib/zstd/lib/legacy/zstd_v03.c +23 -13
- data/contrib/zstd/lib/legacy/zstd_v03.h +1 -1
- data/contrib/zstd/lib/legacy/zstd_v04.c +30 -17
- data/contrib/zstd/lib/legacy/zstd_v04.h +1 -1
- data/contrib/zstd/lib/legacy/zstd_v05.c +113 -102
- data/contrib/zstd/lib/legacy/zstd_v05.h +2 -2
- data/contrib/zstd/lib/legacy/zstd_v06.c +20 -18
- data/contrib/zstd/lib/legacy/zstd_v06.h +1 -1
- data/contrib/zstd/lib/legacy/zstd_v07.c +25 -19
- data/contrib/zstd/lib/legacy/zstd_v07.h +1 -1
- data/contrib/zstd/lib/libzstd.pc.in +3 -2
- data/contrib/zstd/lib/zstd.h +265 -88
- data/ext/extzstd.h +1 -1
- data/ext/libzstd_conf.h +8 -0
- data/ext/zstd_common.c +1 -3
- data/ext/zstd_compress.c +3 -3
- data/ext/zstd_decompress.c +1 -5
- data/ext/zstd_dictbuilder.c +2 -3
- data/ext/zstd_dictbuilder_fastcover.c +1 -3
- data/ext/zstd_legacy_v01.c +2 -0
- data/ext/zstd_legacy_v02.c +2 -0
- data/ext/zstd_legacy_v03.c +2 -0
- data/ext/zstd_legacy_v04.c +2 -0
- data/ext/zstd_legacy_v05.c +2 -0
- data/ext/zstd_legacy_v06.c +2 -0
- data/ext/zstd_legacy_v07.c +2 -0
- data/lib/extzstd.rb +18 -10
- data/lib/extzstd/version.rb +1 -1
- metadata +15 -6
data/contrib/zstd/Makefile
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# ################################################################
|
2
|
-
# Copyright (c) 2015-
|
2
|
+
# Copyright (c) 2015-2020, Yann Collet, Facebook, Inc.
|
3
3
|
# All rights reserved.
|
4
4
|
#
|
5
5
|
# This source code is licensed under both the BSD-style license (found in the
|
6
6
|
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
7
7
|
# in the COPYING file in the root directory of this source tree).
|
8
|
+
# You may select, at your option, one of the above-listed licenses.
|
8
9
|
# ################################################################
|
9
10
|
|
10
11
|
PRGDIR = programs
|
@@ -17,7 +18,16 @@ FUZZDIR = $(TESTDIR)/fuzz
|
|
17
18
|
# Define nul output
|
18
19
|
VOID = /dev/null
|
19
20
|
|
20
|
-
|
21
|
+
# When cross-compiling from linux to windows, you might
|
22
|
+
# need to specify this as "Windows." Fedora build fails
|
23
|
+
# without it.
|
24
|
+
#
|
25
|
+
# Note: mingw-w64 build from linux to windows does not
|
26
|
+
# fail on other tested distros (ubuntu, debian) even
|
27
|
+
# without manually specifying the TARGET_SYSTEM.
|
28
|
+
TARGET_SYSTEM ?= $(OS)
|
29
|
+
|
30
|
+
ifneq (,$(filter Windows%,$(TARGET_SYSTEM)))
|
21
31
|
EXT =.exe
|
22
32
|
else
|
23
33
|
EXT =
|
@@ -35,7 +45,7 @@ allmost: allzstd zlibwrapper
|
|
35
45
|
|
36
46
|
# skip zwrapper, can't build that on alternate architectures without the proper zlib installed
|
37
47
|
.PHONY: allzstd
|
38
|
-
allzstd: lib
|
48
|
+
allzstd: lib-all
|
39
49
|
$(MAKE) -C $(PRGDIR) all
|
40
50
|
$(MAKE) -C $(TESTDIR) all
|
41
51
|
|
@@ -45,7 +55,7 @@ all32:
|
|
45
55
|
$(MAKE) -C $(TESTDIR) all32
|
46
56
|
|
47
57
|
.PHONY: lib lib-release libzstd.a
|
48
|
-
lib lib-release :
|
58
|
+
lib lib-release lib-all :
|
49
59
|
@$(MAKE) -C $(ZSTDDIR) $@
|
50
60
|
|
51
61
|
.PHONY: zstd zstd-release
|
@@ -69,6 +79,7 @@ test: MOREFLAGS += -g -DDEBUGLEVEL=$(DEBUGLEVEL) -Werror
|
|
69
79
|
test:
|
70
80
|
MOREFLAGS="$(MOREFLAGS)" $(MAKE) -j -C $(PRGDIR) allVariants
|
71
81
|
$(MAKE) -C $(TESTDIR) $@
|
82
|
+
ZSTD=../../programs/zstd $(MAKE) -C doc/educational_decoder test
|
72
83
|
|
73
84
|
## shortest: same as `make check`
|
74
85
|
.PHONY: shortest
|
@@ -79,6 +90,13 @@ shortest:
|
|
79
90
|
.PHONY: check
|
80
91
|
check: shortest
|
81
92
|
|
93
|
+
.PHONY: automated_benchmarking
|
94
|
+
automated_benchmarking:
|
95
|
+
$(MAKE) -C $(TESTDIR) $@
|
96
|
+
|
97
|
+
.PHONY: benchmarking
|
98
|
+
benchmarking: automated_benchmarking
|
99
|
+
|
82
100
|
## examples: build all examples in `/examples` directory
|
83
101
|
.PHONY: examples
|
84
102
|
examples: lib
|
@@ -99,8 +117,9 @@ man:
|
|
99
117
|
contrib: lib
|
100
118
|
$(MAKE) -C contrib/pzstd all
|
101
119
|
$(MAKE) -C contrib/seekable_format/examples all
|
102
|
-
$(MAKE) -C contrib/adaptive-compression all
|
103
120
|
$(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
|
104
123
|
|
105
124
|
.PHONY: cleanTabs
|
106
125
|
cleanTabs:
|
@@ -116,7 +135,6 @@ clean:
|
|
116
135
|
@$(MAKE) -C contrib/gen_html $@ > $(VOID)
|
117
136
|
@$(MAKE) -C contrib/pzstd $@ > $(VOID)
|
118
137
|
@$(MAKE) -C contrib/seekable_format/examples $@ > $(VOID)
|
119
|
-
@$(MAKE) -C contrib/adaptive-compression $@ > $(VOID)
|
120
138
|
@$(MAKE) -C contrib/largeNbDicts $@ > $(VOID)
|
121
139
|
@$(RM) zstd$(EXT) zstdmt$(EXT) tmp*
|
122
140
|
@$(RM) -r lz4
|
@@ -337,7 +355,7 @@ endif
|
|
337
355
|
|
338
356
|
ifneq (,$(filter MSYS%,$(shell uname)))
|
339
357
|
HOST_OS = MSYS
|
340
|
-
CMAKE_PARAMS = -G"MSYS Makefiles" -DZSTD_MULTITHREAD_SUPPORT:BOOL=OFF -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON
|
358
|
+
CMAKE_PARAMS = -G"MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug -DZSTD_MULTITHREAD_SUPPORT:BOOL=OFF -DZSTD_BUILD_STATIC:BOOL=ON -DZSTD_BUILD_TESTS:BOOL=ON
|
341
359
|
endif
|
342
360
|
|
343
361
|
|
@@ -349,11 +367,15 @@ cmakebuild:
|
|
349
367
|
cmake --version
|
350
368
|
$(RM) -r $(BUILDIR)/cmake/build
|
351
369
|
mkdir $(BUILDIR)/cmake/build
|
352
|
-
cd $(BUILDIR)/cmake/build
|
370
|
+
cd $(BUILDIR)/cmake/build; cmake -DCMAKE_INSTALL_PREFIX:PATH=~/install_test_dir $(CMAKE_PARAMS) ..
|
371
|
+
$(MAKE) -C $(BUILDIR)/cmake/build -j4;
|
372
|
+
$(MAKE) -C $(BUILDIR)/cmake/build install;
|
373
|
+
$(MAKE) -C $(BUILDIR)/cmake/build uninstall;
|
374
|
+
cd $(BUILDIR)/cmake/build; ctest -V -L Medium
|
353
375
|
|
354
|
-
|
376
|
+
c89build: clean
|
355
377
|
$(CC) -v
|
356
|
-
CFLAGS="-std=
|
378
|
+
CFLAGS="-std=c89 -Werror" $(MAKE) allmost # will fail, due to missing support for `long long`
|
357
379
|
|
358
380
|
gnu90build: clean
|
359
381
|
$(CC) -v
|
data/contrib/zstd/README.md
CHANGED
@@ -15,6 +15,7 @@ a list of known ports and bindings is provided on [Zstandard homepage](http://ww
|
|
15
15
|
[![Build status][AppveyorDevBadge]][AppveyorLink]
|
16
16
|
[![Build status][CircleDevBadge]][CircleLink]
|
17
17
|
[![Build status][CirrusDevBadge]][CirrusLink]
|
18
|
+
[![Fuzzing Status][OSSFuzzBadge]][OSSFuzzLink]
|
18
19
|
|
19
20
|
[travisDevBadge]: https://travis-ci.org/facebook/zstd.svg?branch=dev "Continuous Integration test suite"
|
20
21
|
[travisLink]: https://travis-ci.org/facebook/zstd
|
@@ -24,14 +25,16 @@ a list of known ports and bindings is provided on [Zstandard homepage](http://ww
|
|
24
25
|
[CircleLink]: https://circleci.com/gh/facebook/zstd
|
25
26
|
[CirrusDevBadge]: https://api.cirrus-ci.com/github/facebook/zstd.svg?branch=dev
|
26
27
|
[CirrusLink]: https://cirrus-ci.com/github/facebook/zstd
|
28
|
+
[OSSFuzzBadge]: https://oss-fuzz-build-logs.storage.googleapis.com/badges/zstd.svg
|
29
|
+
[OSSFuzzLink]: https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:zstd
|
27
30
|
|
28
31
|
## Benchmarks
|
29
32
|
|
30
33
|
For reference, several fast compression algorithms were tested and compared
|
31
|
-
on a server running Arch Linux (`Linux version 5.
|
34
|
+
on a server running Arch Linux (`Linux version 5.5.11-arch1-1`),
|
32
35
|
with a Core i9-9900K CPU @ 5.0GHz,
|
33
36
|
using [lzbench], an open-source in-memory benchmark by @inikep
|
34
|
-
compiled with [gcc]
|
37
|
+
compiled with [gcc] 9.3.0,
|
35
38
|
on the [Silesia compression corpus].
|
36
39
|
|
37
40
|
[lzbench]: https://github.com/inikep/lzbench
|
@@ -40,18 +43,26 @@ on the [Silesia compression corpus].
|
|
40
43
|
|
41
44
|
| Compressor name | Ratio | Compression| Decompress.|
|
42
45
|
| --------------- | ------| -----------| ---------- |
|
43
|
-
| **zstd 1.4.
|
44
|
-
| zlib 1.2.11 -1 | 2.743 |
|
45
|
-
| brotli 1.0.7 -0 | 2.
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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 |
|
51
58
|
|
52
59
|
[zlib]: http://www.zlib.net/
|
53
60
|
[LZ4]: http://www.lz4.org/
|
54
61
|
|
62
|
+
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.
|
65
|
+
|
55
66
|
Zstd can also offer stronger compression ratios at the cost of compression speed.
|
56
67
|
Speed vs Compression trade-off is configurable by small increments.
|
57
68
|
Decompression speed is preserved and remains roughly the same at all settings,
|
@@ -140,6 +151,18 @@ example about how Meson is used to build this project.
|
|
140
151
|
|
141
152
|
Note that default build type is **release**.
|
142
153
|
|
154
|
+
### VCPKG
|
155
|
+
You can build and install zstd [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager:
|
156
|
+
|
157
|
+
git clone https://github.com/Microsoft/vcpkg.git
|
158
|
+
cd vcpkg
|
159
|
+
./bootstrap-vcpkg.sh
|
160
|
+
./vcpkg integrate install
|
161
|
+
./vcpkg install zstd
|
162
|
+
|
163
|
+
The zstd port in vcpkg is kept up to date by Microsoft team members and community contributors.
|
164
|
+
If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
|
165
|
+
|
143
166
|
### Visual Studio (Windows)
|
144
167
|
|
145
168
|
Going into `build` directory, you will find additional possibilities:
|
data/contrib/zstd/TESTING.md
CHANGED
@@ -11,7 +11,7 @@ They consist of the following tests:
|
|
11
11
|
- Compilation on all supported targets (x86, x86_64, ARM, AArch64, PowerPC, and PowerPC64)
|
12
12
|
- Compilation on various versions of gcc, clang, and g++
|
13
13
|
- `tests/playTests.sh` on x86_64, without the tests on long data (CLI tests)
|
14
|
-
- Small tests (`tests/legacy.c`, `tests/longmatch.c
|
14
|
+
- Small tests (`tests/legacy.c`, `tests/longmatch.c`) on x64_64
|
15
15
|
|
16
16
|
Medium Tests
|
17
17
|
------------
|
@@ -19,7 +19,7 @@ Medium tests run on every commit and pull request to `dev` branch, on TravisCI.
|
|
19
19
|
They consist of the following tests:
|
20
20
|
- The following tests run with UBsan and Asan on x86_64 and x86, as well as with
|
21
21
|
Msan on x86_64
|
22
|
-
- `tests/playTests.sh --test-
|
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
25
|
- Valgrind Test (`make -C tests valgrindTest`) (testing CLI and fuzzer under valgrind)
|
data/contrib/zstd/appveyor.yml
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# Following tests are run _only_ on master branch
|
2
|
+
# To reproduce these tests, it's possible to push into a branch `appveyorTest`
|
3
|
+
# or a branch `visual*`, they will intentionnally trigger `master` tests
|
4
|
+
|
1
5
|
-
|
2
6
|
version: 1.0.{build}
|
3
7
|
branches:
|
@@ -10,7 +14,7 @@
|
|
10
14
|
- COMPILER: "gcc"
|
11
15
|
HOST: "mingw"
|
12
16
|
PLATFORM: "x64"
|
13
|
-
SCRIPT: "make allzstd MOREFLAGS=-static && make -C tests
|
17
|
+
SCRIPT: "make allzstd MOREFLAGS=-static && make -C tests fullbench-lib"
|
14
18
|
ARTIFACT: "true"
|
15
19
|
BUILD: "true"
|
16
20
|
- COMPILER: "gcc"
|
@@ -165,21 +169,28 @@
|
|
165
169
|
- SET "FUZZERTEST=-T30s"
|
166
170
|
- if [%HOST%]==[visual] if [%CONFIGURATION%]==[Release] (
|
167
171
|
CD tests &&
|
168
|
-
SET
|
172
|
+
SET ZSTD_BIN=./zstd.exe&&
|
173
|
+
SET DATAGEN_BIN=./datagen.exe&&
|
169
174
|
sh -e playTests.sh --test-large-data &&
|
170
175
|
fullbench.exe -i1 &&
|
171
176
|
fullbench.exe -i1 -P0 &&
|
172
|
-
fuzzer_VS2008_%PLATFORM%_Release.exe %FUZZERTEST% &&
|
173
|
-
fuzzer_VS2010_%PLATFORM%_Release.exe %FUZZERTEST% &&
|
174
177
|
fuzzer_VS2012_%PLATFORM%_Release.exe %FUZZERTEST% &&
|
175
178
|
fuzzer_VS2013_%PLATFORM%_Release.exe %FUZZERTEST% &&
|
176
179
|
fuzzer_VS2015_%PLATFORM%_Release.exe %FUZZERTEST%
|
177
180
|
)
|
178
181
|
|
182
|
+
|
183
|
+
# The following tests are for regular pushes
|
184
|
+
# into `dev` or some feature branch
|
185
|
+
# There run less tests, for shorter feedback loop
|
186
|
+
|
179
187
|
-
|
180
188
|
version: 1.0.{build}
|
181
189
|
environment:
|
182
190
|
matrix:
|
191
|
+
- COMPILER: "gcc"
|
192
|
+
HOST: "cygwin"
|
193
|
+
PLATFORM: "x64"
|
183
194
|
- COMPILER: "gcc"
|
184
195
|
HOST: "mingw"
|
185
196
|
PLATFORM: "x64"
|
@@ -213,6 +224,14 @@
|
|
213
224
|
install:
|
214
225
|
- ECHO Installing %COMPILER% %PLATFORM% %CONFIGURATION%
|
215
226
|
- SET PATH_ORIGINAL=%PATH%
|
227
|
+
- if [%HOST%]==[cygwin] (
|
228
|
+
ECHO Installing Cygwin Packages &&
|
229
|
+
C:\cygwin64\setup-x86_64.exe -qnNdO -R "C:\cygwin64" -g -P ^
|
230
|
+
gcc-g++,^
|
231
|
+
gcc,^
|
232
|
+
cmake,^
|
233
|
+
make
|
234
|
+
)
|
216
235
|
- if [%HOST%]==[mingw] (
|
217
236
|
SET "PATH_MINGW32=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin" &&
|
218
237
|
SET "PATH_MINGW64=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin" &&
|
@@ -225,6 +244,17 @@
|
|
225
244
|
|
226
245
|
build_script:
|
227
246
|
- ECHO Building %COMPILER% %PLATFORM% %CONFIGURATION%
|
247
|
+
- if [%HOST%]==[cygwin] (
|
248
|
+
set CHERE_INVOKING=yes &&
|
249
|
+
set CC=%COMPILER% &&
|
250
|
+
C:\cygwin64\bin\bash --login -c "
|
251
|
+
set -e;
|
252
|
+
cd build/cmake;
|
253
|
+
CFLAGS='-Werror' cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Debug -DZSTD_BUILD_TESTS:BOOL=ON -DZSTD_FUZZER_FLAGS=-T30s -DZSTD_ZSTREAM_FLAGS=-T30s .;
|
254
|
+
make -j4;
|
255
|
+
ctest -V -L Medium;
|
256
|
+
"
|
257
|
+
)
|
228
258
|
- if [%HOST%]==[mingw] (
|
229
259
|
( if [%PLATFORM%]==[x64] (
|
230
260
|
SET "PATH=%PATH_MINGW64%;%PATH_ORIGINAL%"
|
@@ -249,3 +279,11 @@
|
|
249
279
|
COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2015_%PLATFORM%_%CONFIGURATION%.exe &&
|
250
280
|
COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe tests\
|
251
281
|
)
|
282
|
+
|
283
|
+
|
284
|
+
test_script:
|
285
|
+
- ECHO Testing %COMPILER% %PLATFORM% %CONFIGURATION%
|
286
|
+
- if [%HOST%]==[mingw] (
|
287
|
+
set "CC=%COMPILER%" &&
|
288
|
+
make check
|
289
|
+
)
|
data/contrib/zstd/lib/Makefile
CHANGED
@@ -1,12 +1,24 @@
|
|
1
1
|
# ################################################################
|
2
|
-
# Copyright (c) 2015-
|
2
|
+
# Copyright (c) 2015-2020, Yann Collet, Facebook, Inc.
|
3
3
|
# All rights reserved.
|
4
4
|
#
|
5
5
|
# This source code is licensed under both the BSD-style license (found in the
|
6
6
|
# LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
7
7
|
# in the COPYING file in the root directory of this source tree).
|
8
|
+
# You may select, at your option, one of the above-listed licenses.
|
8
9
|
# ################################################################
|
9
10
|
|
11
|
+
Q = $(if $(filter 1,$(V) $(VERBOSE)),,@)
|
12
|
+
|
13
|
+
# When cross-compiling from linux to windows, you might
|
14
|
+
# need to specify this as "Windows." Fedora build fails
|
15
|
+
# without it.
|
16
|
+
#
|
17
|
+
# Note: mingw-w64 build from linux to windows does not
|
18
|
+
# fail on other tested distros (ubuntu, debian) even
|
19
|
+
# without manually specifying the TARGET_SYSTEM.
|
20
|
+
TARGET_SYSTEM ?= $(OS)
|
21
|
+
|
10
22
|
# Version numbers
|
11
23
|
LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h`
|
12
24
|
LIBVER_MINOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h`
|
@@ -17,12 +29,12 @@ LIBVER_MINOR := $(shell echo $(LIBVER_MINOR_SCRIPT))
|
|
17
29
|
LIBVER_PATCH := $(shell echo $(LIBVER_PATCH_SCRIPT))
|
18
30
|
LIBVER := $(shell echo $(LIBVER_SCRIPT))
|
19
31
|
VERSION?= $(LIBVER)
|
32
|
+
CCVER := $(shell $(CC) --version)
|
20
33
|
|
21
|
-
CPPFLAGS+= -
|
22
|
-
ifeq ($(
|
34
|
+
CPPFLAGS+= -DXXH_NAMESPACE=ZSTD_
|
35
|
+
ifeq ($(TARGET_SYSTEM),Windows_NT) # MinGW assumed
|
23
36
|
CPPFLAGS += -D__USE_MINGW_ANSI_STDIO # compatibility with %zu formatting
|
24
37
|
endif
|
25
|
-
CFLAGS ?= -O3
|
26
38
|
DEBUGFLAGS= -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
|
27
39
|
-Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
|
28
40
|
-Wstrict-prototypes -Wundef -Wpointer-arith \
|
@@ -45,18 +57,50 @@ ZDICT_FILES := $(sort $(wildcard dictBuilder/*.c))
|
|
45
57
|
ZDEPR_FILES := $(sort $(wildcard deprecated/*.c))
|
46
58
|
ZSTD_FILES := $(ZSTDCOMMON_FILES)
|
47
59
|
|
48
|
-
|
60
|
+
ifeq ($(findstring GCC,$(CCVER)),GCC)
|
61
|
+
decompress/zstd_decompress_block.o : CFLAGS+=-fno-tree-vectorize
|
62
|
+
endif
|
63
|
+
|
64
|
+
# This is a helper variable that configures a bunch of other variables to new,
|
65
|
+
# space-optimized defaults.
|
66
|
+
ZSTD_LIB_MINIFY ?= 0
|
67
|
+
ifneq ($(ZSTD_LIB_MINIFY), 0)
|
68
|
+
HAVE_CC_OZ ?= $(shell echo "" | $(CC) -Oz -x c -c - -o /dev/null 2> /dev/null && echo 1 || echo 0)
|
69
|
+
ZSTD_LEGACY_SUPPORT ?= 0
|
70
|
+
ZSTD_LIB_DEPRECATED ?= 0
|
71
|
+
HUF_FORCE_DECOMPRESS_X1 ?= 1
|
72
|
+
ZSTD_FORCE_DECOMPRESS_SHORT ?= 1
|
73
|
+
ZSTD_NO_INLINE ?= 1
|
74
|
+
ZSTD_STRIP_ERROR_STRINGS ?= 1
|
75
|
+
ifneq ($(HAVE_CC_OZ), 0)
|
76
|
+
# Some compilers (clang) support an even more space-optimized setting.
|
77
|
+
CFLAGS += -Oz
|
78
|
+
else
|
79
|
+
CFLAGS += -Os
|
80
|
+
endif
|
81
|
+
CFLAGS += -fno-stack-protector -fomit-frame-pointer -fno-ident \
|
82
|
+
-DDYNAMIC_BMI2=0 -DNDEBUG
|
83
|
+
else
|
84
|
+
CFLAGS += -O3
|
85
|
+
endif
|
86
|
+
|
87
|
+
# Modules
|
49
88
|
ZSTD_LIB_COMPRESSION ?= 1
|
50
89
|
ZSTD_LIB_DECOMPRESSION ?= 1
|
51
90
|
ZSTD_LIB_DICTBUILDER ?= 1
|
52
91
|
ZSTD_LIB_DEPRECATED ?= 1
|
92
|
+
|
93
|
+
# Legacy support
|
94
|
+
ZSTD_LEGACY_SUPPORT ?= 5
|
95
|
+
ZSTD_LEGACY_MULTITHREADED_API ?= 0
|
96
|
+
|
97
|
+
# Build size optimizations
|
53
98
|
HUF_FORCE_DECOMPRESS_X1 ?= 0
|
54
99
|
HUF_FORCE_DECOMPRESS_X2 ?= 0
|
55
100
|
ZSTD_FORCE_DECOMPRESS_SHORT ?= 0
|
56
101
|
ZSTD_FORCE_DECOMPRESS_LONG ?= 0
|
57
102
|
ZSTD_NO_INLINE ?= 0
|
58
103
|
ZSTD_STRIP_ERROR_STRINGS ?= 0
|
59
|
-
ZSTD_LEGACY_MULTITHREADED_API ?= 0
|
60
104
|
|
61
105
|
ifeq ($(ZSTD_LIB_COMPRESSION), 0)
|
62
106
|
ZSTD_LIB_DICTBUILDER = 0
|
@@ -116,7 +160,6 @@ ifneq ($(ZSTD_LEGACY_SUPPORT), 0)
|
|
116
160
|
ifeq ($(shell test $(ZSTD_LEGACY_SUPPORT) -lt 8; echo $$?), 0)
|
117
161
|
ZSTD_FILES += $(shell ls legacy/*.c | $(GREP) 'v0[$(ZSTD_LEGACY_SUPPORT)-7]')
|
118
162
|
endif
|
119
|
-
CPPFLAGS += -I./legacy
|
120
163
|
endif
|
121
164
|
CPPFLAGS += -DZSTD_LEGACY_SUPPORT=$(ZSTD_LEGACY_SUPPORT)
|
122
165
|
|
@@ -137,26 +180,26 @@ else
|
|
137
180
|
endif
|
138
181
|
|
139
182
|
|
140
|
-
.PHONY: default all clean install uninstall
|
183
|
+
.PHONY: default lib-all all clean install uninstall
|
141
184
|
|
142
185
|
default: lib-release
|
143
186
|
|
187
|
+
# alias
|
188
|
+
lib-all: all
|
189
|
+
|
144
190
|
all: lib
|
145
191
|
|
146
192
|
libzstd.a: ARFLAGS = rcs
|
147
193
|
libzstd.a: $(ZSTD_OBJ)
|
148
194
|
@echo compiling static library
|
149
|
-
|
150
|
-
|
151
|
-
libzstd.a-mt: CPPFLAGS += -DZSTD_MULTITHREAD
|
152
|
-
libzstd.a-mt: libzstd.a
|
195
|
+
$(Q)$(AR) $(ARFLAGS) $@ $^
|
153
196
|
|
154
|
-
ifneq (,$(filter Windows%,$(
|
197
|
+
ifneq (,$(filter Windows%,$(TARGET_SYSTEM)))
|
155
198
|
|
156
199
|
LIBZSTD = dll\libzstd.dll
|
157
200
|
$(LIBZSTD): $(ZSTD_FILES)
|
158
201
|
@echo compiling dynamic library $(LIBVER)
|
159
|
-
$(CC) $(FLAGS) -DZSTD_DLL_EXPORT=1 -Wl,--out-implib,dll\libzstd.
|
202
|
+
$(CC) $(FLAGS) -DZSTD_DLL_EXPORT=1 -Wl,--out-implib,dll\libzstd.dll.a -shared $^ -o $@
|
160
203
|
|
161
204
|
else
|
162
205
|
|
@@ -164,27 +207,30 @@ LIBZSTD = libzstd.$(SHARED_EXT_VER)
|
|
164
207
|
$(LIBZSTD): LDFLAGS += -shared -fPIC -fvisibility=hidden
|
165
208
|
$(LIBZSTD): $(ZSTD_FILES)
|
166
209
|
@echo compiling dynamic library $(LIBVER)
|
167
|
-
|
210
|
+
$(Q)$(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@
|
168
211
|
@echo creating versioned links
|
169
|
-
|
170
|
-
|
212
|
+
$(Q)ln -sf $@ libzstd.$(SHARED_EXT_MAJOR)
|
213
|
+
$(Q)ln -sf $@ libzstd.$(SHARED_EXT)
|
171
214
|
|
172
215
|
endif
|
173
216
|
|
174
|
-
|
217
|
+
.PHONY: libzstd
|
175
218
|
libzstd : $(LIBZSTD)
|
176
219
|
|
177
|
-
|
178
|
-
|
220
|
+
.PHONY: lib
|
221
|
+
lib : libzstd.a libzstd
|
179
222
|
|
180
|
-
|
223
|
+
.PHONY: lib-mt
|
224
|
+
%-mt : CPPFLAGS += -DZSTD_MULTITHREAD
|
225
|
+
%-mt : LDFLAGS += -pthread
|
226
|
+
%-mt : %
|
227
|
+
@echo multi-threading build completed
|
181
228
|
|
182
|
-
|
183
|
-
|
229
|
+
.PHONY: lib-release
|
230
|
+
%-release : DEBUGFLAGS :=
|
231
|
+
%-release : %
|
232
|
+
@echo release build completed
|
184
233
|
|
185
|
-
lib-release lib-release-mt: DEBUGFLAGS :=
|
186
|
-
lib-release: lib
|
187
|
-
lib-release-mt: lib-mt
|
188
234
|
|
189
235
|
# Special case : building library in single-thread mode _and_ without zstdmt_compress.c
|
190
236
|
ZSTDMT_FILES = compress/zstdmt_compress.c
|
@@ -193,20 +239,22 @@ libzstd-nomt: LDFLAGS += -shared -fPIC -fvisibility=hidden
|
|
193
239
|
libzstd-nomt: $(ZSTD_NOMT_FILES)
|
194
240
|
@echo compiling single-thread dynamic library $(LIBVER)
|
195
241
|
@echo files : $(ZSTD_NOMT_FILES)
|
196
|
-
|
242
|
+
$(Q)$(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@
|
197
243
|
|
198
244
|
clean:
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
245
|
+
$(Q)$(RM) -r *.dSYM # macOS-specific
|
246
|
+
$(Q)$(RM) core *.o *.a *.gcda *.$(SHARED_EXT) *.$(SHARED_EXT).* libzstd.pc
|
247
|
+
$(Q)$(RM) dll/libzstd.dll dll/libzstd.lib libzstd-nomt*
|
248
|
+
$(Q)$(RM) common/*.o compress/*.o decompress/*.o dictBuilder/*.o legacy/*.o deprecated/*.o
|
203
249
|
@echo Cleaning library completed
|
204
250
|
|
205
251
|
#-----------------------------------------------------------------------------
|
206
|
-
# make install is validated only for
|
252
|
+
# make install is validated only for below listed environments
|
207
253
|
#-----------------------------------------------------------------------------
|
208
254
|
ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS Haiku))
|
209
255
|
|
256
|
+
all: libzstd.pc
|
257
|
+
|
210
258
|
DESTDIR ?=
|
211
259
|
# directory variables : GNU conventions prefer lowercase
|
212
260
|
# see https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html
|
@@ -214,11 +262,31 @@ DESTDIR ?=
|
|
214
262
|
prefix ?= /usr/local
|
215
263
|
PREFIX ?= $(prefix)
|
216
264
|
exec_prefix ?= $(PREFIX)
|
217
|
-
|
265
|
+
EXEC_PREFIX ?= $(exec_prefix)
|
266
|
+
libdir ?= $(EXEC_PREFIX)/lib
|
218
267
|
LIBDIR ?= $(libdir)
|
219
268
|
includedir ?= $(PREFIX)/include
|
220
269
|
INCLUDEDIR ?= $(includedir)
|
221
270
|
|
271
|
+
PCLIBDIR ?= $(shell echo "$(LIBDIR)" | sed -n -E -e "s@^$(EXEC_PREFIX)(/|$$)@@p")
|
272
|
+
PCINCDIR ?= $(shell echo "$(INCLUDEDIR)" | sed -n -E -e "s@^$(PREFIX)(/|$$)@@p")
|
273
|
+
|
274
|
+
ifeq (,$(PCLIBDIR))
|
275
|
+
# Additional prefix check is required, since the empty string is technically a
|
276
|
+
# valid PCLIBDIR
|
277
|
+
ifeq (,$(shell echo "$(LIBDIR)" | sed -n -E -e "\\@^$(EXEC_PREFIX)(/|$$)@ p"))
|
278
|
+
$(error configured libdir ($(LIBDIR)) is outside of prefix ($(PREFIX)), can't generate pkg-config file)
|
279
|
+
endif
|
280
|
+
endif
|
281
|
+
|
282
|
+
ifeq (,$(PCINCDIR))
|
283
|
+
# Additional prefix check is required, since the empty string is technically a
|
284
|
+
# valid PCINCDIR
|
285
|
+
ifeq (,$(shell echo "$(INCLUDEDIR)" | sed -n -E -e "\\@^$(PREFIX)(/|$$)@ p"))
|
286
|
+
$(error configured includedir ($(INCLUDEDIR)) is outside of exec_prefix ($(EXEC_PREFIX)), can't generate pkg-config file)
|
287
|
+
endif
|
288
|
+
endif
|
289
|
+
|
222
290
|
ifneq (,$(filter $(shell uname),FreeBSD NetBSD DragonFly))
|
223
291
|
PKGCONFIGDIR ?= $(PREFIX)/libdata/pkgconfig
|
224
292
|
else
|
@@ -238,49 +306,49 @@ INSTALL_DATA ?= $(INSTALL) -m 644
|
|
238
306
|
libzstd.pc:
|
239
307
|
libzstd.pc: libzstd.pc.in
|
240
308
|
@echo creating pkgconfig
|
241
|
-
@sed -e 's|@PREFIX@|$(PREFIX)|' \
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
309
|
+
$(Q)@sed -E -e 's|@PREFIX@|$(PREFIX)|' \
|
310
|
+
-e 's|@LIBDIR@|$(PCLIBDIR)|' \
|
311
|
+
-e 's|@INCLUDEDIR@|$(PCINCDIR)|' \
|
312
|
+
-e 's|@VERSION@|$(VERSION)|' \
|
313
|
+
$< >$@
|
246
314
|
|
247
315
|
install: install-pc install-static install-shared install-includes
|
248
316
|
@echo zstd static and shared library installed
|
249
317
|
|
250
318
|
install-pc: libzstd.pc
|
251
|
-
|
252
|
-
|
319
|
+
$(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(PKGCONFIGDIR)/
|
320
|
+
$(Q)$(INSTALL_DATA) libzstd.pc $(DESTDIR)$(PKGCONFIGDIR)/
|
253
321
|
|
254
322
|
install-static: libzstd.a
|
255
323
|
@echo Installing static library
|
256
|
-
|
257
|
-
|
324
|
+
$(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR)/
|
325
|
+
$(Q)$(INSTALL_DATA) libzstd.a $(DESTDIR)$(LIBDIR)
|
258
326
|
|
259
327
|
install-shared: libzstd
|
260
328
|
@echo Installing shared library
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
329
|
+
$(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(LIBDIR)/
|
330
|
+
$(Q)$(INSTALL_PROGRAM) $(LIBZSTD) $(DESTDIR)$(LIBDIR)
|
331
|
+
$(Q)ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_MAJOR)
|
332
|
+
$(Q)ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT)
|
265
333
|
|
266
334
|
install-includes:
|
267
335
|
@echo Installing includes
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
336
|
+
$(Q)$(INSTALL) -d -m 755 $(DESTDIR)$(INCLUDEDIR)/
|
337
|
+
$(Q)$(INSTALL_DATA) zstd.h $(DESTDIR)$(INCLUDEDIR)
|
338
|
+
$(Q)$(INSTALL_DATA) common/zstd_errors.h $(DESTDIR)$(INCLUDEDIR)
|
339
|
+
$(Q)$(INSTALL_DATA) deprecated/zbuff.h $(DESTDIR)$(INCLUDEDIR) # prototypes generate deprecation warnings
|
340
|
+
$(Q)$(INSTALL_DATA) dictBuilder/zdict.h $(DESTDIR)$(INCLUDEDIR)
|
273
341
|
|
274
342
|
uninstall:
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
343
|
+
$(Q)$(RM) $(DESTDIR)$(LIBDIR)/libzstd.a
|
344
|
+
$(Q)$(RM) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT)
|
345
|
+
$(Q)$(RM) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_MAJOR)
|
346
|
+
$(Q)$(RM) $(DESTDIR)$(LIBDIR)/$(LIBZSTD)
|
347
|
+
$(Q)$(RM) $(DESTDIR)$(PKGCONFIGDIR)/libzstd.pc
|
348
|
+
$(Q)$(RM) $(DESTDIR)$(INCLUDEDIR)/zstd.h
|
349
|
+
$(Q)$(RM) $(DESTDIR)$(INCLUDEDIR)/zstd_errors.h
|
350
|
+
$(Q)$(RM) $(DESTDIR)$(INCLUDEDIR)/zbuff.h # Deprecated streaming functions
|
351
|
+
$(Q)$(RM) $(DESTDIR)$(INCLUDEDIR)/zdict.h
|
284
352
|
@echo zstd libraries successfully uninstalled
|
285
353
|
|
286
354
|
endif
|