Skip to content
Snippets Groups Projects
Commit 502d6448 authored by Yuchen Zeng's avatar Yuchen Zeng
Browse files

Use cares package in node

parent aa6240ac
No related branches found
No related tags found
No related merge requests found
...@@ -6607,7 +6607,7 @@ PUBLIC_HEADERS_C += \ ...@@ -6607,7 +6607,7 @@ PUBLIC_HEADERS_C += \
LIBARES_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBARES_SRC)))) LIBARES_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBARES_SRC))))
   
$(LIBARES_OBJS): CPPFLAGS += -Ithird_party/c-ares -Isrc/c-ares $(if $(subst Linux,,$(SYSTEM)),,-Isrc/c-ares/config_linux) $(if $(subst Darwin,,$(SYSTEM)),,-Isrc/c-ares/config_darwin) -fvisibility=hidden -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DHAVE_CONFIG_H $(LIBARES_OBJS): CPPFLAGS += -Ithird_party/c-ares -Isrc/c-ares $(if $(subst Linux,,$(SYSTEM)),,-Isrc/c-ares/config_linux) $(if $(subst Darwin,,$(SYSTEM)),,-Isrc/c-ares/config_darwin) -fvisibility=hidden -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DHAVE_CONFIG_H
$(LIBARES_OBJS): CFLAGS += -Wno-sign-conversion -Wno-invalid-source-encoding -Wno-pointer-sign $(LIBARES_OBJS): CFLAGS += -Wno-sign-conversion -Wno-invalid-source-encoding
   
