dest='tag',
help='custom build tag')
+parser.add_option('--v8-options',
+ action='store',
+ dest='v8_options',
+ help='v8 options to pass, see `node --v8-options` for examples. '
+ 'The flags should be separated by a comma')
+
parser.add_option('--with-arm-float-abi',
action='store',
dest='arm_float_abi',
else:
o['variables']['node_tag'] = ''
+ if options.v8_options:
+ opts = options.v8_options.split(',')
+ o['variables']['node_v8_options'] = '"' + '","'.join(opts) + '"'
+ else:
+ o['variables']['node_v8_options'] = ''
+
def configure_libz(o):
o['variables']['node_shared_zlib'] = b(options.shared_zlib)
'node_use_openssl%': 'true',
'node_shared_openssl%': 'false',
'node_use_mdb%': 'false',
+ 'node_v8_options%': '',
'library_files': [
'src/node.js',
'lib/_debugger.js',
'ARCH="<(target_arch)"',
'PLATFORM="<(OS)"',
'NODE_TAG="<(node_tag)"',
+ 'NODE_V8_OPTIONS=<(node_v8_options)',
],
'conditions': [
}
+static void SetCompileTimeV8Options(const char** argv) {
+#ifdef NODE_V8_OPTIONS
+ int v8_argc;
+ static const char* v8_argv[] = { NULL, NODE_V8_OPTIONS };
+ if (ARRAY_SIZE(v8_argv) == 1)
+ return;
+
+ v8_argv[0] = argv[0];
+ v8_argc = ARRAY_SIZE(v8_argv);
+ V8::SetFlagsFromCommandLine(&v8_argc, const_cast<char**>(v8_argv), true);
+
+ // Anything that's still in v8_argv is not a V8 or a node option.
+ for (int i = 1; i < v8_argc; i++)
+ fprintf(stderr, "%s: bad option: %s\n", argv[0], v8_argv[i]);
+ if (v8_argc > 1)
+ exit(9);
+#endif // NODE_V8_OPTIONS
+}
+
+
// Called from V8 Debug Agent TCP thread.
static void DispatchMessagesDebugAgentCallback() {
uv_async_send(&dispatch_debug_messages_async);
DispatchDebugMessagesAsyncCallback);
uv_unref(reinterpret_cast<uv_handle_t*>(&dispatch_debug_messages_async));
+ SetCompileTimeV8Options(argv);
+
// Parse a few arguments which are specific to Node.
int v8_argc;
const char** v8_argv;
delete NativeModule._source.config;
// strip the gyp comment line at the beginning
- config = config.split('\n').slice(1).join('\n').replace(/'/g, '"');
+ config = config.split('\n')
+ .slice(1)
+ .join('\n')
+ .replace(/"/g, '\\"')
+ .replace(/'/g, '"');
process.config = JSON.parse(config, function(key, value) {
if (value === 'true') return true;