xref: /freebsd/sys/contrib/zstd/lib/BUCK (revision 36712a94975f5bd0d26c85377283b49a2369c82f)
1cxx_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
14cxx_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
25cxx_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
39cxx_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
50cxx_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
64cxx_library(
65    name='zdict',
66    header_namespace='',
67    visibility=['PUBLIC'],
68    exported_headers=subdir_glob([
69        ('dictBuilder', 'zdict.h'),
70    ]),
71    headers=subdir_glob([
72        ('dictBuilder', 'divsufsort.h'),
73        ('dictBuilder', 'cover.h'),
74    ]),
75    srcs=glob(['dictBuilder/*.c']),
76    deps=[':common'],
77)
78
79cxx_library(
80    name='compiler',
81    header_namespace='',
82    visibility=['PUBLIC'],
83    exported_headers=subdir_glob([
84        ('common', 'compiler.h'),
85    ]),
86)
87
88cxx_library(
89    name='cpu',
90    header_namespace='',
91    visibility=['PUBLIC'],
92    exported_headers=subdir_glob([
93        ('common', 'cpu.h'),
94    ]),
95)
96
97cxx_library(
98    name='bitstream',
99    header_namespace='',
100    visibility=['PUBLIC'],
101    exported_headers=subdir_glob([
102        ('common', 'bitstream.h'),
103    ]),
104)
105
106cxx_library(
107    name='entropy',
108    header_namespace='',
109    visibility=['PUBLIC'],
110    exported_headers=subdir_glob([
111        ('common', 'fse.h'),
112        ('common', 'huf.h'),
113    ]),
114    srcs=[
115        'common/entropy_common.c',
116        'common/fse_decompress.c',
117        'compress/fse_compress.c',
118        'compress/huf_compress.c',
119        'decompress/huf_decompress.c',
120    ],
121    deps=[
122        ':debug',
123        ':bitstream',
124        ':compiler',
125        ':errors',
126        ':mem',
127    ],
128)
129
130cxx_library(
131    name='errors',
132    header_namespace='',
133    visibility=['PUBLIC'],
134    exported_headers=subdir_glob([
135        ('common', 'error_private.h'),
136        ('common', 'zstd_errors.h'),
137    ]),
138    srcs=['common/error_private.c'],
139)
140
141cxx_library(
142    name='mem',
143    header_namespace='',
144    visibility=['PUBLIC'],
145    exported_headers=subdir_glob([
146        ('common', 'mem.h'),
147    ]),
148)
149
150cxx_library(
151    name='pool',
152    header_namespace='',
153    visibility=['PUBLIC'],
154    exported_headers=subdir_glob([
155        ('common', 'pool.h'),
156    ]),
157    srcs=['common/pool.c'],
158    deps=[
159        ':threading',
160        ':zstd_common',
161    ],
162)
163
164cxx_library(
165    name='threading',
166    header_namespace='',
167    visibility=['PUBLIC'],
168    exported_headers=subdir_glob([
169        ('common', 'threading.h'),
170    ]),
171    srcs=['common/threading.c'],
172    exported_preprocessor_flags=[
173        '-DZSTD_MULTITHREAD',
174    ],
175    exported_linker_flags=[
176        '-pthread',
177    ],
178)
179
180cxx_library(
181    name='xxhash',
182    header_namespace='',
183    visibility=['PUBLIC'],
184    exported_headers=subdir_glob([
185        ('common', 'xxhash.h'),
186    ]),
187    srcs=['common/xxhash.c'],
188    exported_preprocessor_flags=[
189        '-DXXH_NAMESPACE=ZSTD_',
190    ],
191)
192
193cxx_library(
194    name='zstd_common',
195    header_namespace='',
196    visibility=['PUBLIC'],
197    exported_headers=subdir_glob([
198        ('', 'zstd.h'),
199        ('common', 'zstd_internal.h'),
200    ]),
201    srcs=['common/zstd_common.c'],
202    deps=[
203        ':compiler',
204        ':errors',
205        ':mem',
206    ],
207)
208
209cxx_library(
210    name='debug',
211    header_namespace='',
212    visibility=['PUBLIC'],
213    exported_headers=subdir_glob([
214        ('common', 'debug.h'),
215    ]),
216    srcs=['common/debug.c'],
217)
218
219cxx_library(
220    name='common',
221    deps=[
222        ':debug',
223        ':bitstream',
224        ':compiler',
225        ':cpu',
226        ':entropy',
227        ':errors',
228        ':mem',
229        ':pool',
230        ':threading',
231        ':xxhash',
232        ':zstd_common',
233    ]
234)
235