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