Skip to content

Commit c863fe8

Browse files
committed
Revert "[bazel] Use zlib-ng from the BCR (llvm#169450)"
This reverts commit 9626c90.
1 parent e1cb8b4 commit c863fe8

File tree

7 files changed

+41
-12
lines changed

7 files changed

+41
-12
lines changed

utils/bazel/MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ 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 = "zlib-ng", version = "2.0.7", repo_name = "llvm_zlib")
1918
bazel_dep(name = "zstd", version = "1.5.7", repo_name = "llvm_zstd")
2019

2120
llvm_repos_extension = use_extension(":extensions.bzl", "llvm_repos_extension")
2221
use_repo(
2322
llvm_repos_extension,
2423
"gmp",
2524
"llvm-raw",
25+
"llvm_zlib",
2626
"mpc",
2727
"mpfr",
2828
"nanobind",

utils/bazel/MODULE.bazel.lock

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

utils/bazel/extensions.bzl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ def _llvm_repos_extension_impl(module_ctx):
1616
path = "../../",
1717
)
1818

19+
http_archive(
20+
name = "llvm_zlib",
21+
build_file = "@llvm-raw//utils/bazel/third_party_build:zlib-ng.BUILD",
22+
sha256 = "e36bb346c00472a1f9ff2a0a4643e590a254be6379da7cddd9daeb9a7f296731",
23+
strip_prefix = "zlib-ng-2.0.7",
24+
urls = [
25+
"https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.7.zip",
26+
],
27+
)
28+
1929
http_archive(
2030
name = "vulkan_headers",
2131
build_file = "@llvm-raw//utils/bazel/third_party_build:vulkan_headers.BUILD",

utils/bazel/llvm-project-overlay/lld/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ cc_library(
105105
"//llvm:TargetParser",
106106
"//llvm:TransformUtils",
107107
"//llvm:config",
108-
"//third-party:zlib",
109108
"//third-party:zstd",
109+
"@llvm_zlib//:zlib",
110110
],
111111
)
112112

utils/bazel/llvm-project-overlay/lldb/source/Plugins/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ cc_library(
493493
"//llvm:Support",
494494
"//llvm:TargetParser",
495495
"//llvm:config",
496-
"//third-party:zlib",
496+
"@llvm_zlib//:zlib",
497497
],
498498
)
499499

@@ -1406,7 +1406,7 @@ cc_library(
14061406
"//lldb:Utility",
14071407
"//llvm:Support",
14081408
"//llvm:config",
1409-
"//third-party:zlib",
1409+
"@llvm_zlib//:zlib",
14101410
],
14111411
)
14121412

utils/bazel/llvm-project-overlay/llvm/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ cc_library(
327327
# We unconditionally depend on the custom LLVM zlib wrapper. This will
328328
# be an empty library unless zlib is enabled, in which case it will
329329
# both provide the necessary dependencies and configuration defines.
330-
"//third-party:zlib",
330+
"@llvm_zlib//:zlib",
331331
# We unconditionally depend on the custom LLVM zstd wrapper. This will
332332
# be an empty library unless zstd is enabled, in which case it will
333333
# both provide the necessary dependencies and configuration defines.

utils/bazel/third_party_build/zlib-ng.BUILD

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
11
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
22
# See https://llvm.org/LICENSE.txt for license information.
33
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
45
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
5-
load("@rules_cc//cc:cc_library.bzl", "cc_library")
66

77
package(
88
default_visibility = ["//visibility:public"],
99
# BSD/MIT-like license (for zlib)
1010
licenses = ["notice"],
1111
)
1212

13+
bool_flag(
14+
name = "llvm_enable_zlib",
15+
build_setting_default = True,
16+
)
17+
18+
config_setting(
19+
name = "llvm_zlib_enabled",
20+
flag_values = {":llvm_enable_zlib": "true"},
21+
)
22+
1323
copy_file(
1424
# The input template is identical to the CMake output.
1525
name = "zconf_gen",
@@ -21,7 +31,7 @@ copy_file(
2131
cc_library(
2232
name = "zlib",
2333
srcs = select({
24-
"@llvm-project//third-party:llvm_zlib_enabled": [
34+
":llvm_zlib_enabled": [
2535
"adler32.c",
2636
"adler32_p.h",
2737
"chunkset.c",
@@ -69,7 +79,7 @@ cc_library(
6979
"//conditions:default": [],
7080
}),
7181
hdrs = select({
72-
"@llvm-project//third-party:llvm_zlib_enabled": [
82+
":llvm_zlib_enabled": [
7383
"zlib.h",
7484
":zconf_gen",
7585
],
@@ -86,7 +96,7 @@ cc_library(
8696
# the default config for reproducibility.
8797
],
8898
defines = select({
89-
"@llvm-project//third-party:llvm_zlib_enabled": [
99+
":llvm_zlib_enabled": [
90100
"LLVM_ENABLE_ZLIB=1",
91101
],
92102
"//conditions:default": [],

0 commit comments

Comments
 (0)