gyp: do not let `v8dbg_` slip away on osx
[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': [ './deps/openssl/openssl.gyp:openssl' ],
153             }]]
154         }, {
155           'defines': [ 'HAVE_OPENSSL=0' ]
156         }],
157         [ 'node_use_dtrace=="true"', {
158           'defines': [ 'HAVE_DTRACE=1' ],
159           'dependencies': [
160             'node_dtrace_header',
161             'specialize_node_d',
162           ],
163           'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
164
165           #
166           # DTrace is supported on solaris, mac, and bsd.  There are three
167           # object files associated with DTrace support, but they're not all
168           # used all the time:
169           #
170           #   node_dtrace.o           all configurations
171           #   node_dtrace_ustack.o    not supported on OS X
172           #   node_dtrace_provider.o  All except OS X.  "dtrace -G" is not
173           #                           used on OS X.
174           #
175           # Note that node_dtrace_provider.cc and node_dtrace_ustack.cc do not
176           # actually exist.  They're listed here to trick GYP into linking the
177           # corresponding object files into the final "node" executable.  These
178           # object files are generated by "dtrace -G" using custom actions
179           # below, and the GYP-generated Makefiles will properly build them when
180           # needed.
181           #
182           'sources': [
183             'src/node_dtrace.cc',
184           ],
185           'conditions': [ [
186             'OS!="mac"', {
187               'sources': [
188                 'src/node_dtrace_ustack.cc',
189                 'src/node_dtrace_provider.cc',
190               ]
191             }
192           ] ]
193         } ],
194         [ 'node_use_systemtap=="true"', {
195           'defines': [ 'HAVE_SYSTEMTAP=1', 'STAP_SDT_V1=1' ],
196           'dependencies': [ 'node_systemtap_header' ],
197           'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
198           'sources': [
199             'src/node_dtrace.cc',
200             '<(SHARED_INTERMEDIATE_DIR)/node_systemtap.h',
201           ],
202         } ],
203         [ 'node_use_etw=="true"', {
204           'defines': [ 'HAVE_ETW=1' ],
205           'dependencies': [ 'node_etw' ],
206           'sources': [
207             'src/node_win32_etw_provider.h',
208             'src/node_win32_etw_provider-inl.h',
209             'src/node_win32_etw_provider.cc',
210             'src/node_dtrace.cc',
211             'tools/msvs/genfiles/node_etw_provider.h',
212             'tools/msvs/genfiles/node_etw_provider.rc',
213           ]
214         } ],
215         [ 'node_use_perfctr=="true"', {
216           'defines': [ 'HAVE_PERFCTR=1' ],
217           'dependencies': [ 'node_perfctr' ],
218           'sources': [
219             'src/node_win32_perfctr_provider.h',
220             'src/node_win32_perfctr_provider.cc',
221             'src/node_counters.cc',
222             'src/node_counters.h',
223             'tools/msvs/genfiles/node_perfctr_provider.rc',
224           ]
225         } ],
226         [ 'node_shared_v8=="false"', {
227           'sources': [
228             'deps/v8/include/v8.h',
229             'deps/v8/include/v8-debug.h',
230           ],
231           'dependencies': [ 'deps/v8/tools/gyp/v8.gyp:v8' ],
232         }],
233
234         [ 'node_shared_zlib=="false"', {
235           'dependencies': [ 'deps/zlib/zlib.gyp:zlib' ],
236         }],
237
238         [ 'node_shared_http_parser=="false"', {
239           'dependencies': [ 'deps/http_parser/http_parser.gyp:http_parser' ],
240         }],
241
242         [ 'node_shared_cares=="false"', {
243           'dependencies': [ 'deps/cares/cares.gyp:cares' ],
244         }],
245
246         [ 'node_shared_libuv=="false"', {
247           'dependencies': [ 'deps/uv/uv.gyp:libuv' ],
248         }],
249
250         [ 'OS=="win"', {
251           'sources': [
252             'src/res/node.rc',
253           ],
254           'defines': [
255             'FD_SETSIZE=1024',
256             # we need to use node's preferred "win32" rather than gyp's preferred "win"
257             'PLATFORM="win32"',
258             '_UNICODE=1',
259           ],
260           'libraries': [ '-lpsapi.lib' ]
261         }, { # POSIX
262           'defines': [ '__POSIX__' ],
263         }],
264         [ 'OS=="mac"', {
265           'libraries': [ '-framework Carbon' ],
266           'defines!': [
267             'PLATFORM="mac"',
268           ],
269           'defines': [
270             # we need to use node's preferred "darwin" rather than gyp's preferred "mac"
271             'PLATFORM="darwin"',
272           ],
273         }],
274         [ 'OS=="mac" and v8_postmortem_support=="true"', {
275           # Do not let `v8dbg_` symbols slip away
276           'xcode_settings': {
277             'OTHER_LDFLAGS': [
278               '-Wl,-force_load,<(V8_BASE)',
279             ],
280           },
281         }],
282         [ 'OS=="freebsd"', {
283           'libraries': [
284             '-lutil',
285             '-lkvm',
286           ],
287         }],
288         [ 'OS=="solaris"', {
289           'libraries': [
290             '-lkstat',
291             '-lumem',
292           ],
293           'defines!': [
294             'PLATFORM="solaris"',
295           ],
296           'defines': [
297             # we need to use node's preferred "sunos"
298             # rather than gyp's preferred "solaris"
299             'PLATFORM="sunos"',
300           ],
301         }],
302         [
303           'OS=="linux" and node_shared_v8=="false"', {
304             'ldflags': [
305               '-Wl,--whole-archive <(V8_BASE) -Wl,--no-whole-archive',
306             ],
307         }],
308       ],
309       'msvs_settings': {
310         'VCLinkerTool': {
311           'SubSystem': 1, # /subsystem:console
312         },
313       },
314     },
315     # generate ETW header and resource files
316     {
317       'target_name': 'node_etw',
318       'type': 'none',
319       'conditions': [
320         [ 'node_use_etw=="true" and node_has_winsdk=="true"', {
321           'actions': [
322             {
323               'action_name': 'node_etw',
324               'inputs': [ 'src/res/node_etw_provider.man' ],
325               'outputs': [
326                 'tools/msvs/genfiles/node_etw_provider.rc',
327                 'tools/msvs/genfiles/node_etw_provider.h',
328                 'tools/msvs/genfiles/node_etw_providerTEMP.BIN',
329               ],
330               'action': [ 'mc <@(_inputs) -h tools/msvs/genfiles -r tools/msvs/genfiles' ]
331             }
332           ]
333         } ]
334       ]
335     },
336     # generate perf counter header and resource files
337     {
338       'target_name': 'node_perfctr',
339       'type': 'none',
340       'conditions': [
341         [ 'node_use_perfctr=="true" and node_has_winsdk=="true"', {
342           'actions': [
343             {
344               'action_name': 'node_perfctr_man',
345               'inputs': [ 'src/res/node_perfctr_provider.man' ],
346               'outputs': [
347                 'tools/msvs/genfiles/node_perfctr_provider.h',
348                 'tools/msvs/genfiles/node_perfctr_provider.rc',
349                 'tools/msvs/genfiles/MSG00001.BIN',
350               ],
351               'action': [ 'ctrpp <@(_inputs) '
352                           '-o tools/msvs/genfiles/node_perfctr_provider.h '
353                           '-rc tools/msvs/genfiles/node_perfctr_provider.rc'
354               ]
355             },
356           ],
357         } ]
358       ]
359     },
360     {
361       'target_name': 'node_js2c',
362       'type': 'none',
363       'toolsets': ['host'],
364       'actions': [
365         {
366           'action_name': 'node_js2c',
367           'inputs': [
368             '<@(library_files)',
369             './config.gypi',
370           ],
371           'outputs': [
372             '<(SHARED_INTERMEDIATE_DIR)/node_natives.h',
373           ],
374           'conditions': [
375             [ 'node_use_dtrace=="false"'
376               ' and node_use_etw=="false"'
377               ' and node_use_systemtap=="false"',
378             {
379                 'inputs': ['src/macros.py']
380               }
381               ],
382             [ 'node_use_perfctr=="false"', {
383               'inputs': [ 'src/perfctr_macros.py' ]
384             }]
385           ],
386               'action': [
387                 '<(python)',
388                 'tools/js2c.py',
389                 '<@(_outputs)',
390                 '<@(_inputs)',
391               ],
392         },
393       ],
394     }, # end node_js2c
395     {
396       'target_name': 'node_dtrace_header',
397       'type': 'none',
398       'conditions': [
399         [ 'node_use_dtrace=="true"', {
400           'actions': [
401             {
402               'action_name': 'node_dtrace_header',
403               'inputs': [ 'src/node_provider.d' ],
404               'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_provider.h' ],
405               'action': [ 'dtrace', '-h', '-xnolibs', '-s', '<@(_inputs)',
406                 '-o', '<@(_outputs)' ]
407             }
408           ]
409         } ]
410       ]
411     },
412     {
413       'target_name': 'node_systemtap_header',
414       'type': 'none',
415       'conditions': [
416         [ 'node_use_systemtap=="true"', {
417           'actions': [
418             {
419               'action_name': 'node_systemtap_header',
420               'inputs': [ 'src/node_systemtap.d' ],
421               'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_systemtap.h' ],
422               'action': [ 'dtrace', '-h', '-C', '-s', '<@(_inputs)',
423                 '-o', '<@(_outputs)' ]
424             }
425           ]
426         } ]
427       ]
428     },
429     {
430       'target_name': 'node_dtrace_provider',
431       'type': 'none',
432       'conditions': [
433         [ 'node_use_dtrace=="true" and OS!="mac"', {
434           'actions': [
435             {
436               'action_name': 'node_dtrace_provider_o',
437               'inputs': [
438                 'src/node_provider.d',
439                 '<(OBJ_DIR)/node/src/node_dtrace.o'
440               ],
441               'outputs': [
442                 '<(OBJ_DIR)/node/src/node_dtrace_provider.o'
443               ],
444               'action': [ 'dtrace', '-G', '-xnolibs', '-s', '<@(_inputs)',
445                 '-o', '<@(_outputs)' ]
446             }
447           ]
448         } ]
449       ]
450     },
451     {
452       'target_name': 'node_dtrace_ustack',
453       'type': 'none',
454       'conditions': [
455         [ 'node_use_dtrace=="true" and OS!="mac"', {
456           'actions': [
457             {
458               'action_name': 'node_dtrace_ustack_constants',
459               'inputs': [
460                 '<(V8_BASE)'
461               ],
462               'outputs': [
463                 '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
464               ],
465               'action': [
466                 'tools/genv8constants.py',
467                 '<@(_outputs)',
468                 '<@(_inputs)'
469               ]
470             },
471             {
472               'action_name': 'node_dtrace_ustack',
473               'inputs': [
474                 'src/v8ustack.d',
475                 '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
476               ],
477               'outputs': [
478                 '<(OBJ_DIR)/node/src/node_dtrace_ustack.o'
479               ],
480               'conditions': [
481                 [ 'target_arch=="ia32"', {
482                   'action': [
483                     'dtrace', '-32', '-I<(SHARED_INTERMEDIATE_DIR)', '-Isrc',
484                     '-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)',
485                   ]
486                 } ],
487                 [ 'target_arch=="x64"', {
488                   'action': [
489                     'dtrace', '-64', '-I<(SHARED_INTERMEDIATE_DIR)', '-Isrc',
490                     '-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)',
491                   ]
492                 } ],
493               ]
494             },
495           ]
496         } ],
497       ]
498     },
499     {
500       'target_name': 'specialize_node_d',
501       'type': 'none',
502       'conditions': [
503         [ 'node_use_dtrace=="true"', {
504           'actions': [
505             {
506               'action_name': 'specialize_node_d',
507               'inputs': [
508                 'src/node.d'
509               ],
510               'outputs': [
511                 '<(PRODUCT_DIR)/node.d',
512               ],
513               'action': [
514                 'tools/specialize_node_d.py',
515                 '<@(_outputs)',
516                 '<@(_inputs)',
517                 '<@(OS)',
518                 '<@(target_arch)',
519               ],
520             },
521           ],
522         } ],
523       ]
524     }
525   ] # end targets
526 }