uv: Upgrade to v0.10.19
[platform/upstream/nodejs.git] / deps / uv / uv.gyp
1 {
2   'variables': {
3     'uv_use_dtrace%': 'false',
4     # uv_parent_path is the relative path to libuv in the parent project
5     # this is only relevant when dtrace is enabled and libuv is a child project
6     # as it's necessary to correctly locate the object files for post
7     # processing.
8     'uv_parent_path': '',
9   },
10
11   'target_defaults': {
12     'conditions': [
13       ['OS != "win"', {
14         'defines': [
15           '_LARGEFILE_SOURCE',
16           '_FILE_OFFSET_BITS=64',
17           '_GNU_SOURCE',
18         ],
19         'conditions': [
20           ['OS=="solaris"', {
21             'cflags': [ '-pthreads' ],
22           }, {
23             'cflags': [ '-pthread' ],
24           }],
25         ],
26       }],
27     ],
28   },
29
30   'targets': [
31     {
32       'target_name': 'libuv',
33       'type': '<(library)',
34       'include_dirs': [
35         'include',
36         'include/uv-private',
37         'src/',
38       ],
39       'direct_dependent_settings': {
40         'include_dirs': [ 'include' ],
41         'conditions': [
42           ['OS != "win"', {
43             'defines': [
44               '_LARGEFILE_SOURCE',
45               '_FILE_OFFSET_BITS=64',
46             ],
47           }],
48           ['OS == "mac"', {
49             'defines': [ '_DARWIN_USE_64_BIT_INODE=1' ],
50           }],
51           ['OS == "linux"', {
52             'defines': [ '_POSIX_C_SOURCE=200112' ],
53           }],
54         ],
55       },
56       'defines': [
57         'HAVE_CONFIG_H'
58       ],
59       'sources': [
60         'common.gypi',
61         'include/uv.h',
62         'include/uv-private/ngx-queue.h',
63         'include/uv-private/tree.h',
64         'src/fs-poll.c',
65         'src/inet.c',
66         'src/uv-common.c',
67         'src/uv-common.h',
68         'src/version.c'
69       ],
70       'conditions': [
71         [ 'OS=="win"', {
72           'defines': [
73             '_WIN32_WINNT=0x0600',
74             '_GNU_SOURCE',
75           ],
76           'sources': [
77             'include/uv-private/uv-win.h',
78             'src/win/async.c',
79             'src/win/atomicops-inl.h',
80             'src/win/core.c',
81             'src/win/dl.c',
82             'src/win/error.c',
83             'src/win/fs.c',
84             'src/win/fs-event.c',
85             'src/win/getaddrinfo.c',
86             'src/win/handle.c',
87             'src/win/handle-inl.h',
88             'src/win/internal.h',
89             'src/win/loop-watcher.c',
90             'src/win/pipe.c',
91             'src/win/thread.c',
92             'src/win/poll.c',
93             'src/win/process.c',
94             'src/win/process-stdio.c',
95             'src/win/req.c',
96             'src/win/req-inl.h',
97             'src/win/signal.c',
98             'src/win/stream.c',
99             'src/win/stream-inl.h',
100             'src/win/tcp.c',
101             'src/win/tty.c',
102             'src/win/threadpool.c',
103             'src/win/timer.c',
104             'src/win/udp.c',
105             'src/win/util.c',
106             'src/win/winapi.c',
107             'src/win/winapi.h',
108             'src/win/winsock.c',
109             'src/win/winsock.h',
110           ],
111           'link_settings': {
112             'libraries': [
113               '-ladvapi32.lib',
114               '-liphlpapi.lib',
115               '-lpsapi.lib',
116               '-lshell32.lib',
117               '-lws2_32.lib'
118             ],
119           },
120         }, { # Not Windows i.e. POSIX
121           'cflags': [
122             '-g',
123             '--std=gnu89',
124             '-pedantic',
125             '-Wall',
126             '-Wextra',
127             '-Wno-unused-parameter',
128           ],
129           'sources': [
130             'include/uv-private/uv-unix.h',
131             'include/uv-private/uv-linux.h',
132             'include/uv-private/uv-sunos.h',
133             'include/uv-private/uv-darwin.h',
134             'include/uv-private/uv-bsd.h',
135             'src/unix/async.c',
136             'src/unix/core.c',
137             'src/unix/dl.c',
138             'src/unix/error.c',
139             'src/unix/fs.c',
140             'src/unix/getaddrinfo.c',
141             'src/unix/internal.h',
142             'src/unix/loop.c',
143             'src/unix/loop-watcher.c',
144             'src/unix/pipe.c',
145             'src/unix/poll.c',
146             'src/unix/process.c',
147             'src/unix/signal.c',
148             'src/unix/stream.c',
149             'src/unix/tcp.c',
150             'src/unix/thread.c',
151             'src/unix/threadpool.c',
152             'src/unix/timer.c',
153             'src/unix/tty.c',
154             'src/unix/udp.c',
155           ],
156           'link_settings': {
157             'libraries': [ '-lm' ],
158             'conditions': [
159               ['OS=="solaris"', {
160                 'ldflags': [ '-pthreads' ],
161               }, {
162                 'ldflags': [ '-pthread' ],
163               }],
164             ],
165           },
166           'conditions': [
167             ['library=="shared_library"', {
168               'cflags': [ '-fPIC' ],
169             }],
170             ['library=="shared_library" and OS!="mac"', {
171               'link_settings': {
172                 # Must correspond with UV_VERSION_MAJOR and UV_VERSION_MINOR
173                 # in src/version.c
174                 'libraries': [ '-Wl,-soname,libuv.so.0.10' ],
175               },
176             }],
177           ],
178         }],
179         [ 'OS=="linux" or OS=="mac"', {
180           'sources': [ 'src/unix/proctitle.c' ],
181         }],
182         [ 'OS=="mac"', {
183           'sources': [
184             'src/unix/darwin.c',
185             'src/unix/fsevents.c',
186             'src/unix/darwin-proctitle.c',
187           ],
188           'link_settings': {
189             'libraries': [
190               '$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
191               '$(SDKROOT)/System/Library/Frameworks/CoreServices.framework',
192               '$(SDKROOT)/System/Library/Frameworks/ApplicationServices.framework',
193             ],
194           },
195           'defines': [
196             '_DARWIN_USE_64_BIT_INODE=1',
197           ]
198         }],
199         [ 'OS!="mac"', {
200           # Enable on all platforms except OS X. The antique gcc/clang that
201           # ships with Xcode emits waaaay too many false positives.
202           'cflags': [ '-Wstrict-aliasing' ],
203         }],
204         [ 'OS=="linux"', {
205           'sources': [
206             'src/unix/linux-core.c',
207             'src/unix/linux-inotify.c',
208             'src/unix/linux-syscalls.c',
209             'src/unix/linux-syscalls.h',
210           ],
211           'link_settings': {
212             'libraries': [ '-ldl', '-lrt' ],
213           },
214         }],
215         [ 'OS=="solaris"', {
216           'sources': [ 'src/unix/sunos.c' ],
217           'defines': [
218             '__EXTENSIONS__',
219             '_XOPEN_SOURCE=500',
220           ],
221           'link_settings': {
222             'libraries': [
223               '-lkstat',
224               '-lnsl',
225               '-lsendfile',
226               '-lsocket',
227             ],
228           },
229         }],
230         [ 'OS=="aix"', {
231           'include_dirs': [ 'src/ares/config_aix' ],
232           'sources': [ 'src/unix/aix.c' ],
233           'defines': [
234             '_ALL_SOURCE',
235             '_XOPEN_SOURCE=500',
236           ],
237           'link_settings': {
238             'libraries': [
239               '-lperfstat',
240             ],
241           },
242         }],
243         [ 'OS=="freebsd" or OS=="dragonflybsd"', {
244           'sources': [ 'src/unix/freebsd.c' ],
245         }],
246         [ 'OS=="openbsd"', {
247           'sources': [ 'src/unix/openbsd.c' ],
248         }],
249         [ 'OS=="netbsd"', {
250           'sources': [ 'src/unix/netbsd.c' ],
251         }],
252         [ 'OS in "freebsd dragonflybsd openbsd netbsd".split()', {
253           'link_settings': {
254             'libraries': [ '-lkvm' ],
255           },
256         }],
257         [ 'OS in "mac freebsd dragonflybsd openbsd netbsd".split()', {
258           'sources': [ 'src/unix/kqueue.c' ],
259         }],
260         ['library=="shared_library"', {
261           'defines': [ 'BUILDING_UV_SHARED=1' ]
262         }],
263         ['uv_use_dtrace=="true"', {
264           'defines': [ 'HAVE_DTRACE=1' ],
265           'dependencies': [ 'uv_dtrace_header' ],
266           'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
267           'conditions': [
268             ['OS != "mac"', {
269               'sources': ['src/unix/dtrace.c' ],
270             }],
271           ],
272         }],
273       ]
274     },
275
276     {
277       'target_name': 'run-tests',
278       'type': 'executable',
279       'dependencies': [ 'libuv' ],
280       'sources': [
281         'test/blackhole-server.c',
282         'test/echo-server.c',
283         'test/run-tests.c',
284         'test/runner.c',
285         'test/runner.h',
286         'test/test-get-loadavg.c',
287         'test/task.h',
288         'test/test-util.c',
289         'test/test-active.c',
290         'test/test-async.c',
291         'test/test-callback-stack.c',
292         'test/test-callback-order.c',
293         'test/test-connection-fail.c',
294         'test/test-cwd-and-chdir.c',
295         'test/test-delayed-accept.c',
296         'test/test-error.c',
297         'test/test-embed.c',
298         'test/test-fail-always.c',
299         'test/test-fs.c',
300         'test/test-fs-event.c',
301         'test/test-get-currentexe.c',
302         'test/test-get-memory.c',
303         'test/test-getaddrinfo.c',
304         'test/test-getsockname.c',
305         'test/test-hrtime.c',
306         'test/test-idle.c',
307         'test/test-ipc.c',
308         'test/test-ipc-send-recv.c',
309         'test/test-list.h',
310         'test/test-loop-handles.c',
311         'test/test-loop-stop.c',
312         'test/test-walk-handles.c',
313         'test/test-watcher-cross-stop.c',
314         'test/test-multiple-listen.c',
315         'test/test-osx-select.c',
316         'test/test-pass-always.c',
317         'test/test-ping-pong.c',
318         'test/test-pipe-bind-error.c',
319         'test/test-pipe-connect-error.c',
320         'test/test-platform-output.c',
321         'test/test-poll.c',
322         'test/test-poll-close.c',
323         'test/test-process-title.c',
324         'test/test-ref.c',
325         'test/test-run-nowait.c',
326         'test/test-run-once.c',
327         'test/test-semaphore.c',
328         'test/test-shutdown-close.c',
329         'test/test-shutdown-eof.c',
330         'test/test-signal.c',
331         'test/test-signal-multiple-loops.c',
332         'test/test-spawn.c',
333         'test/test-fs-poll.c',
334         'test/test-stdio-over-pipes.c',
335         'test/test-tcp-bind-error.c',
336         'test/test-tcp-bind6-error.c',
337         'test/test-tcp-close.c',
338         'test/test-tcp-close-accept.c',
339         'test/test-tcp-close-while-connecting.c',
340         'test/test-tcp-connect-error-after-write.c',
341         'test/test-tcp-shutdown-after-write.c',
342         'test/test-tcp-flags.c',
343         'test/test-tcp-connect-error.c',
344         'test/test-tcp-connect-timeout.c',
345         'test/test-tcp-connect6-error.c',
346         'test/test-tcp-open.c',
347         'test/test-tcp-write-to-half-open-connection.c',
348         'test/test-tcp-writealot.c',
349         'test/test-tcp-unexpected-read.c',
350         'test/test-tcp-read-stop.c',
351         'test/test-threadpool.c',
352         'test/test-threadpool-cancel.c',
353         'test/test-mutexes.c',
354         'test/test-thread.c',
355         'test/test-barrier.c',
356         'test/test-condvar.c',
357         'test/test-timer-again.c',
358         'test/test-timer-from-check.c',
359         'test/test-timer.c',
360         'test/test-tty.c',
361         'test/test-udp-dgram-too-big.c',
362         'test/test-udp-ipv6.c',
363         'test/test-udp-open.c',
364         'test/test-udp-options.c',
365         'test/test-udp-send-and-recv.c',
366         'test/test-udp-multicast-join.c',
367         'test/test-dlerror.c',
368         'test/test-udp-multicast-ttl.c',
369       ],
370       'conditions': [
371         [ 'OS=="win"', {
372           'sources': [
373             'test/runner-win.c',
374             'test/runner-win.h'
375           ],
376           'libraries': [ 'ws2_32.lib' ]
377         }, { # POSIX
378           'defines': [ '_GNU_SOURCE' ],
379           'sources': [
380             'test/runner-unix.c',
381             'test/runner-unix.h',
382           ],
383         }],
384         [ 'OS=="solaris"', { # make test-fs.c compile, needs _POSIX_C_SOURCE
385           'defines': [
386             '__EXTENSIONS__',
387             '_XOPEN_SOURCE=500',
388           ],
389         }],
390         [ 'OS=="aix"', {     # make test-fs.c compile, needs _POSIX_C_SOURCE
391           'defines': [
392             '_ALL_SOURCE',
393             '_XOPEN_SOURCE=500',
394           ],
395         }],
396       ],
397       'msvs-settings': {
398         'VCLinkerTool': {
399           'SubSystem': 1, # /subsystem:console
400         },
401       },
402     },
403
404     {
405       'target_name': 'run-benchmarks',
406       'type': 'executable',
407       'dependencies': [ 'libuv' ],
408       'sources': [
409         'test/benchmark-async.c',
410         'test/benchmark-async-pummel.c',
411         'test/benchmark-fs-stat.c',
412         'test/benchmark-getaddrinfo.c',
413         'test/benchmark-list.h',
414         'test/benchmark-loop-count.c',
415         'test/benchmark-million-async.c',
416         'test/benchmark-million-timers.c',
417         'test/benchmark-multi-accept.c',
418         'test/benchmark-ping-pongs.c',
419         'test/benchmark-pound.c',
420         'test/benchmark-pump.c',
421         'test/benchmark-sizes.c',
422         'test/benchmark-spawn.c',
423         'test/benchmark-thread.c',
424         'test/benchmark-tcp-write-batch.c',
425         'test/benchmark-udp-pummel.c',
426         'test/dns-server.c',
427         'test/echo-server.c',
428         'test/blackhole-server.c',
429         'test/run-benchmarks.c',
430         'test/runner.c',
431         'test/runner.h',
432         'test/task.h',
433       ],
434       'conditions': [
435         [ 'OS=="win"', {
436           'sources': [
437             'test/runner-win.c',
438             'test/runner-win.h',
439           ],
440           'libraries': [ 'ws2_32.lib' ]
441         }, { # POSIX
442           'defines': [ '_GNU_SOURCE' ],
443           'sources': [
444             'test/runner-unix.c',
445             'test/runner-unix.h',
446           ]
447         }]
448       ],
449       'msvs-settings': {
450         'VCLinkerTool': {
451           'SubSystem': 1, # /subsystem:console
452         },
453       },
454     },
455
456     {
457       'target_name': 'uv_dtrace_header',
458       'type': 'none',
459       'conditions': [
460         [ 'uv_use_dtrace=="true"', {
461           'actions': [
462             {
463               'action_name': 'uv_dtrace_header',
464               'inputs': [ 'src/unix/uv-dtrace.d' ],
465               'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/uv-dtrace.h' ],
466               'action': [ 'dtrace', '-h', '-xnolibs', '-s', '<@(_inputs)',
467                 '-o', '<@(_outputs)' ],
468             },
469           ],
470         }],
471       ],
472     },
473
474     {
475       'target_name': 'uv_dtrace_provider',
476       'type': 'none',
477       'conditions': [
478         [ 'uv_use_dtrace=="true" and OS!="mac"', {
479           'actions': [
480             {
481               'action_name': 'uv_dtrace_o',
482               'inputs': [
483                 'src/unix/uv-dtrace.d',
484                 '<(PRODUCT_DIR)/obj.target/libuv/<(uv_parent_path)/src/unix/core.o',
485               ],
486               'outputs': [
487                 '<(PRODUCT_DIR)/obj.target/libuv/<(uv_parent_path)/src/unix/dtrace.o',
488               ],
489               'action': [ 'dtrace', '-G', '-xnolibs', '-s', '<@(_inputs)',
490                 '-o', '<@(_outputs)' ]
491             }
492           ]
493         } ]
494       ]
495     },
496
497   ]
498 }