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