This is an automated email from the ASF dual-hosted git repository.

zychen pushed a commit to branch fix_bazel_on_macos
in repository https://gitbox.apache.org/repos/asf/incubator-brpc.git


The following commit(s) were added to refs/heads/fix_bazel_on_macos by this 
push:
     new ffbf054  Add zlib as an external dependency
ffbf054 is described below

commit ffbf054d40c1d7d997e8b59ad9dc6d322646df30
Author: Zhangyi Chen <[email protected]>
AuthorDate: Mon Nov 30 15:52:42 2020 +0800

    Add zlib as an external dependency
---
 BUILD         | 4 +---
 WORKSPACE     | 6 ++++++
 openssl.BUILD | 2 +-
 zlib.BUILD    | 8 ++++++++
 4 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/BUILD b/BUILD
index 5482300..11db84d 100644
--- a/BUILD
+++ b/BUILD
@@ -78,9 +78,6 @@ COPTS = [
 LINKOPTS = [
     "-lpthread",
     "-ldl",
-    "-lz",
-    # "-lssl",
-    # "-lcrypto",
 ] + select({
     ":darwin": [
         "-framework CoreFoundation",
@@ -340,6 +337,7 @@ cc_library(
     deps = [
         "@com_google_protobuf//:protobuf",
         "@com_github_gflags_gflags//:gflags",
+        "@zlib//:zlib",
     ] + select({
         ":with_glog": ["@com_github_google_glog//:glog"],
         "//conditions:default": [],
diff --git a/WORKSPACE b/WORKSPACE
index 1b5255a..441fd16 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -87,3 +87,9 @@ bind(
     name = "ssl_macos",
     actual = "@openssl_macos//:ssl"
 )
+
+new_local_repository(
+    name = "zlib",
+    build_file = "//:zlib.BUILD",
+    path = "/usr",
+)
diff --git a/openssl.BUILD b/openssl.BUILD
index 7b948e9..e2d02eb 100644
--- a/openssl.BUILD
+++ b/openssl.BUILD
@@ -26,7 +26,7 @@ cc_library(
     name = "ssl",
     hdrs = select({
         ":macos": glob(["include/openssl/*.h"]),
-        "//conditions:default": ["lib/libssl.so"]
+        "//conditions:default": []
     }),
     srcs = select ({
         ":macos": ["lib/libssl.dylib"],
diff --git a/zlib.BUILD b/zlib.BUILD
new file mode 100644
index 0000000..8b78952
--- /dev/null
+++ b/zlib.BUILD
@@ -0,0 +1,8 @@
+package(
+    default_visibility=["//visibility:public"]
+)
+
+cc_library(
+    name = "zlib",
+    linkopts = ["-lz"],
+)


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to