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