zstd-ruby 1.5.1.0 → 1.5.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/README.md +56 -3
  4. data/Rakefile +8 -2
  5. data/ext/zstdruby/{zstdruby.h → common.h} +2 -0
  6. data/ext/zstdruby/extconf.rb +1 -1
  7. data/ext/zstdruby/libzstd/common/pool.c +11 -6
  8. data/ext/zstdruby/libzstd/common/pool.h +2 -2
  9. data/ext/zstdruby/libzstd/common/portability_macros.h +6 -0
  10. data/ext/zstdruby/libzstd/common/zstd_internal.h +3 -4
  11. data/ext/zstdruby/libzstd/compress/zstd_compress.c +114 -96
  12. data/ext/zstdruby/libzstd/compress/zstd_compress_internal.h +72 -39
  13. data/ext/zstdruby/libzstd/compress/zstd_compress_sequences.c +10 -10
  14. data/ext/zstdruby/libzstd/compress/zstd_compress_superblock.c +1 -1
  15. data/ext/zstdruby/libzstd/compress/zstd_cwksp.h +38 -24
  16. data/ext/zstdruby/libzstd/compress/zstd_double_fast.c +10 -10
  17. data/ext/zstdruby/libzstd/compress/zstd_fast.c +11 -11
  18. data/ext/zstdruby/libzstd/compress/zstd_lazy.c +66 -62
  19. data/ext/zstdruby/libzstd/compress/zstd_ldm.c +5 -3
  20. data/ext/zstdruby/libzstd/compress/zstd_opt.c +66 -43
  21. data/ext/zstdruby/libzstd/compress/zstdmt_compress.c +17 -9
  22. data/ext/zstdruby/libzstd/compress/zstdmt_compress.h +4 -1
  23. data/ext/zstdruby/libzstd/decompress/huf_decompress.c +2 -2
  24. data/ext/zstdruby/libzstd/decompress/huf_decompress_amd64.S +17 -3
  25. data/ext/zstdruby/libzstd/dictBuilder/zdict.c +2 -2
  26. data/ext/zstdruby/libzstd/zstd.h +1 -1
  27. data/ext/zstdruby/main.c +14 -0
  28. data/ext/zstdruby/streaming_compress.c +185 -0
  29. data/ext/zstdruby/streaming_compress.h +5 -0
  30. data/ext/zstdruby/streaming_decompress.c +125 -0
  31. data/ext/zstdruby/zstdruby.c +4 -6
  32. data/lib/zstd-ruby/version.rb +1 -1
  33. data/zstd-ruby.gemspec +1 -1
  34. metadata +11 -40
  35. data/.github/dependabot.yml +0 -8
  36. data/.github/workflows/ruby.yml +0 -35
  37. data/ext/zstdruby/libzstd/.gitignore +0 -3
  38. data/ext/zstdruby/libzstd/BUCK +0 -232
  39. data/ext/zstdruby/libzstd/Makefile +0 -357
  40. data/ext/zstdruby/libzstd/README.md +0 -217
  41. data/ext/zstdruby/libzstd/deprecated/zbuff.h +0 -214
  42. data/ext/zstdruby/libzstd/deprecated/zbuff_common.c +0 -26
  43. data/ext/zstdruby/libzstd/deprecated/zbuff_compress.c +0 -167
  44. data/ext/zstdruby/libzstd/deprecated/zbuff_decompress.c +0 -75
  45. data/ext/zstdruby/libzstd/dll/example/Makefile +0 -48
  46. data/ext/zstdruby/libzstd/dll/example/README.md +0 -63
  47. data/ext/zstdruby/libzstd/dll/example/build_package.bat +0 -20
  48. data/ext/zstdruby/libzstd/dll/example/fullbench-dll.sln +0 -25
  49. data/ext/zstdruby/libzstd/dll/example/fullbench-dll.vcxproj +0 -181
  50. data/ext/zstdruby/libzstd/legacy/zstd_legacy.h +0 -415
  51. data/ext/zstdruby/libzstd/legacy/zstd_v01.c +0 -2158
  52. data/ext/zstdruby/libzstd/legacy/zstd_v01.h +0 -94
  53. data/ext/zstdruby/libzstd/legacy/zstd_v02.c +0 -3518
  54. data/ext/zstdruby/libzstd/legacy/zstd_v02.h +0 -93
  55. data/ext/zstdruby/libzstd/legacy/zstd_v03.c +0 -3160
  56. data/ext/zstdruby/libzstd/legacy/zstd_v03.h +0 -93
  57. data/ext/zstdruby/libzstd/legacy/zstd_v04.c +0 -3647
  58. data/ext/zstdruby/libzstd/legacy/zstd_v04.h +0 -142
  59. data/ext/zstdruby/libzstd/legacy/zstd_v05.c +0 -4050
  60. data/ext/zstdruby/libzstd/legacy/zstd_v05.h +0 -162
  61. data/ext/zstdruby/libzstd/legacy/zstd_v06.c +0 -4154
  62. data/ext/zstdruby/libzstd/legacy/zstd_v06.h +0 -172
  63. data/ext/zstdruby/libzstd/legacy/zstd_v07.c +0 -4541
  64. data/ext/zstdruby/libzstd/legacy/zstd_v07.h +0 -187
  65. data/ext/zstdruby/libzstd/libzstd.mk +0 -185
  66. data/ext/zstdruby/libzstd/libzstd.pc.in +0 -16
  67. data/ext/zstdruby/libzstd/modulemap/module.modulemap +0 -4
