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