forked from bazel-contrib/toolchains_llvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WORKSPACE
235 lines (194 loc) · 7.87 KB
/
WORKSPACE
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# Copyright 2022 The Bazel Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
workspace(name = "toolchains_llvm_tests")
local_repository(
name = "toolchains_llvm",
path = "..",
)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@toolchains_llvm//toolchain:deps.bzl", "bazel_toolchain_dependencies")
bazel_toolchain_dependencies()
load("@toolchains_llvm//toolchain:rules.bzl", "llvm_toolchain")
# When updating this version, also update the versions associated with
# llvm_toolchain below, sys_paths_test in the workflows file, and xcompile_test
# through the `llvm_toolchain_with_sysroot` toolchain.
LLVM_VERSION = "16.0.0"
LLVM_VERSIONS = {
"": "16.0.0",
"darwin-aarch64": "16.0.5",
"darwin-x86_64": "15.0.7",
}
llvm_toolchain(
name = "llvm_toolchain",
llvm_versions = LLVM_VERSIONS,
)
# Example toolchain with user provided URLs.
# TODO(siddharthab): Add test.
llvm_toolchain(
name = "llvm_toolchain_with_urls",
llvm_versions = LLVM_VERSIONS,
sha256 = {
"": "38bc7f5563642e73e69ac5626724e206d6d539fbef653541b34cae0ba9c3f036",
"darwin-aarch64": "867c6afd41158c132ef05a8f1ddaecf476a26b91c85def8e124414f9a9ba188d",
"darwin-x86_64": "d16b6d536364c5bec6583d12dd7e6cf841b9f508c4430d9ee886726bd9983f1c",
},
strip_prefix = {
"": "clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04",
"darwin-aarch64": "clang+llvm-15.0.7-arm64-apple-darwin22.0",
"darwin-x86_64": "clang+llvm-15.0.7-x86_64-apple-darwin21.0",
},
urls = {
"": ["https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/clang+llvm-15.0.6-x86_64-linux-gnu-ubuntu-18.04.tar.xz"],
"darwin-aarch64": ["https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-arm64-apple-darwin22.0.tar.xz"],
"darwin-x86_64": ["https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.7/clang+llvm-15.0.7-x86_64-apple-darwin21.0.tar.xz"],
},
)
# This is the last known LLVM version with zlib support in ld.lld. Without zlib
# support, if the installed gcc toolchain has compressed sections in its object
# files, then ld.lld won't be able to process them. Example is archlinux docker
# image base-devel as of the time of this writing (23 May 2022).
llvm_toolchain(
name = "llvm_toolchain_13_0_0",
llvm_version = "13.0.0",
)
load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")
llvm_register_toolchains()
## Toolchain example with absolute paths; tested in GitHub CI.
llvm_toolchain(
name = "llvm_toolchain_with_absolute_paths",
absolute_paths = True,
llvm_version = LLVM_VERSION,
# We can share the downloaded LLVM distribution with the first configuration.
toolchain_roots = {
"": "@llvm_toolchain_llvm//",
},
)
## Toolchain example with system LLVM; tested in GitHub CI.
llvm_toolchain(
name = "llvm_toolchain_with_system_llvm",
llvm_version = LLVM_VERSION,
# For this toolchain to work, the LLVM distribution archive would need to be unpacked here.
toolchain_roots = {"": "/opt/llvm-16"},
)
## Toolchain example with a sysroot.
# This sysroot is used by github.com/vsco/bazel-toolchains.
http_archive(
name = "org_chromium_sysroot_linux_x64",
build_file_content = """
filegroup(
name = "sysroot",
srcs = glob(["*/**"]),
visibility = ["//visibility:public"],
)
""",
sha256 = "84656a6df544ecef62169cfe3ab6e41bb4346a62d3ba2a045dc5a0a2ecea94a3",
urls = ["https://commondatastorage.googleapis.com/chrome-linux-sysroot/toolchain/2202c161310ffde63729f29d27fe7bb24a0bc540/debian_stretch_amd64_sysroot.tar.xz"],
)
llvm_toolchain(
name = "llvm_toolchain_with_sysroot",
llvm_versions = LLVM_VERSIONS,
sysroot = {
"linux-x86_64": "@org_chromium_sysroot_linux_x64//:sysroot",
},
# We can share the downloaded LLVM distribution with the first configuration.
toolchain_roots = {
"": "@llvm_toolchain_llvm//",
},
)
http_archive(
name = "bazel_skylib",
sha256 = "cd55a062e763b9349921f0f5db8c3933288dc8ba4f76dd9416aac68acee3cb94",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.5.0/bazel-skylib-1.5.0.tar.gz",
],
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
# Well known repos; present here only for testing.
http_archive(
name = "com_google_googletest",
sha256 = "8ad598c73ad796e0d8280b082cebd82a630d73e73cd3c70057938a6501bba5d7",
strip_prefix = "googletest-1.14.0",
urls = ["https://github.com/google/googletest/archive/v1.14.0.tar.gz"],
)
http_archive(
name = "com_github_google_benchmark",
sha256 = "6bc180a57d23d4d9515519f92b0c83d61b05b5bab188961f36ac7b06b0d9e9ce",
strip_prefix = "benchmark-1.8.3",
urls = ["https://github.com/google/benchmark/archive/v1.8.3.tar.gz"],
)
http_archive(
name = "com_google_absl",
strip_prefix = "abseil-cpp-b2dd3a5be797f8194bbc230c65f35aadd3998535",
urls = ["https://github.com/abseil/abseil-cpp/archive/b2dd3a5be797f8194bbc230c65f35aadd3998535.tar.gz"],
)
http_archive(
name = "openssl",
build_file = "//openssl:openssl.bazel",
sha256 = "f6fb3079ad15076154eda9413fed42877d668e7069d9b87396d0804fdb3f4c90",
strip_prefix = "openssl-1.1.1c",
urls = ["https://www.openssl.org/source/openssl-1.1.1c.tar.gz"],
)
# For testing rules_go.
# Temporary override until newer version is released to the central registry.
# https://github.com/bazelbuild/rules_go/commit/31549c1f0fbe850aee3d2b7dd7a1303952f7cd75
http_archive(
name = "io_bazel_rules_go",
integrity = "sha256-8cixNZS5cm7qapSierAHoRQh8fA9dKMyFD5PBRvFgOY=",
strip_prefix = "rules_go-31549c1f0fbe850aee3d2b7dd7a1303952f7cd75",
urls = ["https://github.com/bazelbuild/rules_go/archive/31549c1f0fbe850aee3d2b7dd7a1303952f7cd75.tar.gz"],
)
load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_rules_dependencies")
go_rules_dependencies()
go_download_sdk(
name = "go_sdk",
version = "1.21.0",
)
# For testing rules_rust.
http_archive(
name = "rules_rust",
sha256 = "1ae45a413d0b9433987320df2ad410db6a15fafb6c88cf0fd1bf3baacbe826db",
urls = ["https://github.com/bazelbuild/rules_rust/releases/download/0.39.0/rules_rust-v0.39.0.tar.gz"],
)
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
rules_rust_dependencies()
rust_register_toolchains()
# For testing rules_foreign_cc.
# See https://bazelbuild.github.io/rules_foreign_cc/0.6.0/cmake.html
http_archive(
name = "rules_foreign_cc",
sha256 = "476303bd0f1b04cc311fc258f1708a5f6ef82d3091e53fd1977fa20383425a6a",
strip_prefix = "rules_foreign_cc-0.10.1",
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.10.1.tar.gz",
)
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
rules_foreign_cc_dependencies()
_ALL_CONTENT = """\
filegroup(
name = "all_srcs",
srcs = glob(["**"]),
visibility = ["//visibility:public"],
)
"""
http_archive(
name = "pcre",
build_file_content = _ALL_CONTENT,
sha256 = "0b8e7465dc5e98c757cc3650a20a7843ee4c3edf50aaf60bb33fd879690d2c73",
strip_prefix = "pcre-8.43",
urls = [
"https://mirror.bazel.build/ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz",
"https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz",
],
)