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