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