src: remove Async Listener
[platform/upstream/nodejs.git] / node.gyp
1 {
2   'variables': {
3     'v8_use_snapshot%': 'true',
4     'node_use_dtrace%': 'false',
5     'node_use_etw%': 'false',
6     'node_use_perfctr%': 'false',
7     'node_has_winsdk%': 'false',
8     'node_shared_v8%': 'false',
9     'node_shared_zlib%': 'false',
10     'node_shared_http_parser%': 'false',
11     'node_shared_cares%': 'false',
12     'node_shared_libuv%': 'false',
13     'node_use_openssl%': 'true',
14     'node_shared_openssl%': 'false',
15     'node_use_mdb%': 'false',
16     'node_v8_options%': '',
17     'library_files': [
18       'src/node.js',
19       'lib/_debugger.js',
20       'lib/_linklist.js',
21       'lib/assert.js',
22       'lib/buffer.js',
23       'lib/child_process.js',
24       'lib/console.js',
25       'lib/constants.js',
26       'lib/crypto.js',
27       'lib/cluster.js',
28       'lib/dgram.js',
29       'lib/dns.js',
30       'lib/domain.js',
31       'lib/events.js',
32       'lib/freelist.js',
33       'lib/fs.js',
34       'lib/http.js',
35       'lib/_http_agent.js',
36       'lib/_http_client.js',
37       'lib/_http_common.js',
38       'lib/_http_incoming.js',
39       'lib/_http_outgoing.js',
40       'lib/_http_server.js',
41       'lib/https.js',
42       'lib/module.js',
43       'lib/net.js',
44       'lib/os.js',
45       'lib/path.js',
46       'lib/punycode.js',
47       'lib/querystring.js',
48       'lib/readline.js',
49       'lib/repl.js',
50       'lib/smalloc.js',
51       'lib/stream.js',
52       'lib/_stream_readable.js',
53       'lib/_stream_writable.js',
54       'lib/_stream_duplex.js',
55       'lib/_stream_transform.js',
56       'lib/_stream_passthrough.js',
57       'lib/string_decoder.js',
58       'lib/sys.js',
59       'lib/timers.js',
60       'lib/tls.js',
61       'lib/_tls_common.js',
62       'lib/_tls_legacy.js',
63       'lib/_tls_wrap.js',
64       'lib/tty.js',
65       'lib/url.js',
66       'lib/util.js',
67       'lib/vm.js',
68       'lib/zlib.js',
69       'deps/debugger-agent/lib/_debugger_agent.js',
70     ],
71   },
72
73   'targets': [
74     {
75       'target_name': 'node',
76       'type': 'executable',
77
78       'dependencies': [
79         'node_js2c#host',
80         'deps/debugger-agent/debugger-agent.gyp:debugger-agent',
81       ],
82
83       'include_dirs': [
84         'src',
85         'tools/msvs/genfiles',
86         'deps/uv/src/ares',
87         '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
88       ],
89
90       'sources': [
91         'src/fs_event_wrap.cc',
92         'src/cares_wrap.cc',
93         'src/handle_wrap.cc',
94         'src/node.cc',
95         'src/node_buffer.cc',
96         'src/node_constants.cc',
97         'src/node_contextify.cc',
98         'src/node_file.cc',
99         'src/node_http_parser.cc',
100         'src/node_javascript.cc',
101         'src/node_main.cc',
102         'src/node_os.cc',
103         'src/node_v8.cc',
104         'src/node_stat_watcher.cc',
105         'src/node_watchdog.cc',
106         'src/node_zlib.cc',
107         'src/node_i18n.cc',
108         'src/pipe_wrap.cc',
109         'src/signal_wrap.cc',
110         'src/smalloc.cc',
111         'src/spawn_sync.cc',
112         'src/string_bytes.cc',
113         'src/stream_wrap.cc',
114         'src/tcp_wrap.cc',
115         'src/timer_wrap.cc',
116         'src/tty_wrap.cc',
117         'src/process_wrap.cc',
118         'src/udp_wrap.cc',
119         'src/uv.cc',
120         # headers to make for a more pleasant IDE experience
121         'src/async-wrap.h',
122         'src/async-wrap-inl.h',
123         'src/base-object.h',
124         'src/base-object-inl.h',
125         'src/env.h',
126         'src/env-inl.h',
127         'src/handle_wrap.h',
128         'src/node.h',
129         'src/node_buffer.h',
130         'src/node_constants.h',
131         'src/node_file.h',
132         'src/node_http_parser.h',
133         'src/node_internals.h',
134         'src/node_javascript.h',
135         'src/node_root_certs.h',
136         'src/node_version.h',
137         'src/node_watchdog.h',
138         'src/node_wrap.h',
139         'src/node_i18n.h',
140         'src/pipe_wrap.h',
141         'src/queue.h',
142         'src/smalloc.h',
143         'src/tty_wrap.h',
144         'src/tcp_wrap.h',
145         'src/udp_wrap.h',
146         'src/req_wrap.h',
147         'src/string_bytes.h',
148         'src/stream_wrap.h',
149         'src/tree.h',
150         'src/util.h',
151         'src/util-inl.h',
152         'src/util.cc',
153         'deps/http_parser/http_parser.h',
154         '<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
155         # javascript files to make for an even more pleasant IDE experience
156         '<@(library_files)',
157         # node.gyp is added to the project by default.
158         'common.gypi',
159       ],
160
161       'defines': [
162         'NODE_WANT_INTERNALS=1',
163         'ARCH="<(target_arch)"',
164         'PLATFORM="<(OS)"',
165         'NODE_TAG="<(node_tag)"',
166         'NODE_V8_OPTIONS="<(node_v8_options)"',
167       ],
168
169       'conditions': [
170         [ 'v8_enable_i18n_support==1', {
171           'defines': [ 'NODE_HAVE_I18N_SUPPORT=1' ],
172           'dependencies': [
173             '<(icu_gyp_path):icui18n',
174             '<(icu_gyp_path):icuuc',
175           ],
176           'conditions': [
177             [ 'icu_small=="true"', {
178               'defines': [ 'NODE_HAVE_SMALL_ICU=1' ],
179           }]],
180         }],
181         [ 'node_use_openssl=="true"', {
182           'defines': [ 'HAVE_OPENSSL=1' ],
183           'sources': [
184             'src/node_crypto.cc',
185             'src/node_crypto_bio.cc',
186             'src/node_crypto_clienthello.cc',
187             'src/node_crypto.h',
188             'src/node_crypto_bio.h',
189             'src/node_crypto_clienthello.h',
190             'src/tls_wrap.cc',
191             'src/tls_wrap.h'
192           ],
193           'conditions': [
194             [ 'node_shared_openssl=="false"', {
195               'dependencies': [
196                 './deps/openssl/openssl.gyp:openssl',
197
198                 # For tests
199                 './deps/openssl/openssl.gyp:openssl-cli',
200               ],
201               # Do not let unused OpenSSL symbols to slip away
202               'xcode_settings': {
203                 'OTHER_LDFLAGS': [
204                   '-Wl,-force_load,<(PRODUCT_DIR)/libopenssl.a',
205                 ],
206               },
207               'conditions': [
208                 ['OS in "linux freebsd"', {
209                   'ldflags': [
210                     '-Wl,--whole-archive <(PRODUCT_DIR)/libopenssl.a -Wl,--no-whole-archive',
211                   ],
212                 }],
213               ],
214             }]]
215         }, {
216           'defines': [ 'HAVE_OPENSSL=0' ]
217         }],
218         [ 'node_use_dtrace=="true"', {
219           'defines': [ 'HAVE_DTRACE=1' ],
220           'dependencies': [
221             'node_dtrace_header',
222             'specialize_node_d',
223           ],
224           'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
225
226           #
227           # DTrace is supported on linux, solaris, mac, and bsd.  There are
228           # three object files associated with DTrace support, but they're
229           # not all used all the time:
230           #
231           #   node_dtrace.o           all configurations
232           #   node_dtrace_ustack.o    not supported on mac and linux
233           #   node_dtrace_provider.o  All except OS X.  "dtrace -G" is not
234           #                           used on OS X.
235           #
236           # Note that node_dtrace_provider.cc and node_dtrace_ustack.cc do not
237           # actually exist.  They're listed here to trick GYP into linking the
238           # corresponding object files into the final "node" executable.  These
239           # object files are generated by "dtrace -G" using custom actions
240           # below, and the GYP-generated Makefiles will properly build them when
241           # needed.
242           #
243           'sources': [ 'src/node_dtrace.cc' ],
244           'conditions': [
245             [ 'OS=="linux"', {
246               'sources': [
247                 '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o',
248                 '<(SHARED_INTERMEDIATE_DIR)/libuv_dtrace_provider.o',
249               ],
250             }],
251             [ 'OS!="mac" and OS!="linux"', {
252               'sources': [
253                 'src/node_dtrace_ustack.cc',
254                 'src/node_dtrace_provider.cc',
255               ]
256             }
257           ] ]
258         } ],
259         [ 'node_use_mdb=="true"', {
260           'dependencies': [ 'node_mdb' ],
261           'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
262           'sources': [
263             'src/node_mdb.cc',
264           ],
265         } ],
266         [ 'node_use_etw=="true"', {
267           'defines': [ 'HAVE_ETW=1' ],
268           'dependencies': [ 'node_etw' ],
269           'sources': [
270             'src/node_win32_etw_provider.h',
271             'src/node_win32_etw_provider-inl.h',
272             'src/node_win32_etw_provider.cc',
273             'src/node_dtrace.cc',
274             'tools/msvs/genfiles/node_etw_provider.h',
275             'tools/msvs/genfiles/node_etw_provider.rc',
276           ]
277         } ],
278         [ 'node_use_perfctr=="true"', {
279           'defines': [ 'HAVE_PERFCTR=1' ],
280           'dependencies': [ 'node_perfctr' ],
281           'sources': [
282             'src/node_win32_perfctr_provider.h',
283             'src/node_win32_perfctr_provider.cc',
284             'src/node_counters.cc',
285             'src/node_counters.h',
286             'tools/msvs/genfiles/node_perfctr_provider.rc',
287           ]
288         } ],
289         [ 'v8_postmortem_support=="true"', {
290           'dependencies': [ 'deps/v8/tools/gyp/v8.gyp:postmortem-metadata' ],
291           'xcode_settings': {
292             'OTHER_LDFLAGS': [
293               '-Wl,-force_load,<(V8_BASE)',
294             ],
295           },
296         }],
297         [ 'node_shared_v8=="false"', {
298           'sources': [
299             'deps/v8/include/v8.h',
300             'deps/v8/include/v8-debug.h',
301           ],
302           'dependencies': [ 'deps/v8/tools/gyp/v8.gyp:v8' ],
303         }],
304
305         [ 'node_shared_zlib=="false"', {
306           'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
307         }],
308
309         [ 'node_shared_http_parser=="false"', {
310           'dependencies': [ 'deps/http_parser/http_parser.gyp:http_parser' ],
311         }],
312
313         [ 'node_shared_cares=="false"', {
314           'dependencies': [ 'deps/cares/cares.gyp:cares' ],
315         }],
316
317         [ 'node_shared_libuv=="false"', {
318           'dependencies': [ 'deps/uv/uv.gyp:libuv' ],
319         }],
320
321         [ 'OS=="win"', {
322           'sources': [
323             'src/res/node.rc',
324           ],
325           'defines': [
326             'FD_SETSIZE=1024',
327             # we need to use node's preferred "win32" rather than gyp's preferred "win"
328             'PLATFORM="win32"',
329             '_UNICODE=1',
330           ],
331           'libraries': [ '-lpsapi.lib' ]
332         }, { # POSIX
333           'defines': [ '__POSIX__' ],
334         }],
335         [ 'OS=="mac"', {
336           # linking Corefoundation is needed since certain OSX debugging tools
337           # like Instruments require it for some features
338           'libraries': [ '-framework CoreFoundation' ],
339           'defines!': [
340             'PLATFORM="mac"',
341           ],
342           'defines': [
343             # we need to use node's preferred "darwin" rather than gyp's preferred "mac"
344             'PLATFORM="darwin"',
345           ],
346         }],
347         [ 'OS=="freebsd"', {
348           'libraries': [
349             '-lutil',
350             '-lkvm',
351           ],
352         }],
353         [ 'OS=="solaris"', {
354           'libraries': [
355             '-lkstat',
356             '-lumem',
357           ],
358           'defines!': [
359             'PLATFORM="solaris"',
360           ],
361           'defines': [
362             # we need to use node's preferred "sunos"
363             # rather than gyp's preferred "solaris"
364             'PLATFORM="sunos"',
365           ],
366         }],
367         [
368           'OS in "linux freebsd" and node_shared_v8=="false"', {
369             'ldflags': [
370               '-Wl,--whole-archive <(V8_BASE) -Wl,--no-whole-archive',
371             ],
372         }],
373       ],
374       'msvs_settings': {
375         'VCLinkerTool': {
376           'SubSystem': 1, # /subsystem:console
377         },
378         'VCManifestTool': {
379           'EmbedManifest': 'true',
380           'AdditionalManifestFiles': 'src/res/node.exe.extra.manifest'
381         }
382       },
383     },
384     # generate ETW header and resource files
385     {
386       'target_name': 'node_etw',
387       'type': 'none',
388       'conditions': [
389         [ 'node_use_etw=="true" and node_has_winsdk=="true"', {
390           'actions': [
391             {
392               'action_name': 'node_etw',
393               'inputs': [ 'src/res/node_etw_provider.man' ],
394               'outputs': [
395                 'tools/msvs/genfiles/node_etw_provider.rc',
396                 'tools/msvs/genfiles/node_etw_provider.h',
397                 'tools/msvs/genfiles/node_etw_providerTEMP.BIN',
398               ],
399               'action': [ 'mc <@(_inputs) -h tools/msvs/genfiles -r tools/msvs/genfiles' ]
400             }
401           ]
402         } ]
403       ]
404     },
405     # generate perf counter header and resource files
406     {
407       'target_name': 'node_perfctr',
408       'type': 'none',
409       'conditions': [
410         [ 'node_use_perfctr=="true" and node_has_winsdk=="true"', {
411           'actions': [
412             {
413               'action_name': 'node_perfctr_man',
414               'inputs': [ 'src/res/node_perfctr_provider.man' ],
415               'outputs': [
416                 'tools/msvs/genfiles/node_perfctr_provider.h',
417                 'tools/msvs/genfiles/node_perfctr_provider.rc',
418                 'tools/msvs/genfiles/MSG00001.BIN',
419               ],
420               'action': [ 'ctrpp <@(_inputs) '
421                           '-o tools/msvs/genfiles/node_perfctr_provider.h '
422                           '-rc tools/msvs/genfiles/node_perfctr_provider.rc'
423               ]
424             },
425           ],
426         } ]
427       ]
428     },
429     {
430       'target_name': 'node_js2c',
431       'type': 'none',
432       'toolsets': ['host'],
433       'actions': [
434         {
435           'action_name': 'node_js2c',
436           'inputs': [
437             '<@(library_files)',
438             './config.gypi',
439           ],
440           'outputs': [
441             '<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
442           ],
443           'conditions': [
444             [ 'node_use_dtrace=="false" and node_use_etw=="false"', {
445               'inputs': [ 'src/notrace_macros.py' ]
446             }],
447             [ 'node_use_perfctr=="false"', {
448               'inputs': [ 'src/perfctr_macros.py' ]
449             }]
450           ],
451           'action': [
452             '<(python)',
453             'tools/js2c.py',
454             '<@(_outputs)',
455             '<@(_inputs)',
456           ],
457         },
458       ],
459     }, # end node_js2c
460     {
461       'target_name': 'node_dtrace_header',
462       'type': 'none',
463       'conditions': [
464         [ 'node_use_dtrace=="true"', {
465           'actions': [
466             {
467               'action_name': 'node_dtrace_header',
468               'inputs': [ 'src/node_provider.d' ],
469               'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_provider.h' ],
470               'action': [ 'dtrace', '-h', '-xnolibs', '-s', '<@(_inputs)',
471                 '-o', '<@(_outputs)' ]
472             }
473           ]
474         } ]
475       ]
476     },
477     {
478       'target_name': 'node_mdb',
479       'type': 'none',
480       'conditions': [
481         [ 'node_use_mdb=="true"',
482           {
483             'dependencies': [ 'deps/mdb_v8/mdb_v8.gyp:mdb_v8' ],
484             'actions': [
485               {
486                 'action_name': 'node_mdb',
487                 'inputs': [ '<(PRODUCT_DIR)/obj.target/deps/mdb_v8/mdb_v8.so' ],
488                 'outputs': [ '<(PRODUCT_DIR)/obj.target/node/src/node_mdb.o' ],
489                 'conditions': [
490                   [ 'target_arch=="ia32"', {
491                     'action': [ 'elfwrap', '-o', '<@(_outputs)', '<@(_inputs)' ],
492                   } ],
493                   [ 'target_arch=="x64"', {
494                     'action': [ 'elfwrap', '-64', '-o', '<@(_outputs)', '<@(_inputs)' ],
495                   } ],
496                 ],
497               },
498             ],
499           },
500         ],
501       ],
502     },
503     {
504       'target_name': 'node_dtrace_provider',
505       'type': 'none',
506       'conditions': [
507         [ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', {
508           'actions': [
509             {
510               'action_name': 'node_dtrace_provider_o',
511               'inputs': [
512                 '<(OBJ_DIR)/libuv/deps/uv/src/unix/core.o',
513                 '<(OBJ_DIR)/node/src/node_dtrace.o',
514               ],
515               'outputs': [
516                 '<(OBJ_DIR)/node/src/node_dtrace_provider.o'
517               ],
518               'action': [ 'dtrace', '-G', '-xnolibs', '-s', 'src/node_provider.d',
519                 '-s', 'deps/uv/src/unix/uv-dtrace.d', '<@(_inputs)',
520                 '-o', '<@(_outputs)' ]
521             }
522           ]
523         }],
524         [ 'node_use_dtrace=="true" and OS=="linux"', {
525           'actions': [
526             {
527               'action_name': 'node_dtrace_provider_o',
528               'inputs': [ 'src/node_provider.d' ],
529               'outputs': [
530                 '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o'
531               ],
532               'action': [
533                 'dtrace', '-C', '-G', '-s', '<@(_inputs)', '-o', '<@(_outputs)'
534               ],
535             },
536             {
537               'action_name': 'libuv_dtrace_provider_o',
538               'inputs': [ 'deps/uv/src/unix/uv-dtrace.d' ],
539               'outputs': [
540                 '<(SHARED_INTERMEDIATE_DIR)/libuv_dtrace_provider.o'
541               ],
542               'action': [
543                 'dtrace', '-C', '-G', '-s', '<@(_inputs)', '-o', '<@(_outputs)'
544               ],
545             },
546           ],
547         }],
548       ]
549     },
550     {
551       'target_name': 'node_dtrace_ustack',
552       'type': 'none',
553       'conditions': [
554         [ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', {
555           'actions': [
556             {
557               'action_name': 'node_dtrace_ustack_constants',
558               'inputs': [
559                 '<(V8_BASE)'
560               ],
561               'outputs': [
562                 '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
563               ],
564               'action': [
565                 'tools/genv8constants.py',
566                 '<@(_outputs)',
567                 '<@(_inputs)'
568               ]
569             },
570             {
571               'action_name': 'node_dtrace_ustack',
572               'inputs': [
573                 'src/v8ustack.d',
574                 '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
575               ],
576               'outputs': [
577                 '<(OBJ_DIR)/node/src/node_dtrace_ustack.o'
578               ],
579               'conditions': [
580                 [ 'target_arch=="ia32"', {
581                   'action': [
582                     'dtrace', '-32', '-I<(SHARED_INTERMEDIATE_DIR)', '-Isrc',
583                     '-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)',
584                   ]
585                 } ],
586                 [ 'target_arch=="x64"', {
587                   'action': [
588                     'dtrace', '-64', '-I<(SHARED_INTERMEDIATE_DIR)', '-Isrc',
589                     '-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)',
590                   ]
591                 } ],
592               ]
593             },
594           ]
595         } ],
596       ]
597     },
598     {
599       'target_name': 'specialize_node_d',
600       'type': 'none',
601       'conditions': [
602         [ 'node_use_dtrace=="true"', {
603           'actions': [
604             {
605               'action_name': 'specialize_node_d',
606               'inputs': [
607                 'src/node.d'
608               ],
609               'outputs': [
610                 '<(PRODUCT_DIR)/node.d',
611               ],
612               'action': [
613                 'tools/specialize_node_d.py',
614                 '<@(_outputs)',
615                 '<@(_inputs)',
616                 '<@(OS)',
617                 '<@(target_arch)',
618               ],
619             },
620           ],
621         } ],
622       ]
623     }
624   ] # end targets
625 }