@@ -0,0 +1,5 @@
1
+ #if !defined(STREAMING_COMPRESS_H)
2
+ #define STREAMING_COMPRESS_H
3
+
4
+
5
+ #endif // STREAMING_COMPRESS_H
@@ -0,0 +1,125 @@
1
+ #include <common.h>
2
+
3
+ struct streaming_decompress_t {
4
+ ZSTD_DCtx* ctx;
5
+ VALUE buf;
6
+ size_t buf_size;
7
+ };
8
+
9
+ static void
10
+ streaming_decompress_mark(void *p)
11
+ {
12
+ struct streaming_decompress_t *sd = p;
13
+ // rb_gc_mark((VALUE)sd->ctx);
14
+ rb_gc_mark(sd->buf);
15
+ rb_gc_mark(sd->buf_size);
16
+ }
17
+
18
+ static void
19
+ streaming_decompress_free(void *p)
20
+ {
21
+ struct streaming_decompress_t *sd = p;
22
+ ZSTD_DCtx* ctx = sd->ctx;
23
+ if (ctx != NULL) {
24
+ ZSTD_freeDCtx(ctx);
25
+ }
26
+ xfree(sd);
27
+ }
28
+
29
+ static size_t
30
+ streaming_decompress_memsize(const void *p)
31
+ {
32
+ return sizeof(struct streaming_decompress_t);
33
+ }
34
+
35
+ static const rb_data_type_t streaming_decompress_type = {
36
+ "streaming_decompress",
37
+ { streaming_decompress_mark, streaming_decompress_free, streaming_decompress_memsize, },
38
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY
39
+ };
40
+
41
+ static VALUE
42
+ rb_streaming_decompress_allocate(VALUE klass)
43
+ {
44
+ struct streaming_decompress_t* sd;
45
+ VALUE obj = TypedData_Make_Struct(klass, struct streaming_decompress_t, &streaming_decompress_type, sd);
46
+ sd->ctx = NULL;
47
+ sd->buf = Qnil;
48
+ sd->buf_size = 0;
49
+ return obj;
50
+ }
51
+
52
+ static VALUE
53
+ rb_streaming_decompress_initialize(VALUE obj)
54
+ {
55
+ struct streaming_decompress_t* sd;
56
+ TypedData_Get_Struct(obj, struct streaming_decompress_t, &streaming_decompress_type, sd);
57
+ size_t const buffOutSize = ZSTD_DStreamOutSize();
58
+
59
+ ZSTD_DCtx* ctx = ZSTD_createDCtx();
60
+ if (ctx == NULL) {
61
+ rb_raise(rb_eRuntimeError, "%s", "ZSTD_createDCtx error");
62
+ }
63
+ sd->ctx = ctx;
64
+ sd->buf = rb_str_new(NULL, buffOutSize);
65
+ sd->buf_size = buffOutSize;
66
+
67
+ return obj;
68
+ }
69
+
70
+ static VALUE
71
+ rb_streaming_decompress_decompress(VALUE obj, VALUE src)
72
+ {
73
+ StringValue(src);
74
+ const char* input_data = RSTRING_PTR(src);
75
+ size_t input_size = RSTRING_LEN(src);
76
+ ZSTD_inBuffer input = { input_data, input_size, 0 };
77
+
78
+ struct streaming_decompress_t* sd;
79
+ TypedData_Get_Struct(obj, struct streaming_decompress_t, &streaming_decompress_type, sd);
80
+ const char* output_data = RSTRING_PTR(sd->buf);
81
+ VALUE result = rb_str_new(0, 0);
82
+ while (input.pos < input.size) {
83
+ ZSTD_outBuffer output = { (void*)output_data, sd->buf_size, 0 };
84
+ size_t const ret = ZSTD_decompressStream(sd->ctx, &output, &input);
85
+ if (ZSTD_isError(ret)) {
86
+ rb_raise(rb_eRuntimeError, "compress error error code: %s", ZSTD_getErrorName(ret));
87
+ }
88
+ rb_str_cat(result, output.dst, output.pos);
89
+ }
90
+ return result;
91
+ }
92
+
93
+ static VALUE
94
+ rb_streaming_decompress_addstr(VALUE obj, VALUE src)
95
+ {
96
+ StringValue(src);
97
+ const char* input_data = RSTRING_PTR(src);
98
+ size_t input_size = RSTRING_LEN(src);
99
+ ZSTD_inBuffer input = { input_data, input_size, 0 };
100
+
101
+ struct streaming_decompress_t* sd;
102
+ TypedData_Get_Struct(obj, struct streaming_decompress_t, &streaming_decompress_type, sd);
103
+ const char* output_data = RSTRING_PTR(sd->buf);
104
+
105
+ while (input.pos < input.size) {
106
+ ZSTD_outBuffer output = { (void*)output_data, sd->buf_size, 0 };
107
+ size_t const result = ZSTD_decompressStream(sd->ctx, &output, &input);
108
+ if (ZSTD_isError(result)) {
109
+ rb_raise(rb_eRuntimeError, "compress error error code: %s", ZSTD_getErrorName(result));
110
+ }
111
+ }
112
+ return obj;
113
+ }
114
+
115
+ extern VALUE rb_mZstd, cStreamingDecompress;
116
+ void
117
+ zstd_ruby_streaming_decompress_init(void)
118
+ {
119
+ VALUE cStreamingDecompress = rb_define_class_under(rb_mZstd, "StreamingDecompress", rb_cObject);
120
+ rb_define_alloc_func(cStreamingDecompress, rb_streaming_decompress_allocate);
121
+ rb_define_method(cStreamingDecompress, "initialize", rb_streaming_decompress_initialize, 0);
122
+ rb_define_method(cStreamingDecompress, "decompress", rb_streaming_decompress_decompress, 1);
123
+ rb_define_method(cStreamingDecompress, "<<", rb_streaming_decompress_addstr, 1);
124
+ }
125
+
@@ -1,5 +1,6 @@
1
- #include "zstdruby.h"
2
- #include "./libzstd/zstd.h"
1
+ #include <common.h>
2
+
3
+ extern VALUE rb_mZstd;
3
4
 
