aboutsummaryrefslogtreecommitdiff
path: root/examples/nodejs/patches/01-shared-c-ares.patch
blob: 220f2c7871c45d671fff49a48c9cbfc1ba6376da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
diff -dubr source/configure cares/configure
--- source/configure	2012-10-26 00:49:32.000000000 +0400
+++ cares/configure	2012-11-01 21:18:15.766658414 +0400
@@ -460,6 +460,8 @@
   'cflags': [],
 }
 
+output['libraries'] += ['-lcares']
+
 configure_node(output)
 configure_libz(output)
 configure_v8(output)
diff -dubr source/deps/uv/config-unix.mk cares/deps/uv/config-unix.mk
--- source/deps/uv/config-unix.mk	2012-10-26 00:49:32.000000000 +0400
+++ cares/deps/uv/config-unix.mk	2012-11-01 21:24:35.522262825 +0400
@@ -47,7 +47,7 @@
 ifeq (SunOS,$(uname_S))
 EV_CONFIG=config_sunos.h
 EIO_CONFIG=config_sunos.h
-CPPFLAGS += -Isrc/ares/config_sunos -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
+CPPFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=500
 LINKFLAGS+=-lsocket -lnsl -lkstat
 OBJS += src/unix/sunos.o
 endif
@@ -65,7 +65,6 @@
 EV_CONFIG=config_linux.h
 EIO_CONFIG=config_linux.h
 CSTDFLAG += -D_GNU_SOURCE
-CPPFLAGS += -Isrc/ares/config_linux
 LINKFLAGS+=-ldl -lrt
 OBJS += src/unix/linux/linux-core.o \
         src/unix/linux/inotify.o    \
@@ -75,7 +74,6 @@
 ifeq (FreeBSD,$(uname_S))
 EV_CONFIG=config_freebsd.h
 EIO_CONFIG=config_freebsd.h
-CPPFLAGS += -Isrc/ares/config_freebsd
 LINKFLAGS+=-lkvm
 OBJS += src/unix/freebsd.o
 OBJS += src/unix/kqueue.o
@@ -84,7 +82,6 @@
 ifeq (DragonFly,$(uname_S))
 EV_CONFIG=config_freebsd.h
 EIO_CONFIG=config_freebsd.h
-CPPFLAGS += -Isrc/ares/config_freebsd
 LINKFLAGS+=
 OBJS += src/unix/freebsd.o
 OBJS += src/unix/kqueue.o
@@ -93,7 +90,6 @@
 ifeq (NetBSD,$(uname_S))
 EV_CONFIG=config_netbsd.h
 EIO_CONFIG=config_netbsd.h
-CPPFLAGS += -Isrc/ares/config_netbsd
 LINKFLAGS+=
 OBJS += src/unix/netbsd.o
 OBJS += src/unix/kqueue.o
@@ -102,7 +98,6 @@
 ifeq (OpenBSD,$(uname_S))
 EV_CONFIG=config_openbsd.h
 EIO_CONFIG=config_openbsd.h
-CPPFLAGS += -Isrc/ares/config_openbsd
 LINKFLAGS+=-lkvm
 OBJS += src/unix/openbsd.o
 OBJS += src/unix/kqueue.o
@@ -113,7 +108,6 @@
 EIO_CONFIG=config_cygwin.h
 # We drop the --std=c89, it hides CLOCK_MONOTONIC on cygwin
 CSTDFLAG = -D_GNU_SOURCE
-CPPFLAGS += -Isrc/ares/config_cygwin
 LINKFLAGS+=
 OBJS += src/unix/cygwin.o
 endif
@@ -131,7 +125,7 @@
 RUNNER_LIBS=
 RUNNER_SRC=test/runner-unix.c
 
-uv.a: $(OBJS) src/cares.o src/fs-poll.o src/uv-common.o src/unix/ev/ev.o src/unix/uv-eio.o src/unix/eio/eio.o $(CARES_OBJS)
+uv.a: $(OBJS) src/cares.o src/fs-poll.o src/uv-common.o src/unix/ev/ev.o src/unix/uv-eio.o src/unix/eio/eio.o
 	$(AR) rcs uv.a $^
 
 src/%.o: src/%.c include/uv.h include/uv-private/uv-unix.h
@@ -157,7 +151,6 @@
 
 
 clean-platform:
-	-rm -f src/ares/*.o
 	-rm -f src/unix/*.o
 	-rm -f src/unix/ev/*.o
 	-rm -f src/unix/eio/*.o
@@ -165,7 +158,6 @@
 	-rm -rf test/run-tests.dSYM run-benchmarks.dSYM
 
 distclean-platform:
-	-rm -f src/ares/*.o
 	-rm -f src/unix/*.o
 	-rm -f src/unix/ev/*.o
 	-rm -f src/unix/eio/*.o
diff -dubr source/deps/uv/include/uv.h cares/deps/uv/include/uv.h
--- source/deps/uv/include/uv.h	2012-10-26 00:49:32.000000000 +0400
+++ cares/deps/uv/include/uv.h	2012-11-01 21:17:00.331361102 +0400
@@ -55,7 +55,7 @@
 #include <stdint.h> /* int64_t */
 #include <sys/types.h> /* size_t */
 