$(LIBDIR)/$(CONFIG)/libares.a: $(ZLIB_DEP) $(LIBARES_OBJS) $(LIBDIR)/$(CONFIG)/libares.a: $(ZLIB_DEP) $(LIBARES_OBJS)
$(E) "[AR] Creating $@" $(E) "[AR] Creating $@"
......
...@@ -47,8 +47,7 @@ ...@@ -47,8 +47,7 @@
"include_dirs": [ "include_dirs": [
"third_party/boringssl/include", "third_party/boringssl/include",
"third_party/zlib", "third_party/zlib",
"third_party/c-ares", "third_party/c-ares"
"src/c-ares",
], ],
"defines": [ "defines": [
'_WIN32_WINNT=0x0600', '_WIN32_WINNT=0x0600',
...@@ -87,8 +86,7 @@ ...@@ -87,8 +86,7 @@
'include_dirs': [ 'include_dirs': [
'<(node_root_dir)/deps/openssl/openssl/include', '<(node_root_dir)/deps/openssl/openssl/include',
'<(node_root_dir)/deps/zlib', '<(node_root_dir)/deps/zlib',
"third_party/c-ares", '<(node_root_dir)/deps/cares/include',
"src/c-ares"
], ],
'conditions': [ 'conditions': [
['config=="gcov"', { ['config=="gcov"', {
...@@ -487,6 +485,7 @@ ...@@ -487,6 +485,7 @@
}] }]
], ],
'targets': [ 'targets': [
{ {
'cflags': [ 'cflags': [
'-std=c99', '-std=c99',
...@@ -564,6 +563,7 @@ ...@@ -564,6 +563,7 @@
'type': 'static_library', 'type': 'static_library',
'dependencies': [ 'dependencies': [
'gpr', 'gpr',
'node_modules/cares/deps/cares/cares.gyp:cares',
], ],
'sources': [ 'sources': [
'src/core/lib/surface/init.c', 'src/core/lib/surface/init.c',
...@@ -769,93 +769,6 @@ ...@@ -769,93 +769,6 @@
}] }]
] ]
}, },
{
'cflags': [
'-std=c99',
'-Wall',
'-Werror',
'-Wno-invalid-source-encoding',
],
'include_dirs': [ 'src/c-ares' ],
'target_name': 'ares',
'product_prefix': 'lib',
'type': 'static_library',
'dependencies': [
],
'sources': [
'third_party/c-ares/ares__close_sockets.c',
'third_party/c-ares/ares__get_hostent.c',
'third_party/c-ares/ares__read_line.c',
'third_party/c-ares/ares__timeval.c',
'third_party/c-ares/ares_cancel.c',
'third_party/c-ares/ares_create_query.c',
'third_party/c-ares/ares_data.c',
'third_party/c-ares/ares_destroy.c',
'third_party/c-ares/ares_expand_name.c',
'third_party/c-ares/ares_expand_string.c',
'third_party/c-ares/ares_fds.c',
'third_party/c-ares/ares_free_hostent.c',
'third_party/c-ares/ares_free_string.c',
'third_party/c-ares/ares_getenv.c',
'third_party/c-ares/ares_gethostbyaddr.c',
'third_party/c-ares/ares_gethostbyname.c',
'third_party/c-ares/ares_getnameinfo.c',
'third_party/c-ares/ares_getopt.c',
'third_party/c-ares/ares_getsock.c',
'third_party/c-ares/ares_init.c',
'third_party/c-ares/ares_library_init.c',
'third_party/c-ares/ares_llist.c',
'third_party/c-ares/ares_mkquery.c',
'third_party/c-ares/ares_nowarn.c',
'third_party/c-ares/ares_options.c',
'third_party/c-ares/ares_parse_a_reply.c',
'third_party/c-ares/ares_parse_aaaa_reply.c',
'third_party/c-ares/ares_parse_mx_reply.c',
'third_party/c-ares/ares_parse_naptr_reply.c',
'third_party/c-ares/ares_parse_ns_reply.c',
'third_party/c-ares/ares_parse_ptr_reply.c',
'third_party/c-ares/ares_parse_soa_reply.c',
'third_party/c-ares/ares_parse_srv_reply.c',
'third_party/c-ares/ares_parse_txt_reply.c',
'third_party/c-ares/ares_platform.c',
'third_party/c-ares/ares_process.c',
'third_party/c-ares/ares_query.c',
'third_party/c-ares/ares_search.c',
'third_party/c-ares/ares_send.c',
'third_party/c-ares/ares_strcasecmp.c',
'third_party/c-ares/ares_strdup.c',
'third_party/c-ares/ares_strerror.c',
'third_party/c-ares/ares_timeout.c',
'third_party/c-ares/ares_version.c',
'third_party/c-ares/ares_writev.c',
'third_party/c-ares/bitncmp.c',
'third_party/c-ares/inet_net_pton.c',
'third_party/c-ares/inet_ntop.c',
'third_party/c-ares/windows_port.c',
],
"conditions": [
['OS != "win"', {
'defines': [
'HAVE_CONFIG_H',
'_GNU_SOURCE'
]
}],
['OS == "mac"', {
'xcode_settings': {
'MACOSX_DEPLOYMENT_TARGET': '10.9'
},
'include_dirs': [ 'src/c-ares/config_darwin' ],
'defines': [ 'HAVE_CONFIG_H' ]
}],
['OS == "linux"', {
'include_dirs': [ 'src/c-ares/config_linux' ],
'defines': [ 'HAVE_CONFIG_H' ]
}],
['OS == "win"', {
'defines': [ 'CARES_STATICLIB' ]
}]
]
},
{ {
'include_dirs': [ 'include_dirs': [
"<!(node -e \"require('nan')\")" "<!(node -e \"require('nan')\")"
...@@ -910,7 +823,7 @@ ...@@ -910,7 +823,7 @@
"dependencies": [ "dependencies": [
"grpc", "grpc",
"gpr", "gpr",
"ares", "node_modules/cares/deps/cares/cares.gyp:cares",
] ]
}, },
{ {
......
...@@ -3409,7 +3409,7 @@ configs: ...@@ -3409,7 +3409,7 @@ configs:
timeout_multiplier: 1.5 timeout_multiplier: 1.5
defaults: defaults:
ares: ares:
CFLAGS: -Wno-sign-conversion -Wno-invalid-source-encoding -Wno-pointer-sign CFLAGS: -Wno-sign-conversion -Wno-invalid-source-encoding
CPPFLAGS: -Ithird_party/c-ares -Isrc/c-ares $(if $(subst Linux,,$(SYSTEM)),,-Isrc/c-ares/config_linux) CPPFLAGS: -Ithird_party/c-ares -Isrc/c-ares $(if $(subst Linux,,$(SYSTEM)),,-Isrc/c-ares/config_linux)
$(if $(subst Darwin,,$(SYSTEM)),,-Isrc/c-ares/config_darwin) -fvisibility=hidden $(if $(subst Darwin,,$(SYSTEM)),,-Isrc/c-ares/config_darwin) -fvisibility=hidden
-D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DHAVE_CONFIG_H -D_GNU_SOURCE -DWIN32_LEAN_AND_MEAN -D_HAS_EXCEPTIONS=0 -DNOMINMAX -DHAVE_CONFIG_H
...@@ -3428,7 +3428,6 @@ node_modules: ...@@ -3428,7 +3428,6 @@ node_modules:
- deps: - deps:
- grpc - grpc
- gpr - gpr
- ares
- boringssl - boringssl
- z - z
headers: headers:
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
"lodash": "^3.9.3", "lodash": "^3.9.3",
"nan": "^2.0.0", "nan": "^2.0.0",
"protobufjs": "^4.0.0", "protobufjs": "^4.0.0",
"cares": "^1.1.0" "cares": "^1.1.5"
}, },
"devDependencies": { "devDependencies": {
"async": "^1.5.0", "async": "^1.5.0",
......
...@@ -49,8 +49,7 @@ ...@@ -49,8 +49,7 @@
"include_dirs": [ "include_dirs": [
"third_party/boringssl/include", "third_party/boringssl/include",
"third_party/zlib", "third_party/zlib",
"third_party/c-ares", "third_party/c-ares"
"src/c-ares",
], ],
"defines": [ "defines": [
'_WIN32_WINNT=0x0600', '_WIN32_WINNT=0x0600',
...@@ -89,8 +88,7 @@ ...@@ -89,8 +88,7 @@
'include_dirs': [ 'include_dirs': [
'<(node_root_dir)/deps/openssl/openssl/include', '<(node_root_dir)/deps/openssl/openssl/include',
'<(node_root_dir)/deps/zlib', '<(node_root_dir)/deps/zlib',
"third_party/c-ares", '<(node_root_dir)/deps/cares/include',
"src/c-ares"
], ],
'conditions': [ 'conditions': [
['config=="gcov"', { ['config=="gcov"', {
...@@ -175,9 +173,16 @@ ...@@ -175,9 +173,16 @@
}] }]
], ],
'targets': [ 'targets': [
<%
for lib in libs:
if 'grpc' in lib.transitive_deps or lib.name == 'grpc':
lib.deps.append('node_modules/cares/deps/cares/cares.gyp:cares')
for module in node_modules:
module.deps.append('node_modules/cares/deps/cares/cares.gyp:cares')
%>
% for module in node_modules: % for module in node_modules:
% for lib in libs: % for lib in libs:
% if lib.name in module.transitive_deps and lib.name not in ('boringssl', 'z', 'ares'): % if lib.name in module.transitive_deps and lib.name not in ('boringssl', 'z'):
{ {
'cflags': [ 'cflags': [
'-std=c99', '-std=c99',
...@@ -206,49 +211,6 @@ ...@@ -206,49 +211,6 @@
] ]
}, },
% endif % endif
% if lib.name == 'ares':
{
'cflags': [
'-std=c99',
'-Wall',
'-Werror',
'-Wno-invalid-source-encoding',
],
'include_dirs': [ 'src/c-ares' ],
'target_name': '${lib.name}',
'product_prefix': 'lib',
'type': 'static_library',
'dependencies': [
],
'sources': [
% for source in lib.src:
'${source}',
% endfor
],
"conditions": [
['OS != "win"', {
'defines': [
'HAVE_CONFIG_H',
'_GNU_SOURCE'
]
}],
['OS == "mac"', {
'xcode_settings': {
'MACOSX_DEPLOYMENT_TARGET': '10.9'
},
'include_dirs': [ 'src/c-ares/config_darwin' ],
'defines': [ 'HAVE_CONFIG_H' ]
}],
['OS == "linux"', {
'include_dirs': [ 'src/c-ares/config_linux' ],
'defines': [ 'HAVE_CONFIG_H' ]
}],
['OS == "win"', {
'defines': [ 'CARES_STATICLIB' ]
}]
]
},
% endif
% endfor % endfor
{ {
'include_dirs': [ 'include_dirs': [
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
"lodash": "^3.9.3", "lodash": "^3.9.3",
"nan": "^2.0.0", "nan": "^2.0.0",
"protobufjs": "^4.0.0", "protobufjs": "^4.0.0",
"cares": "^1.1.0" "cares": "^1.1.5"
}, },
"devDependencies": { "devDependencies": {
"async": "^1.5.0", "async": "^1.5.0",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment