[PATCH] D137009: [Bazel] Add example for bzlmod usage with custom commits

Aaron Siddhartha Mondal via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 28 22:59:39 PDT 2022


aaronmondal created this revision.
aaronmondal added reviewers: GMNGeoffrey, csigg.
aaronmondal added a project: bazel build.
Herald added a project: All.
aaronmondal requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Adds a copy-pasteable example for the bzlmod build when using custom commits.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137009

Files:
  utils/bazel/examples/bzlmod_custom_commit/.bazelrc
  utils/bazel/examples/bzlmod_custom_commit/.bazelversion
  utils/bazel/examples/bzlmod_custom_commit/MODULE.bazel
  utils/bazel/examples/bzlmod_custom_commit/mallinfo2_patch.diff


Index: utils/bazel/examples/bzlmod_custom_commit/mallinfo2_patch.diff
===================================================================
--- /dev/null
+++ utils/bazel/examples/bzlmod_custom_commit/mallinfo2_patch.diff
@@ -0,0 +1,14 @@
+diff --git a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
+index 45945510d..88c0afb66 100644
+--- a/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
++++ b/utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
+@@ -159,6 +159,9 @@
+ /* Define to 1 if you have the `mallinfo' function. */
+ /* HAVE_MALLINFO defined in Bazel */
+
++/* Define to 1 if you have the `mallinfo2` function. */
++#define HAVE_MALLINFO2 1
++
+ /* Define to 1 if you have the <malloc/malloc.h> header file. */
+ /* HAVE_MALLOC_MALLOC_H defined in Bazel */
+
Index: utils/bazel/examples/bzlmod_custom_commit/MODULE.bazel
===================================================================
--- /dev/null
+++ utils/bazel/examples/bzlmod_custom_commit/MODULE.bazel
@@ -0,0 +1,20 @@
+bazel_dep(name = "llvm-project-overlay", version = "16.0.0-bcr.0")
+
+llvm_project_overlay = use_extension(
+    "@llvm-project-overlay//utils/bazel:extensions.bzl",
+    "llvm_project_overlay",
+)
+
+# TODO(aaronmondal): After the other patches in the bzlmod patch series are
+# committed, update <custom_commit> and <some_hash> and submit this example.
+llvm_project_overlay.configure(
+    targets = ["X86"],  # Using a subset of Clang targets to reduce build times.
+    commit = "<custom_commit>",
+    sha256 = "<some_hash>",
+    patches = ["//:mallinfo2_patch.diff"],
+)
+
+use_repo(
+    llvm_project_overlay,
+    "llvm-project",
+)
Index: utils/bazel/examples/bzlmod_custom_commit/.bazelversion
===================================================================
--- /dev/null
+++ utils/bazel/examples/bzlmod_custom_commit/.bazelversion
@@ -0,0 +1 @@
+5.3.2
Index: utils/bazel/examples/bzlmod_custom_commit/.bazelrc
===================================================================
--- /dev/null
+++ utils/bazel/examples/bzlmod_custom_commit/.bazelrc
@@ -0,0 +1,5 @@
+common --repo_env=BAZEL_CXXOPTS='-std=c++17:-O3'
+common --experimental_enable_bzlmod
+
+# TODO(aaronmondal): Only for testing during review. Remove before merging this patch.
+common --registry=https://raw.githubusercontent.com/eomii/bazel-eomii-registry/llvm-project-overlay


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137009.471719.patch
Type: text/x-patch
Size: 2470 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221029/2d4a04e3/attachment.bin>


More information about the llvm-commits mailing list