extzstd 0.1.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +5 -5
  2. data/HISTORY.ja.md +18 -0
  3. data/README.md +15 -50
  4. data/contrib/zstd/CONTRIBUTING.md +1 -1
  5. data/contrib/zstd/COPYING +339 -0
  6. data/contrib/zstd/Makefile +82 -51
  7. data/contrib/zstd/NEWS +92 -5
  8. data/contrib/zstd/README.md +50 -41
  9. data/contrib/zstd/appveyor.yml +164 -102
  10. data/contrib/zstd/circle.yml +10 -22
  11. data/contrib/zstd/lib/BUCK +31 -10
  12. data/contrib/zstd/lib/Makefile +57 -31
  13. data/contrib/zstd/lib/README.md +68 -37
  14. data/contrib/zstd/lib/common/bitstream.h +130 -76
  15. data/contrib/zstd/lib/common/compiler.h +86 -0
  16. data/contrib/zstd/lib/common/error_private.c +15 -11
  17. data/contrib/zstd/lib/common/error_private.h +8 -8
  18. data/contrib/zstd/lib/common/fse.h +19 -9
  19. data/contrib/zstd/lib/common/fse_decompress.c +3 -22
  20. data/contrib/zstd/lib/common/huf.h +68 -26
  21. data/contrib/zstd/lib/common/mem.h +23 -35
  22. data/contrib/zstd/lib/common/pool.c +123 -63
  23. data/contrib/zstd/lib/common/pool.h +19 -10
  24. data/contrib/zstd/lib/common/threading.c +11 -16
  25. data/contrib/zstd/lib/common/threading.h +52 -33
  26. data/contrib/zstd/lib/common/xxhash.c +28 -22
  27. data/contrib/zstd/lib/common/zstd_common.c +40 -27
  28. data/contrib/zstd/lib/common/zstd_errors.h +43 -34
  29. data/contrib/zstd/lib/common/zstd_internal.h +131 -123
  30. data/contrib/zstd/lib/compress/fse_compress.c +17 -33
  31. data/contrib/zstd/lib/compress/huf_compress.c +15 -9
  32. data/contrib/zstd/lib/compress/zstd_compress.c +2096 -2363
  33. data/contrib/zstd/lib/compress/zstd_compress_internal.h +462 -0
  34. data/contrib/zstd/lib/compress/zstd_double_fast.c +309 -0
  35. data/contrib/zstd/lib/compress/zstd_double_fast.h +29 -0
  36. data/contrib/zstd/lib/compress/zstd_fast.c +243 -0
  37. data/contrib/zstd/lib/compress/zstd_fast.h +31 -0
  38. data/contrib/zstd/lib/compress/zstd_lazy.c +765 -0
  39. data/contrib/zstd/lib/compress/zstd_lazy.h +39 -0
  40. data/contrib/zstd/lib/compress/zstd_ldm.c +707 -0
  41. data/contrib/zstd/lib/compress/zstd_ldm.h +68 -0
  42. data/contrib/zstd/lib/compress/zstd_opt.c +785 -0
  43. data/contrib/zstd/lib/compress/zstd_opt.h +19 -908
  44. data/contrib/zstd/lib/compress/zstdmt_compress.c +737 -327
  45. data/contrib/zstd/lib/compress/zstdmt_compress.h +88 -26
  46. data/contrib/zstd/lib/decompress/huf_decompress.c +158 -50
  47. data/contrib/zstd/lib/decompress/zstd_decompress.c +884 -699
  48. data/contrib/zstd/lib/deprecated/zbuff.h +5 -4
  49. data/contrib/zstd/lib/deprecated/zbuff_common.c +5 -5
  50. data/contrib/zstd/lib/deprecated/zbuff_compress.c +6 -4
  51. data/contrib/zstd/lib/deprecated/zbuff_decompress.c +5 -4
  52. data/contrib/zstd/lib/dictBuilder/cover.c +93 -77
  53. data/contrib/zstd/lib/dictBuilder/zdict.c +107 -92
  54. data/contrib/zstd/lib/dictBuilder/zdict.h +112 -102
  55. data/contrib/zstd/lib/legacy/zstd_legacy.h +9 -4
  56. data/contrib/zstd/lib/legacy/zstd_v01.c +7 -6
  57. data/contrib/zstd/lib/legacy/zstd_v01.h +5 -4
  58. data/contrib/zstd/lib/legacy/zstd_v02.c +27 -99
  59. data/contrib/zstd/lib/legacy/zstd_v02.h +5 -4
  60. data/contrib/zstd/lib/legacy/zstd_v03.c +26 -98
  61. data/contrib/zstd/lib/legacy/zstd_v03.h +5 -4
  62. data/contrib/zstd/lib/legacy/zstd_v04.c +22 -91
  63. data/contrib/zstd/lib/legacy/zstd_v04.h +5 -4
  64. data/contrib/zstd/lib/legacy/zstd_v05.c +23 -99
  65. data/contrib/zstd/lib/legacy/zstd_v05.h +5 -4
  66. data/contrib/zstd/lib/legacy/zstd_v06.c +22 -96
  67. data/contrib/zstd/lib/legacy/zstd_v06.h +5 -4
  68. data/contrib/zstd/lib/legacy/zstd_v07.c +19 -95
  69. data/contrib/zstd/lib/legacy/zstd_v07.h +5 -4
  70. data/contrib/zstd/lib/zstd.h +895 -271
  71. data/ext/extconf.rb +11 -2
  72. data/ext/extzstd.c +45 -128
  73. data/ext/extzstd.h +74 -31
  74. data/ext/extzstd_stream.c +401 -142
  75. data/ext/zstd_common.c +5 -0
  76. data/ext/zstd_compress.c +8 -0
  77. data/ext/zstd_decompress.c +1 -0
  78. data/ext/zstd_dictbuilder.c +2 -0
  79. data/lib/extzstd/version.rb +1 -1
  80. data/lib/extzstd.rb +48 -1
  81. data/test/test_basic.rb +9 -1
  82. metadata +17 -7
  83. data/HISTORY.ja +0 -10
  84. data/contrib/zstd/LICENSE-examples +0 -11
  85. data/contrib/zstd/PATENTS +0 -33
