• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2012 the V8 project authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4{
5  'variables': {
6    'V8_ROOT': '../../deps/v8',
7    'v8_code': 1,
8    'v8_random_seed%': 314159265,
9    'v8_vector_stores%': 0,
10    'v8_embed_script%': "",
11    'mksnapshot_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)mksnapshot<(EXECUTABLE_SUFFIX)',
12    'v8_os_page_size%': 0,
13    'generate_bytecode_output_root': '<(SHARED_INTERMEDIATE_DIR)/generate-bytecode-output-root',
14    'generate_bytecode_builtins_list_output': '<(generate_bytecode_output_root)/builtins-generated/bytecodes-builtins-list.h',
15    'torque_files': ['<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "torque_files = ")'],
16    # Torque and V8 expect the files to be named relative to V8's root.
17    'torque_files_without_v8_root': ['<!@pymod_do_main(ForEachReplace "<@(V8_ROOT)/" "" <@(torque_files))'],
18    'torque_files_replaced': ['<!@pymod_do_main(ForEachReplace ".tq" "-tq" <@(torque_files_without_v8_root))'],
19    'torque_outputs_csa_cc': ['<!@pymod_do_main(ForEachFormat "<(SHARED_INTERMEDIATE_DIR)/torque-generated/%s-csa.cc" <@(torque_files_replaced))'],
20    'torque_outputs_csa_h': ['<!@pymod_do_main(ForEachFormat "<(SHARED_INTERMEDIATE_DIR)/torque-generated/%s-csa.h" <@(torque_files_replaced))'],
21    'torque_outputs_inl_inc': ['<!@pymod_do_main(ForEachFormat "<(SHARED_INTERMEDIATE_DIR)/torque-generated/%s-inl.inc" <@(torque_files_replaced))'],
22    'torque_outputs_cc': ['<!@pymod_do_main(ForEachFormat "<(SHARED_INTERMEDIATE_DIR)/torque-generated/%s.cc" <@(torque_files_replaced))'],
23    'torque_outputs_inc': ['<!@pymod_do_main(ForEachFormat "<(SHARED_INTERMEDIATE_DIR)/torque-generated/%s.inc" <@(torque_files_replaced))'],
24    'v8_compiler_sources': ['<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_compiler_sources = ")'],
25    'conditions': [
26      ['v8_enable_i18n_support==1', {
27        'torque_files': [
28          '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "torque_files =.*?v8_enable_i18n_support.*?torque_files \\+= ")',
29        ],
30      }],
31      ['v8_enable_webassembly==1', {
32        'torque_files': [
33          '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "torque_files =.*?v8_enable_webassembly.*?torque_files \\+= ")',
34        ],
35        'v8_compiler_sources': [
36          '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_compiler_sources =.*?v8_enable_webassembly.*?v8_compiler_sources \\+= ")',
37        ],
38      }],
39    ],
40  },
41  'includes': ['toolchain.gypi', 'features.gypi'],
42  'target_defaults': {
43    'msvs_settings': {
44      'VCCLCompilerTool': {
45        'AdditionalOptions': ['/utf-8']
46      }
47    },
48  },
49  'targets': [
50    {
51      'target_name': 'run_torque',
52      'type': 'none',
53      'toolsets': ['host', 'target'],
54      'conditions': [
55        ['want_separate_host_toolset', {
56          'dependencies': ['torque#host'],
57        }, {
58          'dependencies': ['torque#target'],
59        }],
60      ],
61      'hard_dependency': 1,
62      'direct_dependent_settings': {
63        'include_dirs': [
64          '<(SHARED_INTERMEDIATE_DIR)',
65        ],
66      },
67      'actions': [
68        {
69          'action_name': 'run_torque_action',
70          'inputs': [  # Order matters.
71            '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)',
72            '<@(torque_files)',
73          ],
74          'outputs': [
75            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/bit-fields.h",
76            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/builtin-definitions.h",
77            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/class-debug-readers.cc",
78            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/class-debug-readers.h",
79            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/class-forward-declarations.h",
80            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/class-verifiers.cc",
81            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/class-verifiers.h",
82            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/csa-types.h",
83            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/debug-macros.cc",
84            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/debug-macros.h",
85            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/enum-verifiers.cc",
86            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/exported-macros-assembler.cc",
87            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/exported-macros-assembler.h",
88            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/factory.cc",
89            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/factory.inc",
90            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/instance-types.h",
91            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/interface-descriptors.inc",
92            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/objects-body-descriptors-inl.inc",
93            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/objects-printer.cc",
94            "<(SHARED_INTERMEDIATE_DIR)/torque-generated/visitor-lists.h",
95            '<@(torque_outputs_csa_cc)',
96            '<@(torque_outputs_csa_h)',
97            '<@(torque_outputs_inl_inc)',
98            '<@(torque_outputs_cc)',
99            '<@(torque_outputs_inc)',
100          ],
101          'action': [
102            '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)torque<(EXECUTABLE_SUFFIX)',
103            '-o', '<(SHARED_INTERMEDIATE_DIR)/torque-generated',
104            '-v8-root', '<(V8_ROOT)',
105            '<@(torque_files_without_v8_root)',
106          ],
107        },
108      ],
109    },  # run_torque
110    {
111      'target_name': 'v8_maybe_icu',
112      'type': 'none',
113      'toolsets': ['host', 'target'],
114      'hard_dependency': 1,
115      'conditions': [
116        ['v8_enable_i18n_support==1', {
117          'dependencies': [
118            '<(icu_gyp_path):icui18n',
119            '<(icu_gyp_path):icuuc',
120          ],
121          'export_dependent_settings': [
122            '<(icu_gyp_path):icui18n',
123            '<(icu_gyp_path):icuuc',
124          ],
125        }],
126      ],
127    },  # v8_maybe_icu
128    {
129      'target_name': 'torque_runtime_support',
130      'type': 'none',
131      'toolsets': ['host', 'target'],
132      'direct_dependent_settings': {
133        'sources': [
134          '<(V8_ROOT)/src/torque/runtime-support.h',
135        ],
136      },
137    },  # torque_runtime_support
138    {
139      'target_name': 'torque_generated_initializers',
140      'type': 'none',
141      'toolsets': ['host', 'target'],
142      'hard_dependency': 1,
143      'dependencies': [
144        'generate_bytecode_builtins_list',
145        'run_torque',
146        'v8_base_without_compiler',
147        'torque_runtime_support',
148        'v8_maybe_icu',
149      ],
150      'direct_dependent_settings': {
151        'sources': [
152          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/csa-types.h',
153          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/enum-verifiers.cc',
154          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/exported-macros-assembler.cc',
155          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/exported-macros-assembler.h',
156          '<@(torque_outputs_csa_cc)',
157          '<@(torque_outputs_csa_h)',
158        ],
159      }
160    },  # torque_generated_initializers
161    {
162      'target_name': 'torque_generated_definitions',
163      'type': 'none',
164      'toolsets': ['host', 'target'],
165      'hard_dependency': 1,
166      'dependencies': [
167        'generate_bytecode_builtins_list',
168        'run_torque',
169        'v8_internal_headers',
170        'v8_libbase',
171        'v8_maybe_icu',
172      ],
173      'direct_dependent_settings': {
174        'sources': [
175          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/class-forward-declarations.h',
176          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/class-verifiers.cc',
177          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/class-verifiers.h',
178          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/factory.cc',
179          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/objects-printer.cc',
180          '<@(torque_outputs_inl_inc)',
181          '<@(torque_outputs_cc)',
182          '<@(torque_outputs_inc)',
183        ],
184        'include_dirs': [
185          '<(SHARED_INTERMEDIATE_DIR)',
186        ],
187      },
188    },  # torque_generated_definitions
189    {
190      'target_name': 'generate_bytecode_builtins_list',
191      'type': 'none',
192      'hard_dependency': 1,
193      'toolsets': ['host', 'target'],
194      'conditions': [
195        ['want_separate_host_toolset', {
196          'dependencies': ['bytecode_builtins_list_generator#host'],
197        }, {
198          'dependencies': ['bytecode_builtins_list_generator#target'],
199        }],
200      ],
201      'direct_dependent_settings': {
202        'sources': [
203          '<(generate_bytecode_builtins_list_output)',
204        ],
205        'include_dirs': [
206          '<(generate_bytecode_output_root)',
207          '<(SHARED_INTERMEDIATE_DIR)',
208        ],
209      },
210      'actions': [
211        {
212          'action_name': 'generate_bytecode_builtins_list_action',
213          'inputs': [
214            '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)bytecode_builtins_list_generator<(EXECUTABLE_SUFFIX)',
215          ],
216          'outputs': [
217            '<(generate_bytecode_builtins_list_output)',
218          ],
219          'action': [
220            '<(python)',
221            '<(V8_ROOT)/tools/run.py',
222            '<@(_inputs)',
223            '<@(_outputs)',
224          ],
225        },
226      ],
227    },  # generate_bytecode_builtins_list
228    {
229      'target_name': 'v8_init',
230      'type': 'static_library',
231      'toolsets': ['host', 'target'],
232      'dependencies': [
233        'generate_bytecode_builtins_list',
234        'run_torque',
235        'v8_base_without_compiler',
236        'v8_initializers',
237        'v8_maybe_icu',
238      ],
239      'sources': [
240        '<(V8_ROOT)/src/init/setup-isolate-full.cc',
241      ],
242    },  # v8_init
243    {
244      'target_name': 'v8_initializers',
245      'type': 'static_library',
246      'toolsets': ['host', 'target'],
247      'dependencies': [
248        'torque_generated_initializers',
249        'v8_base_without_compiler',
250        'v8_shared_internal_headers',
251      ],
252      'include_dirs': [
253        '<(SHARED_INTERMEDIATE_DIR)',
254        '<(generate_bytecode_output_root)',
255      ],
256      'sources': [
257        '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_initializers.*?sources = ")',
258      ],
259      'conditions': [
260        ['v8_enable_webassembly==1', {
261          'sources': [
262            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_initializers.*?v8_enable_webassembly.*?sources \\+= ")',
263          ],
264        }],
265        ['v8_target_arch=="ia32"', {
266          'sources': [
267            '<(V8_ROOT)/src/builtins/ia32/builtins-ia32.cc',
268          ],
269        }],
270        ['v8_target_arch=="x64"', {
271          'sources': [
272            '<(V8_ROOT)/src/builtins/x64/builtins-x64.cc',
273          ],
274        }],
275        ['v8_target_arch=="arm"', {
276          'sources': [
277            '<(V8_ROOT)/src/builtins/arm/builtins-arm.cc',
278          ],
279        }],
280        ['v8_target_arch=="arm64"', {
281          'sources': [
282            '<(V8_ROOT)/src/builtins/arm64/builtins-arm64.cc',
283          ],
284        }],
285        ['v8_target_arch=="mips" or v8_target_arch=="mipsel"', {
286          'sources': [
287            '<(V8_ROOT)/src/builtins/mips/builtins-mips.cc',
288          ],
289        }],
290        ['v8_target_arch=="riscv64" or v8_target_arch=="riscv64"', {
291          'sources': [
292            '<(V8_ROOT)/src/builtins/riscv64/builtins-riscv64.cc',
293          ],
294        }],
295        ['v8_target_arch=="loong64" or v8_target_arch=="loong64"', {
296          'sources': [
297            '<(V8_ROOT)/src/builtins/loong64/builtins-loong64.cc',
298          ],
299        }],
300        ['v8_target_arch=="mips64" or v8_target_arch=="mips64el"', {
301          'sources': [
302            '<(V8_ROOT)/src/builtins/mips64/builtins-mips64.cc',
303          ],
304        }],
305        ['v8_target_arch=="ppc"', {
306          'sources': [
307            '<(V8_ROOT)/src/builtins/ppc/builtins-ppc.cc',
308          ],
309        }],
310        ['v8_target_arch=="ppc64"', {
311          'sources': [
312            '<(V8_ROOT)/src/builtins/ppc/builtins-ppc.cc',
313          ],
314        }],
315        ['v8_target_arch=="s390x"', {
316          'sources': [
317            '<(V8_ROOT)/src/builtins/s390/builtins-s390.cc',
318          ],
319        }],
320        ['v8_enable_i18n_support==1', {
321          'dependencies': [
322            '<(icu_gyp_path):icui18n',
323            '<(icu_gyp_path):icuuc',
324          ],
325        }, {
326           'sources!': [
327             '<(V8_ROOT)/src/builtins/builtins-intl-gen.cc',
328           ],
329         }],
330        ['OS=="win"', {
331          'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
332          'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
333          'sources': [
334            '<(_msvs_precompiled_header)',
335            '<(_msvs_precompiled_source)',
336          ],
337        }],
338      ],
339    },  # v8_initializers
340    {
341      'target_name': 'v8_snapshot',
342      'type': 'static_library',
343      'toolsets': ['target'],
344      'conditions': [
345        ['want_separate_host_toolset', {
346          'conditions': [
347            ['v8_target_arch=="arm64"', {
348              'msvs_enable_marmasm': 1,
349            }]
350          ],
351          'dependencies': [
352            'generate_bytecode_builtins_list',
353            'run_torque',
354            'mksnapshot#host',
355            'v8_maybe_icu',
356            # [GYP] added explicitly, instead of inheriting from the other deps
357            'v8_base_without_compiler',
358            'v8_compiler_for_mksnapshot',
359            'v8_initializers',
360            'v8_libplatform',
361          ]
362        }, {
363          'dependencies': [
364            'generate_bytecode_builtins_list',
365            'run_torque',
366            'mksnapshot',
367            'v8_maybe_icu',
368            # [GYP] added explicitly, instead of inheriting from the other deps
369            'v8_base_without_compiler',
370            'v8_compiler_for_mksnapshot',
371            'v8_initializers',
372            'v8_libplatform',
373          ]
374        }],
375      ],
376      'sources': [
377        '<(V8_ROOT)/src/init/setup-isolate-deserialize.cc',
378      ],
379      'xcode_settings': {
380        # V8 7.4 over macOS10.11 compatibility
381        # Refs: https://github.com/nodejs/node/pull/26685
382        'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
383      },
384      'actions': [
385        {
386          'action_name': 'run_mksnapshot',
387          'message': 'generating: >@(_outputs)',
388          'variables': {
389            'mksnapshot_flags': [
390              '--turbo_instruction_scheduling',
391              # In cross builds, the snapshot may be generated for both the host and
392              # target toolchains.  The same host binary is used to generate both, so
393              # mksnapshot needs to know which target OS to use at runtime.  It's weird,
394              # but the target OS is really <(OS).
395              '--target_os=<(OS)',
396              '--target_arch=<(v8_target_arch)',
397              '--startup_src', '<(INTERMEDIATE_DIR)/snapshot.cc',
398              '--embedded_variant', 'Default',
399              '--embedded_src', '<(INTERMEDIATE_DIR)/embedded.S',
400            ],
401          },
402          'inputs': [
403            '<(mksnapshot_exec)',
404          ],
405          'outputs': [
406            '<(INTERMEDIATE_DIR)/snapshot.cc',
407            '<(INTERMEDIATE_DIR)/embedded.S',
408          ],
409          'process_outputs_as_sources': 1,
410          'conditions': [
411            ['v8_random_seed', {
412              'variables': {
413                'mksnapshot_flags': ['--random-seed', '<(v8_random_seed)'],
414              },
415            }],
416            ['v8_os_page_size', {
417              'variables': {
418                'mksnapshot_flags': ['--v8_os_page_size', '<(v8_os_page_size)'],
419              },
420            }],
421            ['v8_embed_script != ""', {
422              'inputs': ['<(v8_embed_script)'],
423              'variables': {
424                'mksnapshot_flags': ['<(v8_embed_script)'],
425              },
426            }],
427            ['v8_enable_snapshot_code_comments', {
428              'variables': {
429                'mksnapshot_flags': ['--code-comments'],
430              },
431            }],
432            ['v8_enable_snapshot_native_code_counters', {
433              'variables': {
434                'mksnapshot_flags': ['--native-code-counters'],
435              },
436            }, {
437               # --native-code-counters is the default in debug mode so make sure we can
438               # unset it.
439               'variables': {
440                 'mksnapshot_flags': ['--no-native-code-counters'],
441               },
442             }],
443          ],
444          'action': [
445            '>@(_inputs)',
446            '>@(mksnapshot_flags)',
447          ],
448        },
449      ],
450    },  # v8_snapshot
451    {
452      'target_name': 'v8_version',
453      'type': 'none',
454      'toolsets': ['host', 'target'],
455      'direct_dependent_settings': {
456        'sources': [
457          '<(V8_ROOT)/include/v8-value-serializer-version.h',
458          '<(V8_ROOT)/include/v8-version-string.h',
459          '<(V8_ROOT)/include/v8-version.h',
460        ],
461      },
462    },  # v8_version
463    {
464      'target_name': 'v8_config_headers',
465      'type': 'none',
466      'toolsets': ['host', 'target'],
467      'direct_dependent_settings': {
468        'sources': [
469          '<(V8_ROOT)/include/v8-platform.h',
470          '<(V8_ROOT)/include/v8config.h',
471        ],
472      },
473    },  # v8_config_headers
474    {
475      'target_name': 'v8_headers',
476      'type': 'none',
477      'toolsets': ['host', 'target'],
478      'dependencies': [
479        'v8_config_headers',
480        'v8_heap_base_headers',
481        'v8_version',
482      ],
483      'direct_dependent_settings': {
484        'sources': [
485          '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_headers\\".*?sources = ")',
486
487          '<(V8_ROOT)/include/v8-wasm-trap-handler-posix.h',
488          '<(V8_ROOT)/include/v8-wasm-trap-handler-win.h',
489        ],
490      },
491    },  # v8_headers
492    {
493      'target_name': 'v8_shared_internal_headers',
494      'type': 'none',
495      'toolsets': ['host', 'target'],
496      'dependencies': [
497        'v8_headers',
498        'v8_libbase',
499      ],
500      'direct_dependent_settings': {
501        'sources': [
502          '<(V8_ROOT)/src/common/globals.h',
503          '<(V8_ROOT)/src/wasm/wasm-constants.h',
504          '<(V8_ROOT)/src/wasm/wasm-limits.h',
505        ],
506      },
507    },  # v8_shared_internal_headers
508    {
509      'target_name': 'v8_flags',
510      'type': 'none',
511      'toolsets': ['host', 'target'],
512      'dependencies': [
513        'v8_shared_internal_headers',
514      ],
515      'direct_dependent_settings': {
516        'sources': [
517          '<(V8_ROOT)/src/flags/flag-definitions.h',
518          '<(V8_ROOT)/src/flags/flags.h',
519        ],
520      },
521    },  # v8_flags
522    {
523      'target_name': 'v8_internal_headers',
524      'type': 'none',
525      'toolsets': ['host', 'target'],
526      'dependencies': [
527        'torque_runtime_support',
528        'v8_flags',
529        'v8_headers',
530        'v8_maybe_icu',
531        'v8_shared_internal_headers',
532        'v8_heap_base_headers',
533        'generate_bytecode_builtins_list',
534        'run_torque',
535        'v8_libbase',
536      ],
537      'direct_dependent_settings': {
538        'sources': [
539          '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?sources = ")',
540        ],
541        'conditions': [
542          ['v8_enable_maglev==1', {
543            'sources': [
544              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_maglev.*?sources \\+= ")',
545            ],
546          }],
547          ['v8_enable_webassembly==1', {
548            'sources': [
549              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_webassembly.*?sources \\+= ")',
550            ],
551          }],
552          ['v8_enable_i18n_support==1', {
553            'sources': [
554              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_i18n_support.*?sources \\+= ")',
555            ],
556          }],
557          ['v8_control_flow_integrity==0', {
558            'sources': [
559              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?!v8_control_flow_integrity.*?sources \\+= ")',
560            ],
561          }],
562          ['v8_enable_heap_snapshot_verify==1', {
563            'sources': [
564              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_enable_heap_snapshot_verify.*?sources \\+= ")',
565            ],
566          }],
567          ['v8_target_arch=="ia32"', {
568            'sources': [
569              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"x86\\".*?sources \\+= ")',
570            ],
571          }],
572          ['v8_target_arch=="x64"', {
573            'sources': [
574              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"x64\\".*?sources \\+= ")',
575            ],
576            'conditions': [
577              ['OS=="win"', {
578                'sources': [
579                  '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"x64\\".*?is_win.*?sources \\+= ")',
580                ],
581              }],
582              ['v8_enable_webassembly==1', {
583                'conditions': [
584                  ['OS=="linux" or OS=="mac" or OS=="ios" or OS=="freebsd"', {
585                    'sources': [
586                      '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"x64\\".*?v8_enable_webassembly.*?is_linux.*?sources \\+= ")',
587                    ],
588                  }],
589                  ['OS=="win"', {
590                    'sources': [
591                      '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"x64\\".*?v8_enable_webassembly.*?is_win.*?sources \\+= ")',
592                    ],
593                  }],
594                ],
595              }],
596            ],
597          }],
598          ['v8_target_arch=="arm"', {
599            'sources': [
600              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"arm\\".*?sources \\+= ")',
601            ],
602          }],
603          ['v8_target_arch=="arm64"', {
604            'sources': [
605              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"arm64\\".*?sources \\+= ")',
606            ],
607            'conditions': [
608              ['v8_control_flow_integrity==1', {
609                'sources': [
610                  '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"arm64\\".*?v8_control_flow_integrity.*?sources \\+= ")',
611                ],
612              }],
613              ['v8_enable_webassembly==1', {
614                'conditions': [
615                  ['OS=="mac" or (_toolset=="host" and host_arch=="x64" and OS=="linux")', {
616                    'sources': [
617                      '<(V8_ROOT)/src/trap-handler/handler-inside-posix.h',
618                    ],
619                  }],
620                  # TODO(targos): Replace False with OS=="win" if handler-outside-simulator.cc becomes compatible with MSVC.
621                  ['_toolset=="host" and host_arch=="x64" and (OS=="linux" or OS=="mac" or False)', {
622                    'sources': [
623                      '<(V8_ROOT)/src/trap-handler/trap-handler-simulator.h',
624                    ],
625                  }],
626                ],
627              }],
628              ['OS=="win"', {
629                'sources': [
630                  '<(V8_ROOT)/src/diagnostics/unwinding-info-win64.h',
631                ],
632              }],
633            ],
634          }],
635          ['v8_target_arch=="mips" or v8_target_arch=="mipsel"', {
636            'sources': [
637              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"mips\\".*?sources \\+= ")',
638            ],
639          }],
640          ['v8_target_arch=="mips64" or v8_target_arch=="mips64el"', {
641            'sources': [
642              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"mips64\\".*?sources \\+= ")',
643            ],
644          }],
645          ['v8_target_arch=="ppc"', {
646            'sources': [
647              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"ppc\\".*?sources \\+= ")',
648            ],
649          }],
650          ['v8_target_arch=="ppc64"', {
651            'sources': [
652              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"ppc64\\".*?sources \\+= ")',
653            ],
654          }],
655          ['v8_target_arch=="s390x"', {
656            'sources': [
657              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"s390\\".*?sources \\+= ")',
658            ],
659          }],
660          ['v8_target_arch=="riscv64"', {
661            'sources': [
662              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"riscv64\\".*?sources \\+= ")',
663            ],
664          }],
665          ['v8_target_arch=="loong64"', {
666            'sources': [
667              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_header_set.\\"v8_internal_headers\\".*?v8_current_cpu == \\"loong64\\".*?sources \\+= ")',
668            ],
669          }],
670        ],
671      },
672    },  # v8_internal_headers
673    {
674      'target_name': 'v8_compiler_opt',
675      'type': 'static_library',
676      'toolsets': ['host', 'target'],
677      'dependencies': [
678        'generate_bytecode_builtins_list',
679        'run_torque',
680        'v8_maybe_icu',
681        'v8_base_without_compiler',
682        'v8_internal_headers',
683        'v8_libbase',
684        'v8_shared_internal_headers',
685      ],
686      'sources': ['<@(v8_compiler_sources)'],
687      'conditions': [
688        ['OS=="win"', {
689          'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
690          'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
691          'sources': [
692            '<(_msvs_precompiled_header)',
693            '<(_msvs_precompiled_source)',
694          ],
695        }],
696      ],
697    },  # v8_compiler_opt
698    {
699      'target_name': 'v8_compiler',
700      'type': 'static_library',
701      'toolsets': ['host', 'target'],
702      'dependencies': [
703        'generate_bytecode_builtins_list',
704        'run_torque',
705        'v8_internal_headers',
706        'v8_maybe_icu',
707        'v8_base_without_compiler',
708        'v8_libbase',
709        'v8_shared_internal_headers',
710      ],
711      'sources': ['<@(v8_compiler_sources)'],
712      'conditions': [
713        ['OS=="win"', {
714          'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
715          'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
716          'sources': [
717            '<(_msvs_precompiled_header)',
718            '<(_msvs_precompiled_source)',
719          ],
720        }],
721      ],
722    },  # v8_compiler
723    {
724      'target_name': 'v8_compiler_for_mksnapshot',
725      'type': 'none',
726      'toolsets': ['host', 'target'],
727      'hard_dependency': 1,
728      'dependencies': [
729        'generate_bytecode_builtins_list',
730        'run_torque',
731        'v8_maybe_icu',
732      ],
733      'conditions': [
734        ['is_component_build and not v8_optimized_debug and v8_enable_fast_mksnapshot', {
735          'dependencies': [
736            'v8_compiler_opt',
737          ],
738          'export_dependent_settings': [
739            'v8_compiler_opt',
740          ],
741        }, {
742           'dependencies': [
743             'v8_compiler',
744           ],
745           'export_dependent_settings': [
746             'v8_compiler',
747           ],
748         }],
749      ],
750    },  # v8_compiler_for_mksnapshot
751    {
752      'target_name': 'v8_base_without_compiler',
753      'type': 'static_library',
754      'toolsets': ['host', 'target'],
755      'dependencies': [
756        'torque_generated_definitions',
757        'v8_bigint',
758        'v8_headers',
759        'v8_heap_base',
760        'v8_libbase',
761        'v8_shared_internal_headers',
762        'v8_version',
763        'cppgc_base',
764        'generate_bytecode_builtins_list',
765        'run_torque',
766        'v8_internal_headers',
767        'v8_maybe_icu',
768        'v8_zlib',
769      ],
770      'includes': ['inspector.gypi'],
771      'direct_dependent_settings': {
772        'include_dirs': [
773          '<(generate_bytecode_output_root)',
774          '<(SHARED_INTERMEDIATE_DIR)',
775        ],
776      },
777      'sources': [
778        '<(generate_bytecode_builtins_list_output)',
779
780        '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?sources = ")',
781
782        '<@(inspector_all_sources)',
783      ],
784      'conditions': [
785        ['v8_enable_third_party_heap==1', {
786          # TODO(targos): add values from v8_third_party_heap_files to sources
787        }, {
788          'sources': [
789            '<(V8_ROOT)/src/heap/third-party/heap-api-stub.cc',
790          ],
791        }],
792        ['v8_enable_maglev==1', {
793          'sources': [
794            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_enable_maglev.*?sources \\+= ")',
795          ],
796        }],
797        ['v8_enable_webassembly==1', {
798          'sources': [
799            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_enable_webassembly.*?sources \\+= ")',
800          ],
801        }],
802        ['v8_enable_heap_snapshot_verify==1', {
803          'sources': [
804            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_enable_heap_snapshot_verify.*?sources \\+= ")',
805          ],
806        }],
807        ['v8_target_arch=="ia32"', {
808          'sources': [
809            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"x86.*?sources \\+= ")',
810          ],
811        }],
812        ['v8_target_arch=="x64"', {
813          'sources': [
814            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"x64\\".*?sources \\+= ")',
815          ],
816          'conditions': [
817            ['OS=="win"', {
818              'sources': [
819                '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"x64\\".*?is_win.*?sources \\+= ")',
820              ],
821            }],
822            ['v8_enable_webassembly==1', {
823              'conditions': [
824                ['OS=="linux" or OS=="mac" or OS=="ios" or OS=="freebsd"', {
825                  'sources': [
826                    '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"x64\\".*?v8_enable_webassembly.*?is_linux.*?sources \\+= ")',
827                  ],
828                }],
829                ['OS=="win"', {
830                  'sources': [
831                    '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"x64\\".*?v8_enable_webassembly.*?is_win.*?sources \\+= ")',
832                  ],
833                }],
834              ],
835            }],
836          ],
837        }],
838        ['v8_target_arch=="arm"', {
839          'sources': [
840            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"arm\\".*?sources \\+= ")',
841          ],
842        }],
843        ['v8_target_arch=="arm64"', {
844          'sources': [
845            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"arm64\\".*?sources \\+= ")',
846          ],
847          'conditions': [
848            ['v8_enable_webassembly==1', {
849              'conditions': [
850                ['OS=="mac" or OS=="ios" or '
851                 '(_toolset=="host" and host_arch=="x64" and (host_os=="linux" or host_os=="mac"))', {
852                  'sources': [
853                    '<(V8_ROOT)/src/trap-handler/handler-inside-posix.cc',
854                    '<(V8_ROOT)/src/trap-handler/handler-outside-posix.cc',
855                  ],
856                }],
857                # TODO(targos): Replace False with OS=="win" if handler-outside-simulator.cc becomes compatible with MSVC.
858                ['_toolset=="host" and host_arch=="x64" and False', {
859                  'sources': [
860                    '<(V8_ROOT)/src/trap-handler/handler-inside-win.cc',
861                    '<(V8_ROOT)/src/trap-handler/handler-outside-win.cc',
862                  ],
863                }],
864                # TODO(targos): Replace False with OS=="win" if handler-outside-simulator.cc becomes compatible with MSVC.
865                ['_toolset=="host" and host_arch=="x64" and '
866                 '(host_os=="linux" or host_os=="mac" or False)', {
867                  'sources': [
868                    '<(V8_ROOT)/src/trap-handler/handler-outside-simulator.cc',
869                  ],
870                }],
871              ],
872            }],
873            ['OS=="win"', {
874              'sources': [
875                '<(V8_ROOT)/src/diagnostics/unwinding-info-win64.cc',
876              ],
877            }],
878          ],
879        }],
880        ['v8_target_arch=="mips" or v8_target_arch=="mipsel"', {
881          'sources': [
882            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"mips\\".*?sources \\+= ")',
883          ],
884        }],
885        ['v8_target_arch=="mips64" or v8_target_arch=="mips64el"', {
886          'sources': [
887            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"mips64\\".*?sources \\+= ")',
888          ],
889        }],
890        ['v8_target_arch=="ppc"', {
891          'sources': [
892            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"ppc\\".*?sources \\+= ")',
893          ],
894        }],
895        ['v8_target_arch=="ppc64"', {
896          'sources': [
897            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"ppc64\\".*?sources \\+= ")',
898          ],
899        }],
900        ['v8_target_arch=="s390x"', {
901          'sources': [
902            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"s390\\".*?sources \\+= ")',
903          ],
904        }],
905        ['v8_target_arch=="riscv64"', {
906          'sources': [
907            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"riscv64\\".*?sources \\+= ")',
908          ],
909        }],
910        ['v8_target_arch=="loong64"', {
911          'sources': [
912            '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_current_cpu == \\"loong64\\".*?sources \\+= ")',
913          ],
914        }],
915        ['OS=="win"', {
916          'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
917          'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
918          'sources': [
919            '<(_msvs_precompiled_header)',
920            '<(_msvs_precompiled_source)',
921          ],
922          # This will prevent V8's .cc files conflicting with the inspector's
923          # .cpp files in the same shard.
924          'msvs_settings': {
925            'VCCLCompilerTool': {
926              'ObjectFile': '$(IntDir)%(Extension)\\',
927            },
928          },
929          'conditions': [
930            ['v8_enable_system_instrumentation==1', {
931              'sources': [
932                '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?is_win.*?v8_enable_system_instrumentation.*?sources \\+= ")',
933              ],
934            }],
935          ],
936        }],
937        ['component=="shared_library"', {
938          'defines': [
939            'BUILDING_V8_SHARED',
940          ],
941        }],
942        ['v8_enable_i18n_support==1', {
943          'dependencies': [
944            'run_gen-regexp-special-case',
945          ],
946          'sources': [
947            '<(SHARED_INTERMEDIATE_DIR)/src/regexp/special-case.cc',
948          ],
949          'conditions': [
950            ['icu_use_data_file_flag', {
951              'defines': ['ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_FILE'],
952            }, {
953               'conditions': [
954                 ['OS=="win"', {
955                   'defines': ['ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_SHARED'],
956                 }, {
957                    'defines': ['ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC'],
958                  }],
959               ],
960             }],
961            ['OS=="win"', {
962              'dependencies': [
963                '<(icu_gyp_path):icudata#target',
964              ],
965            }],
966          ],
967        }, {  # v8_enable_i18n_support==0
968           'sources!': [
969             '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_base_without_compiler.*?v8_enable_i18n_support.*?sources -= ")',
970           ],
971         }],
972        ['v8_postmortem_support', {
973          'dependencies': ['postmortem-metadata#target'],
974        }],
975        ['v8_enable_third_party_heap', {
976          # TODO(targos): add values from v8_third_party_heap_libs to link_settings.libraries
977        }],
978        # Platforms that don't have Compare-And-Swap (CAS) support need to link atomic library
979        # to implement atomic memory access
980        ['v8_current_cpu in ["mips", "mipsel", "mips64", "mips64el", "ppc", "arm", "riscv64", "loong64"]', {
981          'link_settings': {
982            'libraries': ['-latomic', ],
983          },
984        }],
985      ],
986    },  # v8_base_without_compiler
987    {
988      'target_name': 'v8_base',
989      'type': 'none',
990      'toolsets': ['host', 'target'],
991      'dependencies': [
992        'v8_base_without_compiler',
993        'v8_compiler',
994      ],
995    },  # v8_base
996    {
997      'target_name': 'torque_base',
998      'type': 'static_library',
999      'toolsets': ['host', 'target'],
1000      'sources': [
1001        '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"torque_base.*?sources = ")',
1002      ],
1003      'dependencies': [
1004        'v8_shared_internal_headers',
1005        'v8_libbase',
1006      ],
1007      'defines!': [
1008        '_HAS_EXCEPTIONS=0',
1009        'BUILDING_V8_SHARED=1',
1010      ],
1011      'cflags_cc!': ['-fno-exceptions'],
1012      'cflags_cc': ['-fexceptions'],
1013      'xcode_settings': {
1014        'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',  # -fexceptions
1015      },
1016      'msvs_settings': {
1017        'VCCLCompilerTool': {
1018          'RuntimeTypeInfo': 'true',
1019          'ExceptionHandling': 1,
1020        },
1021      },
1022    },  # torque_base
1023    {
1024      'target_name': 'torque_ls_base',
1025      'type': 'static_library',
1026      'toolsets': ['host', 'target'],
1027      'sources': [
1028        '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"torque_ls_base.*?sources = ")',
1029      ],
1030      'dependencies': [
1031        'torque_base',
1032      ],
1033      'defines!': [
1034        '_HAS_EXCEPTIONS=0',
1035        'BUILDING_V8_SHARED=1',
1036      ],
1037      'cflags_cc!': ['-fno-exceptions'],
1038      'cflags_cc': ['-fexceptions'],
1039      'xcode_settings': {
1040        'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',  # -fexceptions
1041      },
1042      'msvs_settings': {
1043        'VCCLCompilerTool': {
1044          'RuntimeTypeInfo': 'true',
1045          'ExceptionHandling': 1,
1046        },
1047      },
1048    },  # torque_ls_base
1049    {
1050      'target_name': 'v8_libbase',
1051      'type': 'static_library',
1052      'toolsets': ['host', 'target'],
1053      'sources': [
1054        '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"v8_libbase.*?sources = ")',
1055      ],
1056
1057      'dependencies': [
1058        'v8_headers',
1059      ],
1060
1061      'conditions': [
1062        ['is_component_build', {
1063          'defines': ["BUILDING_V8_BASE_SHARED"],
1064        }],
1065        ['is_posix or is_fuchsia', {
1066          'sources': [
1067            '<(V8_ROOT)/src/base/platform/platform-posix.cc',
1068            '<(V8_ROOT)/src/base/platform/platform-posix.h',
1069          ],
1070          'conditions': [
1071            ['OS != "aix" and OS != "os400" and OS != "solaris"', {
1072              'sources': [
1073                '<(V8_ROOT)/src/base/platform/platform-posix-time.cc',
1074                '<(V8_ROOT)/src/base/platform/platform-posix-time.h',
1075              ],
1076            }],
1077          ],
1078        }],
1079        ['OS=="linux"', {
1080          'sources': [
1081            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1082            '<(V8_ROOT)/src/base/platform/platform-linux.cc',
1083          ],
1084          'link_settings': {
1085            'libraries': [
1086              '-ldl',
1087              '-lrt'
1088            ],
1089          },
1090        }],
1091        ['OS in "aix os400"', {
1092          'variables': {
1093            # Used to differentiate `AIX` and `OS400`(IBM i).
1094            'aix_variant_name': '<!(uname -s)',
1095          },
1096          'sources': [
1097            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1098            '<(V8_ROOT)/src/base/platform/platform-aix.cc',
1099          ],
1100          'conditions': [
1101            [ '"<(aix_variant_name)"=="AIX"', { # It is `AIX`
1102              'link_settings': {
1103                'libraries': [
1104                  '-ldl',
1105                  '-lrt'
1106                ],
1107              },
1108            }],
1109          ],
1110        }],
1111        ['is_android', {
1112          'sources': [
1113            '<(V8_ROOT)/src/base/platform/platform-posix.cc',
1114            '<(V8_ROOT)/src/base/platform/platform-posix.h',
1115            '<(V8_ROOT)/src/base/platform/platform-posix-time.cc',
1116            '<(V8_ROOT)/src/base/platform/platform-posix-time.h',
1117          ],
1118          'link_settings': {
1119            'target_conditions': [
1120              ['_toolset=="host" and host_os=="linux"', {
1121                'libraries': [
1122                  '-ldl',
1123                  '-lrt'
1124                ],
1125              }],
1126            ],
1127          },
1128          'target_conditions': [
1129            ['_toolset=="host"', {
1130              'sources': [
1131                '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1132                '<(V8_ROOT)/src/base/platform/platform-linux.cc',
1133              ],
1134            }, {
1135              'sources': [
1136                '<(V8_ROOT)/src/base/debug/stack_trace_android.cc',
1137                '<(V8_ROOT)/src/base/platform/platform-linux.cc',
1138              ],
1139            }],
1140          ],
1141        }],
1142        ['is_fuchsia', {
1143          'sources': [
1144            '<(V8_ROOT)/src/base/debug/stack_trace_fuchsia.cc',
1145            '<(V8_ROOT)/src/base/platform/platform-fuchsia.cc',
1146          ]
1147        }],
1148        ['OS == "mac" or (_toolset=="host" and host_os=="mac")', {
1149          'sources': [
1150            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1151            '<(V8_ROOT)/src/base/platform/platform-darwin.cc',
1152            '<(V8_ROOT)/src/base/platform/platform-macos.cc',
1153          ]
1154        }],
1155        ['OS == "ios"', {
1156          'sources': [
1157            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1158            '<(V8_ROOT)/src/base/platform/platform-darwin.cc',
1159          ]
1160        }],
1161        ['is_win', {
1162          'sources': [
1163            '<(V8_ROOT)/src/base/debug/stack_trace_win.cc',
1164            '<(V8_ROOT)/src/base/platform/platform-win32.cc',
1165            '<(V8_ROOT)/src/base/win32-headers.h',
1166          ],
1167          'defines': ['_CRT_RAND_S'], # for rand_s()
1168          'direct_dependent_settings': {
1169            'msvs_settings': {
1170              'VCLinkerTool': {
1171                'AdditionalDependencies': [
1172                  'dbghelp.lib',
1173                  'winmm.lib',
1174                  'ws2_32.lib'
1175                ]
1176              }
1177            },
1178            'conditions': [
1179              ['v8_enable_system_instrumentation==1', {
1180                'msvs_settings': {
1181                  'VCLinkerTool': {
1182                    'AdditionalDependencies': [
1183                      'advapi32.lib',
1184                    ],
1185                  },
1186                },
1187              }],
1188            ],
1189          },
1190        }],
1191        ['target_arch == "mips" or OS == "mips64"', {
1192          # here just for 'BUILD.gn' sync
1193          # 'data': [
1194          #   '<(V8_ROOT)/tools/mips_toolchain/sysroot/usr/lib/',
1195          #   '<(V8_ROOT)/tools/mips_toolchain/sysroot/usr/lib/',
1196          # ],
1197        }],
1198        # end of conditions from 'BUILD.gn'
1199
1200        # Node.js validated
1201        ['OS=="solaris"', {
1202          'link_settings': {
1203            'libraries': [
1204              '-lnsl',
1205              '-lrt',
1206            ]
1207          },
1208          'sources': [
1209            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1210            '<(V8_ROOT)/src/base/platform/platform-solaris.cc',
1211          ],
1212        }],
1213
1214        # YMMV with the following conditions
1215        ['OS=="qnx"', {
1216          'link_settings': {
1217            'target_conditions': [
1218              ['_toolset=="host" and host_os=="linux"', {
1219                'libraries': [
1220                  '-lrt'
1221                ],
1222              }],
1223              ['_toolset=="target"', {
1224                'libraries': [
1225                  '-lbacktrace'
1226                ],
1227              }],
1228            ],
1229          },
1230          'sources': [
1231            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1232            '<(V8_ROOT)/src/base/platform/platform-posix.h',
1233            '<(V8_ROOT)/src/base/platform/platform-posix.cc',
1234            '<(V8_ROOT)/src/base/platform/platform-posix-time.h',
1235            '<(V8_ROOT)/src/base/platform/platform-posix-time.cc',
1236            '<(V8_ROOT)/src/base/qnx-math.h'
1237          ],
1238          'target_conditions': [
1239            ['_toolset=="host" and host_os=="linux"', {
1240              'sources': [
1241                '<(V8_ROOT)/src/base/platform/platform-linux.cc'
1242              ],
1243            }],
1244            ['_toolset=="host" and host_os=="mac"', {
1245              'sources': [
1246                '<(V8_ROOT)/src/base/platform/platform-macos.cc'
1247              ],
1248            }],
1249            ['_toolset=="target"', {
1250              'sources': [
1251                '<(V8_ROOT)/src/base/platform/platform-qnx.cc'
1252              ],
1253            }],
1254          ],
1255        },
1256         ],
1257        ['OS=="freebsd"', {
1258          'link_settings': {
1259            'libraries': [
1260              '-L/usr/local/lib -lexecinfo',
1261            ]
1262          },
1263          'sources': [
1264            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1265            '<(V8_ROOT)/src/base/platform/platform-freebsd.cc',
1266            '<(V8_ROOT)/src/base/platform/platform-posix.h',
1267            '<(V8_ROOT)/src/base/platform/platform-posix.cc',
1268            '<(V8_ROOT)/src/base/platform/platform-posix-time.h',
1269            '<(V8_ROOT)/src/base/platform/platform-posix-time.cc',
1270          ],
1271        }
1272         ],
1273        ['OS=="openbsd"', {
1274          'link_settings': {
1275            'libraries': [
1276              '-L/usr/local/lib -lexecinfo',
1277            ]
1278          },
1279          'sources': [
1280            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1281            '<(V8_ROOT)/src/base/platform/platform-openbsd.cc',
1282            '<(V8_ROOT)/src/base/platform/platform-posix.h',
1283            '<(V8_ROOT)/src/base/platform/platform-posix.cc',
1284            '<(V8_ROOT)/src/base/platform/platform-posix-time.h',
1285            '<(V8_ROOT)/src/base/platform/platform-posix-time.cc',
1286          ],
1287        }
1288         ],
1289        ['OS=="netbsd"', {
1290          'link_settings': {
1291            'libraries': [
1292              '-L/usr/pkg/lib -Wl,-R/usr/pkg/lib -lexecinfo',
1293            ]
1294          },
1295          'sources': [
1296            '<(V8_ROOT)/src/base/debug/stack_trace_posix.cc',
1297            '<(V8_ROOT)/src/base/platform/platform-openbsd.cc',
1298            '<(V8_ROOT)/src/base/platform/platform-posix.h',
1299            '<(V8_ROOT)/src/base/platform/platform-posix.cc',
1300            '<(V8_ROOT)/src/base/platform/platform-posix-time.h',
1301            '<(V8_ROOT)/src/base/platform/platform-posix-time.cc',
1302          ],
1303        }
1304         ],
1305      ],
1306    },  # v8_libbase
1307    {
1308      'target_name': 'v8_libplatform',
1309      'type': 'static_library',
1310      'toolsets': ['host', 'target'],
1311      'dependencies': [
1312        'v8_libbase',
1313      ],
1314      'sources': [
1315        '<(V8_ROOT)/base/trace_event/common/trace_event_common.h',
1316        '<(V8_ROOT)/include/libplatform/libplatform-export.h',
1317        '<(V8_ROOT)/include/libplatform/libplatform.h',
1318        '<(V8_ROOT)/include/libplatform/v8-tracing.h',
1319        '<(V8_ROOT)/src/libplatform/default-foreground-task-runner.cc',
1320        '<(V8_ROOT)/src/libplatform/default-foreground-task-runner.h',
1321        '<(V8_ROOT)/src/libplatform/default-job.cc',
1322        '<(V8_ROOT)/src/libplatform/default-job.h',
1323        '<(V8_ROOT)/src/libplatform/default-platform.cc',
1324        '<(V8_ROOT)/src/libplatform/default-platform.h',
1325        '<(V8_ROOT)/src/libplatform/default-worker-threads-task-runner.cc',
1326        '<(V8_ROOT)/src/libplatform/default-worker-threads-task-runner.h',
1327        '<(V8_ROOT)/src/libplatform/delayed-task-queue.cc',
1328        '<(V8_ROOT)/src/libplatform/delayed-task-queue.h',
1329        '<(V8_ROOT)/src/libplatform/task-queue.cc',
1330        '<(V8_ROOT)/src/libplatform/task-queue.h',
1331        '<(V8_ROOT)/src/libplatform/tracing/trace-buffer.cc',
1332        '<(V8_ROOT)/src/libplatform/tracing/trace-buffer.h',
1333        '<(V8_ROOT)/src/libplatform/tracing/trace-config.cc',
1334        '<(V8_ROOT)/src/libplatform/tracing/trace-object.cc',
1335        '<(V8_ROOT)/src/libplatform/tracing/trace-writer.cc',
1336        '<(V8_ROOT)/src/libplatform/tracing/trace-writer.h',
1337        '<(V8_ROOT)/src/libplatform/tracing/tracing-controller.cc',
1338        '<(V8_ROOT)/src/libplatform/worker-thread.cc',
1339        '<(V8_ROOT)/src/libplatform/worker-thread.h',
1340      ],
1341      'conditions': [
1342        ['component=="shared_library"', {
1343          'direct_dependent_settings': {
1344            'defines': ['USING_V8_PLATFORM_SHARED'],
1345          },
1346          'defines': ['BUILDING_V8_PLATFORM_SHARED'],
1347        }],
1348        ['v8_use_perfetto==1', {
1349          'sources!': [
1350            '<(V8_ROOT)/base/trace_event/common/trace_event_common.h',
1351            '<(V8_ROOT)/src/libplatform/tracing/trace-buffer.cc',
1352            '<(V8_ROOT)/src/libplatform/tracing/trace-buffer.h',
1353            '<(V8_ROOT)/src/libplatform/tracing/trace-object.cc',
1354            '<(V8_ROOT)/src/libplatform/tracing/trace-writer.cc',
1355            '<(V8_ROOT)/src/libplatform/tracing/trace-writer.h',
1356          ],
1357          'sources': [
1358            '<(V8_ROOT)/src/libplatform/tracing/trace-event-listener.cc',
1359            '<(V8_ROOT)/src/libplatform/tracing/trace-event-listener.h',
1360          ],
1361          'dependencies': [
1362            '<(V8_ROOT)/third_party/perfetto:libperfetto',
1363            '<(V8_ROOT)/third_party/perfetto/protos/perfetto/trace:lite',
1364          ],
1365        }],
1366        ['v8_enable_system_instrumentation==1 and is_win', {
1367          'sources': [
1368            '<(V8_ROOT)/src/libplatform/tracing/recorder.h',
1369            '<(V8_ROOT)/src/libplatform/tracing/recorder-win.cc',
1370          ],
1371        }],
1372        ['v8_enable_system_instrumentation==1 and OS=="mac"', {
1373          'sources': [
1374            '<(V8_ROOT)/src/libplatform/tracing/recorder.h',
1375            '<(V8_ROOT)/src/libplatform/tracing/recorder-mac.cc',
1376          ],
1377        }],
1378      ],
1379      'direct_dependent_settings': {
1380        'include_dirs': [
1381          '<(V8_ROOT)/include',
1382        ],
1383      },
1384    },  # v8_libplatform
1385    {
1386      'target_name': 'v8_libsampler',
1387      'type': 'static_library',
1388      'toolsets': ['host', 'target'],
1389      'dependencies': [
1390        'v8_libbase',
1391      ],
1392      'sources': [
1393        '<(V8_ROOT)/src/libsampler/sampler.cc',
1394        '<(V8_ROOT)/src/libsampler/sampler.h'
1395      ],
1396    },  # v8_libsampler
1397    {
1398      'target_name': 'bytecode_builtins_list_generator',
1399      'type': 'executable',
1400      'conditions': [
1401        ['want_separate_host_toolset', {
1402          'toolsets': ['host'],
1403        }],
1404        # Avoid excessive LTO
1405        ['enable_lto=="true"', {
1406          'ldflags': [ '-fno-lto' ],
1407        }],
1408      ],
1409      'defines!': [
1410        'BUILDING_V8_SHARED=1',
1411      ],
1412      'dependencies': [
1413        "v8_libbase",
1414        # "build/win:default_exe_manifest",
1415      ],
1416      'sources': [
1417        "<(V8_ROOT)/src/builtins/generate-bytecodes-builtins-list.cc",
1418        "<(V8_ROOT)/src/interpreter/bytecode-operands.cc",
1419        "<(V8_ROOT)/src/interpreter/bytecode-operands.h",
1420        "<(V8_ROOT)/src/interpreter/bytecode-traits.h",
1421        "<(V8_ROOT)/src/interpreter/bytecodes.cc",
1422        "<(V8_ROOT)/src/interpreter/bytecodes.h",
1423      ],
1424    },  # bytecode_builtins_list_generator
1425    {
1426      'target_name': 'mksnapshot',
1427      'type': 'executable',
1428      'dependencies': [
1429        'v8_base_without_compiler',
1430        'v8_compiler_for_mksnapshot',
1431        'v8_init',
1432        'v8_libbase',
1433        'v8_libplatform',
1434        'v8_maybe_icu',
1435        # "build/win:default_exe_manifest",
1436      ],
1437      'sources': [
1438        '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "\\"mksnapshot.*?sources = ")',
1439      ],
1440      'conditions': [
1441        ['want_separate_host_toolset', {
1442          'toolsets': ['host'],
1443        }],
1444        ['OS=="win"', {
1445          'msvs_precompiled_header': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.h',
1446          'msvs_precompiled_source': '<(V8_ROOT)/../../tools/msvs/pch/v8_pch.cc',
1447          'sources': [
1448            '<(_msvs_precompiled_header)',
1449            '<(_msvs_precompiled_source)',
1450          ],
1451        }],
1452        # Avoid excessive LTO
1453        ['enable_lto=="true"', {
1454          'ldflags': [ '-fno-lto' ],
1455        }],
1456      ],
1457    },  # mksnapshot
1458    {
1459      'target_name': 'torque',
1460      'type': 'executable',
1461      'dependencies': [
1462        'torque_base',
1463        # "build/win:default_exe_manifest",
1464      ],
1465      'conditions': [
1466        ['want_separate_host_toolset', {
1467          'toolsets': ['host'],
1468        }],
1469        # Avoid excessive LTO
1470        ['enable_lto=="true"', {
1471          'ldflags': [ '-fno-lto' ],
1472        }],
1473      ],
1474      'defines!': [
1475        '_HAS_EXCEPTIONS=0',
1476        'BUILDING_V8_SHARED=1',
1477      ],
1478      'cflags_cc!': ['-fno-exceptions'],
1479      'cflags_cc': ['-fexceptions'],
1480      'xcode_settings': {
1481        'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',  # -fexceptions
1482      },
1483      'msvs_settings': {
1484        'VCCLCompilerTool': {
1485          'RuntimeTypeInfo': 'true',
1486          'ExceptionHandling': 1,
1487        },
1488        'VCLinkerTool': {
1489          'AdditionalDependencies': [
1490            'dbghelp.lib',
1491            'winmm.lib',
1492            'ws2_32.lib'
1493          ]
1494        }
1495      },
1496      'sources': [
1497        "<(V8_ROOT)/src/torque/torque.cc",
1498      ],
1499    },  # torque
1500    {
1501      'target_name': 'torque-language-server',
1502      'type': 'executable',
1503      'conditions': [
1504        ['want_separate_host_toolset', {
1505          'toolsets': ['host'],
1506        }],
1507        # Avoid excessive LTO
1508        ['enable_lto=="true"', {
1509          'ldflags': [ '-fno-lto' ],
1510        }],
1511      ],
1512      'dependencies': [
1513        'torque_base',
1514        'torque_ls_base',
1515        # "build/win:default_exe_manifest",
1516      ],
1517      'defines!': [
1518        '_HAS_EXCEPTIONS=0',
1519        'BUILDING_V8_SHARED=1',
1520      ],
1521      'msvs_settings': {
1522        'VCCLCompilerTool': {
1523          'RuntimeTypeInfo': 'true',
1524          'ExceptionHandling': 1,
1525        },
1526      },
1527      'sources': [
1528        "<(V8_ROOT)/src/torque/ls/torque-language-server.cc",
1529      ],
1530    },  # torque-language-server
1531    {
1532      'target_name': 'gen-regexp-special-case',
1533      'type': 'executable',
1534      'dependencies': [
1535        'v8_libbase',
1536        # "build/win:default_exe_manifest",
1537        'v8_maybe_icu',
1538      ],
1539      'conditions': [
1540        ['want_separate_host_toolset', {
1541          'toolsets': ['host'],
1542        }],
1543        # Avoid excessive LTO
1544        ['enable_lto=="true"', {
1545          'ldflags': [ '-fno-lto' ],
1546        }],
1547      ],
1548      'sources': [
1549        "<(V8_ROOT)/src/regexp/gen-regexp-special-case.cc",
1550        "<(V8_ROOT)/src/regexp/special-case.h",
1551      ],
1552    },  # gen-regexp-special-case
1553    {
1554      'target_name': 'run_gen-regexp-special-case',
1555      'type': 'none',
1556      'toolsets': ['host', 'target'],
1557      'conditions': [
1558        ['want_separate_host_toolset', {
1559          'dependencies': ['gen-regexp-special-case#host'],
1560        }, {
1561          'dependencies': ['gen-regexp-special-case#target'],
1562        }],
1563        # Avoid excessive LTO
1564        ['enable_lto=="true"', {
1565          'ldflags': [ '-fno-lto' ],
1566        }],
1567      ],
1568      'actions': [
1569        {
1570          'action_name': 'run_gen-regexp-special-case_action',
1571          'inputs': [
1572            '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)gen-regexp-special-case<(EXECUTABLE_SUFFIX)',
1573          ],
1574          'outputs': [
1575            '<(SHARED_INTERMEDIATE_DIR)/src/regexp/special-case.cc',
1576          ],
1577          'action': [
1578            '<(python)',
1579            '<(V8_ROOT)/tools/run.py',
1580            '<@(_inputs)',
1581            '<@(_outputs)',
1582          ],
1583        },
1584      ],
1585    },  # run_gen-regexp-special-case
1586    {
1587      'target_name': 'v8_heap_base_headers',
1588      'type': 'none',
1589      'toolsets': ['host', 'target'],
1590      'direct_dependent_settings': {
1591        'sources': [
1592          '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_source_set.\\"v8_heap_base_headers.*?sources = ")',
1593        ],
1594      },
1595    },  # v8_heap_base_headers
1596    {
1597      'target_name': 'cppgc_base',
1598      'type': 'none',
1599      'toolsets': ['host', 'target'],
1600      'direct_dependent_settings': {
1601        'sources': [
1602          '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_source_set.\\"cppgc_base.*?sources = ")',
1603        ],
1604      },
1605    },  # cppgc_base
1606    {
1607      'target_name': 'v8_bigint',
1608      'type': 'none',
1609      'toolsets': ['host', 'target'],
1610      'direct_dependent_settings': {
1611        'sources': [
1612          '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_source_set.\\"v8_bigint.*?sources = ")',
1613        ],
1614        'conditions': [
1615          ['v8_advanced_bigint_algorithms==1', {
1616            'sources': [
1617              '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn"  "v8_source_set.\\"v8_bigint.*?v8_advanced_bigint_algorithms.*?sources \\+= ")',
1618            ],
1619          }],
1620        ],
1621      },
1622    },  # v8_bigint
1623    {
1624      'target_name': 'v8_heap_base',
1625      'type': 'none',
1626      'toolsets': ['host', 'target'],
1627      'direct_dependent_settings': {
1628        'sources': [
1629          '<(V8_ROOT)/src/heap/base/active-system-pages.cc',
1630          '<(V8_ROOT)/src/heap/base/stack.cc',
1631          '<(V8_ROOT)/src/heap/base/worklist.cc',
1632        ],
1633        'conditions': [
1634          ['enable_lto=="true"', {
1635            'cflags_cc': [ '-fno-lto' ],
1636          }],
1637          ['clang or OS!="win"', {
1638            'conditions': [
1639              ['_toolset == "host" and host_arch == "x64" or _toolset == "target" and target_arch=="x64"', {
1640                'sources': [
1641                  '<(V8_ROOT)/src/heap/base/asm/x64/push_registers_asm.cc',
1642                ],
1643              }],
1644              ['_toolset == "host" and host_arch == "ia32" or _toolset == "target" and target_arch=="ia32"', {
1645                'sources': [
1646                  '<(V8_ROOT)/src/heap/base/asm/ia32/push_registers_asm.cc',
1647                ],
1648              }],
1649              ['_toolset == "host" and host_arch == "arm" or _toolset == "target" and target_arch=="arm"', {
1650                'sources': [
1651                  '<(V8_ROOT)/src/heap/base/asm/arm/push_registers_asm.cc',
1652                ],
1653              }],
1654              ['_toolset == "host" and host_arch == "arm64" or _toolset == "target" and target_arch=="arm64"', {
1655                'sources': [
1656                  '<(V8_ROOT)/src/heap/base/asm/arm64/push_registers_asm.cc',
1657                ],
1658              }],
1659              ['_toolset == "host" and host_arch == "ppc64" or _toolset == "target" and target_arch=="ppc64"', {
1660                'sources': [
1661                  '<(V8_ROOT)/src/heap/base/asm/ppc/push_registers_asm.cc',
1662                ],
1663              }],
1664              ['_toolset == "host" and host_arch == "s390x" or _toolset == "target" and target_arch=="s390x"', {
1665                'sources': [
1666                  '<(V8_ROOT)/src/heap/base/asm/s390/push_registers_asm.cc',
1667                ],
1668              }],
1669              ['_toolset == "host" and host_arch == "mips" or _toolset == "target" and target_arch=="mips" or _toolset == "host" and host_arch == "mipsel" or _toolset == "target" and target_arch=="mipsel"', {
1670                'sources': [
1671                  '<(V8_ROOT)/src/heap/base/asm/mips/push_registers_asm.cc',
1672                ],
1673              }],
1674              ['_toolset == "host" and host_arch == "mips64" or _toolset == "target" and target_arch=="mips64" or _toolset == "host" and host_arch == "mips64el" or _toolset == "target" and target_arch=="mips64el"', {
1675                'sources': [
1676                  '<(V8_ROOT)/src/heap/base/asm/mips64/push_registers_asm.cc',
1677                ],
1678              }],
1679              ['_toolset == "host" and host_arch == "riscv64" or _toolset == "target" and target_arch=="riscv64"', {
1680                'sources': [
1681                  '<(V8_ROOT)/src/heap/base/asm/riscv64/push_registers_asm.cc',
1682                ],
1683              }],
1684              ['_toolset == "host" and host_arch == "loong64" or _toolset == "target" and target_arch=="loong64"', {
1685                'sources': [
1686                  '<(V8_ROOT)/src/heap/base/asm/loong64/push_registers_asm.cc',
1687                ],
1688              }],
1689            ]
1690          }],
1691          ['OS=="win"', {
1692            'conditions': [
1693              ['_toolset == "host" and host_arch == "x64" or _toolset == "target" and target_arch=="x64"', {
1694                'sources': [
1695                  '<(V8_ROOT)/src/heap/base/asm/x64/push_registers_masm.S',
1696                ],
1697              }],
1698              ['_toolset == "host" and host_arch == "ia32" or _toolset == "target" and target_arch=="ia32"', {
1699                'sources': [
1700                  '<(V8_ROOT)/src/heap/base/asm/ia32/push_registers_masm.S',
1701                ],
1702              }],
1703              ['_toolset == "host" and host_arch == "arm64" or _toolset == "target" and target_arch=="arm64"', {
1704                'sources': [
1705                  '<(V8_ROOT)/src/heap/base/asm/arm64/push_registers_masm.S',
1706                ],
1707              }],
1708            ],
1709          }],
1710        ],
1711      },
1712    },  # v8_heap_base
1713
1714    ###############################################################################
1715    # Public targets
1716    #
1717
1718    {
1719      'target_name': 'v8',
1720      'hard_dependency': 1,
1721      'toolsets': ['target'],
1722      'dependencies': [
1723        'v8_snapshot',
1724      ],
1725      'conditions': [
1726        ['component=="shared_library"', {
1727          'type': '<(component)',
1728          'sources': [
1729            # Note: on non-Windows we still build this file so that gyp
1730            # has some sources to link into the component.
1731            '<(V8_ROOT)/src/utils/v8dll-main.cc',
1732          ],
1733          'defines': [
1734            'BUILDING_V8_SHARED',
1735          ],
1736          'direct_dependent_settings': {
1737            'defines': [
1738              'USING_V8_SHARED',
1739            ],
1740          },
1741          'conditions': [
1742            ['OS=="mac"', {
1743              'xcode_settings': {
1744                'OTHER_LDFLAGS': ['-dynamiclib', '-all_load']
1745              },
1746            }],
1747            ['soname_version!=""', {
1748              'product_extension': 'so.<(soname_version)',
1749            }],
1750          ],
1751        },
1752         {
1753           'type': 'static_library',
1754         }],
1755      ],
1756      'direct_dependent_settings': {
1757        'include_dirs': [
1758          '<(V8_ROOT)/include',
1759        ],
1760      },
1761      'actions': [
1762        {
1763          'action_name': 'v8_dump_build_config',
1764          'inputs': [
1765            '<(V8_ROOT)/tools/testrunner/utils/dump_build_config_gyp.py',
1766          ],
1767          'outputs': [
1768            '<(PRODUCT_DIR)/v8_build_config.json',
1769          ],
1770          'variables': {
1771            'v8_dump_build_config_args': [
1772              '<(PRODUCT_DIR)/v8_build_config.json',
1773              'current_cpu=<(v8_current_cpu)',
1774              'dcheck_always_on=<(dcheck_always_on)',
1775              'is_android=<(is_android)',
1776              'is_asan=<(asan)',
1777              'is_cfi=<(cfi_vptr)',
1778              'is_clang=<(clang)',
1779              'is_component_build=<(component)',
1780              'is_debug=<(CONFIGURATION_NAME)',
1781              # Not available in gyp.
1782              'is_full_debug=0',
1783              # Not available in gyp.
1784              'is_gcov_coverage=0',
1785              'is_msan=<(msan)',
1786              'is_tsan=<(tsan)',
1787              # Not available in gyp.
1788              'is_ubsan_vptr=0',
1789              'target_cpu=<(target_arch)',
1790              'v8_current_cpu=<(v8_current_cpu)',
1791              'v8_enable_atomic_object_field_writes=<(v8_enable_atomic_object_field_writes)',
1792              'v8_enable_concurrent_marking=<(v8_enable_concurrent_marking)',
1793              'v8_enable_i18n_support=<(v8_enable_i18n_support)',
1794              'v8_enable_verify_predictable=<(v8_enable_verify_predictable)',
1795              'v8_enable_verify_csa=<(v8_enable_verify_csa)',
1796              'v8_enable_lite_mode=<(v8_enable_lite_mode)',
1797              'v8_enable_pointer_compression=<(v8_enable_pointer_compression)',
1798              'v8_enable_shared_ro_heap=<(v8_enable_shared_ro_heap)',
1799              'v8_enable_webassembly=<(v8_enable_webassembly)',
1800              # Not available in gyp.
1801              'v8_control_flow_integrity=0',
1802              'v8_target_cpu=<(v8_target_arch)',
1803            ]
1804          },
1805          'conditions': [
1806            ['v8_target_arch=="mips" or v8_target_arch=="mipsel" \
1807              or v8_target_arch=="mips64" or v8_target_arch=="mips64el"', {
1808              'v8_dump_build_config_args': [
1809                'mips_arch_variant=<(mips_arch_variant)',
1810                'mips_use_msa=<(mips_use_msa)',
1811              ],
1812            }],
1813          ],
1814          'action': [
1815            '<(python)', '<(V8_ROOT)/tools/testrunner/utils/dump_build_config_gyp.py',
1816            '<@(v8_dump_build_config_args)',
1817          ],
1818        },
1819      ],
1820    },  # v8
1821    # missing a bunch of fuzzer targets
1822
1823    ###############################################################################
1824    # Protobuf targets, used only when building outside of chromium.
1825    #
1826
1827    {
1828      'target_name': 'postmortem-metadata',
1829      'type': 'none',
1830      'toolsets': ['host', 'target'],
1831      'dependencies': ['run_torque'],
1832      'variables': {
1833        'heapobject_files': [
1834          '<(SHARED_INTERMEDIATE_DIR)/torque-generated/instance-types.h',
1835          '<(V8_ROOT)/src/objects/allocation-site.h',
1836          '<(V8_ROOT)/src/objects/allocation-site-inl.h',
1837          '<(V8_ROOT)/src/objects/cell.h',
1838          '<(V8_ROOT)/src/objects/cell-inl.h',
1839          '<(V8_ROOT)/src/objects/code.h',
1840          '<(V8_ROOT)/src/objects/code-inl.h',
1841          '<(V8_ROOT)/src/objects/data-handler.h',
1842          '<(V8_ROOT)/src/objects/data-handler-inl.h',
1843          '<(V8_ROOT)/src/objects/descriptor-array.h',
1844          '<(V8_ROOT)/src/objects/descriptor-array-inl.h',
1845          '<(V8_ROOT)/src/objects/feedback-cell.h',
1846          '<(V8_ROOT)/src/objects/feedback-cell-inl.h',
1847          '<(V8_ROOT)/src/objects/fixed-array.h',
1848          '<(V8_ROOT)/src/objects/fixed-array-inl.h',
1849          '<(V8_ROOT)/src/objects/heap-number.h',
1850          '<(V8_ROOT)/src/objects/heap-number-inl.h',
1851          '<(V8_ROOT)/src/objects/heap-object.h',
1852          '<(V8_ROOT)/src/objects/heap-object-inl.h',
1853          '<(V8_ROOT)/src/objects/instance-type.h',
1854          '<(V8_ROOT)/src/objects/js-array-buffer.h',
1855          '<(V8_ROOT)/src/objects/js-array-buffer-inl.h',
1856          '<(V8_ROOT)/src/objects/js-array.h',
1857          '<(V8_ROOT)/src/objects/js-array-inl.h',
1858          '<(V8_ROOT)/src/objects/js-function-inl.h',
1859          '<(V8_ROOT)/src/objects/js-function.cc',
1860          '<(V8_ROOT)/src/objects/js-function.h',
1861          '<(V8_ROOT)/src/objects/js-objects.cc',
1862          '<(V8_ROOT)/src/objects/js-objects.h',
1863          '<(V8_ROOT)/src/objects/js-objects-inl.h',
1864          '<(V8_ROOT)/src/objects/js-promise.h',
1865          '<(V8_ROOT)/src/objects/js-promise-inl.h',
1866          '<(V8_ROOT)/src/objects/js-regexp.cc',
1867          '<(V8_ROOT)/src/objects/js-regexp.h',
1868          '<(V8_ROOT)/src/objects/js-regexp-inl.h',
1869          '<(V8_ROOT)/src/objects/js-regexp-string-iterator.h',
1870          '<(V8_ROOT)/src/objects/js-regexp-string-iterator-inl.h',
1871          '<(V8_ROOT)/src/objects/map.cc',
1872          '<(V8_ROOT)/src/objects/map.h',
1873          '<(V8_ROOT)/src/objects/map-inl.h',
1874          '<(V8_ROOT)/src/objects/name.h',
1875          '<(V8_ROOT)/src/objects/name-inl.h',
1876          '<(V8_ROOT)/src/objects/objects.h',
1877          '<(V8_ROOT)/src/objects/objects-inl.h',
1878          '<(V8_ROOT)/src/objects/oddball.h',
1879          '<(V8_ROOT)/src/objects/oddball-inl.h',
1880          '<(V8_ROOT)/src/objects/primitive-heap-object.h',
1881          '<(V8_ROOT)/src/objects/primitive-heap-object-inl.h',
1882          '<(V8_ROOT)/src/objects/scope-info.h',
1883          '<(V8_ROOT)/src/objects/scope-info-inl.h',
1884          '<(V8_ROOT)/src/objects/script.h',
1885          '<(V8_ROOT)/src/objects/script-inl.h',
1886          '<(V8_ROOT)/src/objects/shared-function-info.cc',
1887          '<(V8_ROOT)/src/objects/shared-function-info.h',
1888          '<(V8_ROOT)/src/objects/shared-function-info-inl.h',
1889          '<(V8_ROOT)/src/objects/string.cc',
1890          '<(V8_ROOT)/src/objects/string-comparator.cc',
1891          '<(V8_ROOT)/src/objects/string-comparator.h',
1892          '<(V8_ROOT)/src/objects/string.h',
1893          '<(V8_ROOT)/src/objects/string-inl.h',
1894          '<(V8_ROOT)/src/objects/struct.h',
1895          '<(V8_ROOT)/src/objects/struct-inl.h',
1896        ],
1897      },
1898      'actions': [
1899        {
1900          'action_name': 'gen-postmortem-metadata',
1901          'inputs': [
1902            '<(V8_ROOT)/tools/gen-postmortem-metadata.py',
1903            '<@(heapobject_files)',
1904          ],
1905          'outputs': [
1906            '<(SHARED_INTERMEDIATE_DIR)/debug-support.cc',
1907          ],
1908          'action': [
1909            '<(python)',
1910            '<(V8_ROOT)/tools/gen-postmortem-metadata.py',
1911            '<@(_outputs)',
1912            '<@(heapobject_files)'
1913          ],
1914        },
1915      ],
1916      'direct_dependent_settings': {
1917        'sources': ['<(SHARED_INTERMEDIATE_DIR)/debug-support.cc', ],
1918      },
1919    },  # postmortem-metadata
1920
1921    {
1922      'target_name': 'v8_zlib',
1923      'type': 'static_library',
1924      'toolsets': ['host', 'target'],
1925      'conditions': [
1926        ['OS=="win"', {
1927          'conditions': [
1928            ['"<(target_arch)"=="arm64" and _toolset=="target"', {
1929              'defines': ['CPU_NO_SIMD']
1930            }, {
1931              'defines': ['X86_WINDOWS']
1932            }]
1933          ]
1934        }],
1935      ],
1936      'direct_dependent_settings': {
1937        'include_dirs': [
1938          '<(V8_ROOT)/third_party/zlib',
1939          '<(V8_ROOT)/third_party/zlib/google',
1940        ],
1941      },
1942      'defines': [ 'ZLIB_IMPLEMENTATION' ],
1943      'include_dirs': [
1944        '<(V8_ROOT)/third_party/zlib',
1945        '<(V8_ROOT)/third_party/zlib/google',
1946      ],
1947      'sources': [
1948        '<(V8_ROOT)/third_party/zlib/adler32.c',
1949        '<(V8_ROOT)/third_party/zlib/chromeconf.h',
1950        '<(V8_ROOT)/third_party/zlib/compress.c',
1951        '<(V8_ROOT)/third_party/zlib/contrib/optimizations/insert_string.h',
1952        '<(V8_ROOT)/third_party/zlib/contrib/optimizations/insert_string.h',
1953        '<(V8_ROOT)/third_party/zlib/cpu_features.c',
1954        '<(V8_ROOT)/third_party/zlib/cpu_features.h',
1955        '<(V8_ROOT)/third_party/zlib/crc32.c',
1956        '<(V8_ROOT)/third_party/zlib/crc32.h',
1957        '<(V8_ROOT)/third_party/zlib/deflate.c',
1958        '<(V8_ROOT)/third_party/zlib/deflate.h',
1959        '<(V8_ROOT)/third_party/zlib/gzclose.c',
1960        '<(V8_ROOT)/third_party/zlib/gzguts.h',
1961        '<(V8_ROOT)/third_party/zlib/gzlib.c',
1962        '<(V8_ROOT)/third_party/zlib/gzread.c',
1963        '<(V8_ROOT)/third_party/zlib/gzwrite.c',
1964        '<(V8_ROOT)/third_party/zlib/infback.c',
1965        '<(V8_ROOT)/third_party/zlib/inffast.c',
1966        '<(V8_ROOT)/third_party/zlib/inffast.h',
1967        '<(V8_ROOT)/third_party/zlib/inffixed.h',
1968        '<(V8_ROOT)/third_party/zlib/inflate.c',
1969        '<(V8_ROOT)/third_party/zlib/inflate.h',
1970        '<(V8_ROOT)/third_party/zlib/inftrees.c',
1971        '<(V8_ROOT)/third_party/zlib/inftrees.h',
1972        '<(V8_ROOT)/third_party/zlib/trees.c',
1973        '<(V8_ROOT)/third_party/zlib/trees.h',
1974        '<(V8_ROOT)/third_party/zlib/uncompr.c',
1975        '<(V8_ROOT)/third_party/zlib/zconf.h',
1976        '<(V8_ROOT)/third_party/zlib/zlib.h',
1977        '<(V8_ROOT)/third_party/zlib/zutil.c',
1978        '<(V8_ROOT)/third_party/zlib/zutil.h',
1979        '<(V8_ROOT)/third_party/zlib/google/compression_utils_portable.cc',
1980        '<(V8_ROOT)/third_party/zlib/google/compression_utils_portable.h',
1981      ],
1982    },  # v8_zlib
1983  ],
1984}
1985