Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion utils/bazel/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ bazel_dep(name = "rules_cc", version = "0.2.11")
bazel_dep(name = "rules_foreign_cc", version = "0.15.1")
bazel_dep(name = "rules_python", version = "1.6.3")
bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "zlib-ng", version = "2.0.7", repo_name = "llvm_zlib")
bazel_dep(name = "zstd", version = "1.5.7", repo_name = "llvm_zstd")

llvm_repos_extension = use_extension(":extensions.bzl", "llvm_repos_extension")
use_repo(
llvm_repos_extension,
"gmp",
"llvm-raw",
"llvm_zlib",
"mpc",
"mpfr",
"nanobind",
Expand Down
15 changes: 3 additions & 12 deletions utils/bazel/MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions utils/bazel/extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ def _llvm_repos_extension_impl(module_ctx):
path = "../../",
)

http_archive(
name = "llvm_zlib",
build_file = "@llvm-raw//utils/bazel/third_party_build:zlib-ng.BUILD",
sha256 = "e36bb346c00472a1f9ff2a0a4643e590a254be6379da7cddd9daeb9a7f296731",
strip_prefix = "zlib-ng-2.0.7",
urls = [
"https://github.com/zlib-ng/zlib-ng/archive/refs/tags/2.0.7.zip",
],
)

http_archive(
name = "vulkan_headers",
build_file = "@llvm-raw//utils/bazel/third_party_build:vulkan_headers.BUILD",
Expand Down
2 changes: 1 addition & 1 deletion utils/bazel/llvm-project-overlay/lld/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ cc_library(
"//llvm:TargetParser",
"//llvm:TransformUtils",
"//llvm:config",
"//third-party:zlib",
"//third-party:zstd",
"@llvm_zlib//:zlib",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ cc_library(
"//llvm:Support",
"//llvm:TargetParser",
"//llvm:config",
"@llvm_zlib//:zlib",
"//third-party:zlib",
],
)

Expand Down Expand Up @@ -1406,7 +1406,7 @@ cc_library(
"//lldb:Utility",
"//llvm:Support",
"//llvm:config",
"@llvm_zlib//:zlib",
"//third-party:zlib",
],
)

Expand Down
2 changes: 1 addition & 1 deletion utils/bazel/llvm-project-overlay/llvm/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ cc_library(
# We unconditionally depend on the custom LLVM zlib wrapper. This will
# be an empty library unless zlib is enabled, in which case it will
# both provide the necessary dependencies and configuration defines.
"@llvm_zlib//:zlib",
"//third-party:zlib",
# We unconditionally depend on the custom LLVM zstd wrapper. This will
# be an empty library unless zstd is enabled, in which case it will
# both provide the necessary dependencies and configuration defines.
Expand Down
27 changes: 27 additions & 0 deletions utils/bazel/llvm-project-overlay/third-party/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,30 @@ cc_library_wrapper(
"//conditions:default": [],
}),
)

bool_flag(
name = "llvm_enable_zlib",
build_setting_default = True,
)

config_setting(
name = "llvm_zlib_enabled",
flag_values = {":llvm_enable_zlib": "true"},
)

cc_library_wrapper(
name = "zlib",
defines = select({
":llvm_zlib_enabled": [
"LLVM_ENABLE_ZLIB=1",
],
"//conditions:default": [],
}),
visibility = ["//visibility:public"],
deps = select({
":llvm_zlib_enabled": [
"@llvm_zlib//:zlib-ng",
],
"//conditions:default": [],
}),
)
18 changes: 4 additions & 14 deletions utils/bazel/third_party_build/zlib-ng.BUILD
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
# This file is licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
load("@rules_cc//cc:cc_library.bzl", "cc_library")

package(
default_visibility = ["//visibility:public"],
# BSD/MIT-like license (for zlib)
licenses = ["notice"],
)

bool_flag(
name = "llvm_enable_zlib",
build_setting_default = True,
)

config_setting(
name = "llvm_zlib_enabled",
flag_values = {":llvm_enable_zlib": "true"},
)

copy_file(
# The input template is identical to the CMake output.
name = "zconf_gen",
Expand All @@ -31,7 +21,7 @@ copy_file(
cc_library(
name = "zlib",
srcs = select({
":llvm_zlib_enabled": [
"@llvm-project//third-party:llvm_zlib_enabled": [
"adler32.c",
"adler32_p.h",
"chunkset.c",
Expand Down Expand Up @@ -79,7 +69,7 @@ cc_library(
"//conditions:default": [],
}),
hdrs = select({
":llvm_zlib_enabled": [
"@llvm-project//third-party:llvm_zlib_enabled": [
"zlib.h",
":zconf_gen",
],
Expand All @@ -96,7 +86,7 @@ cc_library(
# the default config for reproducibility.
],
defines = select({
":llvm_zlib_enabled": [
"@llvm-project//third-party:llvm_zlib_enabled": [
"LLVM_ENABLE_ZLIB=1",
],
"//conditions:default": [],
Expand Down
Loading