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