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