-#include "ares.h"
+#include <ares.h>
 
 #if defined(__unix__) || defined(__POSIX__) || defined(__APPLE__)
 # include "uv-private/uv-unix.h"
diff -dubr source/deps/uv/Makefile cares/deps/uv/Makefile
--- source/deps/uv/Makefile	2012-10-26 00:49:32.000000000 +0400
+++ cares/deps/uv/Makefile	2012-11-01 21:19:24.730021729 +0400
@@ -26,51 +26,6 @@
 
 CPPFLAGS += -Iinclude -Iinclude/uv-private
 
-CARES_OBJS =
-CARES_OBJS += src/ares/ares__close_sockets.o
-CARES_OBJS += src/ares/ares__get_hostent.o
-CARES_OBJS += src/ares/ares__read_line.o
-CARES_OBJS += src/ares/ares__timeval.o
-CARES_OBJS += src/ares/ares_cancel.o
-CARES_OBJS += src/ares/ares_data.o
-CARES_OBJS += src/ares/ares_destroy.o
-CARES_OBJS += src/ares/ares_expand_name.o
-CARES_OBJS += src/ares/ares_expand_string.o
-CARES_OBJS += src/ares/ares_fds.o
-CARES_OBJS += src/ares/ares_free_hostent.o
-CARES_OBJS += src/ares/ares_free_string.o
-CARES_OBJS += src/ares/ares_gethostbyaddr.o
-CARES_OBJS += src/ares/ares_gethostbyname.o
-CARES_OBJS += src/ares/ares_getnameinfo.o
-CARES_OBJS += src/ares/ares_getopt.o
-CARES_OBJS += src/ares/ares_getsock.o
-CARES_OBJS += src/ares/ares_init.o
-CARES_OBJS += src/ares/ares_library_init.o
-CARES_OBJS += src/ares/ares_llist.o
-CARES_OBJS += src/ares/ares_mkquery.o
-CARES_OBJS += src/ares/ares_nowarn.o
-CARES_OBJS += src/ares/ares_options.o
-CARES_OBJS += src/ares/ares_parse_a_reply.o
-CARES_OBJS += src/ares/ares_parse_aaaa_reply.o
-CARES_OBJS += src/ares/ares_parse_mx_reply.o
-CARES_OBJS += src/ares/ares_parse_ns_reply.o
-CARES_OBJS += src/ares/ares_parse_ptr_reply.o
-CARES_OBJS += src/ares/ares_parse_srv_reply.o
-CARES_OBJS += src/ares/ares_parse_txt_reply.o
-CARES_OBJS += src/ares/ares_process.o
-CARES_OBJS += src/ares/ares_query.o
-CARES_OBJS += src/ares/ares_search.o
-CARES_OBJS += src/ares/ares_send.o
-CARES_OBJS += src/ares/ares_strcasecmp.o
-CARES_OBJS += src/ares/ares_strdup.o
-CARES_OBJS += src/ares/ares_strerror.o
-CARES_OBJS += src/ares/ares_timeout.o
-CARES_OBJS += src/ares/ares_version.o
-CARES_OBJS += src/ares/ares_writev.o
-CARES_OBJS += src/ares/bitncmp.o
-CARES_OBJS += src/ares/inet_net_pton.o
-CARES_OBJS += src/ares/inet_ntop.o
-
 ifneq (,$(findstring MINGW,$(uname_S)))
 include config-mingw.mk
 else
@@ -82,9 +37,6 @@
 
 all: uv.a
 
-$(CARES_OBJS): %.o: %.c
-	$(CC) -o $*.o -c $(CFLAGS) $(CPPFLAGS) $< -DHAVE_CONFIG_H
-
 test/run-tests$(E): test/*.h test/run-tests.c $(RUNNER_SRC) test/runner-unix.c $(TESTS) uv.a
 	$(CC) $(CPPFLAGS) $(RUNNER_CFLAGS) -o test/run-tests test/run-tests.c \
 		test/runner.c $(RUNNER_SRC) $(TESTS) uv.a $(RUNNER_LIBS) $(RUNNER_LINKFLAGS)
diff -dubr source/deps/uv/src/uv-common.c cares/deps/uv/src/uv-common.c
--- source/deps/uv/src/uv-common.c	2012-10-26 00:49:32.000000000 +0400
+++ cares/deps/uv/src/uv-common.c	2012-11-01 21:17:00.332151637 +0400
@@ -28,10 +28,8 @@
 #include <stdlib.h> /* malloc */
 #include <string.h> /* memset */
 
