Parcourir la source

add workspace.bzl and bazel.rc

donghuixu il y a 6 ans
Parent
commit
ed28de7091
5 fichiers modifiés avec 28 ajouts et 25 suppressions
  1. 3 19
      WORKSPACE
  2. 0 2
      bazel/README_bazel_build.md
  3. 24 0
      bazel/workspace.bzl
  4. 0 4
      leveldb.BUILD
  5. 1 0
      tools/bazel.rc

+ 3 - 19
WORKSPACE

@@ -1,22 +1,6 @@
+workspace(name = "brpc")
 
-http_archive(
-    name = "com_google_protobuf",
-    strip_prefix = "protobuf-b04e5cba356212e4e8c66c61bbe0c3a20537c5b9",
-    url = "https://github.com/google/protobuf/archive/b04e5cba356212e4e8c66c61bbe0c3a20537c5b9.tar.gz",
-)
+load("//:bazel/workspace.bzl", "brpc_workspace")
 
-
-http_archive(
-    name = "com_github_gflags_gflags",
-    strip_prefix = "gflags-46f73f88b18aee341538c0dfc22b1710a6abedef",
-    url = "https://github.com/gflags/gflags/archive/46f73f88b18aee341538c0dfc22b1710a6abedef.tar.gz",
-)
-
-
-new_http_archive(
-    name = "com_github_google_leveldb",
-    build_file = "leveldb.BUILD",
-    strip_prefix = "leveldb-a53934a3ae1244679f812d998a4f16f2c7f309a6",
-    url = "https://github.com/google/leveldb/archive/a53934a3ae1244679f812d998a4f16f2c7f309a6.tar.gz"
-)
+brpc_workspace()
 

+ 0 - 2
bazel/README_bazel_build.md

@@ -1,2 +0,0 @@
-bazel build --copt -DHAVE_ZLIB=1 ...   
-

+ 24 - 0
bazel/workspace.bzl

@@ -0,0 +1,24 @@
+# brpc external dependencies
+
+def brpc_workspace():
+  native.http_archive(
+      name = "com_google_protobuf",
+      strip_prefix = "protobuf-b04e5cba356212e4e8c66c61bbe0c3a20537c5b9",
+      url = "https://github.com/google/protobuf/archive/b04e5cba356212e4e8c66c61bbe0c3a20537c5b9.tar.gz",
+  )
+  
+  
+  native.http_archive(
+      name = "com_github_gflags_gflags",
+      strip_prefix = "gflags-46f73f88b18aee341538c0dfc22b1710a6abedef",
+      url = "https://github.com/gflags/gflags/archive/46f73f88b18aee341538c0dfc22b1710a6abedef.tar.gz",
+  )
+  
+  
+  native.new_http_archive(
+      name = "com_github_google_leveldb",
+      build_file = str(Label("//:leveldb.BUILD")),
+      strip_prefix = "leveldb-a53934a3ae1244679f812d998a4f16f2c7f309a6",
+      url = "https://github.com/google/leveldb/archive/a53934a3ae1244679f812d998a4f16f2c7f309a6.tar.gz"
+  )
+

+ 0 - 4
leveldb.BUILD

@@ -66,9 +66,5 @@ cc_library(
         "-DOS_LINUX",
         "-DLEVELDB_PLATFORM_POSIX=1",
         "-DLEVELDB_ATOMIC_PRESENT",
-        "-fno-builtin-memcmp",
-        "-DOS_LINUX",
-        "-DLEVELDB_PLATFORM_POSIX=1",
-        "-DLEVELDB_ATOMIC_PRESENT",
     ],
 )

+ 1 - 0
tools/bazel.rc

@@ -0,0 +1 @@
+build --copt -DHAVE_ZLIB=1