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