Skip to content

Commit

Permalink
Use a patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
fruffy committed Mar 13, 2024
1 parent c4cd948 commit 04c3869
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
4 changes: 1 addition & 3 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,10 @@ cc_library(
],
copts = [
# Where p4c should look for p4include at runtime.
("-DCONFIG_PKGDATADIR=\\\"external/%s\\\"" % repository_name()),
# This will work only if the binary is executed by Bazel. For a general
# solution, we would need to make p4c aware of Bazel, specifically:
# https://github.com/bazelbuild/bazel/blob/master/tools/cpp/runfiles/runfiles_src.h
("-DCONFIG_PKGDATADIR=\\\"external/%s\\\"" % repository_name()),
# Abseil does not export its includes, we add them manually.
"-Iexternal/com_google_absl",
],
textual_hdrs = glob([
"ir/**/*.h",
Expand Down
15 changes: 15 additions & 0 deletions bazel/abseil.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/absl/base/BUILD.bazel b/absl/base/BUILD.bazel
index 0eb735da..5dd4aa67 100644
--- a/absl/base/BUILD.bazel
+++ b/absl/base/BUILD.bazel
@@ -137,6 +137,10 @@ cc_library(
"policy_checks.h",
],
copts = ABSL_DEFAULT_COPTS,
+ # This library is the root of the absl dependency tree.
+ # If we add this `includes` path here, then all absl headers
+ # can be included via angle brackets in external projects.
+ includes = ["../.."],
linkopts = ABSL_DEFAULT_LINKOPTS,
)

2 changes: 2 additions & 0 deletions bazel/p4c_deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ filegroup(
name = "com_google_absl",
url = "https://github.com/abseil/abseil-cpp/releases/download/20240116.1/abseil-cpp-20240116.1.tar.gz",
strip_prefix = "abseil-cpp-20240116.1",
patches = ["@com_github_p4lang_p4c//:bazel/abseil.patch"],
patch_args = ["-p1"],
sha256 = "3c743204df78366ad2eaf236d6631d83f6bc928d1705dd0000b872e53b73dc6a",
)
if not native.existing_rule("com_google_protobuf"):
Expand Down

0 comments on commit 04c3869

Please sign in to comment.