xref: /freebsd/sys/contrib/zstd/lib/BUCK (revision 63cbe8d1d95f97e93929ec66f1138693d08dd9f6)
1cxx_library(
2    name='zstd',
3    header_namespace='',
4    visibility=['PUBLIC'],
5    deps=[
6        ':common',
7        ':compress',
8        ':decompress',
9        ':deprecated',
10    ],
11)
12
13cxx_library(
14    name='compress',
15    header_namespace='',
16    visibility=['PUBLIC'],
17    exported_headers=subdir_glob([
18        ('compress', 'zstd*.h'),
19    ]),
20    srcs=glob(['compress/zstd*.c']),
21    deps=[':common'],
22)
23
24cxx_library(
25    name='decompress',
26    header_namespace='',
27    visibility=['PUBLIC'],
28    headers=subdir_glob([
29        ('decompress', '*_impl.h'),
30    ]),
31    srcs=glob(['decompress/zstd*.c']),
32    deps=[
33        ':common',
34        ':legacy',
35    ],
36)
37
38cxx_library(
39    name='deprecated',
40    header_namespace='',
41    visibility=['PUBLIC'],
42    exported_headers=subdir_glob([
43        ('decprecated', '*.h'),
44    ]),
45    srcs=glob(['deprecated/*.c']),
46    deps=[':common'],
47)
48
49cxx_library(
50    name='legacy',
51    header_namespace='',
52    visibility=['PUBLIC'],
53    exported_headers=subdir_glob([
54        ('legacy', '*.h'),
55    ]),
56    srcs=glob(['legacy/*.c']),
57    deps=[':common'],
58    exported_preprocessor_flags=[
59        '-DZSTD_LEGACY_SUPPORT=4',
60    ],
61)
62
63cxx_library(
64    name='zdict',
65    header_namespace='',
66    visibility=['PUBLIC'],
67    exported_headers=subdir_glob([
68        ('dictBuilder', 'zdict.h'),
69    ]),
70    headers=subdir_glob([
71        ('dictBuilder', 'divsufsort.h'),
72        ('dictBuilder', 'cover.h'),
73    ]),
74    srcs=glob(['dictBuilder/*.c']),
75    deps=[':common'],
76)
77
78cxx_library(
79    name='compiler',
80    header_namespace='',
81    visibility=['PUBLIC'],
82    exported_headers=subdir_glob([
83        ('common', 'compiler.h'),
84    ]),
85)
86
87cxx_library(
88    name='cpu',
89    header_namespace='',
90    visibility=['PUBLIC'],
91    exported_headers=subdir_glob([
92        ('common', 'cpu.h'),
93    ]),
94)
95
96cxx_library(
97    name='bitstream',
98    header_namespace='',
99    visibility=['PUBLIC'],
100    exported_headers=subdir_glob([
101        ('common', 'bitstream.h'),
102    ]),
103)
104
105cxx_library(
106    name='entropy',
107    header_namespace='',
108    visibility=['PUBLIC'],
109    exported_headers=subdir_glob([
110        ('common', 'fse.h'),
111        ('common', 'huf.h'),
112    ]),
113    srcs=[
114        'common/entropy_common.c',
115        'common/fse_decompress.c',
116        'compress/fse_compress.c',
117        'compress/huf_compress.c',
118        'decompress/huf_decompress.c',
119    ],
120    deps=[
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=subdir_glob([
133        ('common', 'error_private.h'),
134        ('common', 'zstd_errors.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='common',
209    deps=[
210        ':bitstream',
211        ':compiler',
212        ':cpu',
213        ':entropy',
214        ':errors',
215        ':mem',
216        ':pool',
217        ':threading',
218        ':xxhash',
219        ':zstd_common',
220    ]
221)
222