Browse Source

Add zlib as an external dependency

Zhangyi Chen 3 years ago
parent
commit
ffbf054d40
4 changed files with 16 additions and 4 deletions
  1. 1 3
      BUILD
  2. 6 0
      WORKSPACE
  3. 1 1
      openssl.BUILD
  4. 8 0
      zlib.BUILD

+ 1 - 3
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": [],

+ 6 - 0
WORKSPACE

@@ -87,3 +87,9 @@ bind(
     name = "ssl_macos",
     actual = "@openssl_macos//:ssl"
 )
+
+new_local_repository(
+    name = "zlib",
+    build_file = "//:zlib.BUILD",
+    path = "/usr",
+)

+ 1 - 1
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"],

+ 8 - 0
zlib.BUILD

@@ -0,0 +1,8 @@
+package(
+    default_visibility=["//visibility:public"]
+)
+
+cc_library(
+    name = "zlib",
+    linkopts = ["-lz"],
+)