xref: /freebsd/sys/contrib/zstd/lib/BUCK (revision 389e4940069316fe667ffa263fa7d6390d0a960f)
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    ]),
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        ':bitstream',
121        ':compiler',
122        ':errors',
123        ':mem',
124    ],
125)
126
127cxx_library(
128    name='errors',
129    header_namespace='',
130    visibility=['PUBLIC'],
131    exported_headers=subdir_glob([
132        ('common', 'error_private.h'),
133        ('common', 'zstd_errors.h'),
134    ]),
135    srcs=['common/error_private.c'],
136)
137
138cxx_library(
139    name='mem',
140    header_namespace='',
141    visibility=['PUBLIC'],
142    exported_headers=subdir_glob([
143        ('common', 'mem.h'),
144    ]),
145)
146
147cxx_library(
148    name='pool',
149    header_namespace='',
150    visibility=['PUBLIC'],
151    exported_headers=subdir_glob([
152        ('common', 'pool.h'),
153    ]),
154    srcs=['common/pool.c'],
155    deps=[
156        ':threading',
157        ':zstd_common',
158    ],
159)
160
161cxx_library(
162    name='threading',
163    header_namespace='',
164    visibility=['PUBLIC'],
165    exported_headers=subdir_glob([
166        ('common', 'threading.h'),
167    ]),
168    srcs=['common/threading.c'],
169    exported_preprocessor_flags=[
170        '-DZSTD_MULTITHREAD',
171    ],
172    exported_linker_flags=[
173        '-pthread',
174    ],
175)
176
177cxx_library(
178    name='xxhash',
179    header_namespace='',
180    visibility=['PUBLIC'],
181    exported_headers=subdir_glob([
182        ('common', 'xxhash.h'),
183    ]),
184    srcs=['common/xxhash.c'],
185    exported_preprocessor_flags=[
186        '-DXXH_NAMESPACE=ZSTD_',
187    ],
188)
189
190cxx_library(
191    name='zstd_common',
192    header_namespace='',
193    visibility=['PUBLIC'],
194    exported_headers=subdir_glob([
195        ('', 'zstd.h'),
196        ('common', 'zstd_internal.h'),
197    ]),
198    srcs=['common/zstd_common.c'],
199    deps=[
200        ':compiler',
201        ':errors',
202        ':mem',
203    ],
204)
205
206cxx_library(
207    name='common',
208    deps=[
209        ':bitstream',
210        ':compiler',
211        ':cpu',
212        ':entropy',
213        ':errors',
214        ':mem',
215        ':pool',
216        ':threading',
217        ':xxhash',
218        ':zstd_common',
219    ]
220)
221