[bazel] Don't override --@v8//bazel/config:v8_target_cpu flag.

Fixes cross-compilation with bazel-zig-cc.

Signed-off-by: Piotr Sikora <piotrsikora@google.com>
Change-Id: I7d94b84be33d8699ec71b4073bc0df1e7fcce5c4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3445204
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78992}
This commit is contained in:
Piotr Sikora 2022-02-07 23:17:43 -08:00 committed by V8 LUCI CQ
parent cb4f3c6957
commit d053afc9ee

View File

@ -372,6 +372,12 @@ def v8_torque(name, noicu_srcs, icu_srcs, args, extras):
)
def _v8_target_cpu_transition_impl(settings, attr):
# Check for an existing v8_target_cpu flag.
if "@v8//bazel/config:v8_target_cpu" in settings:
if settings["@v8//bazel/config:v8_target_cpu"] != "none":
return
# Auto-detect target architecture based on the --cpu flag.
mapping = {
"haswell": "x64",
"k8": "x64",
@ -395,7 +401,7 @@ def _v8_target_cpu_transition_impl(settings, attr):
# on the command line.
v8_target_cpu_transition = transition(
implementation = _v8_target_cpu_transition_impl,
inputs = ["//command_line_option:cpu"],
inputs = ["@v8//bazel/config:v8_target_cpu", "//command_line_option:cpu"],
outputs = ["@v8//bazel/config:v8_target_cpu"],
)