-/* use inet_pton from c-ares if necessary */
-#include "ares_config.h"
-#include "ares/inet_net_pton.h"
-#include "ares/inet_ntop.h"
+#include <ares.h>
+#include <arpa/inet.h>
 
 #define XX(uc, lc) case UV_##uc: return sizeof(uv_##lc##_t);
 
@@ -182,20 +180,20 @@
 
   addr.sin6_family = AF_INET6;
   addr.sin6_port = htons(port);
-  ares_inet_pton(AF_INET6, ip, &addr.sin6_addr);
+  inet_pton(AF_INET6, ip, &addr.sin6_addr);
 
   return addr;
 }
 
 
 int uv_ip4_name(struct sockaddr_in* src, char* dst, size_t size) {
-  const char* d = ares_inet_ntop(AF_INET, &src->sin_addr, dst, size);
+  const char* d = inet_ntop(AF_INET, &src->sin_addr, dst, size);
   return d != dst;
 }
 
 
 int uv_ip6_name(struct sockaddr_in6* src, char* dst, size_t size) {
-  const char* d = ares_inet_ntop(AF_INET6, &src->sin6_addr, dst, size);
+  const char* d = inet_ntop(AF_INET6, &src->sin6_addr, dst, size);
   return d != dst;
 }
 
diff -dubr source/deps/uv/uv.gyp cares/deps/uv/uv.gyp
--- source/deps/uv/uv.gyp	2012-10-26 00:49:32.000000000 +0400
+++ cares/deps/uv/uv.gyp	2012-11-01 21:17:00.332535345 +0400
@@ -53,70 +53,6 @@
         'src/fs-poll.c',
         'src/uv-common.c',
         'src/uv-common.h',
-        'src/ares/ares_cancel.c',
-        'src/ares/ares__close_sockets.c',
-        'src/ares/ares_data.c',
-        'src/ares/ares_data.h',
-        'src/ares/ares_destroy.c',
-        'src/ares/ares_dns.h',
-        'src/ares/ares_expand_name.c',
-        'src/ares/ares_expand_string.c',
-        'src/ares/ares_fds.c',
-        'src/ares/ares_free_hostent.c',
-        'src/ares/ares_free_string.c',
-        'src/ares/ares_getenv.h',
-        'src/ares/ares_gethostbyaddr.c',
-        'src/ares/ares_gethostbyname.c',
-        'src/ares/ares__get_hostent.c',
-        'src/ares/ares_getnameinfo.c',
-        'src/ares/ares_getopt.c',
-        'src/ares/ares_getopt.h',
-        'src/ares/ares_getsock.c',
-        'src/ares/ares_init.c',
-        'src/ares/ares_ipv6.h',
-        'src/ares/ares_library_init.c',
-        'src/ares/ares_library_init.h',
-        'src/ares/ares_llist.c',
-        'src/ares/ares_llist.h',
-        'src/ares/ares_mkquery.c',
-        'src/ares/ares_nowarn.c',
-        'src/ares/ares_nowarn.h',
-        'src/ares/ares_options.c',
-        'src/ares/ares_parse_aaaa_reply.c',
-        'src/ares/ares_parse_a_reply.c',
-        'src/ares/ares_parse_mx_reply.c',
-        'src/ares/ares_parse_ns_reply.c',
-        'src/ares/ares_parse_ptr_reply.c',
-        'src/ares/ares_parse_srv_reply.c',
-        'src/ares/ares_parse_txt_reply.c',
-        'src/ares/ares_platform.h',
-        'src/ares/ares_private.h',
-        'src/ares/ares_process.c',
-        'src/ares/ares_query.c',
-        'src/ares/ares__read_line.c',
-        'src/ares/ares_rules.h',
-        'src/ares/ares_search.c',
-        'src/ares/ares_send.c',
-        'src/ares/ares_setup.h',
-        'src/ares/ares_strcasecmp.c',
-        'src/ares/ares_strcasecmp.h',
-        'src/ares/ares_strdup.c',
-        'src/ares/ares_strdup.h',
-        'src/ares/ares_strerror.c',
-        'src/ares/ares_timeout.c',
-        'src/ares/ares__timeval.c',
-        'src/ares/ares_version.c',
-        'src/ares/ares_writev.c',
-        'src/ares/ares_writev.h',
-        'src/ares/bitncmp.c',
-        'src/ares/bitncmp.h',
-        'src/ares/inet_net_pton.c',
-        'src/ares/inet_net_pton.h',
-        'src/ares/inet_ntop.c',
-        'src/ares/inet_ntop.h',
-        'src/ares/nameser.h',
-        'src/ares/setup_once.h',
-        'src/ares/windows_port.c',
       ],
       'conditions': [
         [ 'OS=="win"', {