From 4fd71935795fa7c284f5ed621551b65a28b8271c Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Thu, 4 Apr 2019 06:29:02 +0800 Subject: tools: implement mkcodecache as an executable This patch implement a mkcodecache executable on top of the `NativeModuleLoader` singleton. This makes it possible to build a Node.js binary with embedded code cache without building itself using the code cache stub - the cache is now initialized by `NativeModuleEnv` instead which can be refactored out of the mkcodecache dependencies. PR-URL: https://github.com/nodejs/node/pull/27161 Reviewed-By: Joyee Cheung --- node.gyp | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'node.gyp') diff --git a/node.gyp b/node.gyp index ead1d67ff2..e5e0ad144f 100644 --- a/node.gyp +++ b/node.gyp @@ -1103,6 +1103,59 @@ }], ], }, # cctest + # TODO(joyeecheung): do not depend on node_lib, + # instead create a smaller static library node_lib_base that does + # just enough for node_native_module.cc and the cache builder to + # compile without compiling the generated code cache C++ file. + # So generate_code_cache -> mkcodecache -> node_lib_base, + # node_lib -> node_lib_base & generate_code_cache + { + 'target_name': 'mkcodecache', + 'type': 'executable', + + 'dependencies': [ + '<(node_lib_target_name)', + 'deps/histogram/histogram.gyp:histogram', + ], + + 'includes': [ + 'node.gypi' + ], + + 'include_dirs': [ + 'src', + 'tools/msvs/genfiles', + 'deps/v8/include', + 'deps/cares/include', + 'deps/uv/include', + ], + + 'defines': [ 'NODE_WANT_INTERNALS=1' ], + + 'sources': [ + 'tools/code_cache/mkcodecache.cc', + 'tools/code_cache/cache_builder.cc' + ], + + 'conditions': [ + [ 'node_report=="true"', { + 'conditions': [ + ['OS=="win"', { + 'libraries': [ + 'dbghelp.lib', + 'PsApi.lib', + 'Ws2_32.lib', + ], + 'dll_files': [ + 'dbghelp.dll', + 'PsApi.dll', + 'Ws2_32.dll', + ], + }], + ], + }], + ], + }, # cache_builder ], # end targets 'conditions': [ -- cgit v1.2.3