xref: /third_party/node/node.gyp (revision 1cb0ef41)
1{
2  'variables': {
3    'v8_use_siphash%': 0,
4    'v8_trace_maps%': 0,
5    'v8_enable_pointer_compression%': 0,
6    'v8_enable_31bit_smis_on_64bit_arch%': 0,
7    'node_use_dtrace%': 'false',
8    'node_use_etw%': 'false',
9    'node_no_browser_globals%': 'false',
10    'node_snapshot_main%': '',
11    'node_use_node_snapshot%': 'false',
12    'node_use_v8_platform%': 'true',
13    'node_use_bundled_v8%': 'true',
14    'node_shared%': 'false',
15    'force_dynamic_crt%': 0,
16    'ossfuzz' : 'false',
17    'node_module_version%': '',
18    'node_shared_brotli%': 'false',
19    'node_shared_zlib%': 'false',
20    'node_shared_http_parser%': 'false',
21    'node_shared_cares%': 'false',
22    'node_shared_libuv%': 'false',
23    'node_shared_nghttp2%': 'false',
24    'node_use_openssl%': 'true',
25    'node_shared_openssl%': 'false',
26    'node_v8_options%': '',
27    'node_enable_v8_vtunejit%': 'false',
28    'node_core_target_name%': 'node',
29    'node_lib_target_name%': 'libjsvm',
30    'node_intermediate_lib_type%': 'static_library',
31    'node_builtin_modules_path%': '',
32    'TARGET_DIR': '$(TARGET_GEN_DIR)',
33    'NDK_SYS_ROOT': '<(TARGET_DIR)/../../../../..',
34    'linked_module_files': [
35    ],
36    # We list the deps/ files out instead of globbing them in js2c.py since we
37    # only include a subset of all the files under these directories.
38    # The lengths of their file names combined should not exceed the
39    # Windows command length limit or there would be an error.
40    # See https://docs.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/command-line-string-limitation
41    'library_files': [
42      '<@(node_library_files)',
43      '<@(linked_module_files)',
44    ],
45    'deps_files': [
46      'deps/v8/tools/splaytree.mjs',
47      'deps/v8/tools/codemap.mjs',
48      'deps/v8/tools/consarray.mjs',
49      'deps/v8/tools/csvparser.mjs',
50      'deps/v8/tools/profile.mjs',
51      'deps/v8/tools/profile_view.mjs',
52      'deps/v8/tools/logreader.mjs',
53      'deps/v8/tools/arguments.mjs',
54      'deps/v8/tools/tickprocessor.mjs',
55      'deps/v8/tools/sourcemap.mjs',
56      'deps/v8/tools/tickprocessor-driver.mjs',
57      'deps/acorn/acorn/dist/acorn.js',
58      'deps/acorn/acorn-walk/dist/walk.js',
59      'deps/minimatch/index.js',
60      '<@(node_builtin_shareable_builtins)',
61    ],
62    'node_mksnapshot_exec': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)node_mksnapshot<(EXECUTABLE_SUFFIX)',
63    'conditions': [
64      ['GENERATOR == "ninja"', {
65        'node_text_start_object_path': 'src/large_pages/node_text_start.node_text_start.o'
66      }, {
67        'node_text_start_object_path': 'node_text_start/src/large_pages/node_text_start.o'
68      }],
69      [ 'node_shared=="true"', {
70        'node_target_type%': 'shared_library',
71        'conditions': [
72          ['OS in "aix os400"', {
73            # For AIX, always generate static library first,
74            # It needs an extra step to generate exp and
75            # then use both static lib and exp to create
76            # shared lib.
77            'node_intermediate_lib_type': 'static_library',
78          }, {
79            'node_intermediate_lib_type': 'shared_library',
80          }],
81        ],
82      }, {
83        'node_target_type%': 'executable',
84      }],
85      [ 'OS=="win" and '
86        'node_use_openssl=="true" and '
87        'node_shared_openssl=="false"', {
88        'use_openssl_def%': 1,
89      }, {
90        'use_openssl_def%': 0,
91      }],
92    ],
93  },
94
95  'target_defaults': {
96    # Putting these explicitly here so not to depend on `common.gypi`.
97    # `common.gypi` need to be more general because it is used to build userland native addons.
98    # Refs: https://github.com/nodejs/node-gyp/issues/1118
99    'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
100    'xcode_settings': {
101      'WARNING_CFLAGS': [
102        '-Wall',
103        '-Wendif-labels',
104        '-W',
105        '-Wno-unused-parameter',
106        '-Werror=undefined-inline',
107        '-Werror=extra-semi',
108      ],
109    },
110
111    # Relevant only for x86.
112    # Refs: https://github.com/nodejs/node/pull/25852
113    # Refs: https://docs.microsoft.com/en-us/cpp/build/reference/safeseh-image-has-safe-exception-handlers
114    'msvs_settings': {
115      'VCLinkerTool': {
116        'ImageHasSafeExceptionHandlers': 'false',
117      },
118    },
119
120    'conditions': [
121      ['OS in "aix os400"', {
122        'ldflags': [
123          '-Wl,-bnoerrmsg',
124        ],
125      }],
126      #['OS == "linux" and llvm_version != "0.0"', {
127      #  'libraries': ['-latomic'],
128      #}],
129    ],
130  },
131
132  'targets': [
133    {
134      'target_name': 'node_text_start',
135      'type': 'none',
136      'conditions': [
137        [ 'OS in "linux freebsd solaris" and '
138          'target_arch=="x64"', {
139          'type': 'static_library',
140          'sources': [
141            'src/large_pages/node_text_start.S'
142          ]
143        }],
144      ]
145    },
146    {
147      'target_name': '<(node_core_target_name)',
148      'type': 'executable',
149
150      'defines': [
151        'NODE_ARCH="<(target_arch)"',
152        'NODE_PLATFORM="<(OS)"',
153        'NODE_WANT_INTERNALS=1',
154      ],
155
156      'includes': [
157        'node.gypi'
158      ],
159
160      'include_dirs': [
161        'src',
162        'deps/v8/include',
163        'deps/postject'
164      ],
165
166      'sources': [
167        'src/node_main.cc'
168      ],
169
170      'dependencies': [
171        'deps/histogram/histogram.gyp:histogram',
172        'deps/uvwasi/uvwasi.gyp:uvwasi',
173      ],
174
175      'msvs_settings': {
176        'VCLinkerTool': {
177          'GenerateMapFile': 'true', # /MAP
178          'MapExports': 'true', # /MAPINFO:EXPORTS
179          'RandomizedBaseAddress': 2, # enable ASLR
180          'DataExecutionPrevention': 2, # enable DEP
181          'AllowIsolation': 'true',
182          # By default, the MSVC linker only reserves 1 MiB of stack memory for
183          # each thread, whereas other platforms typically allow much larger
184          # stack memory sections. We raise the limit to make it more consistent
185          # across platforms and to support the few use cases that require large
186          # amounts of stack memory, without having to modify the node binary.
187          'StackReserveSize': 0x800000,
188        },
189      },
190
191      # - "C4244: conversion from 'type1' to 'type2', possible loss of data"
192      #   Ususaly safe. Disable for `dep`, enable for `src`
193      'msvs_disabled_warnings!': [4244],
194
195      'conditions': [
196        [ 'error_on_warn=="true"', {
197          'cflags': ['-Werror'],
198          'xcode_settings': {
199            'WARNING_CFLAGS': [ '-Werror' ],
200          },
201        }],
202        [ 'node_intermediate_lib_type=="static_library" and '
203            'node_shared=="true" and OS in "aix os400"', {
204          # For AIX, shared lib is linked by static lib and .exp. In the
205          # case here, the executable needs to link to shared lib.
206          # Therefore, use 'node_aix_shared' target to generate the
207          # shared lib and then executable.
208          'dependencies': [ 'node_aix_shared' ],
209        }, {
210          'dependencies': [ '<(node_lib_target_name)' ],
211          'conditions': [
212            ['OS=="win" and node_shared=="true"', {
213              'dependencies': ['generate_node_def'],
214              'msvs_settings': {
215                'VCLinkerTool': {
216                  'ModuleDefinitionFile': '<(PRODUCT_DIR)/<(node_core_target_name).def',
217                },
218              },
219            }],
220          ],
221        }],
222        [ 'node_intermediate_lib_type=="static_library" and node_shared=="false"', {
223          'xcode_settings': {
224            'OTHER_LDFLAGS': [
225              '-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)<(node_core_target_name)<(STATIC_LIB_SUFFIX)',
226              '-Wl,-force_load,<(PRODUCT_DIR)/<(STATIC_LIB_PREFIX)v8_base_without_compiler<(STATIC_LIB_SUFFIX)',
227            ],
228          },
229          'msvs_settings': {
230            'VCLinkerTool': {
231              'AdditionalOptions': [
232                '/WHOLEARCHIVE:<(node_lib_target_name)<(STATIC_LIB_SUFFIX)',
233                '/WHOLEARCHIVE:<(STATIC_LIB_PREFIX)v8_base_without_compiler<(STATIC_LIB_SUFFIX)',
234              ],
235            },
236          },
237          'conditions': [
238            ['OS != "aix" and OS != "os400" and OS != "mac" and OS != "ios"', {
239              'ldflags': [
240                '-Wl,--whole-archive',
241                '<(obj_dir)/<(STATIC_LIB_PREFIX)<(node_core_target_name)<(STATIC_LIB_SUFFIX)',
242                '<(obj_dir)/tools/v8_gypfiles/<(STATIC_LIB_PREFIX)v8_base_without_compiler<(STATIC_LIB_SUFFIX)',
243                '-Wl,--no-whole-archive',
244              ],
245            }],
246            [ 'OS=="win"', {
247              'sources': [ 'src/res/node.rc' ],
248              'conditions': [
249                [ 'node_use_etw=="true"', {
250                  'sources': [
251                    'tools/msvs/genfiles/node_etw_provider.rc'
252                  ],
253                }],
254              ],
255            }],
256          ],
257        }],
258        [ 'node_shared=="true"', {
259          'xcode_settings': {
260            'OTHER_LDFLAGS': [ '-Wl,-rpath,@loader_path', '-Wl,-rpath,@loader_path/../lib'],
261          },
262          'conditions': [
263            ['OS=="linux"', {
264               'ldflags': [
265                 '-Wl,-rpath,\\$$ORIGIN/../lib'
266               ],
267            }],
268          ],
269        }],
270        [ 'enable_lto=="true"', {
271          'xcode_settings': {
272            'OTHER_LDFLAGS': [
273              # man ld -export_dynamic:
274              # Preserves all global symbols in main executables during LTO.
275              # Without this option, Link Time Optimization is allowed to
276              # inline and remove global functions. This option is used when
277              # a main executable may load a plug-in which requires certain
278              # symbols from the main executable.
279              '-Wl,-export_dynamic',
280            ],
281          },
282        }],
283        ['OS=="win"', {
284          'libraries': [
285            'Dbghelp.lib',
286            'winmm.lib',
287            'Ws2_32.lib',
288          ],
289        }],
290        ['node_with_ltcg=="true"', {
291          'msvs_settings': {
292            'VCCLCompilerTool': {
293              'WholeProgramOptimization': 'true'   # /GL, whole program optimization, needed for LTCG
294            },
295            'VCLibrarianTool': {
296              'AdditionalOptions': [
297                '/LTCG:INCREMENTAL',               # link time code generation
298              ],
299            },
300            'VCLinkerTool': {
301              'OptimizeReferences': 2,             # /OPT:REF
302              'EnableCOMDATFolding': 2,            # /OPT:ICF
303              'LinkIncremental': 1,                # disable incremental linking
304              'AdditionalOptions': [
305                '/LTCG:INCREMENTAL',               # incremental link-time code generation
306              ],
307            }
308          }
309        }, {
310          'msvs_settings': {
311            'VCCLCompilerTool': {
312              'WholeProgramOptimization': 'false'
313            },
314            'VCLinkerTool': {
315              'LinkIncremental': 2                 # enable incremental linking
316            },
317          },
318         }],
319         ['node_use_node_snapshot=="true"', {
320          'dependencies': [
321            'node_mksnapshot',
322          ],
323          'conditions': [
324            ['node_snapshot_main!=""', {
325              'actions': [
326                {
327                  'action_name': 'node_mksnapshot',
328                  'process_outputs_as_sources': 1,
329                  'inputs': [
330                    '<(node_mksnapshot_exec)',
331                    '<(node_snapshot_main)',
332                  ],
333                  'outputs': [
334                    '<(SHARED_INTERMEDIATE_DIR)/node_snapshot.cc',
335                  ],
336                  'action': [
337                    '<(node_mksnapshot_exec)',
338                    '--build-snapshot',
339                    '<(node_snapshot_main)',
340                    '<@(_outputs)',
341                  ],
342                },
343              ],
344            }, {
345              'actions': [
346                {
347                  'action_name': 'node_mksnapshot',
348                  'process_outputs_as_sources': 1,
349                  'inputs': [
350                    '<(node_mksnapshot_exec)',
351                  ],
352                  'outputs': [
353                    '<(SHARED_INTERMEDIATE_DIR)/node_snapshot.cc',
354                  ],
355                  'action': [
356                    '<@(_inputs)',
357                    '<@(_outputs)',
358                  ],
359                },
360              ],
361            }],
362          ],
363          }, {
364          'sources': [
365            'src/node_snapshot_stub.cc'
366          ],
367        }],
368        [ 'OS in "linux freebsd" and '
369          'target_arch=="x64"', {
370          'dependencies': [ 'node_text_start' ],
371          'ldflags+': [
372            '<(obj_dir)/<(node_text_start_object_path)'
373          ]
374        }],
375
376        ['node_fipsinstall=="true"', {
377          'variables': {
378            'openssl-cli': '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)openssl-cli<(EXECUTABLE_SUFFIX)',
379            'provider_name': 'libopenssl-fipsmodule',
380            'opensslconfig': './deps/openssl/nodejs-openssl.cnf',
381            'conditions': [
382              ['GENERATOR == "ninja"', {
383	        'fipsmodule_internal': '<(PRODUCT_DIR)/lib/<(provider_name).so',
384                'fipsmodule': '<(PRODUCT_DIR)/obj/lib/openssl-modules/fips.so',
385                'fipsconfig': '<(PRODUCT_DIR)/obj/lib/fipsmodule.cnf',
386                'opensslconfig_internal': '<(PRODUCT_DIR)/obj/lib/openssl.cnf',
387             }, {
388	        'fipsmodule_internal': '<(PRODUCT_DIR)/obj.target/deps/openssl/<(provider_name).so',
389                'fipsmodule': '<(PRODUCT_DIR)/obj.target/deps/openssl/lib/openssl-modules/fips.so',
390                'fipsconfig': '<(PRODUCT_DIR)/obj.target/deps/openssl/fipsmodule.cnf',
391                'opensslconfig_internal': '<(PRODUCT_DIR)/obj.target/deps/openssl/openssl.cnf',
392             }],
393            ],
394          },
395          'actions': [
396            {
397              'action_name': 'fipsinstall',
398              'process_outputs_as_sources': 1,
399              'inputs': [
400                '<(fipsmodule_internal)',
401              ],
402              'outputs': [
403                '<(fipsconfig)',
404              ],
405              'action': [
406                '<(openssl-cli)', 'fipsinstall',
407                '-provider_name', '<(provider_name)',
408                '-module', '<(fipsmodule_internal)',
409                '-out', '<(fipsconfig)',
410                #'-quiet',
411              ],
412            },
413            {
414              'action_name': 'copy_fips_module',
415              'inputs': [
416                '<(fipsmodule_internal)',
417              ],
418              'outputs': [
419                '<(fipsmodule)',
420              ],
421              'action': [
422                'python', 'tools/copyfile.py',
423                '<(fipsmodule_internal)',
424                '<(fipsmodule)',
425              ],
426            },
427            {
428              'action_name': 'copy_openssl_cnf_and_include_fips_cnf',
429              'inputs': [ '<(opensslconfig)', ],
430              'outputs': [ '<(opensslconfig_internal)', ],
431              'action': [
432                'python', 'tools/enable_fips_include.py',
433                '<(opensslconfig)',
434                '<(opensslconfig_internal)',
435                '<(fipsconfig)',
436              ],
437            },
438          ],
439         }, {
440           'variables': {
441              'opensslconfig_internal': '<(obj_dir)/deps/openssl/openssl.cnf',
442              'opensslconfig': './deps/openssl/nodejs-openssl.cnf',
443           },
444           'actions': [
445             {
446               'action_name': 'reset_openssl_cnf',
447               'inputs': [ '<(opensslconfig)', ],
448               'outputs': [ '<(opensslconfig_internal)', ],
449               'action': [
450                 '<(python)', 'tools/copyfile.py',
451                 '<(opensslconfig)',
452                 '<(opensslconfig_internal)',
453               ],
454             },
455           ],
456         }],
457      ],
458    }, # node_core_target_name
459    {
460      'target_name': '<(node_lib_target_name)',
461      'type': '<(node_intermediate_lib_type)',
462      'includes': [
463        'node.gypi',
464      ],
465
466      'include_dirs': [
467        'src',
468        'deps/postject',
469        '../../base/startup/init/interfaces/innerkits/include/param',
470        '../../base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent/include',
471        '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
472      ],
473      'dependencies': [
474        'deps/base64/base64.gyp:base64',
475        'deps/googletest/googletest.gyp:gtest_prod',
476        'deps/histogram/histogram.gyp:histogram',
477        'deps/uvwasi/uvwasi.gyp:uvwasi',
478        'deps/simdutf/simdutf.gyp:simdutf',
479        'deps/ada/ada.gyp:ada',
480      ],
481
482      'sources': [
483        'src/api/async_resource.cc',
484        'src/api/callback.cc',
485        'src/api/embed_helpers.cc',
486        'src/api/encoding.cc',
487        'src/api/environment.cc',
488        'src/api/exceptions.cc',
489        'src/api/hooks.cc',
490        'src/api/utils.cc',
491        'src/async_wrap.cc',
492        'src/base_object.cc',
493        'src/cares_wrap.cc',
494        'src/cleanup_queue.cc',
495        'src/connect_wrap.cc',
496        'src/connection_wrap.cc',
497        'src/debug_utils.cc',
498        'src/env.cc',
499        'src/fs_event_wrap.cc',
500        'src/handle_wrap.cc',
501        'src/heap_utils.cc',
502        'src/histogram.cc',
503        'src/jsvm.h',
504        'src/jsvm_types.h',
505        'src/js_native_api_v8.cc',
506        'src/js_native_api_v8.h',
507        'src/js_native_api_v8_inspector.cc',
508        'src/js_native_api_v8_inspector.h',
509        'src/js_native_api_v8_internals.h',
510        'src/js_stream.cc',
511        'src/json_utils.cc',
512        'src/js_udp_wrap.cc',
513        'src/module_wrap.cc',
514        'src/node.cc',
515        'src/node_api.cc',
516        'src/node_binding.cc',
517        'src/node_blob.cc',
518        'src/node_buffer.cc',
519        'src/node_builtins.cc',
520        'src/node_config.cc',
521        'src/node_constants.cc',
522        'src/node_contextify.cc',
523        'src/node_credentials.cc',
524        'src/node_dir.cc',
525        'src/node_env_var.cc',
526        'src/node_errors.cc',
527        'src/node_external_reference.cc',
528        'src/node_file.cc',
529        'src/node_http_parser.cc',
530        'src/node_http2.cc',
531        'src/node_i18n.cc',
532        'src/node_main_instance.cc',
533        'src/node_messaging.cc',
534        'src/node_metadata.cc',
535        'src/node_options.cc',
536        'src/node_os.cc',
537        'src/node_perf.cc',
538        'src/node_platform.cc',
539        'src/node_postmortem_metadata.cc',
540        'src/node_process_events.cc',
541        'src/node_process_methods.cc',
542        'src/node_process_object.cc',
543        'src/node_realm.cc',
544        'src/node_report.cc',
545        'src/node_report_module.cc',
546        'src/node_report_utils.cc',
547        'src/node_sea.cc',
548        'src/node_serdes.cc',
549        'src/node_shadow_realm.cc',
550        'src/node_snapshotable.cc',
551        'src/node_sockaddr.cc',
552        'src/node_stat_watcher.cc',
553        'src/node_symbols.cc',
554        'src/node_task_queue.cc',
555        'src/node_trace_events.cc',
556        'src/node_types.cc',
557        'src/node_url.cc',
558        'src/node_util.cc',
559        'src/node_v8.cc',
560        'src/node_wasi.cc',
561        'src/node_wasm_web_api.cc',
562        'src/node_watchdog.cc',
563        'src/node_worker.cc',
564        'src/node_zlib.cc',
565        'src/pipe_wrap.cc',
566        'src/process_wrap.cc',
567        'src/signal_wrap.cc',
568        'src/spawn_sync.cc',
569        'src/stream_base.cc',
570        'src/stream_pipe.cc',
571        'src/stream_wrap.cc',
572        'src/string_bytes.cc',
573        'src/string_decoder.cc',
574        'src/tcp_wrap.cc',
575        'src/timers.cc',
576        'src/timer_wrap.cc',
577        'src/tracing/agent.cc',
578        'src/tracing/node_trace_buffer.cc',
579        'src/tracing/node_trace_writer.cc',
580        'src/tracing/trace_event.cc',
581        'src/tracing/traced_value.cc',
582        'src/tty_wrap.cc',
583        'src/udp_wrap.cc',
584        'src/util.cc',
585        'src/uv.cc',
586        # headers to make for a more pleasant IDE experience
587        'src/aliased_buffer.h',
588        'src/aliased_buffer-inl.h',
589        'src/aliased_struct.h',
590        'src/aliased_struct-inl.h',
591        'src/async_wrap.h',
592        'src/async_wrap-inl.h',
593        'src/base_object.h',
594        'src/base_object-inl.h',
595        'src/base_object_types.h',
596        'src/base64.h',
597        'src/base64-inl.h',
598        'src/callback_queue.h',
599        'src/callback_queue-inl.h',
600        'src/cleanup_queue.h',
601        'src/cleanup_queue-inl.h',
602        'src/connect_wrap.h',
603        'src/connection_wrap.h',
604        'src/debug_utils.h',
605        'src/debug_utils-inl.h',
606        'src/env_properties.h',
607        'src/env.h',
608        'src/env-inl.h',
609        'src/handle_wrap.h',
610        'src/histogram.h',
611        'src/histogram-inl.h',
612        'src/js_stream.h',
613        'src/json_utils.h',
614        'src/large_pages/node_large_page.cc',
615        'src/large_pages/node_large_page.h',
616        'src/memory_tracker.h',
617        'src/memory_tracker-inl.h',
618        'src/module_wrap.h',
619        'src/node.h',
620        'src/jsvm_node_api.h',
621        'src/jsvm_node_api_types.h',
622        'src/node_binding.h',
623        'src/node_blob.h',
624        'src/node_buffer.h',
625        'src/node_builtins.h',
626        'src/node_constants.h',
627        'src/node_context_data.h',
628        'src/node_contextify.h',
629        'src/node_dir.h',
630        'src/node_errors.h',
631        'src/node_external_reference.h',
632        'src/node_file.h',
633        'src/node_file-inl.h',
634        'src/node_http_common.h',
635        'src/node_http_common-inl.h',
636        'src/node_http2.h',
637        'src/node_http2_state.h',
638        'src/node_i18n.h',
639        'src/node_internals.h',
640        'src/node_main_instance.h',
641        'src/node_mem.h',
642        'src/node_mem-inl.h',
643        'src/node_messaging.h',
644        'src/node_metadata.h',
645        'src/node_mutex.h',
646        'src/node_object_wrap.h',
647        'src/node_options.h',
648        'src/node_options-inl.h',
649        'src/node_perf.h',
650        'src/node_perf_common.h',
651        'src/node_platform.h',
652        'src/node_process.h',
653        'src/node_process-inl.h',
654        'src/node_realm.h',
655        'src/node_realm-inl.h',
656        'src/node_report.h',
657        'src/node_revert.h',
658        'src/node_root_certs.h',
659        'src/node_sea.h',
660        'src/node_shadow_realm.h',
661        'src/node_snapshotable.h',
662        'src/node_snapshot_builder.h',
663        'src/node_sockaddr.h',
664        'src/node_sockaddr-inl.h',
665        'src/node_stat_watcher.h',
666        'src/node_union_bytes.h',
667        'src/node_url.h',
668        'src/node_util.h',
669        'src/node_version.h',
670        'src/node_v8.h',
671        'src/node_v8_platform-inl.h',
672        'src/node_wasi.h',
673        'src/node_watchdog.h',
674        'src/node_worker.h',
675        'src/pipe_wrap.h',
676        'src/req_wrap.h',
677        'src/req_wrap-inl.h',
678        'src/spawn_sync.h',
679        'src/stream_base.h',
680        'src/stream_base-inl.h',
681        'src/stream_pipe.h',
682        'src/stream_wrap.h',
683        'src/string_bytes.h',
684        'src/string_decoder.h',
685        'src/string_decoder-inl.h',
686        'src/string_search.h',
687        'src/tcp_wrap.h',
688        'src/tracing/agent.h',
689        'src/tracing/node_trace_buffer.h',
690        'src/tracing/node_trace_writer.h',
691        'src/tracing/trace_event.h',
692        'src/tracing/trace_event_common.h',
693        'src/tracing/traced_value.h',
694        'src/timer_wrap.h',
695        'src/timer_wrap-inl.h',
696        'src/tty_wrap.h',
697        'src/udp_wrap.h',
698        'src/util.h',
699        'src/util-inl.h',
700        # Dependency headers
701        'deps/v8/include/v8.h',
702        'deps/postject/postject-api.h'
703        # javascript files to make for an even more pleasant IDE experience
704        '<@(library_files)',
705        '<@(deps_files)',
706        # node.gyp is added by default, common.gypi is added for change detection
707        'common.gypi',
708      ],
709
710      'variables': {
711        'openssl_system_ca_path%': '',
712        'openssl_default_cipher_list%': '',
713      },
714
715      'cflags': ['-Werror=unused-result'],
716
717      'defines': [
718        'NODE_ARCH="<(target_arch)"',
719        'NODE_PLATFORM="<(OS)"',
720        'NODE_WANT_INTERNALS=1',
721        # Warn when using deprecated V8 APIs.
722        'V8_DEPRECATION_WARNINGS=1',
723        'NODE_OPENSSL_SYSTEM_CERT_PATH="<(openssl_system_ca_path)"',
724        'TARGET_OHOS',
725        'ENABLE_HISYSEVENT',
726      ],
727
728      # - "C4244: conversion from 'type1' to 'type2', possible loss of data"
729      #   Ususaly safe. Disable for `dep`, enable for `src`
730      'msvs_disabled_warnings!': [4244],
731
732      'ldflags' : [
733        '<(NDK_SYS_ROOT)/resourceschedule/resource_schedule_service/libressched_client.z.so',
734        '<(NDK_SYS_ROOT)/startup/init/libbegetutil.z.so'
735      ],
736      'conditions': [
737        [ 'openssl_default_cipher_list!=""', {
738          'defines': [
739            'NODE_OPENSSL_DEFAULT_CIPHER_LIST="<(openssl_default_cipher_list)"'
740           ]
741        }],
742        [ 'error_on_warn=="true"', {
743          'cflags': ['-Werror'],
744          'xcode_settings': {
745            'WARNING_CFLAGS': [ '-Werror' ],
746          },
747        }],
748        [ 'node_builtin_modules_path!=""', {
749          'defines': [ 'NODE_BUILTIN_MODULES_PATH="<(node_builtin_modules_path)"' ]
750        }],
751        [ 'node_shared=="true"', {
752          'sources': [
753            'src/node_snapshot_stub.cc',
754          ]
755        }],
756        [ 'node_shared=="true" and node_module_version!="" and OS!="win"', {
757          'product_extension': '<(shlib_suffix)',
758          'xcode_settings': {
759            'LD_DYLIB_INSTALL_NAME':
760              '@rpath/lib<(node_core_target_name).<(shlib_suffix)'
761          },
762        }],
763        [ 'node_use_node_code_cache=="true"', {
764          'defines': [
765            'NODE_USE_NODE_CODE_CACHE=1',
766          ],
767        }],
768        ['node_shared=="true" and OS in "aix os400"', {
769          'product_name': 'node_base',
770        }],
771        [ 'v8_enable_inspector==1', {
772          'includes' : [ 'src/inspector/node_inspector.gypi' ],
773        }, {
774          'defines': [ 'HAVE_INSPECTOR=0' ]
775        }],
776        [ 'OS=="win"', {
777          'conditions': [
778            [ 'node_intermediate_lib_type!="static_library"', {
779              'sources': [
780                'src/res/node.rc',
781              ],
782            }],
783          ],
784          'libraries': [
785            'Dbghelp',
786            'Psapi',
787            'Winmm',
788            'Ws2_32',
789          ],
790        }],
791        [ 'node_use_etw=="true"', {
792          'defines': [ 'HAVE_ETW=1' ],
793          'dependencies': [ 'node_etw' ],
794          'include_dirs': [
795            'src',
796            'tools/msvs/genfiles',
797            '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h
798          ],
799          'sources': [
800            'src/node_win32_etw_provider.h',
801            'src/node_win32_etw_provider-inl.h',
802            'src/node_win32_etw_provider.cc',
803            'src/node_dtrace.h',
804            'src/node_dtrace.cc',
805            'tools/msvs/genfiles/node_etw_provider.h',
806          ],
807          'conditions': [
808            ['node_intermediate_lib_type != "static_library"', {
809              'sources': [
810                'tools/msvs/genfiles/node_etw_provider.rc',
811              ],
812            }],
813          ],
814        }],
815        [ 'node_use_dtrace=="true"', {
816          'defines': [ 'HAVE_DTRACE=1' ],
817          'dependencies': [
818            'node_dtrace_header',
819            'specialize_node_d',
820          ],
821          'include_dirs': [ '<(SHARED_INTERMEDIATE_DIR)' ],
822          #
823          # DTrace is supported on linux, solaris, mac, and bsd.  There are
824          # three object files associated with DTrace support, but they're
825          # not all used all the time:
826          #
827          #   node_dtrace.o           all configurations
828          #   node_dtrace_ustack.o    not supported on mac and linux
829          #   node_dtrace_provider.o  All except OS X.  "dtrace -G" is not
830          #                           used on OS X.
831          #
832          # Note that node_dtrace_provider.cc and node_dtrace_ustack.cc do not
833          # actually exist.  They're listed here to trick GYP into linking the
834          # corresponding object files into the final "node" executable.  These
835          # object files are generated by "dtrace -G" using custom actions
836          # below, and the GYP-generated Makefiles will properly build them when
837          # needed.
838          #
839          'sources': [
840            'src/node_dtrace.h',
841            'src/node_dtrace.cc',
842          ],
843          'conditions': [
844            [ 'OS=="linux"', {
845              'sources': [
846                '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o'
847              ],
848            }],
849            [ 'OS!="mac" and OS!="linux"', {
850              'sources': [
851                'src/node_dtrace_ustack.cc',
852                'src/node_dtrace_provider.cc',
853              ]
854            }
855          ] ]
856        } ],
857        [ 'node_use_openssl=="true"', {
858          'sources': [
859            'src/crypto/crypto_aes.cc',
860            'src/crypto/crypto_bio.cc',
861            'src/crypto/crypto_common.cc',
862            'src/crypto/crypto_dsa.cc',
863            'src/crypto/crypto_hkdf.cc',
864            'src/crypto/crypto_pbkdf2.cc',
865            'src/crypto/crypto_sig.cc',
866            'src/crypto/crypto_timing.cc',
867            'src/crypto/crypto_cipher.cc',
868            'src/crypto/crypto_context.cc',
869            'src/crypto/crypto_ec.cc',
870            'src/crypto/crypto_hmac.cc',
871            'src/crypto/crypto_random.cc',
872            'src/crypto/crypto_rsa.cc',
873            'src/crypto/crypto_spkac.cc',
874            'src/crypto/crypto_util.cc',
875            'src/crypto/crypto_clienthello.cc',
876            'src/crypto/crypto_dh.cc',
877            'src/crypto/crypto_hash.cc',
878            'src/crypto/crypto_keys.cc',
879            'src/crypto/crypto_keygen.cc',
880            'src/crypto/crypto_scrypt.cc',
881            'src/crypto/crypto_tls.cc',
882            'src/crypto/crypto_aes.cc',
883            'src/crypto/crypto_x509.cc',
884            'src/crypto/crypto_bio.h',
885            'src/crypto/crypto_clienthello-inl.h',
886            'src/crypto/crypto_dh.h',
887            'src/crypto/crypto_hmac.h',
888            'src/crypto/crypto_rsa.h',
889            'src/crypto/crypto_spkac.h',
890            'src/crypto/crypto_util.h',
891            'src/crypto/crypto_cipher.h',
892            'src/crypto/crypto_common.h',
893            'src/crypto/crypto_dsa.h',
894            'src/crypto/crypto_hash.h',
895            'src/crypto/crypto_keys.h',
896            'src/crypto/crypto_keygen.h',
897            'src/crypto/crypto_scrypt.h',
898            'src/crypto/crypto_tls.h',
899            'src/crypto/crypto_clienthello.h',
900            'src/crypto/crypto_context.h',
901            'src/crypto/crypto_ec.h',
902            'src/crypto/crypto_hkdf.h',
903            'src/crypto/crypto_pbkdf2.h',
904            'src/crypto/crypto_sig.h',
905            'src/crypto/crypto_random.h',
906            'src/crypto/crypto_timing.h',
907            'src/crypto/crypto_x509.h',
908            'src/node_crypto.cc',
909            'src/node_crypto.h'
910          ],
911        }],
912        [ 'OS in "linux freebsd mac solaris" and '
913          'target_arch=="x64" and '
914          'node_target_type=="executable"', {
915          'defines': [ 'NODE_ENABLE_LARGE_CODE_PAGES=1' ],
916        }],
917        [ 'use_openssl_def==1', {
918          # TODO(bnoordhuis) Make all platforms export the same list of symbols.
919          # Teach mkssldef.py to generate linker maps that UNIX linkers understand.
920          'variables': {
921            'mkssldef_flags': [
922              # Categories to export.
923              '-CAES,BF,BIO,DES,DH,DSA,EC,ECDH,ECDSA,ENGINE,EVP,HMAC,MD4,MD5,'
924              'PSK,RC2,RC4,RSA,SHA,SHA0,SHA1,SHA256,SHA512,SOCK,STDIO,TLSEXT,'
925              'UI,FP_API,TLS1_METHOD,TLS1_1_METHOD,TLS1_2_METHOD,SCRYPT,OCSP,'
926              'NEXTPROTONEG,RMD160,CAST,DEPRECATEDIN_1_1_0,DEPRECATEDIN_1_2_0,'
927              'DEPRECATEDIN_3_0',
928              # Defines.
929              '-DWIN32',
930              # Symbols to filter from the export list.
931              '-X^DSO',
932              '-X^_',
933              '-X^private_',
934              # Base generated DEF on zlib.def
935              '-Bdeps/zlib/win32/zlib.def'
936            ],
937          },
938          'conditions': [
939            ['openssl_is_fips!=""', {
940              'variables': { 'mkssldef_flags': ['-DOPENSSL_FIPS'] },
941            }],
942          ],
943          'actions': [
944            {
945              'action_name': 'mkssldef',
946              'inputs': [
947                'deps/openssl/openssl/util/libcrypto.num',
948                'deps/openssl/openssl/util/libssl.num',
949              ],
950              'outputs': ['<(SHARED_INTERMEDIATE_DIR)/openssl.def'],
951              'process_outputs_as_sources': 1,
952              'action': [
953                '<(python)',
954                'tools/mkssldef.py',
955                '<@(mkssldef_flags)',
956                '-o',
957                '<@(_outputs)',
958                '<@(_inputs)',
959              ],
960            },
961          ],
962        }],
963        [ 'debug_nghttp2==1', {
964          'defines': [ 'NODE_DEBUG_NGHTTP2=1' ]
965        }],
966      ],
967      'actions': [
968        {
969          'action_name': 'node_js2c',
970          'process_outputs_as_sources': 1,
971          'inputs': [
972            # Put the code first so it's a dependency and can be used for invocation.
973            'tools/js2c.py',
974            '<@(library_files)',
975            '<@(deps_files)',
976            'config.gypi'
977          ],
978          'outputs': [
979            '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc',
980          ],
981          'action': [
982            '<(python)',
983            'tools/js2c.py',
984            '--directory',
985            'lib',
986            '--target',
987            '<@(_outputs)',
988            'config.gypi',
989            '<@(deps_files)',
990            '<@(linked_module_files)',
991          ],
992        },
993      ],
994    }, # node_lib_target_name
995    {
996       # generate ETW header and resource files
997      'target_name': 'node_etw',
998      'type': 'none',
999      'conditions': [
1000        [ 'node_use_etw=="true"', {
1001          'actions': [
1002            {
1003              'action_name': 'node_etw',
1004              'inputs': [ 'src/res/node_etw_provider.man' ],
1005              'outputs': [
1006                'tools/msvs/genfiles/node_etw_provider.rc',
1007                'tools/msvs/genfiles/node_etw_provider.h',
1008                'tools/msvs/genfiles/node_etw_providerTEMP.BIN',
1009              ],
1010              'action': [ 'mc <@(_inputs) -h tools/msvs/genfiles -r tools/msvs/genfiles' ]
1011            }
1012          ]
1013        } ]
1014      ]
1015    }, # node_etw
1016    {
1017      'target_name': 'node_dtrace_header',
1018      'type': 'none',
1019      'conditions': [
1020        [ 'node_use_dtrace=="true" and OS!="linux"', {
1021          'actions': [
1022            {
1023              'action_name': 'node_dtrace_header',
1024              'inputs': [ 'src/node_provider.d' ],
1025              'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_provider.h' ],
1026              'action': [ 'dtrace', '-h', '-xnolibs', '-s', '<@(_inputs)',
1027                '-o', '<@(_outputs)' ]
1028            }
1029          ]
1030        } ],
1031        [ 'node_use_dtrace=="true" and OS=="linux"', {
1032          'actions': [
1033            {
1034              'action_name': 'node_dtrace_header',
1035              'inputs': [ 'src/node_provider.d' ],
1036              'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/node_provider.h' ],
1037              'action': [ 'dtrace', '-h', '-s', '<@(_inputs)',
1038                '-o', '<@(_outputs)' ]
1039            }
1040          ]
1041        } ],
1042      ]
1043    }, # node_dtrace_header
1044    {
1045      'target_name': 'node_dtrace_provider',
1046      'type': 'none',
1047      'conditions': [
1048        [ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', {
1049          'actions': [
1050            {
1051              'action_name': 'node_dtrace_provider_o',
1052              'inputs': [
1053                '<(obj_dir)/<(node_lib_target_name)/src/node_dtrace.o',
1054              ],
1055              'outputs': [
1056                '<(obj_dir)/<(node_lib_target_name)/src/node_dtrace_provider.o'
1057              ],
1058              'action': [ 'dtrace', '-G', '-xnolibs', '-s', 'src/node_provider.d',
1059                '<@(_inputs)', '-o', '<@(_outputs)' ]
1060            }
1061          ]
1062        }],
1063        [ 'node_use_dtrace=="true" and OS=="linux"', {
1064          'actions': [
1065            {
1066              'action_name': 'node_dtrace_provider_o',
1067              'inputs': [ 'src/node_provider.d' ],
1068              'outputs': [
1069                '<(SHARED_INTERMEDIATE_DIR)/node_dtrace_provider.o'
1070              ],
1071              'action': [
1072                'dtrace', '-C', '-G', '-s', '<@(_inputs)', '-o', '<@(_outputs)'
1073              ],
1074            }
1075          ],
1076        }],
1077      ]
1078    }, # node_dtrace_provider
1079    {
1080      'target_name': 'node_dtrace_ustack',
1081      'type': 'none',
1082      'conditions': [
1083        [ 'node_use_dtrace=="true" and OS!="mac" and OS!="linux"', {
1084          'actions': [
1085            {
1086              'action_name': 'node_dtrace_ustack_constants',
1087              'inputs': [
1088                '<(obj_dir)/tools/v8_gypfiles/<(STATIC_LIB_PREFIX)v8_base_without_compiler<(STATIC_LIB_SUFFIX)'
1089              ],
1090              'outputs': [
1091                '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
1092              ],
1093              'action': [
1094                'tools/genv8constants.py',
1095                '<@(_outputs)',
1096                '<@(_inputs)'
1097              ]
1098            },
1099            {
1100              'action_name': 'node_dtrace_ustack',
1101              'inputs': [
1102                'src/v8ustack.d',
1103                '<(SHARED_INTERMEDIATE_DIR)/v8constants.h'
1104              ],
1105              'outputs': [
1106                '<(obj_dir)/<(node_lib_target_name)/src/node_dtrace_ustack.o'
1107              ],
1108              'conditions': [
1109                [ 'target_arch=="ia32" or target_arch=="arm"', {
1110                  'action': [
1111                    'dtrace', '-32', '-I<(SHARED_INTERMEDIATE_DIR)', '-Isrc',
1112                    '-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)',
1113                  ]
1114                } ],
1115                [ 'target_arch=="x64"', {
1116                  'action': [
1117                    'dtrace', '-64', '-I<(SHARED_INTERMEDIATE_DIR)', '-Isrc',
1118                    '-C', '-G', '-s', 'src/v8ustack.d', '-o', '<@(_outputs)',
1119                  ]
1120                } ],
1121              ]
1122            },
1123          ]
1124        } ],
1125      ]
1126    }, # node_dtrace_ustack
1127    {
1128      'target_name': 'specialize_node_d',
1129      'type': 'none',
1130      'conditions': [
1131        [ 'node_use_dtrace=="true"', {
1132          'actions': [
1133            {
1134              'action_name': 'specialize_node_d',
1135              'inputs': [
1136                'src/node.d'
1137              ],
1138              'outputs': [
1139                '<(PRODUCT_DIR)/node.d',
1140              ],
1141              'action': [
1142                'tools/specialize_node_d.py',
1143                '<@(_outputs)',
1144                '<@(_inputs)',
1145                '<@(OS)',
1146                '<@(target_arch)',
1147              ],
1148            },
1149          ],
1150        } ],
1151      ]
1152    }, # specialize_node_d
1153    { # fuzz_url
1154      'target_name': 'fuzz_url',
1155      'type': 'executable',
1156      'dependencies': [
1157        '<(node_lib_target_name)',
1158      ],
1159      'includes': [
1160        'node.gypi'
1161      ],
1162      'include_dirs': [
1163        'src',
1164      ],
1165      'defines': [
1166        'NODE_ARCH="<(target_arch)"',
1167        'NODE_PLATFORM="<(OS)"',
1168        'NODE_WANT_INTERNALS=1',
1169      ],
1170      'sources': [
1171        'src/node_snapshot_stub.cc',
1172        'test/fuzzers/fuzz_url.cc',
1173      ],
1174      'conditions': [
1175        ['OS=="linux"', {
1176          'ldflags': [ '-fsanitize=fuzzer' ]
1177        }],
1178        # Ensure that ossfuzz flag has been set and that we are on Linux
1179        [ 'OS!="linux" or ossfuzz!="true"', {
1180          'type': 'none',
1181        }],
1182      ],
1183    }, # fuzz_url
1184    { # fuzz_env
1185      'target_name': 'fuzz_env',
1186      'type': 'executable',
1187      'dependencies': [
1188        '<(node_lib_target_name)',
1189        'deps/histogram/histogram.gyp:histogram',
1190        'deps/uvwasi/uvwasi.gyp:uvwasi',
1191        'node_dtrace_header',
1192        'node_dtrace_ustack',
1193        'node_dtrace_provider',
1194      ],
1195      'includes': [
1196        'node.gypi'
1197      ],
1198      'include_dirs': [
1199        'src',
1200        'tools/msvs/genfiles',
1201        'deps/v8/include',
1202        'deps/cares/include',
1203        'deps/uv/include',
1204        'deps/uvwasi/include',
1205        'test/cctest',
1206      ],
1207      'defines': [
1208        'NODE_ARCH="<(target_arch)"',
1209        'NODE_PLATFORM="<(OS)"',
1210        'NODE_WANT_INTERNALS=1',
1211      ],
1212      'sources': [
1213        'src/node_snapshot_stub.cc',
1214        'test/fuzzers/fuzz_env.cc',
1215      ],
1216      'conditions': [
1217        ['OS=="linux"', {
1218          'ldflags': [ '-fsanitize=fuzzer' ]
1219        }],
1220        # Ensure that ossfuzz flag has been set and that we are on Linux
1221        [ 'OS!="linux" or ossfuzz!="true"', {
1222          'type': 'none',
1223        }],
1224        # Avoid excessive LTO
1225        ['enable_lto=="true"', {
1226          'ldflags': [ '-fno-lto' ],
1227        }],
1228      ],
1229    }, # fuzz_env
1230    #{
1231    #  'target_name': 'cctest',
1232    #  'type': 'executable',
1233
1234    #  'dependencies': [
1235    #    '<(node_lib_target_name)',
1236    #    'deps/base64/base64.gyp:base64',
1237    #    'deps/googletest/googletest.gyp:gtest',
1238    #    'deps/googletest/googletest.gyp:gtest_main',
1239    #    'deps/histogram/histogram.gyp:histogram',
1240    #    'deps/uvwasi/uvwasi.gyp:uvwasi',
1241    #    'node_dtrace_header',
1242    #    'node_dtrace_ustack',
1243    #    'node_dtrace_provider',
1244    #    'deps/simdutf/simdutf.gyp:simdutf',
1245    #    'deps/ada/ada.gyp:ada',
1246    #  ],
1247
1248    #  'includes': [
1249    #    'node.gypi'
1250    #  ],
1251
1252    #  'include_dirs': [
1253    #    'src',
1254    #    'tools/msvs/genfiles',
1255    #    'deps/v8/include',
1256    #    'deps/cares/include',
1257    #    'deps/uv/include',
1258    #    'deps/uvwasi/include',
1259    #    'test/cctest',
1260    #  ],
1261
1262    #  'defines': [
1263    #    'NODE_ARCH="<(target_arch)"',
1264    #    'NODE_PLATFORM="<(OS)"',
1265    #    'NODE_WANT_INTERNALS=1',
1266    #  ],
1267
1268    #  'sources': [
1269    #    'src/node_snapshot_stub.cc',
1270    #    'test/cctest/node_test_fixture.cc',
1271    #    'test/cctest/node_test_fixture.h',
1272    #    'test/cctest/test_aliased_buffer.cc',
1273    #    'test/cctest/test_base64.cc',
1274    #    'test/cctest/test_base_object_ptr.cc',
1275    #    'test/cctest/test_node_postmortem_metadata.cc',
1276    #    'test/cctest/test_environment.cc',
1277    #    'test/cctest/test_linked_binding.cc',
1278    #    'test/cctest/test_node_api.cc',
1279    #    'test/cctest/test_per_process.cc',
1280    #    'test/cctest/test_platform.cc',
1281    #    'test/cctest/test_report.cc',
1282    #    'test/cctest/test_json_utils.cc',
1283    #    'test/cctest/test_sockaddr.cc',
1284    #    'test/cctest/test_traced_value.cc',
1285    #    'test/cctest/test_util.cc',
1286    #  ],
1287
1288    #  'conditions': [
1289    #    [ 'node_use_openssl=="true"', {
1290    #      'defines': [
1291    #        'HAVE_OPENSSL=1',
1292    #      ],
1293    #      'sources': [
1294    #        'test/cctest/test_crypto_clienthello.cc',
1295    #        'test/cctest/test_node_crypto.cc',
1296    #        'test/cctest/test_node_crypto_env.cc',
1297    #      ]
1298    #    }],
1299    #    ['v8_enable_inspector==1', {
1300    #      'sources': [
1301    #        'test/cctest/test_inspector_socket.cc',
1302    #        'test/cctest/test_inspector_socket_server.cc'
1303    #      ],
1304    #      'defines': [
1305    #        'HAVE_INSPECTOR=1',
1306    #      ],
1307    #    }, {
1308    #       'defines': [
1309    #         'HAVE_INSPECTOR=0',
1310    #       ]
1311    #    }],
1312    #    ['OS=="solaris"', {
1313    #      'ldflags': [ '-I<(SHARED_INTERMEDIATE_DIR)' ]
1314    #    }],
1315        # Skip cctest while building shared lib node for Windows
1316    #    [ 'OS=="win" and node_shared=="true"', {
1317    #      'type': 'none',
1318    #    }],
1319    #    [ 'node_shared=="true"', {
1320    #      #'xcode_settings': {
1321    #        'OTHER_LDFLAGS': [ '-Wl,-rpath,@loader_path', ],
1322    #      },
1323    #    }],
1324    #    ['OS=="win"', {
1325    #      'libraries': [
1326    #        'Dbghelp.lib',
1327    #        'winmm.lib',
1328    #        'Ws2_32.lib',
1329    #      ],
1330    #    }],
1331        # Avoid excessive LTO
1332    #    ['enable_lto=="true"', {
1333    #      'ldflags': [ '-fno-lto' ],
1334    #    }],
1335    #  ],
1336    #}, # cctest
1337
1338    #{
1339    #  'target_name': 'embedtest',
1340    #  'type': 'executable',
1341
1342    #  'dependencies': [
1343    #    '<(node_lib_target_name)',
1344    #    'deps/histogram/histogram.gyp:histogram',
1345    #    'deps/uvwasi/uvwasi.gyp:uvwasi',
1346    #    'node_dtrace_header',
1347    #    'node_dtrace_ustack',
1348    #    'node_dtrace_provider',
1349    #    'deps/ada/ada.gyp:ada',
1350    #  ],
1351
1352    #  'includes': [
1353    #    'node.gypi'
1354    #  ],
1355
1356    #  'include_dirs': [
1357    #    'src',
1358    #    'tools/msvs/genfiles',
1359    #    'deps/v8/include',
1360    #    'deps/cares/include',
1361    #    'deps/uv/include',
1362    #    'deps/uvwasi/include',
1363    #    'test/embedding',
1364    #  ],
1365
1366    #  'sources': [
1367    #    'src/node_snapshot_stub.cc',
1368    #    'test/embedding/embedtest.cc',
1369    #  ],
1370
1371    #  'conditions': [
1372    #    ['OS=="solaris"', {
1373    #      'ldflags': [ '-I<(SHARED_INTERMEDIATE_DIR)' ]
1374    #    }],
1375        # Skip cctest while building shared lib node for Windows
1376    #    [ 'OS=="win" and node_shared=="true"', {
1377    #      'type': 'none',
1378    #    }],
1379    #    [ 'node_shared=="true"', {
1380    #      'xcode_settings': {
1381    #        'OTHER_LDFLAGS': [ '-Wl,-rpath,@loader_path', ],
1382    #      },
1383    #    }],
1384    #    ['OS=="win"', {
1385    #      'libraries': [
1386    #        'Dbghelp.lib',
1387    #        'winmm.lib',
1388    #        'Ws2_32.lib',
1389    #      ],
1390    #    }],
1391        # Avoid excessive LTO
1392    #    ['enable_lto=="true"', {
1393    #      'ldflags': [ '-fno-lto' ],
1394    #    }],
1395    #  ],
1396    #}, # embedtest
1397
1398    {
1399      'target_name': 'overlapped-checker',
1400      'type': 'executable',
1401
1402      'conditions': [
1403        ['OS=="win"', {
1404          'sources': [
1405            'test/overlapped-checker/main_win.c'
1406          ],
1407        }],
1408        ['OS!="win"', {
1409          'sources': [
1410            'test/overlapped-checker/main_unix.c'
1411          ],
1412        }],
1413        # Avoid excessive LTO
1414        ['enable_lto=="true"', {
1415          'ldflags': [ '-fno-lto' ],
1416        }],
1417      ]
1418    }, # overlapped-checker
1419    {
1420      'target_name': 'node_mksnapshot',
1421      'type': 'executable',
1422
1423      'dependencies': [
1424        '<(node_lib_target_name)',
1425        'deps/histogram/histogram.gyp:histogram',
1426        'deps/uvwasi/uvwasi.gyp:uvwasi',
1427        'deps/ada/ada.gyp:ada',
1428      ],
1429
1430      'includes': [
1431        'node.gypi'
1432      ],
1433
1434      'include_dirs': [
1435        'src',
1436        'tools/msvs/genfiles',
1437        'deps/v8/include',
1438        'deps/cares/include',
1439        'deps/uv/include',
1440        'deps/uvwasi/include',
1441        '../../base/startup/init/interfaces/innerkits/include/param',
1442      ],
1443
1444      'defines': [ 'NODE_WANT_INTERNALS=1' ],
1445   
1446      'ldflags' : [
1447        '<(NDK_SYS_ROOT)/resourceschedule/resource_schedule_service/libressched_client.z.so',
1448        '<(NDK_SYS_ROOT)/startup/init/libbegetutil.z.so',
1449        '<(NDK_SYS_ROOT)/hiviewdfx/hisysevent/libhisysevent.z.so'
1450      ],
1451
1452      'sources': [
1453        'src/node_snapshot_stub.cc',
1454        'tools/snapshot/node_mksnapshot.cc',
1455      ],
1456
1457      'conditions': [
1458        [ 'node_use_openssl=="true"', {
1459          'defines': [
1460            'HAVE_OPENSSL=1',
1461          ],
1462        }],
1463        [ 'node_use_node_code_cache=="true"', {
1464          'defines': [
1465            'NODE_USE_NODE_CODE_CACHE=1',
1466          ],
1467        }],
1468        ['v8_enable_inspector==1', {
1469          'defines': [
1470            'HAVE_INSPECTOR=1',
1471          ],
1472        }],
1473        ['OS=="win"', {
1474          'libraries': [
1475            'Dbghelp.lib',
1476            'winmm.lib',
1477            'Ws2_32.lib',
1478          ],
1479        }],
1480        # Avoid excessive LTO
1481        ['enable_lto=="true"', {
1482          'ldflags': [ '-fno-lto' ],
1483        }],
1484      ],
1485    }, # node_mksnapshot
1486  ], # end targets
1487
1488  'conditions': [
1489    ['OS in "aix os400" and node_shared=="true"', {
1490      'targets': [
1491        {
1492          'target_name': 'node_aix_shared',
1493          'type': 'shared_library',
1494          'product_name': '<(node_core_target_name)',
1495          'ldflags': ['--shared'],
1496          'product_extension': '<(shlib_suffix)',
1497          'includes': [
1498            'node.gypi'
1499          ],
1500          'dependencies': ['<(node_lib_target_name)'],
1501          'include_dirs': [
1502            'src',
1503            'deps/v8/include',
1504          ],
1505          'sources': [
1506            '<@(library_files)',
1507            '<@(deps_files)',
1508            'common.gypi',
1509          ],
1510          'direct_dependent_settings': {
1511            'ldflags': [ '-Wl,-brtl' ],
1512          },
1513        },
1514      ]
1515    }], # end aix section
1516    ['OS=="win" and node_shared=="true"', {
1517     'targets': [
1518       {
1519         'target_name': 'gen_node_def',
1520         'type': 'executable',
1521         'sources': [
1522           'tools/gen_node_def.cc'
1523         ],
1524       },
1525       {
1526         'target_name': 'generate_node_def',
1527         'dependencies': [
1528           'gen_node_def',
1529           '<(node_lib_target_name)',
1530         ],
1531         'type': 'none',
1532         'actions': [
1533           {
1534             'action_name': 'generate_node_def_action',
1535             'inputs': [
1536               '<(PRODUCT_DIR)/<(node_lib_target_name).dll'
1537             ],
1538             'outputs': [
1539               '<(PRODUCT_DIR)/<(node_core_target_name).def',
1540             ],
1541             'action': [
1542               '<(PRODUCT_DIR)/gen_node_def.exe',
1543               '<@(_inputs)',
1544               '<@(_outputs)',
1545             ],
1546           },
1547         ],
1548       },
1549     ],
1550   }], # end win section
1551  ], # end conditions block
1552}
1553