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