Use cares package in node

pull/7900/head
Yuchen Zeng 9 years ago
parent aa6240ac93
commit 502d644887
  1. 2
      Makefile
  2. 97
      binding.gyp
  3. 3
      build.yaml
  4. 2
      package.json
  5. 58
      templates/binding.gyp.template
  6. 2
      templates/package.json.template

@ -6607,7 +6607,7 @@ PUBLIC_HEADERS_C += \
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): 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)
$(E) "[AR] Creating $@"

@ -47,8 +47,7 @@
"include_dirs": [
"third_party/boringssl/include",
"third_party/zlib",
"third_party/c-ares",
"src/c-ares",
"third_party/c-ares"
],
"defines": [
'_WIN32_WINNT=0x0600',
@ -87,8 +86,7 @@
'include_dirs': [
'<(node_root_dir)/deps/openssl/openssl/include',
'<(node_root_dir)/deps/zlib',
"third_party/c-ares",
"src/c-ares"
'<(node_root_dir)/deps/cares/include',
],
'conditions': [
['config=="gcov"', {
@ -487,6 +485,7 @@
}]
],
'targets': [
{
'cflags': [
'-std=c99',
@ -564,6 +563,7 @@
'type': 'static_library',
'dependencies': [
'gpr',
'node_modules/cares/deps/cares/cares.gyp:cares',
],
'sources': [
'src/core/lib/surface/init.c',
@ -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': [
"<!(node -e \"require('nan')\")"
@ -910,7 +823,7 @@
"dependencies": [
"grpc",
"gpr",
"ares",
"node_modules/cares/deps/cares/cares.gyp:cares",
]
},
{

@ -3409,7 +3409,7 @@ configs:
timeout_multiplier: 1.5
defaults:
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)
$(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
@ -3428,7 +3428,6 @@ node_modules:
- deps:
- grpc
- gpr
- ares
- boringssl
- z
headers:

@ -31,7 +31,7 @@
"lodash": "^3.9.3",
"nan": "^2.0.0",
"protobufjs": "^4.0.0",
"cares": "^1.1.0"
"cares": "^1.1.5"
},
"devDependencies": {
"async": "^1.5.0",

@ -49,8 +49,7 @@
"include_dirs": [
"third_party/boringssl/include",
"third_party/zlib",
"third_party/c-ares",
"src/c-ares",
"third_party/c-ares"
],
"defines": [
'_WIN32_WINNT=0x0600',
@ -89,8 +88,7 @@
'include_dirs': [
'<(node_root_dir)/deps/openssl/openssl/include',
'<(node_root_dir)/deps/zlib',
"third_party/c-ares",
"src/c-ares"
'<(node_root_dir)/deps/cares/include',
],
'conditions': [
['config=="gcov"', {
@ -175,9 +173,16 @@
}]
],
'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 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': [
'-std=c99',
@ -206,49 +211,6 @@
]
},
% 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
{
'include_dirs': [

@ -33,7 +33,7 @@
"lodash": "^3.9.3",
"nan": "^2.0.0",
"protobufjs": "^4.0.0",
"cares": "^1.1.0"
"cares": "^1.1.5"
},
"devDependencies": {
"async": "^1.5.0",

Loading…
Cancel
Save