configure: remove shared cares build option
[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_libuv%': 'false',
12     'node_use_openssl%': 'true',
13     'node_shared_openssl%': 'false',
14     'node_use_mdb%': '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/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         'deps/cares/cares.gyp:cares'
81       ],
82
83       'include_dirs': [
84         'src',
85         'tools/msvs/genfiles',
86         'deps/uv/src/ares',
87         '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
88       ],
89
90       'sources': [
91         'src/debug-agent.cc',
92         'src/fs_event_wrap.cc',
93         'src/cares_wrap.cc',
94         'src/handle_wrap.cc',
95         'src/node.cc',
96         'src/node_buffer.cc',
97         'src/node_constants.cc',
98         'src/node_contextify.cc',
99         'src/node_file.cc',
100         'src/node_http_parser.cc',
101         'src/node_javascript.cc',
102         'src/node_main.cc',
103         'src/node_os.cc',
104         'src/node_v8.cc',
105         'src/node_v8_platform.cc',
106         'src/node_stat_watcher.cc',
107         'src/node_watchdog.cc',
108         'src/node_zlib.cc',
109         'src/node_i18n.cc',
110         'src/pipe_wrap.cc',
111         'src/signal_wrap.cc',
112         'src/smalloc.cc',
113         'src/spawn_sync.cc',
114         'src/string_bytes.cc',
115         'src/stream_wrap.cc',
116         'src/tcp_wrap.cc',
117         'src/timer_wrap.cc',
118         'src/tty_wrap.cc',
119         'src/process_wrap.cc',
120         'src/udp_wrap.cc',
121         'src/uv.cc',
122         # headers to make for a more pleasant IDE experience
123         'src/async-wrap.h',
124         'src/async-wrap-inl.h',
125         'src/base-object.h',
126         'src/base-object-inl.h',
127         'src/debug-agent.h',
128         'src/env.h',
129         'src/env-inl.h',
130         'src/handle_wrap.h',
131         'src/node.h',
132         'src/node_buffer.h',
133         'src/node_constants.h',
134         'src/node_file.h',
135         'src/node_http_parser.h',
136         'src/node_internals.h',
137         'src/node_javascript.h',
138         'src/node_root_certs.h',
139         'src/node_version.h',
140         'src/node_watchdog.h',
141         'src/node_wrap.h',
142         'src/node_i18n.h',
143         'src/pipe_wrap.h',
144         'src/queue.h',
145         'src/smalloc.h',
146         'src/tty_wrap.h',
147         'src/tcp_wrap.h',
148         'src/udp_wrap.h',
149         'src/req_wrap.h',
150         'src/string_bytes.h',
151         'src/stream_wrap.h',
152         'src/tree.h',
153         'src/util.h',
154         'src/util-inl.h',
155         'src/util.cc',
156         'deps/http_parser/http_parser.h',
157         '<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
158         # javascript files to make for an even more pleasant IDE experience
159         '<@(library_files)',
160         # node.gyp is added to the project by default.
161         'common.gypi',
162       ],
163
164       'defines': [
165         'NODE_WANT_INTERNALS=1',
166         'ARCH="<(target_arch)"',
167         'PLATFORM="<(OS)"',
168         'NODE_TAG="<(node_tag)"',
169         'NODE_V8_OPTIONS="<(node_v8_options)"',
170       ],
171
172       'conditions': [
173         [ 'v8_enable_i18n_support==1', {
174           'defines': [ 'NODE_HAVE_I18N_SUPPORT=1' ],
175           'dependencies': [
176             '<(icu_gyp_path):icui18n',
177             '<(icu_gyp_path):icuuc',
178           ],
179           'conditions': [
180             [ 'icu_small=="true"', {
181               'defines': [ 'NODE_HAVE_SMALL_ICU=1' ],
182           }]],
183         }],
184         [ 'node_use_openssl=="true"', {
185           'defines': [ 'HAVE_OPENSSL=1' ],
186           'sources': [
187             'src/node_crypto.cc',
188             'src/node_crypto_bio.cc',
189             'src/node_crypto_clienthello.cc',
190             'src/node_crypto.h',
191             'src/node_crypto_bio.h',
192             'src/node_crypto_clienthello.h',
193             'src/tls_wrap.cc',
194             'src/tls_wrap.h'
195           ],
196           'conditions': [
197             [ 'node_shared_openssl=="false"', {
198               'dependencies': [
199                 './deps/openssl/openssl.gyp:openssl',
200
201                 # For tests
202                 './deps/openssl/openssl.gyp:openssl-cli',
203               ],
204               # Do not let unused OpenSSL symbols to slip away
205               'xcode_settings': {
206                 'OTHER_LDFLAGS': [
207                   '-Wl,-force_load,<(PRODUCT_DIR)/libopenssl.a',
208                 ],
209               },
210               'conditions': [
211                 ['OS in "linux freebsd"', {
212                   'ldflags': [
213                     '-Wl,--whole-archive <(PRODUCT_DIR)/libopenssl.a -Wl,--no-whole-archive',
214                   ],
215                 }],
216               ],
217             }]]
218         }, {
219           'defines': [ 'HAVE_OPENSSL=0' ]
220         }],
221         [ 'node_use_dtrace=="true"', {
222           'defines': [ 'HAVE_DTRACE=1' ],
223           'dependencies': [
224             'node_dtrace_header',
225             'specialize_node_d',
226           ],
227           'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
228
229           #
230           # DTrace is supported on linux, solaris, mac, and bsd.  There are
231           # three object files associated with DTrace support, but they're
232           # not all used all the time:
233           #
234           #   node_dtrace.o           all configurations
235           #   node_dtrace_ustack.o    not supported on mac and linux
236           #   node_dtrace_provider.o  All except OS X.  "dtrace -G" is not
237           #                           used on OS X.
238           #
239           # Note that node_dtrace_provider.cc and node_dtrace_ustack.cc do not
240           # actually exist.  They're listed here to trick GYP into linking the
241           # corresponding object files into the final "node" executable.  These
242           # object files are generated by "dtrace -G" using custom actions
243           # below, and the GYP-generated Makefiles will properly build them when
244           # needed.
245           #
246           'sources': [ 'src/node_dtrace.cc' ],
247           'conditions': [
248             [ 'OS=="linux"', {
249               'sources': [
250                 '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o',
251                 '<(SHARED_INTERMEDIATE_DIR)/libuv_dtrace_provider.o',
252               ],
253             }],
254             [ 'OS!="mac" and OS!="linux"', {
255               'sources': [
256                 'src/node_dtrace_ustack.cc',
257                 'src/node_dtrace_provider.cc',
258               ]
259             }
260           ] ]
261         } ],
262         [ 'node_use_mdb=="true"', {
263           'dependencies': [ 'node_mdb' ],
264           'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
265           'sources': [
266             'src/node_mdb.cc',
267           ],
268         } ],
269         [ 'node_use_etw=="true"', {
270           'defines': [ 'HAVE_ETW=1' ],
271           'dependencies': [ 'node_etw' ],
272           'sources': [
273             'src/node_win32_etw_provider.h',
274             'src/node_win32_etw_provider-inl.h',
275             'src/node_win32_etw_provider.cc',
276             'src/node_dtrace.cc',
277             'tools/msvs/genfiles/node_etw_provider.h',
278             'tools/msvs/genfiles/node_etw_provider.rc',
279           ]
280         } ],
281         [ 'node_use_perfctr=="true"', {
282           'defines': [ 'HAVE_PERFCTR=1' ],
283           'dependencies': [ 'node_perfctr' ],
284           'sources': [
285             'src/node_win32_perfctr_provider.h',
286             'src/node_win32_perfctr_provider.cc',
287             'src/node_counters.cc',
288             'src/node_counters.h',
289             'tools/msvs/genfiles/node_perfctr_provider.rc',
290           ]
291         } ],
292         [ 'v8_postmortem_support=="true"', {
293           'dependencies': [ 'deps/v8/tools/gyp/v8.gyp:postmortem-metadata' ],
294           'xcode_settings': {
295             'OTHER_LDFLAGS': [
296               '-Wl,-force_load,<(V8_BASE)',
297             ],
298           },
299         }],
300         [ 'node_shared_v8=="false"', {
301           'sources': [
302             'deps/v8/include/v8.h',
303             'deps/v8/include/v8-debug.h',
304           ],
305           'dependencies': [ 'deps/v8/tools/gyp/v8.gyp:v8' ],
306         }],
307
308         [ 'node_shared_zlib=="false"', {
309           'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
310         }],
311
312         [ 'node_shared_http_parser=="false"', {
313           'dependencies': [ 'deps/http_parser/http_parser.gyp:http_parser' ],
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         [ 'OS=="freebsd" or OS=="linux"', {
367           'ldflags': [ '-Wl,-z,noexecstack' ],
368         }],
369         [ 'OS=="sunos"', {
370           'ldflags': [ '-Wl,-M,/usr/lib/ld/map.noexstk' ],
371         }],
372         [
373           'OS in "linux freebsd" and node_shared_v8=="false"', {
374             'ldflags': [
375               '-Wl,--whole-archive <(V8_BASE) -Wl,--no-whole-archive',
376             ],
377         }],
378       ],
379       'msvs_settings': {
380         'VCLinkerTool': {
381           'SubSystem': 1, # /subsystem:console
382         },
383         'VCManifestTool': {
384           'EmbedManifest': 'true',
385           'AdditionalManifestFiles': 'src/res/node.exe.extra.manifest'
386         }
387       },
388     },
389     # generate ETW header and resource files
390     {
391       'target_name': 'node_etw',
392       'type': 'none',
393       'conditions': [
394         [ 'node_use_etw=="true" and node_has_winsdk=="true"', {
395           'actions': [
396             {
397               'action_name': 'node_etw',
398               'inputs': [ 'src/res/node_etw_provider.man' ],
399               'outputs': [
400                 'tools/msvs/genfiles/node_etw_provider.rc',
401                 'tools/msvs/genfiles/node_etw_provider.h',
402                 'tools/msvs/genfiles/node_etw_providerTEMP.BIN',
403               ],
404               'action': [ 'mc <@(_inputs) -h tools/msvs/genfiles -r tools/msvs/genfiles' ]
405             }
406           ]
407         } ]
408       ]
409     },
410     # generate perf counter header and resource files
411     {
412       'target_name': 'node_perfctr',
413       'type': 'none',
414       'conditions': [
415         [ 'node_use_perfctr=="true" and node_has_winsdk=="true"', {
416           'actions': [
417             {
418               'action_name': 'node_perfctr_man',
419               'inputs': [ 'src/res/node_perfctr_provider.man' ],
420               'outputs': [
421                 'tools/msvs/genfiles/node_perfctr_provider.h',
422                 'tools/msvs/genfiles/node_perfctr_provider.rc',
423                 'tools/msvs/genfiles/MSG00001.BIN',
424               ],
425               'action': [ 'ctrpp <@(_inputs) '
426                           '-o tools/msvs/genfiles/node_perfctr_provider.h '
427                           '-rc tools/msvs/genfiles/node_perfctr_provider.rc'
428               ]
429             },
430           ],
431         } ]
432       ]
433     },
434     {
435       'target_name': 'node_js2c',
436       'type': 'none',
437       'toolsets': ['host'],
438       'actions': [
439         {
440           'action_name': 'node_js2c',
441           'inputs': [
442             '<@(library_files)',
443             './config.gypi',
444           ],
445           'outputs': [
446             '<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
447           ],
448           'conditions': [
449             [ 'node_use_dtrace=="false" and node_use_etw=="false"', {
450               'inputs': [ 'src/notrace_macros.py' ]
451             }],
452             [ 'node_use_perfctr=="false"', {
453               'inputs': [ 'src/perfctr_macros.py' ]
454             }]
455           ],
456           'action': [
457             '<(python)',
458             'tools/js2c.py',
459             '<@(_outputs)',
460             '<@(_inputs)',
461           ],
462         },
463       ],
464     }, # end node_js2c
465     {
466       'target_name': 'node_dtrace_header',
467       'type': 'none',
468       'conditions': [
469         [ 'node_use_dtrace=="true"', {
470           'actions': [
471             {
472               'action_name': 'node_dtrace_header',
473               'inputs': [ 'src/node_provider.d' ],
474               'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_provider.h' ],
475               'action': [ 'dtrace', '-h', '-xnolibs', '-s', '<@(_inputs)',
476                 '-o', '<@(_outputs)' ]
477             }
478           ]
479         } ]
480       ]
481     },
482     {
483       'target_name': 'node_mdb',
484       'type': 'none',
485       'conditions': [
486         [ 'node_use_mdb=="true"',
487           {
488             'dependencies': [ 'deps/mdb_v8/mdb_v8.gyp:mdb_v8' ],
489             'actions': [
490               {
491                 'action_name': 'node_mdb',
492                 'inputs': [ '<(PRODUCT_DIR)/obj.target/deps/mdb_v8/mdb_v8.so' ],
493                 'outputs': [ '<(PRODUCT_DIR)/obj.target/node/src/node_mdb.o' ],
494                 'conditions': [
495                   [ 'target_arch=="ia32"', {
496                     'action': [ 'elfwrap', '-o', '<@(_outputs)', '<@(_inputs)' ],
497                   } ],
498                   [ 'target_arch=="x64"', {
499                     'action': [ 'elfwrap', '-64', '-o', '<@(_outputs)', '<@(_inputs)' ],
500                   } ],
501                 ],
502               },
503             ],
504           },
505         ],
506       ],
507     },
508     {
509       'target_name': 'node_dtrace_provider',
510       'type': 'none',
511       'conditions': [
512         [ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', {
513           'actions': [
514             {
515               'action_name': 'node_dtrace_provider_o',
516               'inputs': [
517                 '<(OBJ_DIR)/libuv/deps/uv/src/unix/core.o',
518                 '<(OBJ_DIR)/node/src/node_dtrace.o',
519               ],
520               'outputs': [
521                 '<(OBJ_DIR)/node/src/node_dtrace_provider.o'
522               ],
523               'action': [ 'dtrace', '-G', '-xnolibs', '-s', 'src/node_provider.d',
524                 '-s', 'deps/uv/src/unix/uv-dtrace.d', '<@(_inputs)',
525                 '-o', '<@(_outputs)' ]
526             }
527           ]
528         }],
529         [ 'node_use_dtrace=="true" and OS=="linux"', {
530           'actions': [
531             {
532               'action_name': 'node_dtrace_provider_o',
533               'inputs': [ 'src/node_provider.d' ],
534               'outputs': [
535                 '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o'
536               ],
537               'action': [
538                 'dtrace', '-C', '-G', '-s', '<@(_inputs)', '-o', '<@(_outputs)'
539               ],
540             },
541             {
542               'action_name': 'libuv_dtrace_provider_o',
543               'inputs': [ 'deps/uv/src/unix/uv-dtrace.d' ],
544               'outputs': [
545                 '<(SHARED_INTERMEDIATE_DIR)/libuv_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)/node/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   ] # end targets
630 }