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