@@ -1,66 +1,95 @@
1
- version: 1.0.{build}
2
- environment:
3
- matrix:
4
- - COMPILER: "gcc"
5
- PLATFORM: "mingw64"
6
- MAKE_PARAMS: '"make test && make lib && make -C tests test-symbols fullbench-dll fullbench-lib"'
7
- - COMPILER: "gcc"
8
- PLATFORM: "mingw32"
9
- MAKE_PARAMS: '"make -C tests test-zstd test-fullbench test-fuzzer test-invalidDictionaries"'
10
- - COMPILER: "gcc"
11
- PLATFORM: "clang"
12
- MAKE_PARAMS: '"make -C tests zstd fullbench fuzzer paramgrill datagen CC=clang MOREFLAGS="--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion""'
13
- - COMPILER: "visual"
14
- CONFIGURATION: "Debug"
15
- PLATFORM: "x64"
16
- - COMPILER: "visual"
17
- CONFIGURATION: "Debug"
18
- PLATFORM: "Win32"
19
- - COMPILER: "visual"
20
- CONFIGURATION: "Release"
21
- PLATFORM: "x64"
22
- - COMPILER: "visual"
23
- CONFIGURATION: "Release"
24
- PLATFORM: "Win32"
1
+ -
2
+ version: 1.0.{build}
3
+ branches:
4
+ only:
5
+ - dev
6
+ - master
7
+ environment:
8
+ matrix:
9
+ - COMPILER: "gcc"
10
+ HOST: "mingw"
11
+ PLATFORM: "x64"
12
+ SCRIPT: "make allzstd MOREFLAGS=-static && make -C tests test-symbols fullbench-dll fullbench-lib"
13
+ ARTIFACT: "true"
14
+ BUILD: "true"
15
+ - COMPILER: "gcc"
16
+ HOST: "mingw"
17
+ PLATFORM: "x86"
18
+ SCRIPT: "make allzstd MOREFLAGS=-static"
19
+ ARTIFACT: "true"
20
+ BUILD: "true"
21
+ - COMPILER: "clang"
22
+ HOST: "mingw"
23
+ PLATFORM: "x64"
24
+ SCRIPT: "MOREFLAGS='--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion' make allzstd"
25
+ BUILD: "true"
25
26
 
26
- install:
27
+ - COMPILER: "gcc"
28
+ HOST: "mingw"
29
+ PLATFORM: "x64"
30
+ SCRIPT: ""
31
+ TEST: "cmake"
32
+
33
+ - COMPILER: "visual"
34
+ HOST: "visual"
35
+ PLATFORM: "x64"
36
+ CONFIGURATION: "Debug"
37
+ - COMPILER: "visual"
38
+ HOST: "visual"
39
+ PLATFORM: "Win32"
40
+ CONFIGURATION: "Debug"
41
+ - COMPILER: "visual"
42
+ HOST: "visual"
43
+ PLATFORM: "x64"
44
+ CONFIGURATION: "Release"
45
+ - COMPILER: "visual"
46
+ HOST: "visual"
47
+ PLATFORM: "Win32"
48
+ CONFIGURATION: "Release"
49
+
50
+ install:
27
51
  - ECHO Installing %COMPILER% %PLATFORM% %CONFIGURATION%
