mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 12:26:50 +00:00
[bazel] Codesign debugserver on macOS (#91789)
This tool doesn't work unless it's signed with the entitlements used here. We should probably consider using the macos_command_line_application rule from rules_apple which manages this more flexibly for us, but for now this works. This uses apple_genrule as opposed to genrule since the former encodes the Xcode environment info into the action so it is correctly invalidated if that changes.
This commit is contained in:
parent
f32f6d199a
commit
666c686d59
@ -56,6 +56,19 @@ maybe(
|
||||
name = "vulkan_sdk",
|
||||
)
|
||||
|
||||
http_archive(
|
||||
name = "build_bazel_apple_support",
|
||||
sha256 = "c4bb2b7367c484382300aee75be598b92f847896fb31bbd22f3a2346adf66a80",
|
||||
url = "https://github.com/bazelbuild/apple_support/releases/download/1.15.1/apple_support.1.15.1.tar.gz",
|
||||
)
|
||||
|
||||
load(
|
||||
"@build_bazel_apple_support//lib:repositories.bzl",
|
||||
"apple_support_dependencies",
|
||||
)
|
||||
|
||||
apple_support_dependencies()
|
||||
|
||||
# llvm libc math tests reply on `mpfr`.
|
||||
# The availability of `mpfr` is controlled by a flag and can be either `disable`, `system` or `external`.
|
||||
# Continuous integration uses `system` to speed up the build process (see .bazelrc).
|
||||
|
@ -5,6 +5,7 @@
|
||||
load("@bazel_skylib//lib:selects.bzl", "selects")
|
||||
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
|
||||
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")
|
||||
load("@build_bazel_apple_support//rules:apple_genrule.bzl", "apple_genrule")
|
||||
load("//:vars.bzl", "LLVM_VERSION_MAJOR", "LLVM_VERSION_MINOR", "LLVM_VERSION_PATCH", "LLVM_VERSION_SUFFIX", "PACKAGE_VERSION")
|
||||
load("//lldb/source/Plugins:plugin_config.bzl", "DEFAULT_PLUGINS", "DEFAULT_SCRIPT_PLUGINS", "OBJCPP_COPTS")
|
||||
load("//mlir:tblgen.bzl", "gentbl_cc_library", "td_library")
|
||||
@ -800,24 +801,20 @@ gentbl_cc_library(
|
||||
deps = ["//llvm:OptParserTdFiles"],
|
||||
)
|
||||
|
||||
alias(
|
||||
name = "gdb-server",
|
||||
actual = select({
|
||||
"@platforms//os:macos": ":debugserver",
|
||||
"//conditions:default": ":lldb-server",
|
||||
}),
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "lldb",
|
||||
srcs = glob([
|
||||
"tools/driver/*.cpp",
|
||||
"tools/driver/*.h",
|
||||
]),
|
||||
data = [
|
||||
":lldb-argdumper",
|
||||
] + select({
|
||||
"@platforms//os:macos": [
|
||||
":debugserver",
|
||||
":lldb-server",
|
||||
],
|
||||
"@platforms//os:linux": [
|
||||
":lldb-server",
|
||||
],
|
||||
"//conditions:default": [],
|
||||
}),
|
||||
deps = [
|
||||
":APIHeaders",
|
||||
":Host",
|
||||
@ -896,7 +893,7 @@ expand_template(
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "debugserver",
|
||||
name = "debugserver_unsigned",
|
||||
srcs = [
|
||||
"tools/debugserver/source/debugserver.cpp",
|
||||
":debugserver_version_gen",
|
||||
@ -914,6 +911,21 @@ cc_binary(
|
||||
],
|
||||
)
|
||||
|
||||
apple_genrule(
|
||||
name = "debugserver_signed",
|
||||
srcs = [":debugserver_unsigned"],
|
||||
outs = ["debugserver"],
|
||||
cmd = "cp $(SRCS) $(OUTS) && xcrun codesign -f -s - --entitlements $(location tools/debugserver/resources/debugserver-macosx-entitlements.plist) $(OUTS)",
|
||||
tags = ["nobuildkite"],
|
||||
target_compatible_with = select({
|
||||
"@platforms//os:macos": [],
|
||||
"//conditions:default": ["@platforms//:incompatible"],
|
||||
}),
|
||||
tools = [
|
||||
"tools/debugserver/resources/debugserver-macosx-entitlements.plist",
|
||||
],
|
||||
)
|
||||
|
||||
cc_binary(
|
||||
name = "lldb-argdumper",
|
||||
srcs = glob(["tools/argdumper/*.cpp"]),
|
||||
|
Loading…
x
Reference in New Issue
Block a user