test: fix test-tls-server-verify
[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_cares%': 'false',
12     'node_shared_libuv%': 'false',
13     'node_use_openssl%': 'true',
14     'node_use_systemtap%': 'false',
15     'node_shared_openssl%': 'false',
16     'library_files': [
17       'src/node.js',
18       'lib/_debugger.js',
19       'lib/_linklist.js',
20       'lib/assert.js',
21       'lib/buffer.js',
22       'lib/child_process.js',
23       'lib/console.js',
24       'lib/constants.js',
25       'lib/crypto.js',
26       'lib/cluster.js',
27       'lib/dgram.js',
28       'lib/dns.js',
29       'lib/domain.js',
30       'lib/events.js',
31       'lib/freelist.js',
32       'lib/fs.js',
33       'lib/http.js',
34       'lib/https.js',
35       'lib/module.js',
36       'lib/net.js',
37       'lib/os.js',
38       'lib/path.js',
39       'lib/punycode.js',
40       'lib/querystring.js',
41       'lib/readline.js',
42       'lib/repl.js',
43       'lib/stream.js',
44       'lib/_stream_readable.js',
45       'lib/_stream_writable.js',
46       'lib/_stream_duplex.js',
47       'lib/_stream_transform.js',
48       'lib/_stream_passthrough.js',
49       'lib/string_decoder.js',
50       'lib/sys.js',
51       'lib/timers.js',
52       'lib/tls.js',
53       'lib/tty.js',
54       'lib/url.js',
55       'lib/util.js',
56       'lib/vm.js',
57       'lib/zlib.js',
58     ],
59   },
60
61   'targets': [
62     {
63       'target_name': 'node',
64       'type': 'executable',
65
66       'dependencies': [
67         'node_js2c#host',
68       ],
69
70       'include_dirs': [
71         'src',
72         'tools/msvs/genfiles',
73         'deps/uv/src/ares',
74         '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
75       ],
76
77       'sources': [
78         'src/fs_event_wrap.cc',
79         'src/cares_wrap.cc',
80         'src/handle_wrap.cc',
81         'src/node.cc',
82         'src/node_buffer.cc',
83         'src/node_constants.cc',
84         'src/node_extensions.cc',
85         'src/node_file.cc',
86         'src/node_http_parser.cc',
87         'src/node_javascript.cc',
88         'src/node_main.cc',
89         'src/node_os.cc',
90         'src/node_script.cc',
91         'src/node_stat_watcher.cc',
92         'src/node_string.cc',
93         'src/node_zlib.cc',
94         'src/pipe_wrap.cc',
95         'src/signal_wrap.cc',
96         'src/string_bytes.cc',
97         'src/stream_wrap.cc',
98         'src/slab_allocator.cc',
99         'src/tcp_wrap.cc',
100         'src/timer_wrap.cc',
101         'src/tty_wrap.cc',
102         'src/process_wrap.cc',
103         'src/v8_typed_array.cc',
104         'src/udp_wrap.cc',
105         # headers to make for a more pleasant IDE experience
106         'src/handle_wrap.h',
107         'src/node.h',
108         'src/node_buffer.h',
109         'src/node_constants.h',
110         'src/node_crypto.h',
111         'src/node_extensions.h',
112         'src/node_file.h',
113         'src/node_http_parser.h',
114         'src/node_javascript.h',
115         'src/node_os.h',
116         'src/node_root_certs.h',
117         'src/node_script.h',
118         'src/node_string.h',
119         'src/node_version.h',
120         'src/ngx-queue.h',
121         'src/pipe_wrap.h',
122         'src/tty_wrap.h',
123         'src/tcp_wrap.h',
124         'src/udp_wrap.h',
125         'src/req_wrap.h',
126         'src/slab_allocator.h',
127         'src/string_bytes.h',
128         'src/stream_wrap.h',
129         'src/tree.h',
130         'src/v8_typed_array.h',
131         'deps/http_parser/http_parser.h',
132         '<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
133         # javascript files to make for an even more pleasant IDE experience
134         '<@(library_files)',
135         # node.gyp is added to the project by default.
136         'common.gypi',
137       ],
138
139       'defines': [
140         'NODE_WANT_INTERNALS=1',
141         'ARCH="<(target_arch)"',
142         'PLATFORM="<(OS)"',
143         'NODE_TAG="<(node_tag)"',
144       ],
145
146       'conditions': [
147         [ 'node_use_openssl=="true"', {
148           'defines': [ 'HAVE_OPENSSL=1' ],
149           'sources': [ 'src/node_crypto.cc' ],
150           'conditions': [
151             [ 'node_shared_openssl=="false"', {
152               'dependencies': [
153                 './deps/openssl/openssl.gyp:openssl',
154
155                 # For tests
156                 './deps/openssl/openssl.gyp:openssl-cli',
157               ],
158             }]]
159         }, {
160           'defines': [ 'HAVE_OPENSSL=0' ]
161         }],
162         [ 'node_use_dtrace=="true"', {
163           'defines': [ 'HAVE_DTRACE=1' ],
164           'dependencies': [
165             'node_dtrace_header',
166             'specialize_node_d',
167           ],
168           'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
169
170           #
171           # DTrace is supported on solaris, mac, and bsd.  There are three
172           # object files associated with DTrace support, but they're not all
173           # used all the time:
174           #
175           #   node_dtrace.o           all configurations
176           #   node_dtrace_ustack.o    not supported on OS X
177           #   node_dtrace_provider.o  All except OS X.  "dtrace -G" is not
178           #                           used on OS X.
179           #
180           # Note that node_dtrace_provider.cc and node_dtrace_ustack.cc do not
181           # actually exist.  They're listed here to trick GYP into linking the
182           # corresponding object files into the final "node" executable.  These
183           # object files are generated by "dtrace -G" using custom actions
184           # below, and the GYP-generated Makefiles will properly build them when
185           # needed.
186           #
187           'sources': [
188             'src/node_dtrace.cc',
189           ],
190           'conditions': [ [
191             'OS!="mac"', {
192               'sources': [
193                 'src/node_dtrace_ustack.cc',
194                 'src/node_dtrace_provider.cc',
195               ]
196             }
197           ] ]
198         } ],
199         [ 'node_use_systemtap=="true"', {
200           'defines': [ 'HAVE_SYSTEMTAP=1', 'STAP_SDT_V1=1' ],
201           'dependencies': [ 'node_systemtap_header' ],
202           'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
203           'sources': [
204             'src/node_dtrace.cc',
205             '<(SHARED_INTERMEDIATE_DIR)/node_systemtap.h',
206           ],
207         } ],
208         [ 'node_use_etw=="true"', {
209           'defines': [ 'HAVE_ETW=1' ],
210           'dependencies': [ 'node_etw' ],
211           'sources': [
212             'src/node_win32_etw_provider.h',
213             'src/node_win32_etw_provider-inl.h',
214             'src/node_win32_etw_provider.cc',
215             'src/node_dtrace.cc',
216             'tools/msvs/genfiles/node_etw_provider.h',
217             'tools/msvs/genfiles/node_etw_provider.rc',
218           ]
219         } ],
220         [ 'node_use_perfctr=="true"', {
221           'defines': [ 'HAVE_PERFCTR=1' ],
222           'dependencies': [ 'node_perfctr' ],
223           'sources': [
224             'src/node_win32_perfctr_provider.h',
225             'src/node_win32_perfctr_provider.cc',
226             'src/node_counters.cc',
227             'src/node_counters.h',
228             'tools/msvs/genfiles/node_perfctr_provider.rc',
229           ]
230         } ],
231         [ 'node_shared_v8=="false"', {
232           'sources': [
233             'deps/v8/include/v8.h',
234             'deps/v8/include/v8-debug.h',
235           ],
236           'dependencies': [ 'deps/v8/tools/gyp/v8.gyp:v8' ],
237         }],
238
239         [ 'node_shared_zlib=="false"', {
240           'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
241         }],
242
243         [ 'node_shared_http_parser=="false"', {
244           'dependencies': [ 'deps/http_parser/http_parser.gyp:http_parser' ],
245         }],
246
247         [ 'node_shared_cares=="false"', {
248           'dependencies': [ 'deps/cares/cares.gyp:cares' ],
249         }],
250
251         [ 'node_shared_libuv=="false"', {
252           'dependencies': [ 'deps/uv/uv.gyp:libuv' ],
253         }],
254
255         [ 'OS=="win"', {
256           'sources': [
257             'src/res/node.rc',
258           ],
259           'defines': [
260             'FD_SETSIZE=1024',
261             # we need to use node's preferred "win32" rather than gyp's preferred "win"
262             'PLATFORM="win32"',
263             '_UNICODE=1',
264           ],
265           'libraries': [ '-lpsapi.lib' ]
266         }, { # POSIX
267           'defines': [ '__POSIX__' ],
268         }],
269         [ 'OS=="mac"', {
270           'libraries': [ '-framework Carbon' ],
271           'defines!': [
272             'PLATFORM="mac"',
273           ],
274           'defines': [
275             # we need to use node's preferred "darwin" rather than gyp's preferred "mac"
276             'PLATFORM="darwin"',
277           ],
278         }],
279         [ 'OS=="mac" and v8_postmortem_support=="true"', {
280           # Do not let `v8dbg_` symbols slip away
281           'xcode_settings': {
282             'OTHER_LDFLAGS': [
283               '-Wl,-force_load,<(V8_BASE)',
284             ],
285           },
286         }],
287         [ 'OS=="freebsd"', {
288           'libraries': [
289             '-lutil',
290             '-lkvm',
291           ],
292         }],
293         [ 'OS=="solaris"', {
294           'libraries': [
295             '-lkstat',
296             '-lumem',
297           ],
298           'defines!': [
299             'PLATFORM="solaris"',
300           ],
301           'defines': [
302             # we need to use node's preferred "sunos"
303             # rather than gyp's preferred "solaris"
304             'PLATFORM="sunos"',
305           ],
306         }],
307         [
308           'OS=="linux" and node_shared_v8=="false"', {
309             'ldflags': [
310               '-Wl,--whole-archive <(V8_BASE) -Wl,--no-whole-archive',
311             ],
312         }],
313       ],
314       'msvs_settings': {
315         'VCLinkerTool': {
316           'SubSystem': 1, # /subsystem:console
317         },
318       },
319     },
320     # generate ETW header and resource files
321     {
322       'target_name': 'node_etw',
323       'type': 'none',
324       'conditions': [
325         [ 'node_use_etw=="true" and node_has_winsdk=="true"', {
326           'actions': [
327             {
328               'action_name': 'node_etw',
329               'inputs': [ 'src/res/node_etw_provider.man' ],
330               'outputs': [
331                 'tools/msvs/genfiles/node_etw_provider.rc',
332                 'tools/msvs/genfiles/node_etw_provider.h',
333                 'tools/msvs/genfiles/node_etw_providerTEMP.BIN',
334               ],
335               'action': [ 'mc <@(_inputs) -h tools/msvs/genfiles -r tools/msvs/genfiles' ]
336             }
337           ]
338         } ]
339       ]
340     },
341     # generate perf counter header and resource files
342     {
343       'target_name': 'node_perfctr',
344       'type': 'none',
345       'conditions': [
346         [ 'node_use_perfctr=="true" and node_has_winsdk=="true"', {
347           'actions': [
348             {
349               'action_name': 'node_perfctr_man',
350               'inputs': [ 'src/res/node_perfctr_provider.man' ],
351               'outputs': [
352                 'tools/msvs/genfiles/node_perfctr_provider.h',
353                 'tools/msvs/genfiles/node_perfctr_provider.rc',
354                 'tools/msvs/genfiles/MSG00001.BIN',
355               ],
356               'action': [ 'ctrpp <@(_inputs) '
357                           '-o tools/msvs/genfiles/node_perfctr_provider.h '
358                           '-rc tools/msvs/genfiles/node_perfctr_provider.rc'
359               ]
360             },
361           ],
362         } ]
363       ]
364     },
365     {
366       'target_name': 'node_js2c',
367       'type': 'none',
368       'toolsets': ['host'],
369       'actions': [
370         {
371           'action_name': 'node_js2c',
372           'inputs': [
373             '<@(library_files)',
374             './config.gypi',
375           ],
376           'outputs': [
377             '<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
378           ],
379           'conditions': [
380             [ 'node_use_dtrace=="false"'
381               ' and node_use_etw=="false"'
382               ' and node_use_systemtap=="false"',
383             {
384                 'inputs': ['src/macros.py']
385               }
386               ],
387             [ 'node_use_perfctr=="false"', {
388               'inputs': [ 'src/perfctr_macros.py' ]
389             }]
390           ],
391               'action': [
392                 '<(python)',
393                 'tools/js2c.py',
394                 '<@(_outputs)',
395                 '<@(_inputs)',
396               ],
397         },
398       ],
399     }, # end node_js2c
400     {
401       'target_name': 'node_dtrace_header',
402       'type': 'none',
403       'conditions': [
404         [ 'node_use_dtrace=="true"', {
405           'actions': [
406             {
407               'action_name': 'node_dtrace_header',
408               'inputs': [ 'src/node_provider.d' ],
409               'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_provider.h' ],
410               'action': [ 'dtrace', '-h', '-xnolibs', '-s', '<@(_inputs)',
411                 '-o', '<@(_outputs)' ]
412             }
413           ]
414         } ]
415       ]
416     },
417     {
418       'target_name': 'node_systemtap_header',
419       'type': 'none',
420       'conditions': [
421         [ 'node_use_systemtap=="true"', {
422           'actions': [
423             {
424               'action_name': 'node_systemtap_header',
425               'inputs': [ 'src/node_systemtap.d' ],
426               'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_systemtap.h' ],
427               'action': [ 'dtrace', '-h', '-C', '-s', '<@(_inputs)',
428                 '-o', '<@(_outputs)' ]
429             }
430           ]
431         } ]
432       ]
433     },
434     {
435       'target_name': 'node_dtrace_provider',
436       'type': 'none',
437       'conditions': [
438         [ 'node_use_dtrace=="true" and OS!="mac"', {
439           'actions': [
440             {
441               'action_name': 'node_dtrace_provider_o',
442               'inputs': [
443                 'src/node_provider.d',
444                 '<(OBJ_DIR)/node/src/node_dtrace.o'
445               ],
446               'outputs': [
447                 '<(OBJ_DIR)/node/src/node_dtrace_provider.o'
448               ],
449               'action': [ 'dtrace', '-G', '-xnolibs', '-s', '<@(_inputs)',
450                 '-o', '<@(_outputs)' ]
451             }
452           ]
453         } ]
454       ]
455     },
456     {
457       'target_name': 'node_dtrace_ustack',
458       'type': 'none',
459       'conditions': [
460         [ 'node_use_dtrace=="true" and OS!="mac"', {
461           'actions': [
462             {
463               'action_name': 'node_dtrace_ustack_constants',
464               'inputs': [
465                 '<(V8_BASE)'
466               ],
467               'outputs': [
468                 '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
469               ],
470               'action': [
471                 'tools/genv8constants.py',
472                 '<@(_outputs)',
473                 '<@(_inputs)'
474               ]
475             },
476             {
477               'action_name': 'node_dtrace_ustack',
478               'inputs': [
479                 'src/v8ustack.d',
480                 '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
481               ],
482               'outputs': [
483                 '<(OBJ_DIR)/node/src/node_dtrace_ustack.o'
484               ],
485               'conditions': [
486                 [ 'target_arch=="ia32"', {
487                   'action': [
488                     'dtrace', '-32', '-I<(SHARED_INTERMEDIATE_DIR)', '-Isrc',
489                     '-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)',
490                   ]
491                 } ],
492                 [ 'target_arch=="x64"', {
493                   'action': [
494                     'dtrace', '-64', '-I<(SHARED_INTERMEDIATE_DIR)', '-Isrc',
495                     '-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)',
496                   ]
497                 } ],
498               ]
499             },
500           ]
501         } ],
502       ]
503     },
504     {
505       'target_name': 'specialize_node_d',
506       'type': 'none',
507       'conditions': [
508         [ 'node_use_dtrace=="true"', {
509           'actions': [
510             {
511               'action_name': 'specialize_node_d',
512               'inputs': [
513                 'src/node.d'
514               ],
515               'outputs': [
516                 '<(PRODUCT_DIR)/node.d',
517               ],
518               'action': [
519                 'tools/specialize_node_d.py',
520                 '<@(_outputs)',
521                 '<@(_inputs)',
522                 '<@(OS)',
523                 '<@(target_arch)',
524               ],
525             },
526           ],
527         } ],
528       ]
529     }
530   ] # end targets
531 }