|
@@ -6,10 +6,10 @@ Subject: build: add GN build files
|
|
|
|
|
|
diff --git a/BUILD.gn b/BUILD.gn
|
|
|
new file mode 100644
|
|
|
-index 0000000000000000000000000000000000000000..028b0ae16ffac1fc89128f2f994680923a500a36
|
|
|
+index 0000000000000000000000000000000000000000..f27c13b312a60d9b5c7ea0948b347ab0936ab3f8
|
|
|
--- /dev/null
|
|
|
+++ b/BUILD.gn
|
|
|
-@@ -0,0 +1,351 @@
|
|
|
+@@ -0,0 +1,369 @@
|
|
|
+import("//electron/build/asar.gni")
|
|
|
+import("//v8/gni/v8.gni")
|
|
|
+
|
|
@@ -49,6 +49,9 @@ index 0000000000000000000000000000000000000000..028b0ae16ffac1fc89128f2f99468092
|
|
|
+ # `sourceUrl` and `headersUrl`. When compiling a release build, this will
|
|
|
+ # default to https://nodejs.org/download/release/')
|
|
|
+ node_release_urlbase = ""
|
|
|
++
|
|
|
++ # Allows embedders to override the NODE_MODULE_VERSION define
|
|
|
++ node_module_version = ""
|
|
|
+}
|
|
|
+
|
|
|
+assert(!node_use_dtrace, "node_use_dtrace not supported in GN")
|
|
@@ -87,14 +90,14 @@ index 0000000000000000000000000000000000000000..028b0ae16ffac1fc89128f2f99468092
|
|
|
+
|
|
|
+ macro_inputs = []
|
|
|
+ if (!node_use_dtrace && !node_use_etw) {
|
|
|
-+ macro_inputs += [ "src/notrace_macros.py" ]
|
|
|
++ macro_inputs += [ "tools/js2c_macros/notrace_macros.py" ]
|
|
|
+ }
|
|
|
+ if (node_debug_lib) {
|
|
|
-+ macro_inputs += [ "tools/nodcheck_macros.py" ]
|
|
|
++ macro_inputs += [ "tools/js2c_macros/nodcheck_macros.py" ]
|
|
|
+ } else {
|
|
|
-+ macro_inputs += [ "tools/dcheck_macros.py" ]
|
|
|
++ macro_inputs += [ "tools/js2c_macros/dcheck_macros.py" ]
|
|
|
+ }
|
|
|
-+ macro_inputs += [ "tools/check_macros.py" ]
|
|
|
++ macro_inputs += [ "tools/js2c_macros/check_macros.py" ]
|
|
|
+
|
|
|
+ config_gypi = [ "$target_gen_dir/config.gypi" ]
|
|
|
+
|
|
@@ -105,9 +108,7 @@ index 0000000000000000000000000000000000000000..028b0ae16ffac1fc89128f2f99468092
|
|
|
+
|
|
|
+ cwd = "$target_gen_dir/js2c_inputs"
|
|
|
+ script = "tools/js2c.py"
|
|
|
-+ args = rebase_path(outputs)
|
|
|
-+ args += library_files
|
|
|
-+ args += rebase_path(macro_inputs + config_gypi)
|
|
|
++ args = library_files + rebase_path(macro_inputs + config_gypi) + ["--target"] + rebase_path(outputs)
|
|
|
+}
|
|
|
+
|
|
|
+config("node_features") {
|
|
@@ -122,6 +123,8 @@ index 0000000000000000000000000000000000000000..028b0ae16ffac1fc89128f2f99468092
|
|
|
+ } else {
|
|
|
+ defines += [ "HAVE_OPENSSL=0" ]
|
|
|
+ }
|
|
|
++ # boringssl does not support SSL_trace, let's disable it
|
|
|
++ defines += ["OPENSSL_NO_SSL_TRACE=1"]
|
|
|
+ if (v8_enable_i18n_support) {
|
|
|
+ defines += [ "NODE_HAVE_I18N_SUPPORT=1" ]
|
|
|
+ } else {
|
|
@@ -157,11 +160,11 @@ index 0000000000000000000000000000000000000000..028b0ae16ffac1fc89128f2f99468092
|
|
|
+ "NODE_WANT_INTERNALS=1",
|
|
|
+ "NODE_IMPLEMENTATION",
|
|
|
+ ]
|
|
|
++ if (node_module_version != "") {
|
|
|
++ defines += [ "NODE_MODULE_VERSION=" + node_module_version ]
|
|
|
++ }
|
|
|
+ if (is_component_build) {
|
|
|
+ defines += [
|
|
|
-+ "BUILDING_V8_SHARED",
|
|
|
-+ "BUILDING_V8_PLATFORM_SHARED",
|
|
|
-+ "BUILDING_V8_BASE_SHARED",
|
|
|
+ "NODE_SHARED_MODE",
|
|
|
+ ]
|
|
|
+ }
|
|
@@ -212,14 +215,14 @@ index 0000000000000000000000000000000000000000..028b0ae16ffac1fc89128f2f99468092
|
|
|
+component("node_lib") {
|
|
|
+ deps = [
|
|
|
+ ":node_js2c",
|
|
|
-+ "//third_party/brotli:enc",
|
|
|
-+ "//third_party/brotli:dec",
|
|
|
+ "deps/cares",
|
|
|
+ "deps/histogram",
|
|
|
+ "deps/http_parser",
|
|
|
+ "deps/llhttp",
|
|
|
+ "deps/nghttp2",
|
|
|
+ "deps/zlib",
|
|
|
++ "//third_party/brotli:dec",
|
|
|
++ "//third_party/brotli:enc",
|
|
|
+ "//v8:v8_libplatform",
|
|
|
+ ]
|
|
|
+ public_deps = [
|
|
@@ -267,8 +270,8 @@ index 0000000000000000000000000000000000000000..028b0ae16ffac1fc89128f2f99468092
|
|
|
+ "src/inspector_agent.h",
|
|
|
+ "src/inspector_io.cc",
|
|
|
+ "src/inspector_io.h",
|
|
|
-+ "src/inspector_profiler.cc",
|
|
|
+ "src/inspector_js_api.cc",
|
|
|
++ "src/inspector_profiler.cc",
|
|
|
+ "src/inspector_socket.cc",
|
|
|
+ "src/inspector_socket.h",
|
|
|
+ "src/inspector_socket_server.cc",
|
|
@@ -335,6 +338,20 @@ index 0000000000000000000000000000000000000000..028b0ae16ffac1fc89128f2f99468092
|
|
|
+ ]
|
|
|
+}
|
|
|
+
|
|
|
++action("node_version_header") {
|
|
|
++ inputs = [
|
|
|
++ "src/node_version.h",
|
|
|
++ ]
|
|
|
++ outputs = [
|
|
|
++ "$node_headers_dir/include/node/node_version.h",
|
|
|
++ ]
|
|
|
++ script = "tools/generate_node_version_header.py"
|
|
|
++ args = [ rebase_path("src/node_version.h"), rebase_path(outputs[0]) ]
|
|
|
++ if (node_module_version != "") {
|
|
|
++ args += [ "$node_module_version" ]
|
|
|
++ }
|
|
|
++}
|
|
|
++
|
|
|
+action("tar_headers") {
|
|
|
+ deps = [
|
|
|
+ ":copy_headers",
|
|
@@ -353,6 +370,7 @@ index 0000000000000000000000000000000000000000..028b0ae16ffac1fc89128f2f99468092
|
|
|
+ public_deps = header_groups + [
|
|
|
+ ":zlib_headers",
|
|
|
+ ":node_gypi_headers",
|
|
|
++ ":node_version_header",
|
|
|
+ ]
|
|
|
+}
|
|
|
+
|
|
@@ -608,10 +626,10 @@ index 0000000000000000000000000000000000000000..66af819990b338caa49ca59d1fe6c5ad
|
|
|
+}
|
|
|
diff --git a/deps/uv/BUILD.gn b/deps/uv/BUILD.gn
|
|
|
new file mode 100644
|
|
|
-index 0000000000000000000000000000000000000000..b62fac6738ae74788faa6e5dcc705b81d8325ece
|
|
|
+index 0000000000000000000000000000000000000000..4674bdd48b4bfc9b7152377b8cd0984d1cf42562
|
|
|
--- /dev/null
|
|
|
+++ b/deps/uv/BUILD.gn
|
|
|
-@@ -0,0 +1,188 @@
|
|
|
+@@ -0,0 +1,185 @@
|
|
|
+config("libuv_config") {
|
|
|
+ include_dirs = [ "include" ]
|
|
|
+
|
|
@@ -643,6 +661,9 @@ index 0000000000000000000000000000000000000000..b62fac6738ae74788faa6e5dcc705b81
|
|
|
+
|
|
|
+ defines = []
|
|
|
+
|
|
|
++ # This only has an effect on Windows, where it will cause libuv's symbols to be exported in node.lib
|
|
|
++ defines += [ "BUILDING_UV_SHARED=1" ]
|
|
|
++
|
|
|
+ cflags_c = [
|
|
|
+ "-Wno-bitwise-op-parentheses",
|
|
|
+ "-Wno-implicit-function-declaration",
|
|
@@ -781,7 +802,6 @@ index 0000000000000000000000000000000000000000..b62fac6738ae74788faa6e5dcc705b81
|
|
|
+ "src/unix/linux-syscalls.h",
|
|
|
+ "src/unix/procfs-exepath.c",
|
|
|
+ "src/unix/sysinfo-loadavg.c",
|
|
|
-+ "src/unix/sysinfo-memory.c",
|
|
|
+ ]
|
|
|
+ libs += [
|
|
|
+ "dl",
|
|
@@ -794,11 +814,6 @@ index 0000000000000000000000000000000000000000..b62fac6738ae74788faa6e5dcc705b81
|
|
|
+ "src/unix/kqueue.c",
|
|
|
+ ]
|
|
|
+ }
|
|
|
-+ if (is_component_build && is_win) {
|
|
|
-+ defines += [
|
|
|
-+ "BUILDING_UV_SHARED=1",
|
|
|
-+ ]
|
|
|
-+ }
|
|
|
+}
|
|
|
diff --git a/deps/zlib/BUILD.gn b/deps/zlib/BUILD.gn
|
|
|
new file mode 100644
|
|
@@ -866,10 +881,10 @@ index 0000000000000000000000000000000000000000..f13b471d17128468bed06e66bd03a2ea
|
|
|
+}
|
|
|
diff --git a/filenames.json b/filenames.json
|
|
|
new file mode 100644
|
|
|
-index 0000000000000000000000000000000000000000..615b82d3d78d63c8441172d65f008914756fdb7e
|
|
|
+index 0000000000000000000000000000000000000000..edb0b215088118f567c5ad5e5969d1eb5ef661a3
|
|
|
--- /dev/null
|
|
|
+++ b/filenames.json
|
|
|
-@@ -0,0 +1,435 @@
|
|
|
+@@ -0,0 +1,443 @@
|
|
|
+// This file is automatically generated by generate_gn_filenames_json.py
|
|
|
+// DO NOT EDIT
|
|
|
+{
|
|
@@ -883,8 +898,7 @@ index 0000000000000000000000000000000000000000..615b82d3d78d63c8441172d65f008914
|
|
|
+ "src/node_api.h",
|
|
|
+ "src/node_api_types.h",
|
|
|
+ "src/node_buffer.h",
|
|
|
-+ "src/node_object_wrap.h",
|
|
|
-+ "src/node_version.h"
|
|
|
++ "src/node_object_wrap.h"
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
@@ -940,11 +954,11 @@ index 0000000000000000000000000000000000000000..615b82d3d78d63c8441172d65f008914
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "library_files": [
|
|
|
-+ "lib/internal/bootstrap/primordials.js",
|
|
|
-+ "lib/internal/bootstrap/cache.js",
|
|
|
++ "lib/internal/bootstrap/environment.js",
|
|
|
+ "lib/internal/bootstrap/loaders.js",
|
|
|
+ "lib/internal/bootstrap/node.js",
|
|
|
+ "lib/internal/bootstrap/pre_execution.js",
|
|
|
++ "lib/internal/per_context/primordials.js",
|
|
|
+ "lib/internal/per_context/setup.js",
|
|
|
+ "lib/internal/per_context/domexception.js",
|
|
|
+ "lib/async_hooks.js",
|
|
@@ -1083,7 +1097,6 @@ index 0000000000000000000000000000000000000000..615b82d3d78d63c8441172d65f008914
|
|
|
+ "lib/internal/process/worker_thread_only.js",
|
|
|
+ "lib/internal/process/report.js",
|
|
|
+ "lib/internal/process/task_queues.js",
|
|
|
-+ "lib/internal/profiler.js",
|
|
|
+ "lib/internal/querystring.js",
|
|
|
+ "lib/internal/readline.js",
|
|
|
+ "lib/internal/repl.js",
|
|
@@ -1137,9 +1150,16 @@ index 0000000000000000000000000000000000000000..615b82d3d78d63c8441172d65f008914
|
|
|
+ "deps/node-inspect/lib/internal/inspect_client.js",
|
|
|
+ "deps/node-inspect/lib/internal/inspect_repl.js",
|
|
|
+ "deps/acorn/acorn/dist/acorn.js",
|
|
|
-+ "deps/acorn/acorn-walk/dist/walk.js"
|
|
|
++ "deps/acorn/acorn-walk/dist/walk.js",
|
|
|
++ "deps/acorn-plugins/acorn-bigint/index.js",
|
|
|
++ "deps/acorn-plugins/acorn-class-fields/index.js",
|
|
|
++ "deps/acorn-plugins/acorn-numeric-separator/index.js",
|
|
|
++ "deps/acorn-plugins/acorn-private-class-elements/index.js",
|
|
|
++ "deps/acorn-plugins/acorn-private-methods/index.js",
|
|
|
++ "deps/acorn-plugins/acorn-static-class-features/index.js"
|
|
|
+ ],
|
|
|
+ "node_sources": [
|
|
|
++ "src/api/async_resource.cc",
|
|
|
+ "src/api/callback.cc",
|
|
|
+ "src/api/encoding.cc",
|
|
|
+ "src/api/environment.cc",
|
|
@@ -1178,9 +1198,11 @@ index 0000000000000000000000000000000000000000..615b82d3d78d63c8441172d65f008914
|
|
|
+ "src/node_http_parser_traditional.cc",
|
|
|
+ "src/node_http2.cc",
|
|
|
+ "src/node_i18n.cc",
|
|
|
++ "src/node_main_instance.cc",
|
|
|
+ "src/node_messaging.cc",
|
|
|
+ "src/node_metadata.cc",
|
|
|
+ "src/node_native_module.cc",
|
|
|
++ "src/node_native_module_env.cc",
|
|
|
+ "src/node_options.cc",
|
|
|
+ "src/node_os.cc",
|
|
|
+ "src/node_perf.cc",
|
|
@@ -1256,16 +1278,17 @@ index 0000000000000000000000000000000000000000..615b82d3d78d63c8441172d65f008914
|
|
|
+ "src/node_http2_state.h",
|
|
|
+ "src/node_i18n.h",
|
|
|
+ "src/node_internals.h",
|
|
|
++ "src/node_main_instance.h",
|
|
|
+ "src/node_messaging.h",
|
|
|
+ "src/node_metadata.h",
|
|
|
+ "src/node_mutex.h",
|
|
|
+ "src/node_native_module.h",
|
|
|
++ "src/node_native_module_env.h",
|
|
|
+ "src/node_object_wrap.h",
|
|
|
+ "src/node_options.h",
|
|
|
+ "src/node_options-inl.h",
|
|
|
+ "src/node_perf.h",
|
|
|
+ "src/node_perf_common.h",
|
|
|
-+ "src/node_persistent.h",
|
|
|
+ "src/node_platform.h",
|
|
|
+ "src/node_process.h",
|
|
|
+ "src/node_revert.h",
|
|
@@ -1307,10 +1330,10 @@ index 0000000000000000000000000000000000000000..615b82d3d78d63c8441172d65f008914
|
|
|
+}
|
|
|
diff --git a/src/inspector/BUILD.gn b/src/inspector/BUILD.gn
|
|
|
new file mode 100644
|
|
|
-index 0000000000000000000000000000000000000000..0e1a5a22315989d5b0b4b6462330b3d693a43228
|
|
|
+index 0000000000000000000000000000000000000000..48ad85e895b6111223119fafa57c13ba75cdbeae
|
|
|
--- /dev/null
|
|
|
+++ b/src/inspector/BUILD.gn
|
|
|
-@@ -0,0 +1,194 @@
|
|
|
+@@ -0,0 +1,195 @@
|
|
|
+import("//v8/gni/v8.gni")
|
|
|
+
|
|
|
+inspector_protocol_dir = "../../tools/inspector_protocol"
|
|
@@ -1381,10 +1404,11 @@ index 0000000000000000000000000000000000000000..0e1a5a22315989d5b0b4b6462330b3d6
|
|
|
+
|
|
|
+ inputs = [
|
|
|
+ "$target_gen_dir/node_protocol_config.json",
|
|
|
-+ "$target_gen_dir/node_protocol.json",
|
|
|
++ "$target_gen_dir/src/node_protocol.json",
|
|
|
++ "$inspector_protocol_dir/lib/base_string_adapter_cc.template",
|
|
|
++ "$inspector_protocol_dir/lib/base_string_adapter_h.template",
|
|
|
+ "$inspector_protocol_dir/lib/Allocator_h.template",
|
|
|
+ "$inspector_protocol_dir/lib/Array_h.template",
|
|
|
-+ "$inspector_protocol_dir/lib/Collections_h.template",
|
|
|
+ "$inspector_protocol_dir/lib/DispatcherBase_cpp.template",
|
|
|
+ "$inspector_protocol_dir/lib/DispatcherBase_h.template",
|
|
|
+ "$inspector_protocol_dir/lib/ErrorSupport_cpp.template",
|
|
@@ -1463,13 +1487,13 @@ index 0000000000000000000000000000000000000000..0e1a5a22315989d5b0b4b6462330b3d6
|
|
|
+ "node_protocol.pdl",
|
|
|
+ ]
|
|
|
+ outputs = [
|
|
|
-+ "$target_gen_dir/node_protocol.json",
|
|
|
++ "$target_gen_dir/src/node_protocol.json",
|
|
|
+ ]
|
|
|
+}
|
|
|
+
|
|
|
+generate_protocol_json("v8_protocol_json") {
|
|
|
+ sources = [
|
|
|
-+ "//v8/src/inspector/js_protocol.pdl",
|
|
|
++ "//v8/include/js_protocol.pdl",
|
|
|
+ ]
|
|
|
+ outputs = [
|
|
|
+ "$target_gen_dir/js_protocol.json",
|
|
@@ -1483,7 +1507,7 @@ index 0000000000000000000000000000000000000000..0e1a5a22315989d5b0b4b6462330b3d6
|
|
|
+ ]
|
|
|
+ inputs = [
|
|
|
+ "$target_gen_dir/js_protocol.json",
|
|
|
-+ "$target_gen_dir/node_protocol.json",
|
|
|
++ "$target_gen_dir/src/node_protocol.json",
|
|
|
+ ]
|
|
|
+ outputs = [
|
|
|
+ "$target_gen_dir/concatenated_protocol.json",
|
|
@@ -1505,6 +1529,21 @@ index 0000000000000000000000000000000000000000..0e1a5a22315989d5b0b4b6462330b3d6
|
|
|
+ script = "../../tools/compress_json.py"
|
|
|
+ args = rebase_path(inputs + outputs, root_build_dir)
|
|
|
+}
|
|
|
+diff --git a/src/node_version.h b/src/node_version.h
|
|
|
+index 1c04b102721f891c6b657702b7f8585137647e04..a9f8a9c8cbfd3996906eb400388aaa99ef77f547 100644
|
|
|
+--- a/src/node_version.h
|
|
|
++++ b/src/node_version.h
|
|
|
+@@ -89,7 +89,10 @@
|
|
|
+ * version matching should open a pull request to reserve a number in this
|
|
|
+ * registry.
|
|
|
+ */
|
|
|
++// Electron sets NODE_MODULE_VERSION in their GN configuration
|
|
|
++#ifndef NODE_MODULE_VERSION
|
|
|
+ #define NODE_MODULE_VERSION 72
|
|
|
++#endif
|
|
|
+
|
|
|
+ // the NAPI_VERSION provided by this version of the runtime
|
|
|
+ #define NAPI_VERSION 4
|
|
|
diff --git a/tools/generate_config_gypi.py b/tools/generate_config_gypi.py
|
|
|
new file mode 100644
|
|
|
index 0000000000000000000000000000000000000000..01f62d4ae6e3b9d539444e3dff069f0011353caa
|
|
@@ -1524,7 +1563,7 @@ index 0000000000000000000000000000000000000000..01f62d4ae6e3b9d539444e3dff069f00
|
|
|
+ main(sys.argv[1:])
|
|
|
diff --git a/tools/generate_gn_filenames_json.py b/tools/generate_gn_filenames_json.py
|
|
|
new file mode 100755
|
|
|
-index 0000000000000000000000000000000000000000..28e97bcb9aed0a8c0bbfa0e00ba914aa923d4bba
|
|
|
+index 0000000000000000000000000000000000000000..41f0138dfa9f610de1f8267080fa15e8bd9e0325
|
|
|
--- /dev/null
|
|
|
+++ b/tools/generate_gn_filenames_json.py
|
|
|
@@ -0,0 +1,63 @@
|
|
@@ -1579,7 +1618,7 @@ index 0000000000000000000000000000000000000000..28e97bcb9aed0a8c0bbfa0e00ba914aa
|
|
|
+
|
|
|
+ def add_headers(files, dest_dir):
|
|
|
+ if 'src/node.h' in files:
|
|
|
-+ files = [f for f in files if f.endswith('.h')]
|
|
|
++ files = [f for f in files if f.endswith('.h') and f != 'src/node_version.h']
|
|
|
+ elif any(f.startswith('deps/v8/') for f in files):
|
|
|
+ files = [f.replace('deps/v8/', '//v8/', 1) for f in files]
|
|
|
+ hs = {'files': sorted(files), 'dest_dir': dest_dir}
|
|
@@ -1591,6 +1630,37 @@ index 0000000000000000000000000000000000000000..28e97bcb9aed0a8c0bbfa0e00ba914aa
|
|
|
+ f.write(FILENAMES_JSON_HEADER)
|
|
|
+ f.write(json.dumps(out, sort_keys=True, indent=2, separators=(',', ': ')))
|
|
|
+ f.write('\n')
|
|
|
+diff --git a/tools/generate_node_version_header.py b/tools/generate_node_version_header.py
|
|
|
+new file mode 100755
|
|
|
+index 0000000000000000000000000000000000000000..3088ae4bdf814ae255c9805ebd393b2eee17e941
|
|
|
+--- /dev/null
|
|
|
++++ b/tools/generate_node_version_header.py
|
|
|
+@@ -0,0 +1,25 @@
|
|
|
++#!/usr/bin/env python
|
|
|
++import re
|
|
|
++import sys
|
|
|
++
|
|
|
++node_version_file = sys.argv[1]
|
|
|
++out_file = sys.argv[2]
|
|
|
++NMV = None
|
|
|
++if len(sys.argv) > 3:
|
|
|
++ NMV = sys.argv[3]
|
|
|
++
|
|
|
++with open(node_version_file, 'r') as in_file, open(out_file, 'w') as out_file:
|
|
|
++ changed = False
|
|
|
++ contents = in_file.read()
|
|
|
++ new_contents = re.sub(
|
|
|
++ r'^#define NODE_MODULE_VERSION [0-9]+$',
|
|
|
++ '#define NODE_MODULE_VERSION ' + NMV,
|
|
|
++ contents,
|
|
|
++ flags=re.MULTILINE)
|
|
|
++
|
|
|
++ changed = contents != new_contents
|
|
|
++
|
|
|
++ if not changed and NMV is not None:
|
|
|
++ raise Exception("Did not modify the NMV from nodes value, this value MUST differ from node")
|
|
|
++
|
|
|
++ out_file.writelines(new_contents)
|
|
|
diff --git a/tools/js2c.py b/tools/js2c.py
|
|
|
index c3ac53f14b739142a5da43e15b43b8642b36fa84..68152c499ce610d759b5abd659340957efb864d6 100755
|
|
|
--- a/tools/js2c.py
|