diff options
author | 2016-08-22 17:36:24 -0700 | |
---|---|---|
committer | 2016-08-22 17:36:24 -0700 | |
commit | 502d644887f82837a762b300080e0b7f81117be3 (patch) | |
tree | f26a4c99e13a81bc4e72cda375c91fcd626b11b0 | |
parent | aa6240ac93eae6b9a6c9c51ae5a0bc705f89d53d (diff) |
Use cares package in node
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | binding.gyp | 97 | ||||
-rw-r--r-- | build.yaml | 3 | ||||
-rw-r--r-- | package.json | 2 | ||||
-rw-r--r-- | templates/binding.gyp.template | 58 | ||||
-rw-r--r-- | templates/package.json.template | 2 |
6 files changed, 19 insertions, 145 deletions
@@ -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 $@" diff --git a/binding.gyp b/binding.gyp index 5154868206..5860f7cffc 100644 --- a/binding.gyp +++ b/binding.gyp @@ -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', @@ -770,93 +770,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", ] }, { diff --git a/build.yaml b/build.yaml index 6513bd39a8..92c30f224b 100644 --- a/build.yaml +++ b/build.yaml @@ -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: diff --git a/package.json b/package.json index c74dbe45e3..80e8e994ca 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/templates/binding.gyp.template b/templates/binding.gyp.template index 2da9785201..6f1425e3c8 100644 --- a/templates/binding.gyp.template +++ b/templates/binding.gyp.template @@ -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': [ diff --git a/templates/package.json.template b/templates/package.json.template index d0150f6bf8..832495eb19 100644 --- a/templates/package.json.template +++ b/templates/package.json.template @@ -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", |