Commit edce708f authored by Victor Gomes's avatar Victor Gomes Committed by V8 LUCI CQ

[bazel] Adds skylib and macos support

No-Try: true
Bug: v8:11234
Change-Id: I4099a231ecc5cfb87d74170b04753a8bec2b5cbf
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2985501Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75374}
parent 77713fdd
......@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
load("@bazel_skylib//lib:selects.bzl", "selects")
load(
"@v8//:bazel/defs.bzl",
"v8_binary",
......@@ -19,10 +20,20 @@ load(
# =================================================
config_setting(
name = "is_x64",
name = "is_k8",
values = {"cpu": "k8"},
)
config_setting(
name = "is_darwin",
values = {"cpu": "darwin"},
)
selects.config_setting_group(
name = "is_x64",
match_any = [":is_k8", ":is_darwin"],
)
config_setting(
name = "is_arm64",
values = {
......@@ -57,12 +68,33 @@ config_setting(
constraint_values = ["@platforms//os:android"],
)
config_setting(
name = "is_macos",
constraint_values = ["@platforms//os:macos"],
)
selects.config_setting_group(
name = "is_posix",
match_any = [":is_linux", ":is_android", ":is_macos"],
)
config_setting(
name = "is_linux_x64",
constraint_values = ["@platforms//os:linux"],
values = {"cpu": "k8"},
)
config_setting(
name = "is_macos_x64",
constraint_values = ["@platforms//os:macos"],
values = {"cpu": "darwin"},
)
selects.config_setting_group(
name = "is_linux_x64_or_macos_x64",
match_any = [":is_linux_x64", ":is_macos_x64"],
)
config_setting(
name = "is_android_x86",
constraint_values = ["@platforms//os:android"],
......@@ -113,6 +145,10 @@ v8_config(
"V8_HAVE_TARGET_OS",
"V8_TARGET_OS_LINUX",
],
":is_macos": [
"V8_HAVE_TARGET_OS",
"V8_TARGET_OS_MACOSX",
],
}) + select({
"is_android_x86": [ "DISABLE_UNTRUSTED_CODE_MITIGATIONS" ],
"//conditions:default": [],
......@@ -324,22 +360,26 @@ filegroup(
"src/base/vlq-base64.cc",
"src/base/vlq-base64.h",
] + select({
":is_linux": [
":is_posix": [
"src/base/platform/platform-posix.cc",
"src/base/platform/platform-posix.h",
"src/base/platform/platform-posix-time.cc",
"src/base/platform/platform-posix-time.h",
],
"//conditions:default": [],
}) + select({
":is_linux": [
"src/base/debug/stack_trace_posix.cc",
"src/base/platform/platform-linux.cc",
],
"is_android": [
"src/base/platform/platform-posix.cc",
"src/base/platform/platform-posix.h",
"src/base/platform/platform-posix-time.cc",
"src/base/platform/platform-posix-time.h",
"src/base/debug/stack_trace_android.cc",
"src/base/platform/platform-linux.cc",
],
"is_macos": [
"src/base/debug/stack_trace_posix.cc",
"src/base/platform/platform-macos.cc",
],
}),
)
......@@ -1829,7 +1869,7 @@ filegroup(
"src/wasm/baseline/arm64/liftoff-assembler-arm64.h",
],
}) + select({
":is_linux_x64": [
":is_linux_x64_or_macos_x64": [
"src/trap-handler/handler-inside-posix.cc",
"src/trap-handler/handler-outside-posix.cc",
],
......
......@@ -4,4 +4,14 @@
workspace(name = "v8")
# TODO(victorgomes): load dependencies using repo_rule?
\ No newline at end of file
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "bazel_skylib",
urls = [
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
],
sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()
......@@ -98,9 +98,11 @@ def _default_args(configs):
],
includes = ["include"],
linkopts = [
"-pthread",
"-Wl,--no-as-needed -ldl",
],
"-pthread"
] + select({
":is_macos": [],
"//conditions:default": [ "-Wl,--no-as-needed -ldl" ],
}),
)
def v8_binary(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment