build: do not generate support for libuv's probes
[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/async-wrap.cc',
92         'src/fs_event_wrap.cc',
93         'src/cares_wrap.cc',
94         'src/handle_wrap.cc',
95         'src/node.cc',
96         'src/node_buffer.cc',
97         'src/node_constants.cc',
98         'src/node_contextify.cc',
99         'src/node_file.cc',
100         'src/node_http_parser.cc',
101         'src/node_javascript.cc',
102         'src/node_main.cc',
103         'src/node_os.cc',
104         'src/node_v8.cc',
105         'src/node_stat_watcher.cc',
106         'src/node_watchdog.cc',
107         'src/node_zlib.cc',
108         'src/node_i18n.cc',
109         'src/pipe_wrap.cc',
110         'src/signal_wrap.cc',
111         'src/smalloc.cc',
112         'src/spawn_sync.cc',
113         'src/string_bytes.cc',
114         'src/stream_wrap.cc',
115         'src/tcp_wrap.cc',
116         'src/timer_wrap.cc',
117         'src/tty_wrap.cc',
118         'src/process_wrap.cc',
119         'src/udp_wrap.cc',
120         'src/uv.cc',
121         # headers to make for a more pleasant IDE experience
122         'src/async-wrap.h',
123         'src/async-wrap-inl.h',
124         'src/base-object.h',
125         'src/base-object-inl.h',
126         'src/env.h',
127         'src/env-inl.h',
128         'src/handle_wrap.h',
129         'src/node.h',
130         'src/node_buffer.h',
131         'src/node_constants.h',
132         'src/node_file.h',
133         'src/node_http_parser.h',
134         'src/node_internals.h',
135         'src/node_javascript.h',
136         'src/node_root_certs.h',
137         'src/node_version.h',
138         'src/node_watchdog.h',
139         'src/node_wrap.h',
140         'src/node_i18n.h',
141         'src/pipe_wrap.h',
142         'src/queue.h',
143         'src/smalloc.h',
144         'src/tty_wrap.h',
145         'src/tcp_wrap.h',
146         'src/udp_wrap.h',
147         'src/req_wrap.h',
148         'src/string_bytes.h',
149         'src/stream_wrap.h',
150         'src/tree.h',
151         'src/util.h',
152         'src/util-inl.h',
153         'src/util.cc',
154         'deps/http_parser/http_parser.h',
155         '<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
156         # javascript files to make for an even more pleasant IDE experience
157         '<@(library_files)',
158         # node.gyp is added to the project by default.
159         'common.gypi',
160       ],
161
162       'defines': [
163         'NODE_WANT_INTERNALS=1',
164         'ARCH="<(target_arch)"',
165         'PLATFORM="<(OS)"',
166         'NODE_TAG="<(node_tag)"',
167         'NODE_V8_OPTIONS="<(node_v8_options)"',
168       ],
169
170       'conditions': [
171         [ 'v8_enable_i18n_support==1', {
172           'defines': [ 'NODE_HAVE_I18N_SUPPORT=1' ],
173           'dependencies': [
174             '<(icu_gyp_path):icui18n',
175             '<(icu_gyp_path):icuuc',
176           ],
177           'conditions': [
178             [ 'icu_small=="true"', {
179               'defines': [ 'NODE_HAVE_SMALL_ICU=1' ],
180           }]],
181         }],
182         [ 'node_use_openssl=="true"', {
183           'defines': [ 'HAVE_OPENSSL=1' ],
184           'sources': [
185             'src/node_crypto.cc',
186             'src/node_crypto_bio.cc',
187             'src/node_crypto_clienthello.cc',
188             'src/node_crypto.h',
189             'src/node_crypto_bio.h',
190             'src/node_crypto_clienthello.h',
191             'src/tls_wrap.cc',
192             'src/tls_wrap.h'
193           ],
194           'conditions': [
195             [ 'node_shared_openssl=="false"', {
196               'dependencies': [
197                 './deps/openssl/openssl.gyp:openssl',
198
199                 # For tests
200                 './deps/openssl/openssl.gyp:openssl-cli',
201               ],
202               # Do not let unused OpenSSL symbols to slip away
203               'xcode_settings': {
204                 'OTHER_LDFLAGS': [
205                   '-Wl,-force_load,<(PRODUCT_DIR)/libopenssl.a',
206                 ],
207               },
208               'conditions': [
209                 ['OS in "linux freebsd"', {
210                   'ldflags': [
211                     '-Wl,--whole-archive <(PRODUCT_DIR)/libopenssl.a -Wl,--no-whole-archive',
212                   ],
213                 }],
214               ],
215             }]]
216         }, {
217           'defines': [ 'HAVE_OPENSSL=0' ]
218         }],
219         [ 'node_use_dtrace=="true"', {
220           'defines': [ 'HAVE_DTRACE=1' ],
221           'dependencies': [
222             'node_dtrace_header',
223             'specialize_node_d',
224           ],
225           'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
226
227           #
228           # DTrace is supported on linux, solaris, mac, and bsd.  There are
229           # three object files associated with DTrace support, but they're
230           # not all used all the time:
231           #
232           #   node_dtrace.o           all configurations
233           #   node_dtrace_ustack.o    not supported on mac and linux
234           #   node_dtrace_provider.o  All except OS X.  "dtrace -G" is not
235           #                           used on OS X.
236           #
237           # Note that node_dtrace_provider.cc and node_dtrace_ustack.cc do not
238           # actually exist.  They're listed here to trick GYP into linking the
239           # corresponding object files into the final "node" executable.  These
240           # object files are generated by "dtrace -G" using custom actions
241           # below, and the GYP-generated Makefiles will properly build them when
242           # needed.
243           #
244           'sources': [ 'src/node_dtrace.cc' ],
245           'conditions': [
246             [ 'OS=="linux"', {
247               'sources': [
248                 '<(SHARED_INTERMEDIATE_DIR)/node_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)/node/src/node_dtrace.o',
513               ],
514               'outputs': [
515                 '<(OBJ_DIR)/node/src/node_dtrace_provider.o'
516               ],
517               'action': [ 'dtrace', '-G', '-xnolibs', '-s', 'src/node_provider.d',
518                 '<@(_inputs)', '-o', '<@(_outputs)' ]
519             }
520           ]
521         }],
522         [ 'node_use_dtrace=="true" and OS=="linux"', {
523           'actions': [
524             {
525               'action_name': 'node_dtrace_provider_o',
526               'inputs': [ 'src/node_provider.d' ],
527               'outputs': [
528                 '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o'
529               ],
530               'action': [
531                 'dtrace', '-C', '-G', '-s', '<@(_inputs)', '-o', '<@(_outputs)'
532               ],
533             }
534           ],
535         }],
536       ]
537     },
538     {
539       'target_name': 'node_dtrace_ustack',
540       'type': 'none',
541       'conditions': [
542         [ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', {
543           'actions': [
544             {
545               'action_name': 'node_dtrace_ustack_constants',
546               'inputs': [
547                 '<(V8_BASE)'
548               ],
549               'outputs': [
550                 '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
551               ],
552               'action': [
553                 'tools/genv8constants.py',
554                 '<@(_outputs)',
555                 '<@(_inputs)'
556               ]
557             },
558             {
559               'action_name': 'node_dtrace_ustack',
560               'inputs': [
561                 'src/v8ustack.d',
562                 '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
563               ],
564               'outputs': [
565                 '<(OBJ_DIR)/node/src/node_dtrace_ustack.o'
566               ],
567               'conditions': [
568                 [ 'target_arch=="ia32"', {
569                   'action': [
570                     'dtrace', '-32', '-I<(SHARED_INTERMEDIATE_DIR)', '-Isrc',
571                     '-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)',
572                   ]
573                 } ],
574                 [ 'target_arch=="x64"', {
575                   'action': [
576                     'dtrace', '-64', '-I<(SHARED_INTERMEDIATE_DIR)', '-Isrc',
577                     '-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)',
578                   ]
579                 } ],
580               ]
581             },
582           ]
583         } ],
584       ]
585     },
586     {
587       'target_name': 'specialize_node_d',
588       'type': 'none',
589       'conditions': [
590         [ 'node_use_dtrace=="true"', {
591           'actions': [
592             {
593               'action_name': 'specialize_node_d',
594               'inputs': [
595                 'src/node.d'
596               ],
597               'outputs': [
598                 '<(PRODUCT_DIR)/node.d',
599               ],
600               'action': [
601                 'tools/specialize_node_d.py',
602                 '<@(_outputs)',
603                 '<@(_inputs)',
604                 '<@(OS)',
605                 '<@(target_arch)',
606               ],
607             },
608           ],
609         } ],
610       ]
611     }
612   ] # end targets
613 }