28
- - MKDIR bin
29
- - if [%COMPILER%]==[gcc] SET PATH_ORIGINAL=%PATH%
30
- - if [%COMPILER%]==[gcc] (
31
- SET "PATH_MINGW32=c:\MinGW\bin;c:\MinGW\usr\bin" &&
32
- SET "PATH_MINGW64=c:\msys64\mingw64\bin;c:\msys64\usr\bin" &&
33
- COPY C:\msys64\usr\bin\make.exe C:\MinGW\bin\make.exe &&
34
- COPY C:\MinGW\bin\gcc.exe C:\MinGW\bin\cc.exe
35
- ) else (
36
- IF [%PLATFORM%]==[x64] (SET ADDITIONALPARAM=/p:LibraryPath="C:\Program Files\Microsoft SDKs\Windows\v7.1\lib\x64;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\lib\amd64;")
52
+ - SET PATH_ORIGINAL=%PATH%
53
+ - if [%HOST%]==[mingw] (
54
+ SET "PATH_MINGW32=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin" &&
55
+ SET "PATH_MINGW64=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin" &&
56
+ COPY C:\msys64\usr\bin\make.exe C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin\make.exe &&
57
+ COPY C:\msys64\usr\bin\make.exe C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin\make.exe
37
58
  )
38
-
39
- build_script:
40
- - ECHO Building %COMPILER% %PLATFORM% %CONFIGURATION%
41
- - if [%PLATFORM%]==[mingw32] SET PATH=%PATH_MINGW32%;%PATH_ORIGINAL%
42
- - if [%PLATFORM%]==[mingw64] SET PATH=%PATH_MINGW64%;%PATH_ORIGINAL%
43
- - if [%PLATFORM%]==[clang] SET PATH=%PATH_MINGW64%;%PATH_ORIGINAL%
44
- - if [%COMPILER%]==[gcc] (
45
- ECHO *** &&
46
- ECHO *** Building %PLATFORM% &&
47
- ECHO *** &&
48
- make -v &&
49
- cc -v &&
50
- ECHO %MAKE_PARAMS% &&
51
- sh -c %MAKE_PARAMS%
59
+ - IF [%HOST%]==[visual] IF [%PLATFORM%]==[x64] (
60
+ SET ADDITIONALPARAM=/p:LibraryPath="C:\Program Files\Microsoft SDKs\Windows\v7.1\lib\x64;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\lib\amd64;"
52
61
  )
53
- - if [%PLATFORM%]==[clang] COPY tests\fuzzer.exe tests\fuzzer_clang.exe
54
- - if [%COMPILER%]==[gcc] if [%PLATFORM%]==[mingw64] (
55
- COPY programs\zstd.exe bin\zstd.exe &&
56
- appveyor PushArtifact bin\zstd.exe
62
+
63
+ build_script:
64
+ - if [%HOST%]==[mingw] (
65
+ ( if [%PLATFORM%]==[x64] (
66
+ SET "PATH=%PATH_MINGW64%;%PATH_ORIGINAL%"
67
+ ) else if [%PLATFORM%]==[x86] (
68
+ SET "PATH=%PATH_MINGW32%;%PATH_ORIGINAL%"
69
+ ) )
57
70
  )
58
- - if [%COMPILER%]==[gcc] if [%PLATFORM%]==[mingw32] (
59
- COPY programs\zstd.exe bin\zstd32.exe &&
60
- appveyor PushArtifact bin\zstd32.exe
71
+ - if [%HOST%]==[mingw] if [%BUILD%]==[true] (
72
+ make -v &&
73
+ sh -c "%COMPILER% -v" &&
74
+ ECHO Building zlib to static link &&
75
+ SET "CC=%COMPILER%" &&
76
+ sh -c "cd .. && git clone --depth 1 --branch v1.2.11 https://github.com/madler/zlib" &&
77
+ sh -c "cd ../zlib && make -f win32/Makefile.gcc libz.a"
78
+ ECHO Building zstd &&
79
+ SET "CPPFLAGS=-I../../zlib" &&
80
+ SET "LDFLAGS=../../zlib/libz.a" &&
81
+ sh -c "%SCRIPT%" &&
82
+ ( if [%COMPILER%]==[gcc] if [%ARTIFACT%]==[true]
83
+ lib\dll\example\build_package.bat &&
84
+ make -C programs DEBUGFLAGS= clean zstd &&
85
+ cd programs\ && 7z a -tzip -mx9 zstd-win-binary-%PLATFORM%.zip zstd.exe &&
86
+ appveyor PushArtifact zstd-win-binary-%PLATFORM%.zip &&
87
+ cp zstd.exe ..\bin\zstd.exe &&
88
+ cd ..\bin\ && 7z a -tzip -mx9 zstd-win-release-%PLATFORM%.zip * &&
89
+ appveyor PushArtifact zstd-win-release-%PLATFORM%.zip
90
+ )
61
91
  )
62
- - if [%COMPILER%]==[gcc] make clean
63
- - if [%COMPILER%]==[visual] (
92
+ - if [%HOST%]==[visual] (
64
93
  ECHO *** &&
65
94
  ECHO *** Building Visual Studio 2008 %PLATFORM%\%CONFIGURATION% in %APPVEYOR_BUILD_FOLDER% &&
66
95
  ECHO *** &&
@@ -111,29 +140,19 @@ build_script:
111
140
  COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe tests\
112
141
  )
113
142
 
114
- test_script:
143
+ test_script:
115
144
  - ECHO Testing %COMPILER% %PLATFORM% %CONFIGURATION%
116
- - SET FUZZERTEST=-T1mn
117
- - if [%COMPILER%]==[gcc] if [%PLATFORM%]==[clang] (
118
- tests\fuzzer_clang.exe %FUZZERTEST% &&
119
- ECHO *** &&
120
- ECHO *** Building cmake for %PLATFORM% &&
121
- ECHO *** &&
145
+ - SET "CC=gcc"
146
+ - SET "CXX=g++"
147
+ - if [%TEST%]==[cmake] (
122
148
  mkdir build\cmake\build &&
123
149
  cd build\cmake\build &&
124
150
  cmake -G "Visual Studio 14 2015 Win64" .. &&
125
151
  cd ..\..\.. &&
126
- make clean &&
127
- ECHO *** &&
128
- ECHO *** Building pzstd for %PLATFORM% &&
129
- ECHO *** &&
130
- make -C contrib\pzstd googletest-mingw64 &&
131
- make -C contrib\pzstd pzstd.exe &&
132
- make -C contrib\pzstd tests &&
133
- make -C contrib\pzstd check &&
134
- make -C contrib\pzstd clean
152
+ make clean
135
153
  )
136
- - if [%COMPILER%]==[visual] if [%CONFIGURATION%]==[Release] (
154
+ - SET "FUZZERTEST=-T30s"
155
+ - if [%HOST%]==[visual] if [%CONFIGURATION%]==[Release] (
137
156
  CD tests &&
138
157
  SET ZSTD=./zstd.exe &&
139
158
  sh -e playTests.sh --test-large-data &&
@@ -146,33 +165,76 @@ test_script:
146
165
  fuzzer_VS2015_%PLATFORM%_Release.exe %FUZZERTEST%
147
166
  )
148
167
 
149
- branches:
150
- only:
151
- - dev
152
- - master
168
+ -
169
+ version: 1.0.{build}
170
+ environment:
171
+ matrix:
172
+ - COMPILER: "gcc"
173
+ HOST: "mingw"
174
+ PLATFORM: "x64"
175
+ SCRIPT: "make allzstd"
176
+ - COMPILER: "gcc"
177
+ HOST: "mingw"
178
+ PLATFORM: "x86"
179
+ SCRIPT: "make allzstd"
180
+ - COMPILER: "clang"
181
+ HOST: "mingw"
182
+ PLATFORM: "x64"
183
+ SCRIPT: "MOREFLAGS='--target=x86_64-w64-mingw32 -Werror -Wconversion -Wno-sign-conversion' make allzstd"
184
+
185
+ - COMPILER: "visual"
186
+ HOST: "visual"
187
+ PLATFORM: "x64"
188
+ CONFIGURATION: "Debug"
189
+ - COMPILER: "visual"
190
+ HOST: "visual"
191
+ PLATFORM: "Win32"
192
+ CONFIGURATION: "Debug"
193
+ - COMPILER: "visual"
194
+ HOST: "visual"
195
+ PLATFORM: "x64"
196
+ CONFIGURATION: "Release"
197
+ - COMPILER: "visual"
198
+ HOST: "visual"
199
+ PLATFORM: "Win32"
200
+ CONFIGURATION: "Release"
153
201
 
154
- artifacts:
155
- - path: bin\zstd.exe
156
- - path: bin\zstd32.exe
202
+ install:
203
+ - ECHO Installing %COMPILER% %PLATFORM% %CONFIGURATION%
204
+ - SET PATH_ORIGINAL=%PATH%
205
+ - if [%HOST%]==[mingw] (
206
+ SET "PATH_MINGW32=C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin" &&
207
+ SET "PATH_MINGW64=C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin" &&
208
+ COPY C:\msys64\usr\bin\make.exe C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin\make.exe &&
209
+ COPY C:\msys64\usr\bin\make.exe C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin\make.exe
210
+ )
211
+ - IF [%HOST%]==[visual] IF [%PLATFORM%]==[x64] (
212
+ SET ADDITIONALPARAM=/p:LibraryPath="C:\Program Files\Microsoft SDKs\Windows\v7.1\lib\x64;c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\amd64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\lib\amd64;"
213
+ )
157
214
 
158
- deploy:
159
- - provider: GitHub
160
- auth_token:
161
- secure: LgJo8emYc3sFnlNWkGl4/VYK3nk/8+RagcsqDlAi3xeqNGNutnKjcftjg84uJoT4
162
- artifact: bin\zstd.exe
163
- force_update: true
164
- on:
165
- branch: autobuild
166
- COMPILER: gcc
167
- PLATFORM: "mingw64"
168
- appveyor_repo_tag: true
169
- - provider: GitHub
170
- auth_token:
171
- secure: LgJo8emYc3sFnlNWkGl4/VYK3nk/8+RagcsqDlAi3xeqNGNutnKjcftjg84uJoT4
172
- artifact: bin\zstd32.exe
173
- force_update: true
174
- on:
175
- branch: autobuild
176
- COMPILER: gcc
177
- PLATFORM: "mingw32"
178
- appveyor_repo_tag: true
215
+ build_script:
216
+ - ECHO Building %COMPILER% %PLATFORM% %CONFIGURATION%
217
+ - if [%HOST%]==[mingw] (
218
+ ( if [%PLATFORM%]==[x64] (
219
+ SET "PATH=%PATH_MINGW64%;%PATH_ORIGINAL%"
220
+ ) else if [%PLATFORM%]==[x86] (
221
+ SET "PATH=%PATH_MINGW32%;%PATH_ORIGINAL%"
222
+ ) ) &&
223
+ make -v &&
224
+ sh -c "%COMPILER% -v" &&
225
+ set "CC=%COMPILER%" &&
226
+ sh -c "%SCRIPT%"
227
+ )
228
+ - if [%HOST%]==[visual] (
229
+ ECHO *** &&
230
+ ECHO *** Building Visual Studio 2015 %PLATFORM%\%CONFIGURATION% &&
231
+ ECHO *** &&
232
+ msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v140 /p:ForceImportBeforeCppTargets=%APPVEYOR_BUILD_FOLDER%\build\VS2010\CompileAsCpp.props /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" &&
233
+ DIR build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe &&
234
+ MD5sum build/VS2010/bin/%PLATFORM%_%CONFIGURATION%/*.exe &&
235
+ msbuild "build\VS2010\zstd.sln" /m /verbosity:minimal /property:PlatformToolset=v140 /t:Clean,Build /p:Platform=%PLATFORM% /p:Configuration=%CONFIGURATION% /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" &&
236
+ DIR build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe &&
237
+ MD5sum build/VS2010/bin/%PLATFORM%_%CONFIGURATION%/*.exe &&
238
+ COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\fuzzer.exe tests\fuzzer_VS2015_%PLATFORM%_%CONFIGURATION%.exe &&
239
+ COPY build\VS2010\bin\%PLATFORM%_%CONFIGURATION%\*.exe tests\
240
+ )
@@ -3,13 +3,11 @@ dependencies:
3
3
  - sudo dpkg --add-architecture i386
4
4
  - sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; sudo apt-get -y -qq update
5
5
  - sudo apt-get -y install gcc-powerpc-linux-gnu gcc-arm-linux-gnueabi libc6-dev-armel-cross gcc-aarch64-linux-gnu libc6-dev-arm64-cross
6
- - sudo apt-get -y install libstdc++-6-dev clang gcc g++ gcc-5 gcc-6
7
- - sudo apt-get -y install linux-libc-dev:i386 libc6-dev-i386
8
6
 
9
7
  test:
10
8
  override:
11
9
  - ? |
12
- if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then cc -v; make all && make clean; fi &&
10
+ if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then cc -v; CFLAGS="-O0 -Werror" make all && make clean; fi &&
13
11
  if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make gnu90build && make clean; fi
14
12
  :
15
13
  parallel: true
@@ -20,22 +18,7 @@ test:
20
18
  parallel: true
21
19
  - ? |
22
20
  if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then make c11build && make clean; fi &&
23
- if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make cmakebuild && make clean; fi
24
- :
25
- parallel: true
26
- - ? |
27
- if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then make gppbuild && make clean; fi &&
28
- if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make gcc5build && make clean; fi
29
- :
30
- parallel: true
31
- - ? |
32
- if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then make gcc6build && make clean; fi &&
33
- if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make clangbuild && make clean; fi
34
- :
35
- parallel: true
36
- - ? |
37
- if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then make m32build && make clean; fi &&
38
- if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make armbuild && make clean; fi
21
+ if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make ppc64build && make clean; fi
39
22
  :
40
23
  parallel: true
41
24
  - ? |
@@ -44,8 +27,8 @@ test:
44
27
  :
45
28
  parallel: true
46
29
  - ? |
47
- if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then make ppc64build && make clean; fi &&
48
- if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then true && make clean; fi #could add another test here
30
+ if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then make -j regressiontest && make clean; fi &&
31
+ if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make armbuild && make clean; fi
49
32
  :
50
33
  parallel: true
51
34
  - ? |
@@ -53,6 +36,11 @@ test:
53
36
  if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make -C tests test-legacy test-longmatch test-symbols && make clean; fi
54
37
  :
55
38
  parallel: true
39
+ - ? |
40
+ if [[ "$CIRCLE_NODE_INDEX" == "0" ]] ; then make cxxtest && make clean; fi &&
41
+ if [[ "$CIRCLE_NODE_TOTAL" < "2" ]] || [[ "$CIRCLE_NODE_INDEX" == "1" ]]; then make -C lib libzstd-nomt && make clean; fi
42
+ :
43
+ parallel: true
56
44
 
57
45
  post:
58
46
  - echo Circle CI tests finished
@@ -64,7 +52,7 @@ test:
64
52
  #- gcc -v; make -C tests test32 MOREFLAGS="-I/usr/include/x86_64-linux-gnu" && make clean
65
53
  #- make uasan && make clean
66
54
  #- make asan32 && make clean
67
- #- make -C tests test32 CC=clang MOREFLAGS="-g -fsanitize=address -I/usr/include/x86_64-linux-gnu"
55
+ #- make -C tests test32 CC=clang MOREFLAGS="-g -fsanitize=address -I/usr/include/x86_64-linux-gnu"
68
56
  # Valgrind tests
69
57
  #- CFLAGS="-O1 -g" make -C zlibWrapper valgrindTest && make clean
70
58
  #- make -C tests valgrindTest && make clean
@@ -15,15 +15,9 @@ cxx_library(
15
15
  header_namespace='',
16
16
  visibility=['PUBLIC'],
17
17
  exported_headers=subdir_glob([
18
- ('compress', 'zstdmt_compress.h'),
18
+ ('compress', 'zstd*.h'),
19
19
  ]),
20
- headers=subdir_glob([
21
- ('compress', 'zstd_opt.h'),
22
- ]),
23
- srcs=[
24
- 'compress/zstd_compress.c',
25
- 'compress/zstdmt_compress.c',
26
- ],
20
+ srcs=glob(['compress/zstd*.c']),
27
21
  deps=[':common'],
28
22
  )
29
23
 
@@ -31,7 +25,7 @@ cxx_library(
31
25
  name='decompress',
32
26
  header_namespace='',
33
27
  visibility=['PUBLIC'],
34
- srcs=['decompress/zstd_decompress.c'],
28
+ srcs=glob(['decompress/zstd*.c']),
35
29
  deps=[
36
30
  ':common',
37
31
  ':legacy',
@@ -58,6 +52,9 @@ cxx_library(
58
52
  ]),
59
53
  srcs=glob(['legacy/*.c']),
60
54
  deps=[':common'],
55
+ exported_preprocessor_flags=[
56
+ '-DZSTD_LEGACY_SUPPORT=4',
57
+ ],
61
58
  )
62
59
 
63
60
  cxx_library(
@@ -74,6 +71,15 @@ cxx_library(
74
71
  deps=[':common'],
75
72
  )
76
73
 
74
+ cxx_library(
75
+ name='compiler',
76
+ header_namespace='',
77
+ visibility=['PUBLIC'],
78
+ exported_headers=subdir_glob([
79
+ ('common', 'compiler.h'),
80
+ ]),
81
+ )
82
+
77
83
  cxx_library(
78
84
  name='bitstream',
79
85
  header_namespace='',
@@ -100,6 +106,7 @@ cxx_library(
100
106
  ],
101
107
  deps=[
102
108
  ':bitstream',
109
+ ':compiler',
103
110
  ':errors',
104
111
  ':mem',
105
112
  ],
@@ -133,7 +140,10 @@ cxx_library(
133
140
  ('common', 'pool.h'),
134
141
  ]),
135
142
  srcs=['common/pool.c'],
136
- deps=[':threading'],
143
+ deps=[
144
+ ':threading',
145
+ ':zstd_common',
146
+ ],
137
147
  )
138
148
 
139
149
  cxx_library(
@@ -144,6 +154,12 @@ cxx_library(
144
154
  ('common', 'threading.h'),
145
155
  ]),
146
156
  srcs=['common/threading.c'],
157
+ exported_preprocessor_flags=[
158
+ '-DZSTD_MULTITHREAD',
159
+ ],
160
+ exported_linker_flags=[
161
+ '-pthread',
162
+ ],
147
163
  )
148
164
 
149
165
  cxx_library(
@@ -154,6 +170,9 @@ cxx_library(
154
170
  ('common', 'xxhash.h'),
155
171
  ]),
156
172
  srcs=['common/xxhash.c'],
173
+ exported_preprocessor_flags=[
174
+ '-DXXH_NAMESPACE=ZSTD_',
175
+ ],
157
176
  )
158
177
 
159
178
  cxx_library(
@@ -166,6 +185,7 @@ cxx_library(
166
185
  ]),
167
186
  srcs=['common/zstd_common.c'],
168
187
  deps=[
188
+ ':compiler',
169
189
  ':errors',
170
190
  ':mem',
171
191
  ],
@@ -175,6 +195,7 @@ cxx_library(
175
195
  name='common',
176
196
  deps=[
177
197
  ':bitstream',
198
+ ':compiler',
178
199
  ':entropy',
179
200
  ':errors',
180
201
  ':mem',
@@ -1,13 +1,11 @@
1
- # ##########################################################################
2
- # Copyright (c) 2016-present, Yann Collet, Facebook, Inc.
1
+ # ################################################################
2
+ # Copyright (c) 2015-present, Yann Collet, Facebook, Inc.
3
3
  # All rights reserved.
4
4
  #
5
- # This Makefile is validated for Linux, macOS, *BSD, Hurd, Solaris, MSYS2 targets
6
- #
7
- # This source code is licensed under the BSD-style license found in the
8
- # LICENSE file in the root directory of this source tree. An additional grant
9
- # of patent rights can be found in the PATENTS file in the same directory.
10
- # ##########################################################################
5
+ # This source code is licensed under both the BSD-style license (found in the
6
+ # LICENSE file in the root directory of this source tree) and the GPLv2 (found
7
+ # in the COPYING file in the root directory of this source tree).
8
+ # ################################################################
11
9
 
12
10
  # Version numbers
13
11
  LIBVER_MAJOR_SCRIPT:=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < ./zstd.h`
@@ -22,14 +20,16 @@ VERSION?= $(LIBVER)
22
20
 
23
21
  CPPFLAGS+= -I. -I./common -DXXH_NAMESPACE=ZSTD_
24
22
  CFLAGS ?= -O3
25
- DEBUGFLAGS = -g -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
26
- -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
27
- -Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security
23
+ DEBUGFLAGS = -Wall -Wextra -Wcast-qual -Wcast-align -Wshadow \
24
+ -Wstrict-aliasing=1 -Wswitch-enum -Wdeclaration-after-statement \
25
+ -Wstrict-prototypes -Wundef -Wpointer-arith -Wformat-security \
26
+ -Wvla -Wformat=2 -Winit-self -Wfloat-equal -Wwrite-strings \
27
+ -Wredundant-decls
28
28
  CFLAGS += $(DEBUGFLAGS) $(MOREFLAGS)
29
29
  FLAGS = $(CPPFLAGS) $(CFLAGS)
30
30
 
31
31
 
32
- ZSTD_FILES := $(wildcard common/*.c compress/*.c decompress/*.c dictBuilder/*.c deprecated/*.c)
32
+ ZSTD_FILES := $(sort $(wildcard common/*.c compress/*.c decompress/*.c dictBuilder/*.c deprecated/*.c))
33
33
 
34
34
  ZSTD_LEGACY_SUPPORT ?= 4
35
35
 
@@ -71,6 +71,9 @@ libzstd.a: $(ZSTD_OBJ)
71
71
  @echo compiling static library
72
72
  @$(AR) $(ARFLAGS) $@ $^
73
73
 
74
+ libzstd.a-mt: CPPFLAGS += -DZSTD_MULTITHREAD
75
+ libzstd.a-mt: libzstd.a
76
+
74
77
  $(LIBZSTD): LDFLAGS += -shared -fPIC -fvisibility=hidden
75
78
  $(LIBZSTD): $(ZSTD_FILES)
76
79
  @echo compiling dynamic library $(LIBVER)
@@ -86,15 +89,31 @@ endif
86
89
 
87
90
  libzstd : $(LIBZSTD)
88
91
 
92
+ libzstd-mt : CPPFLAGS += -DZSTD_MULTITHREAD
93
+ libzstd-mt : libzstd
94
+
89
95
  lib: libzstd.a libzstd
90
96
 
91
- lib-release: DEBUGFLAGS :=
97
+ lib-mt: CPPFLAGS += -DZSTD_MULTITHREAD
98
+ lib-mt: lib
99
+
100
+ lib-release lib-release-mt: DEBUGFLAGS :=
92
101
  lib-release: lib
102
+ lib-release-mt: lib-mt
103
+
104
+ # Special case : building library in single-thread mode _and_ without zstdmt_compress.c
105
+ ZSTDMT_FILES = compress/zstdmt_compress.c
106
+ ZSTD_NOMT_FILES = $(filter-out $(ZSTDMT_FILES),$(ZSTD_FILES))
107
+ libzstd-nomt: LDFLAGS += -shared -fPIC -fvisibility=hidden
108
+ libzstd-nomt: $(ZSTD_NOMT_FILES)
109
+ @echo compiling single-thread dynamic library $(LIBVER)
110
+ @echo files : $(ZSTD_NOMT_FILES)
111
+ @$(CC) $(FLAGS) $^ $(LDFLAGS) $(SONAME_FLAGS) -o $@
93
112
 
94
113
  clean:
95
114
  @$(RM) -r *.dSYM # Mac OS-X specific
96
115
  @$(RM) core *.o *.a *.gcda *.$(SHARED_EXT) *.$(SHARED_EXT).* libzstd.pc
97
- @$(RM) dll/libzstd.dll dll/libzstd.lib
116
+ @$(RM) dll/libzstd.dll dll/libzstd.lib libzstd-nomt*
98
117
  @$(RM) common/*.o compress/*.o decompress/*.o dictBuilder/*.o legacy/*.o deprecated/*.o
99
118
  @echo Cleaning library completed
100
119
 
@@ -103,16 +122,17 @@ clean:
103
122
  #-----------------------------------------------------------------------------
104
123
  ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS))
105
124
 
106
- ifneq (,$(filter $(shell uname),SunOS))
107
- INSTALL ?= ginstall
108
- else
109
- INSTALL ?= install
110
- endif
111
-
112
- PREFIX ?= /usr/local
113
- DESTDIR ?=
114
- LIBDIR ?= $(PREFIX)/lib
115
- INCLUDEDIR ?= $(PREFIX)/include
125
+ DESTDIR ?=
126
+ # directory variables : GNU conventions prefer lowercase
127
+ # see https://www.gnu.org/prep/standards/html_node/Makefile-Conventions.html
128
+ # support both lower and uppercase (BSD), use uppercase in script
129
+ prefix ?= /usr/local
130
+ PREFIX ?= $(prefix)
131
+ exec_prefix ?= $(PREFIX)
132
+ libdir ?= $(exec_prefix)/lib
133
+ LIBDIR ?= $(libdir)
134
+ includedir ?= $(PREFIX)/include
135
+ INCLUDEDIR ?= $(includedir)
116
136
 
117
137
  ifneq (,$(filter $(shell uname),OpenBSD FreeBSD NetBSD DragonFly))
118
138
  PKGCONFIGDIR ?= $(PREFIX)/libdata/pkgconfig
@@ -120,8 +140,14 @@ else
120
140
  PKGCONFIGDIR ?= $(LIBDIR)/pkgconfig
121
141
  endif
122
142
 
123
- INSTALL_LIB ?= $(INSTALL) -m 755
124
- INSTALL_DATA ?= $(INSTALL) -m 644
143
+ ifneq (,$(filter $(shell uname),SunOS))
144
+ INSTALL ?= ginstall
145
+ else
146
+ INSTALL ?= install
147
+ endif
148
+
149
+ INSTALL_PROGRAM ?= $(INSTALL)
150
+ INSTALL_DATA ?= $(INSTALL) -m 644
125
151
 
126
152
 
127
153
  libzstd.pc:
@@ -137,10 +163,10 @@ install: libzstd.a libzstd libzstd.pc
137
163
  @$(INSTALL) -d -m 755 $(DESTDIR)$(PKGCONFIGDIR)/ $(DESTDIR)$(INCLUDEDIR)/
138
164
  @$(INSTALL_DATA) libzstd.pc $(DESTDIR)$(PKGCONFIGDIR)/
139
165
  @echo Installing libraries
140
- @$(INSTALL_LIB) libzstd.a $(DESTDIR)$(LIBDIR)
141
- @$(INSTALL_LIB) libzstd.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR)
142
- @ln -sf libzstd.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_MAJOR)
143
- @ln -sf libzstd.$(SHARED_EXT_VER) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT)
166
+ @$(INSTALL_DATA) libzstd.a $(DESTDIR)$(LIBDIR)
167
+ @$(INSTALL_PROGRAM) $(LIBZSTD) $(DESTDIR)$(LIBDIR)
168
+ @ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_MAJOR)
169
+ @ln -sf $(LIBZSTD) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT)
144
170
  @echo Installing includes
145
171
  @$(INSTALL_DATA) zstd.h $(DESTDIR)$(INCLUDEDIR)
146
172
  @$(INSTALL_DATA) common/zstd_errors.h $(DESTDIR)$(INCLUDEDIR)
@@ -152,7 +178,7 @@ uninstall:
152
178
  @$(RM) $(DESTDIR)$(LIBDIR)/libzstd.a
153
179
  @$(RM) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT)
154
180
  @$(RM) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_MAJOR)
155
- @$(RM) $(DESTDIR)$(LIBDIR)/libzstd.$(SHARED_EXT_VER)
181
+ @$(RM) $(DESTDIR)$(LIBDIR)/$(LIBZSTD)
156
182
  @$(RM) $(DESTDIR)$(PKGCONFIGDIR)/libzstd.pc
157
183
  @$(RM) $(DESTDIR)$(INCLUDEDIR)/zstd.h
158
184
  @$(RM) $(DESTDIR)$(INCLUDEDIR)/zstd_errors.h