Thi Doan | 52457b1 | 2020-12-08 04:49:48 -0800 | [diff] [blame] | 1 | load("@bazel_skylib//lib:selects.bzl", "selects") |
| 2 | |
tomlu | 1a483d4 | 2017-11-30 15:08:40 -0800 | [diff] [blame] | 3 | filegroup( |
| 4 | name = "srcs", |
| 5 | srcs = glob(["**"]), |
pcloudy | b5f3521 | 2020-05-08 01:06:30 -0700 | [diff] [blame] | 6 | visibility = [ |
| 7 | "//src:__pkg__", |
| 8 | "//src/test/shell/bazel:__pkg__", |
| 9 | ], |
tomlu | 1a483d4 | 2017-11-30 15:08:40 -0800 | [diff] [blame] | 10 | ) |
| 11 | |
| 12 | filegroup( |
| 13 | name = "embedded_tools", |
| 14 | srcs = ["BUILD.tools"], |
| 15 | visibility = ["//src:__pkg__"], |
| 16 | ) |
| 17 | |
Ivo List | 6d637f4 | 2020-11-09 08:16:33 -0800 | [diff] [blame] | 18 | config_setting( |
| 19 | name = "linux", |
| 20 | constraint_values = ["@platforms//os:linux"], |
| 21 | visibility = ["//visibility:public"], |
| 22 | ) |
adonovan | 5598ac4 | 2020-04-09 12:20:59 -0700 | [diff] [blame] | 23 | |
tomlu | 1a483d4 | 2017-11-30 15:08:40 -0800 | [diff] [blame] | 24 | config_setting( |
Googler | 78a29b0 | 2020-06-03 12:42:48 -0700 | [diff] [blame] | 25 | name = "linux_aarch64", |
Ivo List | 6d637f4 | 2020-11-09 08:16:33 -0800 | [diff] [blame] | 26 | constraint_values = [ |
| 27 | "@platforms//os:linux", |
| 28 | "@platforms//cpu:aarch64", |
| 29 | ], |
Googler | 78a29b0 | 2020-06-03 12:42:48 -0700 | [diff] [blame] | 30 | visibility = ["//visibility:public"], |
| 31 | ) |
| 32 | |
| 33 | config_setting( |
| 34 | name = "linux_arm", |
Ivo List | 6d637f4 | 2020-11-09 08:16:33 -0800 | [diff] [blame] | 35 | constraint_values = [ |
| 36 | "@platforms//os:linux", |
| 37 | "@platforms//cpu:arm", |
| 38 | ], |
Googler | 78a29b0 | 2020-06-03 12:42:48 -0700 | [diff] [blame] | 39 | visibility = ["//visibility:public"], |
| 40 | ) |
| 41 | |
| 42 | config_setting( |
Christy Norman | 5cff4f1 | 2019-09-27 07:29:15 -0700 | [diff] [blame] | 43 | name = "linux_ppc", |
Ivo List | 6d637f4 | 2020-11-09 08:16:33 -0800 | [diff] [blame] | 44 | constraint_values = [ |
| 45 | "@platforms//os:linux", |
| 46 | "@platforms//cpu:ppc", |
| 47 | ], |
Christy Norman | 5cff4f1 | 2019-09-27 07:29:15 -0700 | [diff] [blame] | 48 | visibility = ["//visibility:public"], |
| 49 | ) |
| 50 | |
| 51 | config_setting( |
Jason Furmanek | 04e073e | 2020-05-28 05:48:09 -0700 | [diff] [blame] | 52 | name = "linux_ppc64le", |
Ivo List | 6d637f4 | 2020-11-09 08:16:33 -0800 | [diff] [blame] | 53 | constraint_values = [ |
| 54 | "@platforms//os:linux", |
| 55 | "@platforms//cpu:ppc", |
| 56 | ], |
Jason Furmanek | 04e073e | 2020-05-28 05:48:09 -0700 | [diff] [blame] | 57 | visibility = ["//visibility:public"], |
| 58 | ) |
| 59 | |
| 60 | config_setting( |
Jonathan Springer | 07b6247 | 2020-02-12 10:29:10 -0800 | [diff] [blame] | 61 | name = "linux_s390x", |
Ivo List | 6d637f4 | 2020-11-09 08:16:33 -0800 | [diff] [blame] | 62 | constraint_values = [ |
| 63 | "@platforms//os:linux", |
| 64 | "@platforms//cpu:s390x", |
| 65 | ], |
Jonathan Springer | 07b6247 | 2020-02-12 10:29:10 -0800 | [diff] [blame] | 66 | visibility = ["//visibility:public"], |
| 67 | ) |
| 68 | |
| 69 | config_setting( |
Yun Peng | 1c29dff | 2021-03-01 01:28:01 -0800 | [diff] [blame] | 70 | name = "linux_mips64", |
| 71 | constraint_values = [ |
| 72 | "@platforms//os:linux", |
| 73 | "@platforms//cpu:mips64", |
| 74 | ], |
| 75 | visibility = ["//visibility:public"], |
| 76 | ) |
| 77 | |
| 78 | config_setting( |
| 79 | name = "linux_riscv64", |
| 80 | constraint_values = [ |
| 81 | "@platforms//os:linux", |
| 82 | "@platforms//cpu:riscv64", |
| 83 | ], |
| 84 | visibility = ["//visibility:public"], |
| 85 | ) |
| 86 | |
| 87 | config_setting( |
tomlu | 1a483d4 | 2017-11-30 15:08:40 -0800 | [diff] [blame] | 88 | name = "linux_x86_64", |
Ivo List | 6d637f4 | 2020-11-09 08:16:33 -0800 | [diff] [blame] | 89 | constraint_values = [ |
| 90 | "@platforms//os:linux", |
| 91 | "@platforms//cpu:x86_64", |
| 92 | ], |
tomlu | 1a483d4 | 2017-11-30 15:08:40 -0800 | [diff] [blame] | 93 | visibility = ["//visibility:public"], |
| 94 | ) |
| 95 | |
| 96 | config_setting( |
| 97 | name = "darwin", |
Ivo List | 6d637f4 | 2020-11-09 08:16:33 -0800 | [diff] [blame] | 98 | constraint_values = ["@platforms//os:macos"], |
tomlu | 1a483d4 | 2017-11-30 15:08:40 -0800 | [diff] [blame] | 99 | visibility = ["//visibility:public"], |
| 100 | ) |
| 101 | |
| 102 | config_setting( |
| 103 | name = "darwin_x86_64", |
Ivo List | 6d637f4 | 2020-11-09 08:16:33 -0800 | [diff] [blame] | 104 | constraint_values = [ |
| 105 | "@platforms//os:macos", |
| 106 | "@platforms//cpu:x86_64", |
| 107 | ], |
tomlu | 1a483d4 | 2017-11-30 15:08:40 -0800 | [diff] [blame] | 108 | visibility = ["//visibility:public"], |
| 109 | ) |
| 110 | |
| 111 | config_setting( |
Thi Doan | 52457b1 | 2020-12-08 04:49:48 -0800 | [diff] [blame] | 112 | name = "darwin_arm64_constraint", |
Ivo List | 6d637f4 | 2020-11-09 08:16:33 -0800 | [diff] [blame] | 113 | constraint_values = [ |
| 114 | "@platforms//os:macos", |
| 115 | "@platforms//cpu:arm64", |
| 116 | ], |
Thi Doan | 52457b1 | 2020-12-08 04:49:48 -0800 | [diff] [blame] | 117 | ) |
| 118 | |
| 119 | config_setting( |
| 120 | name = "darwin_arm64_flag", |
Googler | 5bab7ef | 2022-05-11 10:13:56 -0700 | [diff] [blame] | 121 | constraint_values = [ |
| 122 | "@platforms//os:macos", |
| 123 | "@platforms//cpu:x86_64", |
| 124 | ], |
Thi Doan | 52457b1 | 2020-12-08 04:49:48 -0800 | [diff] [blame] | 125 | 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. |
| 132 | selects.config_setting_group( |
| 133 | name = "darwin_arm64", |
| 134 | match_any = [ |
| 135 | ":darwin_arm64_constraint", |
| 136 | ":darwin_arm64_flag", |
| 137 | ], |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 138 | visibility = ["//visibility:public"], |
| 139 | ) |
| 140 | |
| 141 | config_setting( |
| 142 | name = "darwin_arm64e", |
Ivo List | 6d637f4 | 2020-11-09 08:16:33 -0800 | [diff] [blame] | 143 | constraint_values = [ |
| 144 | "@platforms//os:macos", |
| 145 | "@platforms//cpu:arm64e", |
| 146 | ], |
Dave MacLachlan | 9689859 | 2020-09-01 14:31:33 -0700 | [diff] [blame] | 147 | visibility = ["//visibility:public"], |
| 148 | ) |
| 149 | |
| 150 | config_setting( |
tomlu | 1a483d4 | 2017-11-30 15:08:40 -0800 | [diff] [blame] | 151 | name = "iphonesdk", |
| 152 | values = {"define": "IPHONE_SDK=1"}, |
| 153 | visibility = ["//visibility:public"], |
| 154 | ) |
| 155 | |
| 156 | config_setting( |
| 157 | name = "freebsd", |
Ivo List | 6d637f4 | 2020-11-09 08:16:33 -0800 | [diff] [blame] | 158 | constraint_values = ["@platforms//os:freebsd"], |
tomlu | 1a483d4 | 2017-11-30 15:08:40 -0800 | [diff] [blame] | 159 | visibility = ["//visibility:public"], |
| 160 | ) |
| 161 | |
| 162 | config_setting( |
Googler | 070a519 | 2019-12-06 09:21:42 -0800 | [diff] [blame] | 163 | name = "openbsd", |
Ivo List | 6d637f4 | 2020-11-09 08:16:33 -0800 | [diff] [blame] | 164 | constraint_values = ["@platforms//os:openbsd"], |
Googler | 070a519 | 2019-12-06 09:21:42 -0800 | [diff] [blame] | 165 | visibility = ["//visibility:public"], |
| 166 | ) |
| 167 | |
| 168 | config_setting( |
tomlu | 1a483d4 | 2017-11-30 15:08:40 -0800 | [diff] [blame] | 169 | name = "windows", |
Ivo List | 6d637f4 | 2020-11-09 08:16:33 -0800 | [diff] [blame] | 170 | constraint_values = ["@platforms//os:windows"], |
tomlu | 1a483d4 | 2017-11-30 15:08:40 -0800 | [diff] [blame] | 171 | visibility = ["//visibility:public"], |
| 172 | ) |
| 173 | |
| 174 | config_setting( |
Niyas Sait | 0ba4caa | 2022-02-02 10:29:06 -0800 | [diff] [blame] | 175 | name = "windows_x86_64", |
| 176 | constraint_values = [ |
| 177 | "@platforms//os:windows", |
| 178 | "@platforms//cpu:x86_64", |
| 179 | ], |
| 180 | visibility = ["//visibility:public"], |
| 181 | ) |
| 182 | |
| 183 | config_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 |
| 193 | config_setting( |
| 194 | name = "windows_x64_arm64_flag", |
Googler | 5bab7ef | 2022-05-11 10:13:56 -0700 | [diff] [blame] | 195 | constraint_values = [ |
| 196 | "@platforms//os:windows", |
| 197 | "@platforms//cpu:x86_64", |
| 198 | ], |
Niyas Sait | 0ba4caa | 2022-02-02 10:29:06 -0800 | [diff] [blame] | 199 | values = {"cpu": "x64_arm64_windows"}, |
| 200 | ) |
| 201 | |
| 202 | config_setting( |
| 203 | name = "windows_arm64_flag", |
| 204 | values = {"cpu": "arm64_windows"}, |
| 205 | ) |
| 206 | |
| 207 | selects.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 | |
| 217 | config_setting( |
tomlu | 1a483d4 | 2017-11-30 15:08:40 -0800 | [diff] [blame] | 218 | name = "arm", |
Ivo List | 6d637f4 | 2020-11-09 08:16:33 -0800 | [diff] [blame] | 219 | constraint_values = ["@platforms//cpu:arm"], |
tomlu | 1a483d4 | 2017-11-30 15:08:40 -0800 | [diff] [blame] | 220 | visibility = ["//visibility:public"], |
| 221 | ) |
| 222 | |
| 223 | config_setting( |
tomlu | 1a483d4 | 2017-11-30 15:08:40 -0800 | [diff] [blame] | 224 | name = "remote", |
| 225 | values = {"define": "EXECUTOR=remote"}, |
| 226 | visibility = ["//visibility:public"], |
| 227 | ) |
Yun Peng | 01609b8 | 2020-05-04 11:12:33 -0700 | [diff] [blame] | 228 | |
| 229 | config_setting( |
| 230 | name = "debian_build", |
| 231 | values = { |
| 232 | "define": "distribution=debian", |
| 233 | }, |
| 234 | visibility = ["//visibility:public"], |
| 235 | ) |