Skip to content

Commit 01527a3

Browse files
committed
chore: migrate lz4 to use BUILD.bazel from BCR
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
1 parent dc9a0de commit 01527a3

File tree

7 files changed

+105
-41
lines changed

7 files changed

+105
-41
lines changed

MODULE.bazel

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ bazel_dep(name = "envoy_api", version = "1.37.0-dev")
88
bazel_dep(name = "envoy_build_config", version = "1.37.0-dev")
99
bazel_dep(name = "envoy_mobile", version = "1.37.0-dev")
1010
bazel_dep(name = "gperftools", version = "2.17.2")
11+
bazel_dep(name = "lz4", version = "1.10.0.bcr.1")
1112
bazel_dep(name = "numactl", version = "2.0.19")
1213
bazel_dep(name = "platforms", version = "1.0.0")
1314
bazel_dep(name = "rules_python", version = "1.6.3")

MODULE.bazel.lock

Lines changed: 16 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bazel/external/lz4.BUILD

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
load("@rules_cc//cc:defs.bzl", "cc_library")
2+
3+
cc_library(
4+
name = "lz4",
5+
srcs = [
6+
"lib/lz4.c",
7+
"lib/xxhash.c",
8+
"lib/xxhash.h",
9+
],
10+
hdrs = [
11+
"lib/lz4.h",
12+
],
13+
strip_include_prefix = "lib/",
14+
visibility = ["//visibility:public"],
15+
)
16+
17+
cc_library(
18+
name = "lz4_lz4c_include",
19+
hdrs = [
20+
"lib/lz4.c",
21+
],
22+
strip_include_prefix = "lib/",
23+
)
24+
25+
cc_library(
26+
name = "lz4_hc",
27+
srcs = [
28+
"lib/lz4hc.c",
29+
],
30+
hdrs = [
31+
"lib/lz4hc.h",
32+
],
33+
strip_include_prefix = "lib/",
34+
visibility = ["//visibility:public"],
35+
deps = [
36+
":lz4",
37+
":lz4_lz4c_include",
38+
],
39+
)
40+
41+
cc_library(
42+
name = "lz4_file",
43+
srcs = [
44+
"lib/lz4file.c",
45+
],
46+
hdrs = [
47+
"lib/lz4file.h",
48+
],
49+
strip_include_prefix = "lib/",
50+
visibility = ["//:__subpackages__"],
51+
deps = [
52+
":lz4",
53+
":lz4_frame",
54+
],
55+
)
56+
57+
cc_library(
58+
name = "lz4_frame",
59+
srcs = [
60+
"lib/lz4frame.c",
61+
"lib/lz4frame_static.h",
62+
],
63+
hdrs = [
64+
"lib/lz4frame.h",
65+
],
66+
strip_include_prefix = "lib/",
67+
visibility = ["//visibility:public"],
68+
deps = [
69+
":lz4",
70+
":lz4_hc",
71+
],
72+
)
73+
74+
cc_library(
75+
name = "lz4_xxhash_include",
76+
hdrs = [
77+
"lib/xxhash.h",
78+
],
79+
strip_include_prefix = "lib/",
80+
visibility = ["//:__subpackages__"],
81+
)

bazel/foreign_cc/BUILD

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
22
load("@rules_cc//cc:defs.bzl", "cc_library")
33
load("@rules_foreign_cc//foreign_cc:configure.bzl", "configure_make")
4-
load("@rules_foreign_cc//foreign_cc:make.bzl", "make")
54
load("//bazel:envoy_build_system.bzl", "envoy_cc_library", "envoy_cmake", "envoy_package")
65

76
licenses(["notice"]) # Apache 2
@@ -56,25 +55,6 @@ envoy_cc_library(
5655
}),
5756
)
5857

59-
make(
60-
name = "lz4",
61-
args = [
62-
"MOREFLAGS='-fPIC'",
63-
"BUILD_SHARED=no",
64-
],
65-
lib_source = "@com_github_lz4_lz4//:all",
66-
out_static_libs = [
67-
"liblz4.a",
68-
],
69-
tags = ["skip_on_windows"],
70-
targets = [
71-
"lib",
72-
"install",
73-
],
74-
visibility = ["//visibility:public"],
75-
alwayslink = False,
76-
)
77-
7858
# Kafka client dependency used by Kafka-mesh filter.
7959
# librdkafka build generates extra headers that need to be copied into source to get it to compile.
8060
configure_make(
@@ -93,7 +73,7 @@ configure_make(
9373
targets = [
9474
"ARFLAGS='' WITH_LDS='n' libs install-subdirs",
9575
],
96-
deps = [":lz4"],
76+
deps = ["@lz4"],
9777
alwayslink = True,
9878
)
9979

bazel/repositories.bzl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def envoy_dependencies(skip_targets = []):
161161
_com_github_intel_qatlib()
162162
_com_github_intel_qatzip()
163163
_com_github_qat_zstd()
164-
_com_github_lz4_lz4()
164+
_lz4()
165165
_com_github_jbeder_yaml_cpp()
166166
_com_github_libevent_libevent()
167167
_com_github_luajit_luajit()
@@ -412,10 +412,10 @@ def _com_github_qat_zstd():
412412
patches = ["@envoy//bazel/foreign_cc:qatzstd.patch"],
413413
)
414414

415-
def _com_github_lz4_lz4():
415+
def _lz4():
416416
external_http_archive(
417-
name = "com_github_lz4_lz4",
418-
build_file_content = BUILD_ALL_CONTENT,
417+
name = "lz4",
418+
build_file = "@envoy//bazel/external:lz4.BUILD",
419419
)
420420

421421
def _com_github_jbeder_yaml_cpp():

bazel/repository_locations.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1681,7 +1681,7 @@ REPOSITORY_LOCATIONS_SPEC = dict(
16811681
license = "Apache-2.0",
16821682
license_url = "https://github.com/maxmind/libmaxminddb/blob/{version}/LICENSE",
16831683
),
1684-
com_github_lz4_lz4 = dict(
1684+
lz4 = dict(
16851685
project_name = "LZ4",
16861686
project_desc = "Extremely Fast Compression algorithm",
16871687
project_url = "http://www.lz4.org/",

contrib/qat/compression/qatzip/compressor/source/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ configure_make(
4848
target_compatible_with = envoy_contrib_linux_x86_64_constraints(),
4949
visibility = ["//visibility:public"],
5050
deps = [
51-
"//bazel/foreign_cc:lz4",
51+
"@lz4",
5252
"@zlib",
5353
"//contrib/qat:qatlib",
5454
# Use boringssl alias to select fips vs non-fips version.

0 commit comments

Comments
 (0)