Skip to content

Commit 350e17b

Browse files
committed
add zstd.BUILD back
1 parent 5c60057 commit 350e17b

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

utils/bazel/MODULE.bazel

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ bazel_dep(name = "rules_cc", version = "0.2.11")
1515
bazel_dep(name = "rules_foreign_cc", version = "0.15.1")
1616
bazel_dep(name = "rules_python", version = "1.6.3")
1717
bazel_dep(name = "rules_shell", version = "0.6.1")
18+
bazel_dep(name = "zstd", version = "1.5.7", repo_name = "llvm_zstd")
1819

1920
llvm_repos_extension = use_extension(":extensions.bzl", "llvm_repos_extension")
2021
use_repo(
@@ -33,8 +34,6 @@ use_repo(
3334
"vulkan_sdk",
3435
)
3536

36-
bazel_dep(name = "zstd", version = "1.5.7", repo_name = "llvm_zstd")
37-
3837
llvm_configure = use_repo_rule("@llvm-raw//utils/bazel:configure.bzl", "llvm_configure")
3938

4039
llvm_configure(name = "llvm-project")
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
2+
# See https://llvm.org/LICENSE.txt for license information.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
5+
load("@rules_cc//cc:cc_library.bzl", "cc_library")
6+
7+
package(
8+
default_visibility = ["//visibility:public"],
9+
# BSD/MIT-like license (for zstd)
10+
licenses = ["notice"],
11+
)
12+
13+
bool_flag(
14+
name = "llvm_enable_zstd",
15+
build_setting_default = True,
16+
)
17+
18+
config_setting(
19+
name = "llvm_zstd_enabled",
20+
flag_values = {":llvm_enable_zstd": "true"},
21+
)
22+
23+
cc_library(
24+
name = "zstd",
25+
srcs = select({
26+
":llvm_zstd_enabled": glob([
27+
"lib/common/*.c",
28+
"lib/common/*.h",
29+
"lib/compress/*.c",
30+
"lib/compress/*.h",
31+
"lib/decompress/*.c",
32+
"lib/decompress/*.h",
33+
"lib/decompress/*.S",
34+
"lib/dictBuilder/*.c",
35+
"lib/dictBuilder/*.h",
36+
]),
37+
"//conditions:default": [],
38+
}),
39+
hdrs = select({
40+
":llvm_zstd_enabled": [
41+
"lib/zdict.h",
42+
"lib/zstd.h",
43+
"lib/zstd_errors.h",
44+
],
45+
"//conditions:default": [],
46+
}),
47+
defines = select({
48+
":llvm_zstd_enabled": [
49+
"LLVM_ENABLE_ZSTD=1",
50+
"ZSTD_MULTITHREAD",
51+
],
52+
"//conditions:default": [],
53+
}),
54+
strip_include_prefix = "lib",
55+
)

0 commit comments

Comments
 (0)