blob: 6fd49f313a20dc5be8efd95e2dc332aa78d07b8b [file] [log] [blame]
Thi Doan52457b12020-12-08 04:49:48 -08001load("@bazel_skylib//lib:selects.bzl", "selects")
2
tomlu1a483d42017-11-30 15:08:40 -08003filegroup(
4 name = "srcs",
5 srcs = glob(["**"]),
pcloudyb5f35212020-05-08 01:06:30 -07006 visibility = [
7 "//src:__pkg__",
8 "//src/test/shell/bazel:__pkg__",
9 ],
tomlu1a483d42017-11-30 15:08:40 -080010)
11
12filegroup(
13 name = "embedded_tools",
14 srcs = ["BUILD.tools"],
15 visibility = ["//src:__pkg__"],
16)
17
Ivo List6d637f42020-11-09 08:16:33 -080018config_setting(
19 name = "linux",
20 constraint_values = ["@platforms//os:linux"],
21 visibility = ["//visibility:public"],
22)
adonovan5598ac42020-04-09 12:20:59 -070023
tomlu1a483d42017-11-30 15:08:40 -080024config_setting(
Googler78a29b02020-06-03 12:42:48 -070025 name = "linux_aarch64",
Ivo List6d637f42020-11-09 08:16:33 -080026 constraint_values = [
27 "@platforms//os:linux",
28 "@platforms//cpu:aarch64",
29 ],
Googler78a29b02020-06-03 12:42:48 -070030 visibility = ["//visibility:public"],
31)
32
33config_setting(
34 name = "linux_arm",
Ivo List6d637f42020-11-09 08:16:33 -080035 constraint_values = [
36 "@platforms//os:linux",
37 "@platforms//cpu:arm",
38 ],
Googler78a29b02020-06-03 12:42:48 -070039 visibility = ["//visibility:public"],
40)
41
42config_setting(
Christy Norman5cff4f12019-09-27 07:29:15 -070043 name = "linux_ppc",
Ivo List6d637f42020-11-09 08:16:33 -080044 constraint_values = [
45 "@platforms//os:linux",
46 "@platforms//cpu:ppc",
47 ],
Christy Norman5cff4f12019-09-27 07:29:15 -070048 visibility = ["//visibility:public"],
49)
50
51config_setting(
Jason Furmanek04e073e2020-05-28 05:48:09 -070052 name = "linux_ppc64le",
Ivo List6d637f42020-11-09 08:16:33 -080053 constraint_values = [
54 "@platforms//os:linux",
55 "@platforms//cpu:ppc",
56 ],
Jason Furmanek04e073e2020-05-28 05:48:09 -070057 visibility = ["//visibility:public"],
58)
59
60config_setting(
Jonathan Springer07b62472020-02-12 10:29:10 -080061 name = "linux_s390x",
Ivo List6d637f42020-11-09 08:16:33 -080062 constraint_values = [
63 "@platforms//os:linux",
64 "@platforms//cpu:s390x",
65 ],
Jonathan Springer07b62472020-02-12 10:29:10 -080066 visibility = ["//visibility:public"],
67)
68
69config_setting(
Yun Peng1c29dff2021-03-01 01:28:01 -080070 name = "linux_mips64",
71 constraint_values = [
72 "@platforms//os:linux",
73 "@platforms//cpu:mips64",
74 ],
75 visibility = ["//visibility:public"],
76)
77
78config_setting(
79 name = "linux_riscv64",
80 constraint_values = [
81 "@platforms//os:linux",
82 "@platforms//cpu:riscv64",
83 ],
84 visibility = ["//visibility:public"],
85)
86
87config_setting(
tomlu1a483d42017-11-30 15:08:40 -080088 name = "linux_x86_64",
Ivo List6d637f42020-11-09 08:16:33 -080089 constraint_values = [
90 "@platforms//os:linux",
91 "@platforms//cpu:x86_64",
92 ],
tomlu1a483d42017-11-30 15:08:40 -080093 visibility = ["//visibility:public"],
94)
95
96config_setting(
97 name = "darwin",
Ivo List6d637f42020-11-09 08:16:33 -080098 constraint_values = ["@platforms//os:macos"],
tomlu1a483d42017-11-30 15:08:40 -080099 visibility = ["//visibility:public"],
100)
101
102config_setting(
103 name = "darwin_x86_64",
Ivo List6d637f42020-11-09 08:16:33 -0800104 constraint_values = [
105 "@platforms//os:macos",
106 "@platforms//cpu:x86_64",
107 ],
tomlu1a483d42017-11-30 15:08:40 -0800108 visibility = ["//visibility:public"],
109)
110
111config_setting(
Thi Doan52457b12020-12-08 04:49:48 -0800112 name = "darwin_arm64_constraint",
Ivo List6d637f42020-11-09 08:16:33 -0800113 constraint_values = [
114 "@platforms//os:macos",
115 "@platforms//cpu:arm64",
116 ],
Thi Doan52457b12020-12-08 04:49:48 -0800117)
118
119config_setting(
120 name = "darwin_arm64_flag",
Googler5bab7ef2022-05-11 10:13:56 -0700121 constraint_values = [
122 "@platforms//os:macos",
123 "@platforms//cpu:x86_64",
124 ],
Thi Doan52457b12020-12-08 04:49:48 -0800125 values = {"cpu": "darwin_arm64"},
126)
127
128# Workaround for an issue where the dummy cc toolchain isn't being picked up
129# when cross-compile from darwin_x86_64 to darwin_arm64 cpu.
130# TODO(https://github.com/bazelbuild/bazel/issues/12655): Remove the flag based
131# select when the issue is resolved.
132selects.config_setting_group(
133 name = "darwin_arm64",
134 match_any = [
135 ":darwin_arm64_constraint",
136 ":darwin_arm64_flag",
137 ],
Dave MacLachlan96898592020-09-01 14:31:33 -0700138 visibility = ["//visibility:public"],
139)
140
141config_setting(
142 name = "darwin_arm64e",
Ivo List6d637f42020-11-09 08:16:33 -0800143 constraint_values = [
144 "@platforms//os:macos",
145 "@platforms//cpu:arm64e",
146 ],
Dave MacLachlan96898592020-09-01 14:31:33 -0700147 visibility = ["//visibility:public"],
148)
149
150config_setting(
tomlu1a483d42017-11-30 15:08:40 -0800151 name = "iphonesdk",
152 values = {"define": "IPHONE_SDK=1"},
153 visibility = ["//visibility:public"],
154)
155
156config_setting(
157 name = "freebsd",
Ivo List6d637f42020-11-09 08:16:33 -0800158 constraint_values = ["@platforms//os:freebsd"],
tomlu1a483d42017-11-30 15:08:40 -0800159 visibility = ["//visibility:public"],
160)
161
162config_setting(
Googler070a5192019-12-06 09:21:42 -0800163 name = "openbsd",
Ivo List6d637f42020-11-09 08:16:33 -0800164 constraint_values = ["@platforms//os:openbsd"],
Googler070a5192019-12-06 09:21:42 -0800165 visibility = ["//visibility:public"],
166)
167
168config_setting(
tomlu1a483d42017-11-30 15:08:40 -0800169 name = "windows",
Ivo List6d637f42020-11-09 08:16:33 -0800170 constraint_values = ["@platforms//os:windows"],
tomlu1a483d42017-11-30 15:08:40 -0800171 visibility = ["//visibility:public"],
172)
173
174config_setting(
Niyas Sait0ba4caa2022-02-02 10:29:06 -0800175 name = "windows_x86_64",
176 constraint_values = [
177 "@platforms//os:windows",
178 "@platforms//cpu:x86_64",
179 ],
180 visibility = ["//visibility:public"],
181)
182
183config_setting(
184 name = "windows_arm64_constraint",
185 constraint_values = [
186 "@platforms//os:windows",
187 "@platforms//cpu:arm64",
188 ],
189)
190
191# TODO(https://github.com/bazelbuild/bazel/issues/7260)
192# Remove the flag after toolchain cc resolution is fixed
193config_setting(
194 name = "windows_x64_arm64_flag",
Googler5bab7ef2022-05-11 10:13:56 -0700195 constraint_values = [
196 "@platforms//os:windows",
197 "@platforms//cpu:x86_64",
198 ],
Niyas Sait0ba4caa2022-02-02 10:29:06 -0800199 values = {"cpu": "x64_arm64_windows"},
200)
201
202config_setting(
203 name = "windows_arm64_flag",
204 values = {"cpu": "arm64_windows"},
205)
206
207selects.config_setting_group(
208 name = "windows_arm64",
209 match_any = [
210 ":windows_arm64_constraint",
211 ":windows_arm64_flag",
212 ":windows_x64_arm64_flag",
213 ],
214 visibility = ["//visibility:public"],
215)
216
217config_setting(
tomlu1a483d42017-11-30 15:08:40 -0800218 name = "arm",
Ivo List6d637f42020-11-09 08:16:33 -0800219 constraint_values = ["@platforms//cpu:arm"],
tomlu1a483d42017-11-30 15:08:40 -0800220 visibility = ["//visibility:public"],
221)
222
223config_setting(
tomlu1a483d42017-11-30 15:08:40 -0800224 name = "remote",
225 values = {"define": "EXECUTOR=remote"},
226 visibility = ["//visibility:public"],
227)
Yun Peng01609b82020-05-04 11:12:33 -0700228
229config_setting(
230 name = "debian_build",
231 values = {
232 "define": "distribution=debian",
233 },
234 visibility = ["//visibility:public"],
235)