xref: /freebsd/sys/contrib/zstd/lib/BUCK (revision 52f72944b8f5abb2386eae924357dee8aea17d5b)
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    srcs=glob(['decompress/zstd*.c']),
29    deps=[
30        ':common',
31        ':legacy',
32    ],
33)
34
35cxx_library(
36    name='deprecated',
37    header_namespace='',
38    visibility=['PUBLIC'],
39    exported_headers=subdir_glob([
40        ('decprecated', '*.h'),
41    ]),
42    srcs=glob(['deprecated/*.c']),
43    deps=[':common'],
44)
45
46cxx_library(
47    name='legacy',
48    header_namespace='',
49    visibility=['PUBLIC'],
50    exported_headers=subdir_glob([
51        ('legacy', '*.h'),
52    ]),
53    srcs=glob(['legacy/*.c']),
54    deps=[':common'],
55    exported_preprocessor_flags=[
56        '-DZSTD_LEGACY_SUPPORT=4',
57    ],
58)
59
60cxx_library(
61    name='zdict',
62    header_namespace='',
63    visibility=['PUBLIC'],
64    exported_headers=subdir_glob([
65        ('dictBuilder', 'zdict.h'),
66    ]),
67    headers=subdir_glob([
68        ('dictBuilder', 'divsufsort.h'),
69    ]),
70    srcs=glob(['dictBuilder/*.c']),
71    deps=[':common'],
72)
73
74cxx_library(
75    name='compiler',
76    header_namespace='',
77    visibility=['PUBLIC'],
78    exported_headers=subdir_glob([
79        ('common', 'compiler.h'),
80    ]),
81)
82
83cxx_library(
84    name='bitstream',
85    header_namespace='',
86    visibility=['PUBLIC'],
87    exported_headers=subdir_glob([
88        ('common', 'bitstream.h'),
89    ]),
90)
91
92cxx_library(
93    name='entropy',
94    header_namespace='',
95    visibility=['PUBLIC'],
96    exported_headers=subdir_glob([
97        ('common', 'fse.h'),
98        ('common', 'huf.h'),
99    ]),
100    srcs=[
101        'common/entropy_common.c',
102        'common/fse_decompress.c',
103        'compress/fse_compress.c',
104        'compress/huf_compress.c',
105        'decompress/huf_decompress.c',
106    ],
107    deps=[
108        ':bitstream',
109        ':compiler',
110        ':errors',
111        ':mem',
112    ],
113)
114
115cxx_library(
116    name='errors',
117    header_namespace='',
118    visibility=['PUBLIC'],
119    exported_headers=subdir_glob([
120        ('common', 'error_private.h'),
121        ('common', 'zstd_errors.h'),
122    ]),
123    srcs=['common/error_private.c'],
124)
125
126cxx_library(
127    name='mem',
128    header_namespace='',
129    visibility=['PUBLIC'],
130    exported_headers=subdir_glob([
131        ('common', 'mem.h'),
132    ]),
133)
134
135cxx_library(
136    name='pool',
137    header_namespace='',
138    visibility=['PUBLIC'],
139    exported_headers=subdir_glob([
140        ('common', 'pool.h'),
141    ]),
142    srcs=['common/pool.c'],
143    deps=[
144        ':threading',
145        ':zstd_common',
146    ],
147)
148
149cxx_library(
150    name='threading',
151    header_namespace='',
152    visibility=['PUBLIC'],
153    exported_headers=subdir_glob([
154        ('common', 'threading.h'),
155    ]),
156    srcs=['common/threading.c'],
157    exported_preprocessor_flags=[
158        '-DZSTD_MULTITHREAD',
159    ],
160    exported_linker_flags=[
161        '-pthread',
162    ],
163)
164
165cxx_library(
166    name='xxhash',
167    header_namespace='',
168    visibility=['PUBLIC'],
169    exported_headers=subdir_glob([
170        ('common', 'xxhash.h'),
171    ]),
172    srcs=['common/xxhash.c'],
173    exported_preprocessor_flags=[
174        '-DXXH_NAMESPACE=ZSTD_',
175    ],
176)
177
178cxx_library(
179    name='zstd_common',
180    header_namespace='',
181    visibility=['PUBLIC'],
182    exported_headers=subdir_glob([
183        ('', 'zstd.h'),
184        ('common', 'zstd_internal.h'),
185    ]),
186    srcs=['common/zstd_common.c'],
187    deps=[
188        ':compiler',
189        ':errors',
190        ':mem',
191    ],
192)
193
194cxx_library(
195    name='common',
196    deps=[
197        ':bitstream',
198        ':compiler',
199        ':entropy',
200        ':errors',
201        ':mem',
202        ':pool',
203        ':threading',
204        ':xxhash',
205        ':zstd_common',
206    ]
207)
208