Skip to content

Commit

Permalink
build: exclude liburing from non-Linux builds (envoyproxy#29635)
Browse files Browse the repository at this point in the history
This fixes some uncommon bazel invocations such as `bazel build
//source/...` and `tools/gen_compilation_database.py` on non-Linux.

Signed-off-by: Greg Greenway <[email protected]>
  • Loading branch information
ggreenway authored Sep 14, 2023
1 parent 2add6ca commit ef420f5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
11 changes: 10 additions & 1 deletion bazel/foreign_cc/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@rules_foreign_cc//foreign_cc:configure.bzl", "configure_make")
load("//bazel:envoy_build_system.bzl", "envoy_cmake", "envoy_package")
load("//bazel:envoy_build_system.bzl", "envoy_cc_library", "envoy_cmake", "envoy_package")

licenses(["notice"]) # Apache 2

Expand All @@ -17,6 +17,15 @@ configure_make(
],
)

envoy_cc_library(
name = "liburing_linux",
srcs = [],
deps = select({
"//bazel:linux": [":liburing"],
"//conditions:default": [],
}),
)

# autotools packages are unusable on Windows as-is
# TODO: Consider our own gperftools.BUILD file as we do with many other packages
configure_make(
Expand Down
2 changes: 1 addition & 1 deletion bazel/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ def _com_github_axboe_liburing():
)
native.bind(
name = "uring",
actual = "@envoy//bazel/foreign_cc:liburing",
actual = "@envoy//bazel/foreign_cc:liburing_linux",
)

def _com_github_bazel_buildtools():
Expand Down
12 changes: 8 additions & 4 deletions source/common/io/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ envoy_package()

envoy_cc_library(
name = "io_uring_impl_lib",
srcs = [
"io_uring_impl.cc",
],
srcs = select({
"//bazel:linux": ["io_uring_impl.cc"],
"//conditions:default": [],
}),
hdrs = [
"io_uring_impl.h",
],
Expand All @@ -26,7 +27,10 @@ envoy_cc_library(

envoy_cc_library(
name = "io_uring_worker_lib",
srcs = ["io_uring_worker_impl.cc"],
srcs = select({
"//bazel:linux": ["io_uring_worker_impl.cc"],
"//conditions:default": [],
}),
hdrs = ["io_uring_worker_impl.h"],
deps = [
":io_uring_impl_lib",
Expand Down

0 comments on commit ef420f5

Please sign in to comment.