Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Integrate gRPC
Browse files Browse the repository at this point in the history
  • Loading branch information
ctiller committed Nov 26, 2017
1 parent 553de72 commit b55567e
Show file tree
Hide file tree
Showing 7 changed files with 1,425 additions and 0 deletions.
159 changes: 159 additions & 0 deletions BUILD.cares
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
config_setting(
name = "darwin",
values = {"cpu": "darwin"},
)

# Android is not officially supported through C++.
# This just helps with the build for now.
config_setting(
name = "android",
values = {
"crosstool_top": "//external:android/crosstool",
},
)

# iOS is not officially supported through C++.
# This just helps with the build for now.
config_setting(
name = "ios_x86_64",
values = {"cpu": "ios_x86_64"},
)

config_setting(
name = "ios_armv7",
values = {"cpu": "ios_armv7"},
)

config_setting(
name = "ios_armv7s",
values = {"cpu": "ios_armv7s"},
)

config_setting(
name = "ios_arm64",
values = {"cpu": "ios_arm64"},
)

genrule(
name = "ares_build",
srcs = ["@cares_local_files//:ares_build_h"],
outs = ["ares_build.h"],
cmd = "cat $(location @cares_local_files//:ares_build_h) > $@",
)

# cc_library(
# name = "ares_build_h",
# hdrs = ["ares_build.h"],
# data = [":ares_build"],
# includes = ["."],
# )

genrule(
name = "ares_config",
srcs = ["@cares_local_files//:ares_config_h"],
outs = ["ares_config.h"],
cmd = "cat $(location @cares_local_files//:ares_config_h) > $@",
)

# cc_library(
# name = "ares_config_h",
# hdrs = ["ares_config.h"],
# data = [":ares_config"],
# includes = ["."],
# )

cc_library(
name = "ares",
srcs = [
"ares__close_sockets.c",
"ares__get_hostent.c",
"ares__read_line.c",
"ares__timeval.c",
"ares_cancel.c",
"ares_create_query.c",
"ares_data.c",
"ares_destroy.c",
"ares_expand_name.c",
"ares_expand_string.c",
"ares_fds.c",
"ares_free_hostent.c",
"ares_free_string.c",
"ares_getenv.c",
"ares_gethostbyaddr.c",
"ares_gethostbyname.c",
"ares_getnameinfo.c",
"ares_getopt.c",
"ares_getsock.c",
"ares_init.c",
"ares_library_init.c",
"ares_llist.c",
"ares_mkquery.c",
"ares_nowarn.c",
"ares_options.c",
"ares_parse_a_reply.c",
"ares_parse_aaaa_reply.c",
"ares_parse_mx_reply.c",
"ares_parse_naptr_reply.c",
"ares_parse_ns_reply.c",
"ares_parse_ptr_reply.c",
"ares_parse_soa_reply.c",
"ares_parse_srv_reply.c",
"ares_parse_txt_reply.c",
"ares_platform.c",
"ares_process.c",
"ares_query.c",
"ares_search.c",
"ares_send.c",
"ares_strcasecmp.c",
"ares_strdup.c",
"ares_strerror.c",
"ares_timeout.c",
"ares_version.c",
"ares_writev.c",
"bitncmp.c",
"inet_net_pton.c",
"inet_ntop.c",
"windows_port.c",
],
hdrs = [
"ares.h",
"ares_build.h",
"ares_config.h",
"ares_data.h",
"ares_dns.h",
"ares_getenv.h",
"ares_getopt.h",
"ares_inet_net_pton.h",
"ares_iphlpapi.h",
"ares_ipv6.h",
"ares_library_init.h",
"ares_llist.h",
"ares_nowarn.h",
"ares_platform.h",
"ares_private.h",
"ares_rules.h",
"ares_setup.h",
"ares_strcasecmp.h",
"ares_strdup.h",
"ares_version.h",
"bitncmp.h",
"config-win32.h",
"nameser.h",
"setup_once.h",
],
copts = [
"-D_GNU_SOURCE",
"-D_HAS_EXCEPTIONS=0",
"-DNOMINMAX",
"-DHAVE_CONFIG_H",
],
data = [
":ares_build",
":ares_config",
],
includes = ["."],
linkstatic = 1,
visibility = [
"//visibility:public",
],
)
57 changes: 57 additions & 0 deletions BUILD.cares_local_files
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package(
default_visibility = ["//visibility:public"],
)

