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