Skip to content

Commit

Permalink
Add libclang_rt.profile
Browse files Browse the repository at this point in the history
  • Loading branch information
dzbarsky committed Oct 4, 2024
1 parent a6bcbfe commit 61e71e1
Showing 1 changed file with 47 additions and 1 deletion.
48 changes: 47 additions & 1 deletion BUILD
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@aspect_bazel_lib//lib:copy_file.bzl", "copy_file")
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
load("@llvm-project//:vars.bzl", "LLVM_VERSION_MAJOR")
load("@rules_pkg//pkg:pkg.bzl", "pkg_tar")
Expand Down Expand Up @@ -48,14 +49,59 @@ DIST_FLAVORS = {
for (suffix, props) in DIST_FLAVORS.items()
]

# Note, there are some inconsistencies in naming so expanding the templates.
LIB_PREFIX = "lib/clang/%s/lib/" % LLVM_VERSION_MAJOR

copy_file(
name = "copy_libclang_rt.profile_osx",
src = "@llvm-project//compiler-rt:profile",
out = "libclang_rt.profile_osx.a",
)

pkg_files(
name = "libclang_rt.profile_osx",
srcs = ["libclang_rt.profile_osx.a"],
prefix = LIB_PREFIX + "darwin",
)

copy_file(
name = "copy_libclang_rt.profile_linux_aarch64",
src = "@llvm-project//compiler-rt:profile",
out = "libclang_rt.profile_linux-aarch64.a",
)

pkg_files(
name = "libclang_rt.profile_linux_aarch64",
srcs = ["libclang_rt.profile_linux-aarch64.a"],
prefix = LIB_PREFIX + "linux",
)

# TODO(zbarsky): Not sure if this is the right name.
# Hopefully someone yells at me if it's wrong.
copy_file(
name = "copy_libclang_rt.profile_linux_x84_64",
src = "@llvm-project//compiler-rt:profile",
out = "libclang_rt.profile_linux-x86_64.a",
)

pkg_files(
name = "libclang_rt.profile_linux_x86_64",
srcs = ["libclang_rt.profile_linux-x86_64.a"],
prefix = LIB_PREFIX + "linux",
)

[
pkg_tar(
name = "dist" + suffix,
srcs = [
":bins" + suffix,
"//:builtin_headers_pkg_files",
"@llvm-raw//:libcxx_include",
],
] + select({
"@bazel_tools//src/conditions:darwin": [":libclang_rt.profile_osx"],
"@bazel_tools//src/conditions:linux_aarch64": [":libclang_rt.profile_linux_aarch64"],
"@bazel_tools//src/conditions:linux_x86_64": [":libclang_rt.profile_linux_x86_64"],
}),
empty_files = props.get("extra_empty_files", []),
extension = ".tar.xz",
symlinks = {
Expand Down

0 comments on commit 61e71e1

Please sign in to comment.