config_setting(
name = "darwin",
values = {"cpu": "darwin"},
)

# Android is not officially supported through C++.
# This just helps with the build for now.
config_setting(
name = "android",
values = {
"crosstool_top": "//external:android/crosstool",
},
)

# iOS is not officially supported through C++.
# This just helps with the build for now.
config_setting(
name = "ios_x86_64",
values = {"cpu": "ios_x86_64"},
)

config_setting(
name = "ios_armv7",
values = {"cpu": "ios_armv7"},
)

config_setting(
name = "ios_armv7s",
values = {"cpu": "ios_armv7s"},
)

config_setting(
name = "ios_arm64",
values = {"cpu": "ios_arm64"},
)

filegroup(
name = "ares_build_h",
srcs = ["ares_build.h"],
)

filegroup(
name = "ares_config_h",
srcs = select({
":ios_x86_64": ["config_darwin/ares_config.h"],
":ios_armv7": ["config_darwin/ares_config.h"],
":ios_armv7s": ["config_darwin/ares_config.h"],
":ios_arm64": ["config_darwin/ares_config.h"],
":darwin": ["config_darwin/ares_config.h"],
":android": ["config_android/ares_config.h"],
"//conditions:default": ["config_linux/ares_config.h"],
}),
)
36 changes: 36 additions & 0 deletions BUILD.zlib
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
cc_library(
name = "z",
srcs = [
"adler32.c",
"compress.c",
"crc32.c",
"deflate.c",
"infback.c",
"inffast.c",
"inflate.c",
"inftrees.c",
"trees.c",
"uncompr.c",
"zutil.c",
],
hdrs = [
"crc32.h",
"deflate.h",
"gzguts.h",
"inffast.h",
"inffixed.h",
"inflate.h",
"inftrees.h",
"trees.h",
"zconf.h",
"zlib.h",
"zutil.h",
],
includes = [
"include",
],
linkstatic = 1,
visibility = [
"//visibility:public",
],
)
67 changes: 67 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,70 @@ cc_library(
)
"""
)

#
# gRPC bits
#

git_repository(
name = "grpc",
remote = 'https://github.com/grpc/grpc.git',
commit = 'de93112a3f70afa39d3e9aa87da165f9f737fdef'
)

new_http_archive(
name = "com_github_madler_zlib",
build_file = "BUILD.zlib",
strip_prefix = "zlib-cacf7f1d4e3d44d871b605da3b647f07d718623f",
url = "https://github.com/madler/zlib/archive/cacf7f1d4e3d44d871b605da3b647f07d718623f.tar.gz",
)

http_archive(
name = "boringssl",
# on the master-with-bazel branch
url = "https://boringssl.googlesource.com/boringssl/+archive/886e7d75368e3f4fab3f4d0d3584e4abfc557755.tar.gz",
)

new_http_archive(
name = "com_github_cares_cares",
build_file = "BUILD.cares",
strip_prefix = "c-ares-3be1924221e1326df520f8498d704a5c4c8d0cce",
url = "https://github.com/c-ares/c-ares/archive/3be1924221e1326df520f8498d704a5c4c8d0cce.tar.gz",
)

new_local_repository(
name = "cares_local_files",
build_file = "BUILD.cares_local_files",
path = 'third_party/cares'
)

# required binds...
bind(
name = "protobuf",
actual = "@com_google_protobuf//:protobuf",
)

bind(
name = "protobuf_headers",
actual = "@com_google_protobuf//:protobuf_headers",
)

bind(
name = "zlib",
actual = "@com_github_madler_zlib//:z",
)

bind(
name = "libssl",
actual = "@boringssl//:ssl",
)

bind(
name = "cares",
actual = "@com_github_cares_cares//:ares",
)

bind(
name = "nanopb",
actual = "@grpc//third_party/nanopb",
)
Loading

0 comments on commit b55567e

Please sign in to comment.