This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Add c-ares dependency

This is the c-ares code that used to live in the libuv source tree.
It is based on c-ares 1.9.0.
  • Loading branch information...
1 parent 4c150ca commit 81791ff33cc5413b7711c957406635ed780d0b4e @piscisaureus piscisaureus committed Aug 6, 2012
Showing with 29,243 additions and 0 deletions.
  1. +15 −0 deps/cares/.gitignore
  2. +20 −0 deps/cares/build/gcc_version.py
  3. +160 −0 deps/cares/cares.gyp
  4. +172 −0 deps/cares/common.gypi
  5. +512 −0 deps/cares/config/cygwin/ares_config.h
  6. +512 −0 deps/cares/config/darwin/ares_config.h
  7. +512 −0 deps/cares/config/freebsd/ares_config.h
  8. +512 −0 deps/cares/config/linux/ares_config.h
  9. +512 −0 deps/cares/config/netbsd/ares_config.h
  10. +512 −0 deps/cares/config/openbsd/ares_config.h
  11. +512 −0 deps/cares/config/sunos/ares_config.h
  12. +369 −0 deps/cares/config/win32/ares_config.h
  13. +622 −0 deps/cares/include/ares.h
  14. +24 −0 deps/cares/include/ares_version.h
  15. +203 −0 deps/cares/include/nameser.h
  16. +37 −0 deps/cares/src/AUTHORS
  17. +7 −0 deps/cares/src/CHANGES
  18. +21 −0 deps/cares/src/NEWS
  19. +60 −0 deps/cares/src/README
  20. +13 −0 deps/cares/src/README.cares
  21. +142 −0 deps/cares/src/README.msvc
  22. +16 −0 deps/cares/src/RELEASE-NOTES
  23. +23 −0 deps/cares/src/TODO
  24. +66 −0 deps/cares/src/ares__close_sockets.c
  25. +264 −0 deps/cares/src/ares__get_hostent.c
  26. +71 −0 deps/cares/src/ares__read_line.c
  27. +111 −0 deps/cares/src/ares__timeval.c
  28. +63 −0 deps/cares/src/ares_cancel.c
  29. +231 −0 deps/cares/src/ares_data.c
  30. +69 −0 deps/cares/src/ares_data.h
  31. +107 −0 deps/cares/src/ares_destroy.c
  32. +103 −0 deps/cares/src/ares_dns.h
  33. +201 −0 deps/cares/src/ares_expand_name.c
  34. +75 −0 deps/cares/src/ares_expand_string.c
  35. +63 −0 deps/cares/src/ares_fds.c
  36. +42 −0 deps/cares/src/ares_free_hostent.c
  37. +25 −0 deps/cares/src/ares_free_string.c
  38. +30 −0 deps/cares/src/ares_getenv.c
  39. +26 −0 deps/cares/src/ares_getenv.h
  40. +301 −0 deps/cares/src/ares_gethostbyaddr.c
  41. +524 −0 deps/cares/src/ares_gethostbyname.c
  42. +427 −0 deps/cares/src/ares_getnameinfo.c
  43. +122 −0 deps/cares/src/ares_getopt.c
  44. +53 −0 deps/cares/src/ares_getopt.h
  45. +72 −0 deps/cares/src/ares_getsock.c
  46. +2,021 −0 deps/cares/src/ares_init.c
  47. +221 −0 deps/cares/src/ares_iphlpapi.h
  48. +78 −0 deps/cares/src/ares_ipv6.h
  49. +142 −0 deps/cares/src/ares_library_init.c
  50. +42 −0 deps/cares/src/ares_library_init.h
  51. +86 −0 deps/cares/src/ares_llist.c
  52. +42 −0 deps/cares/src/ares_llist.h
  53. +195 −0 deps/cares/src/ares_mkquery.c
  54. +249 −0 deps/cares/src/ares_nowarn.c
  55. +61 −0 deps/cares/src/ares_nowarn.h
  56. +248 −0 deps/cares/src/ares_options.c
  57. +263 −0 deps/cares/src/ares_parse_a_reply.c
  58. +261 −0 deps/cares/src/ares_parse_aaaa_reply.c
  59. +170 −0 deps/cares/src/ares_parse_mx_reply.c
  60. +188 −0 deps/cares/src/ares_parse_naptr_reply.c
  61. +182 −0 deps/cares/src/ares_parse_ns_reply.c
  62. +218 −0 deps/cares/src/ares_parse_ptr_reply.c
  63. +135 −0 deps/cares/src/ares_parse_soa_reply.c
  64. +179 −0 deps/cares/src/ares_parse_srv_reply.c
  65. +201 −0 deps/cares/src/ares_parse_txt_reply.c
  66. +11,035 −0 deps/cares/src/ares_platform.c
  67. +43 −0 deps/cares/src/ares_platform.h
  68. +355 −0 deps/cares/src/ares_private.h
  69. +1,294 −0 deps/cares/src/ares_process.c
  70. +183 −0 deps/cares/src/ares_query.c
  71. +144 −0 deps/cares/src/ares_rules.h
  72. +321 −0 deps/cares/src/ares_search.c
  73. +134 −0 deps/cares/src/ares_send.c
  74. +221 −0 deps/cares/src/ares_setup.h
  75. +66 −0 deps/cares/src/ares_strcasecmp.c
  76. +30 −0 deps/cares/src/ares_strcasecmp.h
  77. +42 −0 deps/cares/src/ares_strdup.c
  78. +26 −0 deps/cares/src/ares_strdup.h
  79. +56 −0 deps/cares/src/ares_strerror.c
  80. +81 −0 deps/cares/src/ares_timeout.c
  81. +11 −0 deps/cares/src/ares_version.c
  82. +79 −0 deps/cares/src/ares_writev.c
  83. +36 −0 deps/cares/src/ares_writev.h
  84. +59 −0 deps/cares/src/bitncmp.c
  85. +26 −0 deps/cares/src/bitncmp.h
  86. +35 −0 deps/cares/src/get_ver.awk
  87. +451 −0 deps/cares/src/inet_net_pton.c
  88. +31 −0 deps/cares/src/inet_net_pton.h
  89. +208 −0 deps/cares/src/inet_ntop.c
  90. +26 −0 deps/cares/src/inet_ntop.h
  91. +512 −0 deps/cares/src/setup_once.h
  92. +22 −0 deps/cares/src/windows_port.c
