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