[llvm] [bazel] Rework liblldb (PR #91549)

Keith Smiley via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 09:41:42 PDT 2024


================
@@ -728,37 +728,57 @@ cc_library(
     ],
 )
 
-cc_library(
-    name = "liblldb.static",
-    deps = [
-        ":API",
-        ":Interpreter",
-    ],
+genrule(
+    name = "gen_exports_file_linux",
+    srcs = ["//lldb:source/API/liblldb-private.exports"],
+    outs = ["exports_linux.txt"],
+    cmd = """
+cat > $(OUTS) <<EOF
+{
+  global:
+    $$(sed 's/$$/;/g' $(SRCS))
+};
+EOF
+""",
 )
 
-cc_shared_library(
-    name = "liblldb",
-    # TODO: Remove once fixed https://github.com/bazelbuild/bazel/issues/21893
+genrule(
+    name = "gen_exports_file_macos",
+    srcs = ["//lldb:source/API/liblldb-private.exports"],
+    outs = ["exports_macos.txt"],
+    cmd = "sed 's/^/_/g' $(SRCS) > $(OUTS)",
+)
+
+cc_binary(
+    name = "lldb{}".format(PACKAGE_VERSION),
----------------
keith wrote:

select doesn't work on name, but also this actually already does output the correct name for the library. with cc_binary + linkshared you  don't have control over the output file name and it implicitly adds `lib` and `.dylib`/`.so`, so actually we're lucky here that we can name it with this version in the name so it doesn't conflict with the `lldb` target. we could write our own trivial rule on top of the C++ bazel APIs to make this nicer, but probably not worth it. will add a comment

https://github.com/llvm/llvm-project/pull/91549


More information about the llvm-commits mailing list