4
5
  static VALUE zstdVersion(VALUE self)
5
6
  {
@@ -104,12 +105,9 @@ static VALUE decompress(VALUE self, VALUE input)
104
105
  return output;
105
106
  }
106
107
 
107
- VALUE rb_mZstd;
108
-
109
108
  void
110
- Init_zstdruby(void)
109
+ zstd_ruby_init(void)
111
110
  {
112
- rb_mZstd = rb_define_module("Zstd");
113
111
  rb_define_module_function(rb_mZstd, "zstd_version", zstdVersion, 0);
114
112
  rb_define_module_function(rb_mZstd, "compress", compress, -1);
115
113
  rb_define_module_function(rb_mZstd, "decompress", decompress, 1);
@@ -1,3 +1,3 @@
1
1
  module Zstd
2
- VERSION = "1.5.1.0"
2
+ VERSION = "1.5.2.1"
3
3
  end
data/zstd-ruby.gemspec CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
24
24
  #end
25
25
 
26
26
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
- f.match(%r{^(test|spec|features|benchmarks|zstd)/})
27
+ f.match(%r{^(test|spec|features|benchmarks|zstd|.github)/})
28
28
  end
29
29
  spec.bindir = "exe"
30
30
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zstd-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1.0
4
+ version: 1.5.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - SpringMT
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-27 00:00:00.000000000 Z
11
+ date: 2022-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,8 +75,6 @@ extensions:
75
75
  - ext/zstdruby/extconf.rb
76
76
  extra_rdoc_files: []
77
77
  files:
78
- - ".github/dependabot.yml"
79
- - ".github/workflows/ruby.yml"
80
78
  - ".gitignore"
81
79
  - ".gitmodules"
82
80
  - ".rspec"
@@ -87,11 +85,8 @@ files:
87
85
  - Rakefile
88
86
  - bin/console
89
87
  - bin/setup
88
+ - ext/zstdruby/common.h
90
89
  - ext/zstdruby/extconf.rb
91
- - ext/zstdruby/libzstd/.gitignore
92
- - ext/zstdruby/libzstd/BUCK
93
- - ext/zstdruby/libzstd/Makefile
94
- - ext/zstdruby/libzstd/README.md
95
90
  - ext/zstdruby/libzstd/common/bitstream.h
96
91
  - ext/zstdruby/libzstd/common/compiler.h
97
92
  - ext/zstdruby/libzstd/common/cpu.h
@@ -150,44 +145,20 @@ files:
150
145
  - ext/zstdruby/libzstd/decompress/zstd_decompress_block.c
151
146
  - ext/zstdruby/libzstd/decompress/zstd_decompress_block.h
152
147
  - ext/zstdruby/libzstd/decompress/zstd_decompress_internal.h
153
- - ext/zstdruby/libzstd/deprecated/zbuff.h
154
- - ext/zstdruby/libzstd/deprecated/zbuff_common.c
155
- - ext/zstdruby/libzstd/deprecated/zbuff_compress.c
156
- - ext/zstdruby/libzstd/deprecated/zbuff_decompress.c
157
148
  - ext/zstdruby/libzstd/dictBuilder/cover.c
158
149
  - ext/zstdruby/libzstd/dictBuilder/cover.h
159
150
  - ext/zstdruby/libzstd/dictBuilder/divsufsort.c
160
151
  - ext/zstdruby/libzstd/dictBuilder/divsufsort.h
161
152
  - ext/zstdruby/libzstd/dictBuilder/fastcover.c
162
153
  - ext/zstdruby/libzstd/dictBuilder/zdict.c
163
- - ext/zstdruby/libzstd/dll/example/Makefile
164
- - ext/zstdruby/libzstd/dll/example/README.md
165
- - ext/zstdruby/libzstd/dll/example/build_package.bat
166
- - ext/zstdruby/libzstd/dll/example/fullbench-dll.sln
167
- - ext/zstdruby/libzstd/dll/example/fullbench-dll.vcxproj
168
- - ext/zstdruby/libzstd/legacy/zstd_legacy.h
169
- - ext/zstdruby/libzstd/legacy/zstd_v01.c
170
- - ext/zstdruby/libzstd/legacy/zstd_v01.h
171
- - ext/zstdruby/libzstd/legacy/zstd_v02.c
172
- - ext/zstdruby/libzstd/legacy/zstd_v02.h
173
- - ext/zstdruby/libzstd/legacy/zstd_v03.c
174
- - ext/zstdruby/libzstd/legacy/zstd_v03.h
175
- - ext/zstdruby/libzstd/legacy/zstd_v04.c
176
- - ext/zstdruby/libzstd/legacy/zstd_v04.h
177
- - ext/zstdruby/libzstd/legacy/zstd_v05.c
178
- - ext/zstdruby/libzstd/legacy/zstd_v05.h
179
- - ext/zstdruby/libzstd/legacy/zstd_v06.c
180
- - ext/zstdruby/libzstd/legacy/zstd_v06.h
181
- - ext/zstdruby/libzstd/legacy/zstd_v07.c
182
- - ext/zstdruby/libzstd/legacy/zstd_v07.h
183
- - ext/zstdruby/libzstd/libzstd.mk
184
- - ext/zstdruby/libzstd/libzstd.pc.in
185
- - ext/zstdruby/libzstd/modulemap/module.modulemap
186
154
  - ext/zstdruby/libzstd/zdict.h
187
155
  - ext/zstdruby/libzstd/zstd.h
188
156
  - ext/zstdruby/libzstd/zstd_errors.h
157
+ - ext/zstdruby/main.c
158
+ - ext/zstdruby/streaming_compress.c
159
+ - ext/zstdruby/streaming_compress.h
160
+ - ext/zstdruby/streaming_decompress.c
189
161
  - ext/zstdruby/zstdruby.c
190
- - ext/zstdruby/zstdruby.h
191
162
  - lib/zstd-ruby.rb
192
163
  - lib/zstd-ruby/version.rb
193
164
  - zstd-ruby.gemspec
@@ -195,7 +166,7 @@ homepage: https://github.com/SpringMT/zstd-ruby
195
166
  licenses:
196
167
  - MIT
197
168
  metadata: {}
198
- post_install_message:
169
+ post_install_message:
199
170
  rdoc_options: []
200
171
  require_paths:
201
172
  - lib
@@ -210,8 +181,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
181
  - !ruby/object:Gem::Version
211
182
  version: '0'
212
183
  requirements: []
213
- rubygems_version: 3.3.3
214
- signing_key:
184
+ rubygems_version: 3.1.6
185
+ signing_key:
215
186
  specification_version: 4
216
187
  summary: Ruby binding for zstd(Zstandard - Fast real-time compression algorithm)
217
188
  test_files: []
@@ -1,8 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: bundler
4
- directory: "/"
5
- schedule:
6
- interval: weekly
7
- time: "20:00"
8
- open-pull-requests-limit: 10
@@ -1,35 +0,0 @@
1
- # This workflow uses actions that are not certified by GitHub.
2
- # They are provided by a third-party and are governed by
3
- # separate terms of service, privacy policy, and support
4
- # documentation.
5
- # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
- # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
-
8
- name: Ruby
9
-
10
- on: [push, pull_request]
11
-
12
- jobs:
13
- test:
14
-
15
- runs-on: ubuntu-latest
16
- strategy:
17
- matrix:
18
- ruby-version: ['2.6', '2.7', '3.0', '3.1']
19
-
20
- steps:
21
- - uses: actions/checkout@v2
22
- - name: Set up Ruby
23
- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
24
- # change this to (see https://github.com/ruby/setup-ruby#versioning):
25
- # uses: ruby/setup-ruby@v1
26
- uses: ruby/setup-ruby@168d6a54b412713c0ed60998a78093a270ca8d84
27
- with:
28
- ruby-version: ${{ matrix.ruby-version }}
29
- bundler-cache: true # runs 'bundle install' and caches installed gems automatically
30
- - name: Install dependencies
31
- run: bundle install
32
- - name: Compile
33
- run: bundle exec rake compile
34
- - name: Run tests
35
- run: bundle exec rspec
@@ -1,3 +0,0 @@
1
- # make install artefact
2
- libzstd.pc
3
- libzstd-nomt
@@ -1,232 +0,0 @@
1
- cxx_library(
2
- name='zstd',
3
- header_namespace='',
4
- exported_headers=['zstd.h'],
5
- visibility=['PUBLIC'],
6
- deps=[
7
- ':common',
8
- ':compress',
9
- ':decompress',
10
- ':deprecated',
11
- ],
12
- )
13
-
14
- cxx_library(
15
- name='compress',
16
- header_namespace='',
17
- visibility=['PUBLIC'],
18
- exported_headers=subdir_glob([
19
- ('compress', 'zstd*.h'),
20
- ]),
21
- srcs=glob(['compress/zstd*.c', 'compress/hist.c']),
22
- deps=[':common'],
23
- )
24
-
25
- cxx_library(
26
- name='decompress',
27
- header_namespace='',
28
- visibility=['PUBLIC'],
29
- headers=subdir_glob([
30
- ('decompress', '*_impl.h'),
31
- ]),
32
- srcs=glob(['decompress/zstd*.c']),
33
- deps=[
34
- ':common',
35
- ':legacy',
36
- ],
37
- )
38
-
39
- cxx_library(
40
- name='deprecated',
41
- header_namespace='',
42
- visibility=['PUBLIC'],
43
- exported_headers=subdir_glob([
44
- ('deprecated', '*.h'),
45
- ]),
46
- srcs=glob(['deprecated/*.c']),
47
- deps=[':common'],
48
- )
49
-
50
- cxx_library(
51
- name='legacy',
52
- header_namespace='',
53
- visibility=['PUBLIC'],
54
- exported_headers=subdir_glob([
55
- ('legacy', '*.h'),
56
- ]),
57
- srcs=glob(['legacy/*.c']),
58
- deps=[':common'],
59
- exported_preprocessor_flags=[
60
- '-DZSTD_LEGACY_SUPPORT=4',
61
- ],
62
- )
63
-
64
- cxx_library(
65
- name='zdict',
66
- header_namespace='',
67
- visibility=['PUBLIC'],
68
- exported_headers=['zdict.h'],
69
- headers=subdir_glob([
70
- ('dictBuilder', 'divsufsort.h'),
71
- ('dictBuilder', 'cover.h'),
72
- ]),
73
- srcs=glob(['dictBuilder/*.c']),
74
- deps=[':common'],
75
- )
76
-
77
- cxx_library(
78
- name='compiler',
79
- header_namespace='',
80
- visibility=['PUBLIC'],
81
- exported_headers=subdir_glob([
82
- ('common', 'compiler.h'),
83
- ]),
84
- )
85
-
86
- cxx_library(
87
- name='cpu',
88
- header_namespace='',
89
- visibility=['PUBLIC'],
90
- exported_headers=subdir_glob([
91
- ('common', 'cpu.h'),
92
- ]),
93
- )
94
-
95
- cxx_library(
96
- name='bitstream',
97
- header_namespace='',
98
- visibility=['PUBLIC'],
99
- exported_headers=subdir_glob([
100
- ('common', 'bitstream.h'),
101
- ]),
102
- )
103
-
104
- cxx_library(
105
- name='entropy',
106
- header_namespace='',
107
- visibility=['PUBLIC'],
108
- exported_headers=subdir_glob([
109
- ('common', 'fse.h'),
110
- ('common', 'huf.h'),
111
- ]),
112
- srcs=[
113
- 'common/entropy_common.c',
114
- 'common/fse_decompress.c',
115
- 'compress/fse_compress.c',
116
- 'compress/huf_compress.c',
117
- 'decompress/huf_decompress.c',
118
- ],
119
- deps=[
120
- ':debug',
121
- ':bitstream',
122
- ':compiler',
123
- ':errors',
124
- ':mem',
125
- ],
126
- )
127
-
128
- cxx_library(
129
- name='errors',
130
- header_namespace='',
131
- visibility=['PUBLIC'],
132
- exported_headers=[
133
- 'zstd_errors.h',
134
- 'common/error_private.h',
135
- ]
136
- srcs=['common/error_private.c'],
137
- )
138
-
139
- cxx_library(
140
- name='mem',
141
- header_namespace='',
142
- visibility=['PUBLIC'],
143
- exported_headers=subdir_glob([
144
- ('common', 'mem.h'),
145
- ]),
146
- )
147
-
148
- cxx_library(
149
- name='pool',
150
- header_namespace='',
151
- visibility=['PUBLIC'],
152
- exported_headers=subdir_glob([
153
- ('common', 'pool.h'),
154
- ]),
155
- srcs=['common/pool.c'],
156
- deps=[
157
- ':threading',
158
- ':zstd_common',
159
- ],
160
- )
161
-
162
- cxx_library(
163
- name='threading',
164
- header_namespace='',
165
- visibility=['PUBLIC'],
166
- exported_headers=subdir_glob([
167
- ('common', 'threading.h'),
168
- ]),
169
- srcs=['common/threading.c'],
170
- exported_preprocessor_flags=[
171
- '-DZSTD_MULTITHREAD',
172
- ],
173
- exported_linker_flags=[
174
- '-pthread',
175
- ],
176
- )
177
-
178
- cxx_library(
179
- name='xxhash',
180
- header_namespace='',
181
- visibility=['PUBLIC'],
182
- exported_headers=subdir_glob([
183
- ('common', 'xxhash.h'),
184
- ]),
185
- srcs=['common/xxhash.c'],
186
- exported_preprocessor_flags=[
187
- '-DXXH_NAMESPACE=ZSTD_',
188
- ],
189
- )
190
-
191
- cxx_library(
192
- name='zstd_common',
193
- header_namespace='',
194
- visibility=['PUBLIC'],
195
- exported_headers=subdir_glob([
196
- ('', 'zstd.h'),
197
- ('common', 'zstd_internal.h'),
198
- ]),
199
- srcs=['common/zstd_common.c'],
200
- deps=[
201
- ':compiler',
202
- ':errors',
203
- ':mem',
204
- ],
205
- )
206
-
207
- cxx_library(
208
- name='debug',
209
- header_namespace='',
210
- visibility=['PUBLIC'],
211
- exported_headers=subdir_glob([
212
- ('common', 'debug.h'),
213
- ]),
214
- srcs=['common/debug.c'],
215
- )
216
-
217
- cxx_library(
218
- name='common',
219
- deps=[
220
- ':debug',
221
- ':bitstream',
222
- ':compiler',
223
- ':cpu',
224
- ':entropy',
225
- ':errors',
226
- ':mem',
227
- ':pool',
228
- ':threading',
229
- ':xxhash',
230
- ':zstd_common',
231
- ]
232
- )