View
@@ -0,0 +1,15 @@
+/Debug/
+/out/
+/Release/
+
+/cares.Makefile
+/cares.target.mk
+/Makefile
+
+/*.opensdf
+/*.sdf
+/*.sln
+/*.suo
+/*.vcxproj
+/*.vcxproj.filters
+/*.vcxproj.user
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+import os
+import re
+import subprocess
+import sys
+
+
+def DoMain(*args):
+ cc = os.environ.get('CC', 'gcc')
+ stdin, stderr = os.pipe()
+ subprocess.call([cc, '-v'], stderr=stderr)
+ output = os.read(stdin, 4096)
+ match = re.search("\ngcc version (\d+\.\d+\.\d+)", output)
+ if match:
+ print(match.group(1))
+
+
+if __name__ == '__main__':
+ DoMain(*sys.argv)
View
@@ -0,0 +1,160 @@
+{
+ 'target_defaults': {
+ 'conditions': [
+ ['OS!="win"', {
+ 'defines': [
+ '_DARWIN_USE_64_BIT_INODE=1',
+ '_LARGEFILE_SOURCE',
+ '_FILE_OFFSET_BITS=64',
+ '_GNU_SOURCE'
+ ]
+ }],
+ ['OS=="solaris"', {
+ 'defines': [
+ '__EXTENSIONS__',
+ '_XOPEN_SOURCE=500'
+ ]
+ }]
+ ]
+ },
+
+ 'targets': [
+ {
+ 'target_name': 'cares',
+ 'type': '<(library)',
+ 'include_dirs': [ 'include', 'src' ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [ 'include' ]
+ },
+ 'defines': [ 'HAVE_CONFIG_H' ],
+ 'sources': [
+ 'common.gypi',
+ 'include/ares.h',
+ 'include/ares_version.h',
+ 'include/nameser.h',
+ 'src/ares_cancel.c',
+ 'src/ares__close_sockets.c',
+ 'src/ares_data.c',
+ 'src/ares_data.h',
+ 'src/ares_destroy.c',
+ 'src/ares_dns.h',
+ 'src/ares_expand_name.c',
+ 'src/ares_expand_string.c',
+ 'src/ares_fds.c',
+ 'src/ares_free_hostent.c',
+ 'src/ares_free_string.c',
+ 'src/ares_getenv.h',
+ 'src/ares_gethostbyaddr.c',
+ 'src/ares_gethostbyname.c',
+ 'src/ares__get_hostent.c',
+ 'src/ares_getnameinfo.c',
+ 'src/ares_getopt.c',
+ 'src/ares_getopt.h',
+ 'src/ares_getsock.c',
+ 'src/ares_init.c',
+ 'src/ares_ipv6.h',
+ 'src/ares_library_init.c',
+ 'src/ares_library_init.h',
+ 'src/ares_llist.c',
+ 'src/ares_llist.h',
+ 'src/ares_mkquery.c',
+ 'src/ares_nowarn.c',
+ 'src/ares_nowarn.h',
+ 'src/ares_options.c',
+ 'src/ares_parse_aaaa_reply.c',
+ 'src/ares_parse_a_reply.c',
+ 'src/ares_parse_mx_reply.c',
+ 'src/ares_parse_naptr_reply.c',
+ 'src/ares_parse_ns_reply.c',
+ 'src/ares_parse_ptr_reply.c',
+ 'src/ares_parse_soa_reply.c',
+ 'src/ares_parse_srv_reply.c',
+ 'src/ares_parse_txt_reply.c',
+ 'src/ares_platform.h',
+ 'src/ares_private.h',
+ 'src/ares_process.c',
+ 'src/ares_query.c',
+ 'src/ares__read_line.c',
+ 'src/ares_rules.h',
+ 'src/ares_search.c',
+ 'src/ares_send.c',
+ 'src/ares_setup.h',
+ 'src/ares_strcasecmp.c',
+ 'src/ares_strcasecmp.h',
+ 'src/ares_strdup.c',
+ 'src/ares_strdup.h',
+ 'src/ares_strerror.c',
+ 'src/ares_timeout.c',
+ 'src/ares__timeval.c',
+ 'src/ares_version.c',
+ 'src/ares_writev.c',
+ 'src/ares_writev.h',
+ 'src/bitncmp.c',
+ 'src/bitncmp.h',
+ 'src/inet_net_pton.c',
+ 'src/inet_net_pton.h',
+ 'src/inet_ntop.c',
+ 'src/inet_ntop.h',
+ 'src/setup_once.h',
+ 'src/windows_port.c'
+ ],
+ 'conditions': [
+ [ 'library=="static_library"', {
+ 'defines': [ 'CARES_STATICLIB' ]
+ }, {
+ 'defines': [ 'CARES_BUILDING_LIBRARY' ]
+ }],
+ [ 'OS=="win"', {
+ 'include_dirs': [ 'config/win32' ],
+ 'sources': [
+ 'config/win32/ares_config.h',
+ 'src/windows_port.c',
+ 'src/ares_getenv.c',
+ 'src/ares_iphlpapi.h',
+ 'src/ares_platform.c'
+ ],
+ 'libraries': [
+ '-lws2_32.lib',
+ '-liphlpapi.lib'
+ ],
+ }, {
+ # Not Windows i.e. POSIX
+ 'cflags': [
+ '-g',
+ '--std=gnu89',
+ '-pedantic',
+ '-Wall',
+ '-Wextra',
+ '-Wno-unused-parameter'
+ ],
+ }],
+ [ 'OS=="linux"', {
+ 'include_dirs': [ 'config/linux' ],
+ 'sources': [ 'config/linux/ares_config.h' ]
+ }],
+ [ 'OS=="mac"', {
+ 'include_dirs': [ 'config/darwin' ],
+ 'sources': [ 'config/darwin/ares_config.h' ]
+ }],
+ [ 'OS=="freebsd"', {
+ 'include_dirs': [ 'config/freebsd' ],
+ 'sources': [ 'config/freebsd/ares_config.h' ]
+ }],
+ [ 'OS=="openbsd"', {
+ 'include_dirs': [ 'config/openbsd' ],
+ 'sources': [ 'config/openbsd/ares_config.h' ]
+ }],
+ [ 'OS=="solaris"', {
+ 'include_dirs': [ 'config/sunos' ],
+ 'sources': [ 'config/sunos/ares_config.h' ],
+ 'direct_dependent_settings': {
+ 'libraries': [
+ '-lsocket',
+ '-lnsl'
+ ]
+ }
+ }]
+ ]
+ }
+ ]
+}
View
@@ -0,0 +1,172 @@
+{
+ 'variables': {
+ 'visibility%': 'hidden',
+ 'library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds
+ 'component%': 'static_library',
+ 'host_arch%': '',
+ 'target_arch%': ''
+ },
+
+ 'target_defaults': {
+ 'default_configuration': 'Debug',
+ 'configurations': {
+
+ 'Debug': {
+ 'defines': [ 'DEBUG', '_DEBUG' ],
+ 'cflags': [ '-g', '-O0' ],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'target_conditions': [
+ ['library=="static_library"', {
+ 'RuntimeLibrary': 1 # static debug
+ }, {
+ 'RuntimeLibrary': 3 # DLL debug
+ }]
+ ],
+ 'Optimization': 0, # /Od, no optimization
+ 'MinimalRebuild': 'false',
+ 'OmitFramePointers': 'false',
+ 'BasicRuntimeChecks': 3 # /RTC1
+ },
+ 'VCLinkerTool': {
+ 'LinkIncremental': 2 # enable incremental linking
+ }
+ },
+ 'xcode_settings': {
+ 'GCC_OPTIMIZATION_LEVEL': '0'
+ }
+ },
+
+ 'Release': {
+ 'defines': [ 'NDEBUG' ],
+ 'cflags': [
+ '-O3',
+ '-fomit-frame-pointer',
+ '-fdata-sections',
+ '-ffunction-sections'
+ ],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'target_conditions': [
+ ['library=="static_library"', {
+ 'RuntimeLibrary': 0, # static release
+ }, {
+ 'RuntimeLibrary': 2, # debug release
+ }],
+ ],
+ 'Optimization': 3, # /Ox, full optimization
+ 'FavorSizeOrSpeed': 1, # /Ot, favour speed over size
+ 'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
+ 'WholeProgramOptimization': 'true', # /GL, whole program optimization, needed for LTCG
+ 'OmitFramePointers': 'true',
+ 'EnableFunctionLevelLinking': 'true',
+ 'EnableIntrinsicFunctions': 'true'
+ },
+ 'VCLibrarianTool': {
+ 'AdditionalOptions': [
+ '/LTCG' # link time code generation
+ ]
+ },
+ 'VCLinkerTool': {
+ 'LinkTimeCodeGeneration': 1, # link-time code generation
+ 'OptimizeReferences': 2, # /OPT:REF
+ 'EnableCOMDATFolding': 2, # /OPT:ICF
+ 'LinkIncremental': 1 # disable incremental linking
+ },
+ },
+ }
+ },
+
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'StringPooling': 'true', # pool string literals
+ 'DebugInformationFormat': 3, # Generate a PDB
+ 'WarningLevel': 3,
+ 'BufferSecurityCheck': 'true',
+ 'ExceptionHandling': 1, # /EHsc
+ 'SuppressStartupBanner': 'true',
+ 'WarnAsError': 'false',
+ 'AdditionalOptions': [
+ '/MP', # compile across multiple CPUs
+ ],
+ },
+ 'VCLinkerTool': {
+ 'GenerateDebugInformation': 'true',
+ 'RandomizedBaseAddress': 2, # enable ASLR
+ 'DataExecutionPrevention': 2, # enable DEP
+ 'AllowIsolation': 'true',
+ 'SuppressStartupBanner': 'true',
+ 'target_conditions': [
+ ['_type=="executable"', {
+ 'SubSystem': 1, # console executable
+ }],
+ ],
+ },
+ },
+
+ 'xcode_settings': {
+ 'ALWAYS_SEARCH_USER_PATHS': 'NO',
+ 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
+ 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
+ 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
+ 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
+ # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
+ 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
+ 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
+ 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
+ 'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
+ 'PREBINDING': 'NO', # No -Wl,-prebind
+ 'USE_HEADERMAP': 'NO',
+ 'WARNING_CFLAGS': [
+ '-Wall',
+ '-Wendif-labels',
+ '-W',
+ '-Wno-unused-parameter'
+ ]
+ },
+
+ 'conditions': [
+ ['OS == "win"', {
+ 'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
+ 'defines': [
+ 'WIN32',
+ # we don't want VC++ warning us about how dangerous C functions are.
+ '_CRT_SECURE_NO_DEPRECATE',
+ # ... or that C implementations shouldn't use POSIX names
+ '_CRT_NONSTDC_NO_DEPRECATE'
+ ],
+ }],
+
+ [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
+ 'variables': {
+ 'gcc_version%': '<!(python build/gcc_version.py)>)'
+ },
+ 'cflags': [ '-Wall' ],
+ 'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ],
+ 'conditions': [
+ [ 'host_arch != target_arch and target_arch=="ia32"', {
+ 'cflags': [ '-m32' ],
+ 'ldflags': [ '-m32' ]
+ }],
+ [ 'OS=="linux"', {
+ 'cflags': [ '-ansi' ]
+ }],
+ [ 'visibility=="hidden" and gcc_version >= "4.0.0"', {
+ 'cflags': [ '-fvisibility=hidden' ]
+ }],
+ ]
+ }]
+ ],
+
+ 'target_conditions': [
+ ['_type!="static_library"', {
+ 'cflags': [ '-fPIC' ],
+ 'xcode_settings': {
+ 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
+ # (Equivalent to -fPIC)
+ 'OTHER_LDFLAGS': [ '-Wl,-search_paths_first' ]
+ }
+ }]
+ ]
+ }
+}
Oops, something went wrong.

0 comments on commit 81791ff

Please sign in to comment.