diff --git a/BUILD b/BUILD index 9cd9963e..09f849c2 100644 --- a/BUILD +++ b/BUILD @@ -55,6 +55,7 @@ DIST_FLAVORS = { ":bins" + suffix, "//:builtin_headers_pkg_files", "@llvm-raw//:libcxx_include", + "@llvm-raw//:unwind", ], empty_files = props.get("extra_empty_files", []), extension = ".tar.xz", diff --git a/BUILD.llvm-raw b/BUILD.llvm-raw index 6be9018c..4926f601 100644 --- a/BUILD.llvm-raw +++ b/BUILD.llvm-raw @@ -1,5 +1,6 @@ package(default_visibility = ["//visibility:public"]) +load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake") load("@rules_pkg//pkg:mappings.bzl", "pkg_files", "strip_prefix") load("@bazel_skylib//rules:copy_file.bzl", "copy_file") @@ -46,3 +47,25 @@ pkg_files( strip_prefix = "libcxx/include", prefix = "include/c++/v1", ) + +filegroup( + name = "llvm_srcs", + srcs = glob(["**"]), +) + +cmake( + name = "unwind", + lib_source = ":llvm_srcs", + working_directory = "llvm", + build_args = ["-j10"], + generate_args = [ + "-DCMAKE_BUILD_TYPE=Release", + "-DLLVM_ENABLE_RUNTIMES=libunwind", + ], + postfix_script = """\ +cp ${BUILD_TMPDIR}/lib/libunwind.a ${INSTALLDIR}/lib + """, + targets = ["unwind"], + out_static_libs = ["libunwind.a"], + install = False, +) diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index d0570c51..1a88eb7c 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -1734,6 +1734,25 @@ ] } }, + "@@bazel_tools//tools/osx:xcode_configure.bzl%xcode_configure_extension": { + "general": { + "bzlTransitiveDigest": "Qh2bWTU6QW6wkrd87qrU4YeY+SG37Nvw3A0PR4Y0L2Y=", + "accumulatedFileDigests": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "local_config_xcode": { + "bzlFile": "@@bazel_tools//tools/osx:xcode_configure.bzl", + "ruleClassName": "xcode_autoconf", + "attributes": { + "name": "bazel_tools~xcode_configure_extension~local_config_xcode", + "xcode_locator": "@bazel_tools//tools/osx:xcode_locator.m", + "remote_xcode": "" + } + } + }, + "recordedRepoMappingEntries": [] + } + }, "@@bazel_tools//tools/sh:sh_configure.bzl%sh_configure_extension": { "general": { "bzlTransitiveDigest": "hp4NgmNjEg5+xgvzfh6L83bt9/aiiWETuNpwNuF1MSU=", diff --git a/WORKSPACE b/WORKSPACE index a487a500..58f21382 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -16,6 +16,17 @@ http_archive( ], ) +FOREIGN_CC_VERSION = "0.9.0" + +http_archive( + name = "rules_foreign_cc", + sha256 = "", + strip_prefix = "rules_foreign_cc-{version}".format(version = FOREIGN_CC_VERSION), + url = "https://github.com/bazelbuild/rules_foreign_cc/archive/{version}.tar.gz".format(version = FOREIGN_CC_VERSION), +) +load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies") +rules_foreign_cc_dependencies() + LLVM_COMMIT = "26a1d6601d727a96f4301d0d8647b5a42760ae0c" # 18.1.2 http_archive(