xref: /freebsd/sys/contrib/zstd/lib/BUCK (revision ebacd8013fe5f7fdf9f6a5b286f6680dd2891036)
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=['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
77cxx_library(
78    name='compiler',
79    header_namespace='',
80    visibility=['PUBLIC'],
81    exported_headers=subdir_glob([
82        ('common', 'compiler.h'),
83    ]),
84)
85
86cxx_library(
87    name='cpu',
88    header_namespace='',
89    visibility=['PUBLIC'],
90    exported_headers=subdir_glob([
91        ('common', 'cpu.h'),
92    ]),
93)
94
95cxx_library(
96    name='bitstream',
97    header_namespace='',
98    visibility=['PUBLIC'],
99    exported_headers=subdir_glob([
100        ('common', 'bitstream.h'),
101    ]),
102)
103
104cxx_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
128cxx_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
139cxx_library(
140    name='mem',
141    header_namespace='',
142    visibility=['PUBLIC'],
143    exported_headers=subdir_glob([
144        ('common', 'mem.h'),
145    ]),
146)
147
148cxx_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
162cxx_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
178cxx_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
191cxx_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
207cxx_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
217cxx_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)
233