Skip to content

Commit

Permalink
Update build rules and patches for darwin_arm64 platform.
Browse files Browse the repository at this point in the history
Changes include:

Update nelhage/rules_boost package from current version (08/5/2020) to 5/27/2021 version.
Remove rules_boost-undefine-boost_fallthrough.patch, since BOOST_FALLTHROUGH seems to be defined now.
Minor changes to rules_boost-windows-linkopts.patch to use default condition to add -lpthread flag for all platforms.
Add darwin_arm64 config to BUILD files for lib civetweb pulled in via prometheu dependency.
  • Loading branch information
Jun Gong committed Oct 1, 2021
1 parent c052395 commit d521337
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 27 deletions.
5 changes: 2 additions & 3 deletions bazel/ray_deps_setup.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,9 @@ def ray_deps_setup():
auto_http_archive(
name = "com_github_nelhage_rules_boost",
# If you update the Boost version, remember to update the 'boost' rule.
url = "https://github.com/nelhage/rules_boost/archive/2613d04ab3d22dfc4543ea0a083d9adeaa0daf09.tar.gz",
sha256 = "512f913240e026099d4ca4a98b1ce8048c99de77fdc8e8584e9e2539ee119ca2",
url = "https://github.com/nelhage/rules_boost/archive/652b21e35e4eeed5579e696da0facbe8dba52b1f.tar.gz",
sha256 = "c1b8b2adc3b4201683cf94dda7eef3fc0f4f4c0ea5caa3ed3feffe07e1fb5b15",
patches = [
"//thirdparty/patches:rules_boost-undefine-boost_fallthrough.patch",
"//thirdparty/patches:rules_boost-windows-linkopts.patch",
],
)
Expand Down
37 changes: 33 additions & 4 deletions thirdparty/patches/prometheus-windows-pollfd.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,46 @@ Windows Vista and later SDKs define struct pollfd for WSAPoll(), but it has a pe
civetweb provides its own implementation of poll, but it has a conflicting definition for pollfd.
Hence we block Windows from defining pollfd (which this project doesn't use).
---
bazel/civetweb.BUILD | 1 +
1 file changed, 1 insertion(+)
bazel/civetweb.BUILD | 7 +++++++
1 file changed, 7 insertions(+)

diff --git bazel/civetweb.BUILD bazel/civetweb.BUILD
--- bazel/civetweb.BUILD
+++ bazel/civetweb.BUILD
@@ -34,5 +34,6 @@ cc_library(
@@ -9,6 +9,11 @@ config_setting(
values = {"cpu": "darwin_x86_64"},
)

+config_setting(
+ name = "darwin_arm64",
+ values = {"cpu": "darwin_arm64"},
+)
+
config_setting(
name = "windows",
values = { "cpu": "x64_windows" },
@@ -34,6 +39,7 @@ cc_library(
"-DNO_CACHING",
"-DNO_SSL",
"-DNO_FILES",
+ "-D_WIN32_WINNT=0x0502",
"-UDEBUG",
],
--
includes = [
@@ -46,6 +52,7 @@ cc_library(
}) + select({
":darwin": [],
":darwin_x86_64": [],
+ ":darwin_arm64": [],
":windows": [],
":windows_msvc": [],
"//conditions:default": ["-lrt"],
@@ -86,6 +93,7 @@ cc_library(
}) + select({
":darwin": [],
":darwin_x86_64": [],
+ ":darwin_arm64": [],
":windows": [],
":windows_msvc": [],
"//conditions:default": ["-lrt"],
--

This file was deleted.

21 changes: 9 additions & 12 deletions thirdparty/patches/rules_boost-windows-linkopts.patch
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
diff --git BUILD.boost BUILD.boost
--- BUILD.boost
+++ BUILD.boost
@@ -313,1 +313,9 @@ boost_library(name = "asio",
- linkopts = ["-lpthread"],
+ linkopts = select({
+ ":linux": [
+ "-lpthread",
+ ],
+ ":osx_x86_64": [
+ "-lpthread",
+ ],
+ "//conditions:default": [],
+ }),
--
@@ -428,6 +428,7 @@ boost_library(
}),
linkopts = select({
":android": [],
+ ":windows": [],
"//conditions:default": ["-lpthread"],
}),
deps = [
--

0 comments on commit d521337

Please sign in to comment.