Skip to content

Commit

Permalink
Build with upstream node
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Dec 1, 2023
1 parent d2ef329 commit d728afe
Show file tree
Hide file tree
Showing 84 changed files with 1,257 additions and 3,538 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Dependencies
/base
/build
/buildtools/
/buildtools
/node
/third_party
/tools/clang
Expand All @@ -11,4 +11,4 @@
/out

# Generated
/node_files.json
*.swp
84 changes: 42 additions & 42 deletions .gn
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ import("//build/dotfile_settings.gni")
# The location of the build configuration file.
buildconfig = "//build/config/BUILDCONFIG.gn"

# The secondary source root is a parallel directory tree where
# GN build files are placed when they can not be placed directly
# in the source tree, e.g. for third party source trees.
secondary_source = "//gn/"

# These are the targets to check headers for by default. The files in targets
# matching these patterns (see "gn help label_pattern" for format) will have
# their includes checked for proper dependencies when you run either
Expand All @@ -28,7 +23,43 @@ check_targets = ["*"]
exec_script_whitelist =
build_dotfile_settings.exec_script_whitelist + [
"//v8/build_overrides/build.gni",
"//node/node_component.gni",
"//node/BUILD.gn",
"//node/node.gni",
"//node/unofficial.gni",
"//node/tools/inspector_protocol/BUILD.gn",
"//node/deps/ada/BUILD.gn",
"//node/deps/ada/unofficial.gni",
"//node/deps/llhttp/BUILD.gn",
"//node/deps/llhttp/unofficial.gni",
"//node/deps/nghttp2/BUILD.gn",
"//node/deps/nghttp2/unofficial.gni",
"//node/deps/simdjson/BUILD.gn",
"//node/deps/simdjson/unofficial.gni",
"//node/deps/simdutf/BUILD.gn",
"//node/deps/simdutf/unofficial.gni",
"//node/deps/postject/BUILD.gn",
"//node/deps/postject/unofficial.gni",
"//node/deps/brotli/BUILD.gn",
"//node/deps/brotli/unofficial.gni",
"//node/deps/base64/BUILD.gn",
"//node/deps/base64/unofficial.gni",
"//node/deps/ngtcp2/BUILD.gn",
"//node/deps/ngtcp2/unofficial.gni",
"//node/deps/uv/BUILD.gn",
"//node/deps/uv/unofficial.gni",
"//node/deps/uvwasi/BUILD.gn",
"//node/deps/uvwasi/unofficial.gni",
"//node/deps/cares/BUILD.gn",
"//node/deps/cares/unofficial.gni",
"//node/deps/googletest/BUILD.gn",
"//node/deps/googletest/unofficial.gni",
"//node/deps/openssl/BUILD.gn",
"//node/deps/openssl/unofficial.gni",
"//node/deps/histogram/BUILD.gn",
"//node/deps/histogram/unofficial.gni",
"//node/src/inspector/BUILD.gn",
"//node/src/inspector/unofficial.gni",
"//node_tests/BUILD.gn",
]

# The python interpreter to use by default.
Expand All @@ -37,56 +68,25 @@ script_executable = "vpython3"
default_args = {
#########################################################
# Changeable defaults
# General build options
use_sysroot = false
is_component_build = false

# Node.js defaults.
node_report = true
is_debug = false
node_use_custom_libcxx = false
node_v8_path = "//v8"

# V8 options.
v8_embedder_string = "-node.0"
v8_enable_i18n_support = true

# V8 debug options.
v8_enable_disassembler = true
v8_deprecation_warnings = false
v8_imminent_deprecation_warnings = false
v8_enable_handle_zapping = false
v8_enable_pointer_compression = false
v8_optimized_debug = false
v8_enable_fast_mksnapshot = false
v8_enable_snapshot_compression = false

#########################################################
# Alternative configuration not supported. Do not change.
# General build options.
clang_use_chrome_plugins = false
icu_use_data_file = false
symbol_level = 0

# Node.js options. Do not change.
node_use_v8_platform = true
treat_warnings_as_errors = false

# V8 options catering towards Node.js use case.
v8_postmortem_support = true
v8_expose_public_symbols = true
v8_promise_internal_field_count = 1
v8_use_external_startup_data = false
v8_untrusted_code_mitigations = false
v8_enable_pointer_compression = false
v8_enable_31bit_smis_on_64bit_arch = false
v8_disable_arguments_adaptor = false
v8_use_siphash = true
v8_expose_symbols = true
v8_enable_lazy_source_positions = false
v8_allow_javascript_in_promise_hooks = true
v8_enable_javascript_promise_hooks = true
v8_enable_sandbox = false
v8_enable_maglev = false
# TODO(cbruni, v8:12302): Remove once API is migrated
v8_scriptormodule_legacy_lifetime = true

# V8 options.
v8_experimental_extra_library_files = []
v8_extra_library_files = []
}
38 changes: 0 additions & 38 deletions .vpython

This file was deleted.

6 changes: 6 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
group("default") {
deps = [
"//node",
"//node_tests",
]
}
78 changes: 55 additions & 23 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
gclient_gn_args_file = 'node-ci/build/config/gclient_args.gni'
gclient_gn_args = [
'checkout_google_benchmark',
'checkout_fuchsia_for_arm64_host'
]

vars = {
'checkout_google_benchmark' : False,
'checkout_fuchsia_for_arm64_host' : False,

'abseil_revision': '84ccde02f2ad7c440aa8b5d99f73b77c5e6484ad',
'abseil_url': 'https://chromium.googlesource.com/chromium/src/third_party/abseil-cpp.git',
Expand Down Expand Up @@ -42,9 +40,6 @@ vars = {
# Fetch configuration files required for the 'use_remoteexec' gn arg
'download_remoteexec_cfg': False,

'fuchsia_sdk_revision': 'f8df9ff79b878d1998970cc04a197061069e48ce',
'fuchsia_sdk_url': 'https://chromium.googlesource.com/chromium/src/third_party/fuchsia-sdk.git',

# GN CIPD package version.
'gn_version': 'git_revision:e9e83d9095d3234adf68f3e2866f25daf766d5c7',

Expand All @@ -64,8 +59,8 @@ vars = {
'markupsafe_revision': '006709ba3ed87660a17bd4548c45663628f5ed85',
'markupsafe_url': 'https://chromium.googlesource.com/chromium/src/third_party/markupsafe.git',

'node_revision': '72cd9e5248e50cd1eaba6f2f91ab2d9db5d99295',
'node_url': 'https://chromium.googlesource.com/external/github.com/v8/node.git',
'node_revision': '2f4065250e453da2de2ee9cbb8aaae28cbdb4df5',
'node_url': 'https://github.com/nodejs/node',

'trace_common_revision' : '29ac73db520575590c3aceb0a6f1f58dda8934f6',
'trace_common_url': 'https://chromium.googlesource.com/chromium/src/base/trace_event/common.git',
Expand Down Expand Up @@ -97,10 +92,6 @@ deps = {
'node-ci/node': Var('node_url') + '@' + Var('node_revision'),
'node-ci/third_party/abseil-cpp': Var('abseil_url') + '@' + Var('abseil_revision'),
'node-ci/third_party/depot_tools': Var('depot_tools_url') + '@' + Var('depot_tools_revision'),
'node-ci/third_party/fuchsia-sdk': {
'url': Var('fuchsia_sdk_url') + '@' + Var('fuchsia_sdk_revision'),
'condition': 'checkout_fuchsia',
},
'node-ci/third_party/googletest/src': Var('googletest_url') + '@' + Var('googletest_revision'),
'node-ci/third_party/icu': Var('icu_url') + '@' + Var('icu_revision'),
'node-ci/third_party/jinja2': Var('jinja2_url') + '@' + Var('jinja2_revision'),
Expand Down Expand Up @@ -161,9 +152,59 @@ deps = {

hooks = [
{
'name': 'generate_node_filelist',
'pattern': 'node-ci/node',
'action': ['python3', 'node-ci/tools/generate_node_files_json.py'],
'name': 'sysroot_arm',
'pattern': '.',
'condition': 'checkout_linux and checkout_arm',
'action': ['python3', 'node-ci/build/linux/sysroot_scripts/install-sysroot.py',
'--arch=arm'],
},
{
'name': 'sysroot_arm64',
'pattern': '.',
'condition': 'checkout_linux and checkout_arm64',
'action': ['python3', 'node-ci/build/linux/sysroot_scripts/install-sysroot.py',
'--arch=arm64'],
},
{
'name': 'sysroot_x86',
'pattern': '.',
'condition': 'checkout_linux and (checkout_x86 or checkout_x64)',
'action': ['python3', 'node-ci/build/linux/sysroot_scripts/install-sysroot.py',
'--arch=x86'],
},
{
'name': 'sysroot_mips',
'pattern': '.',
'condition': 'checkout_linux and checkout_mips',
'action': ['python3', 'node-ci/build/linux/sysroot_scripts/install-sysroot.py',
'--arch=mips'],
},
{
'name': 'sysroot_mips64',
'pattern': '.',
'condition': 'checkout_linux and checkout_mips64',
'action': ['python3', 'node-ci/build/linux/sysroot_scripts/install-sysroot.py',
'--arch=mips64el'],
},
{
'name': 'sysroot_x64',
'pattern': '.',
'condition': 'checkout_linux and checkout_x64',
'action': ['python3', 'node-ci/build/linux/sysroot_scripts/install-sysroot.py',
'--arch=x64'],
},
{
# Case-insensitivity for the Win SDK. Must run before win_toolchain below.
'name': 'ciopfs_linux',
'pattern': '.',
'condition': 'checkout_win and host_os == "linux"',
'action': [ 'python3',
'node-ci/third_party/depot_tools/download_from_google_storage.py',
'--no_resume',
'--no_auth',
'--bucket', 'chromium-browser-clang/ciopfs',
'-s', 'node-ci/build/ciopfs.sha1',
]
},
{
# Update the Windows toolchain if necessary.
Expand Down Expand Up @@ -199,15 +240,6 @@ hooks = [
'node-ci/build/linux/sysroot_scripts/install-sysroot.py',
'--arch=x64'],
},
{
'name': 'fuchsia_sdk',
'pattern': '.',
'condition': 'checkout_fuchsia',
'action': [
'python3',
'node-ci/build/fuchsia/update_sdk.py',
],
},
# Configure remote exec cfg files
{
'name': 'configure_reclient_cfgs',
Expand Down
14 changes: 3 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ ifdef JOBS
PARALLEL_ARGS = -j $(JOBS)
endif

BUILDDEPS_FLAGS = --no-nacl --no-chromeos-fonts --no-arm --lib32

# Gclient sync and check build deps
# Gclient sync
deps:
gclient sync
build/install-build-deps.sh --quick-check $(BUILDDEPS_FLAGS) ||\
build/install-build-deps.sh $(BUILDDEPS_FLAGS)

# Generate GN configs
out/Release:
Expand All @@ -21,17 +17,14 @@ out/Release:
out/Debug:
tools/gn-gen.py out/Debug --debug

out/fuchsia:
tools/gn-gen.py out/fuchsia --target_os="fuchsia" --no-cache

# Build
.PHONY: build.Release
build.Release: out/Release
autoninja -C $< test_all
autoninja -C $< node

.PHONY:
build.Debug: out/Debug
autoninja -C $< test_all
autoninja -C $< node

.PHONY: build.fuchsia
build.fuchsia: out/fuchsia
Expand Down Expand Up @@ -112,4 +105,3 @@ test-addons.Release: build.Release
test-addons.Debug: build.Debug
tools/test.py --test-root out/Debug/gen/node/test\
$(PARALLEL_ARGS) -m debug addons

9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Electron, having both Chromium and Node.js as its dependencies, adopted GN. Many

Some reading material:
* [GN build system](https://www.chromium.org/developers/gn-build-configuration)
* [Discussion on adding GN files to upstream Node.js](https://github.com/nodejs/TSC/issues/1353)
* [Discussion on building Node.js with GN](https://github.com/nodejs/node/issues/21410)
* [Discussion on building Node.js with cmake](https://github.com/nodejs/TSC/issues/648)
* [Discussion on building Node.js with Bazel](https://github.com/nodejs/TSC/issues/464)
Expand All @@ -31,8 +32,8 @@ Alternatively, you can
```bash
mkdir node-ci
cd node-ci
git clone https://chromium.googlesource.com/v8/node-ci
gclient config https://chromium.googlesource.com/v8/node-ci --unmanaged
git clone https://github.com/photoionization/node-ci
gclient config https://github.com/photoionization/node-ci --unmanaged
```

### Build
Expand Down Expand Up @@ -76,10 +77,6 @@ git checkout local-v8/<your-branch>
* Stay as up-to-date as possible. The point of this is to be able to build with newest versions of dependencies, including Node.js, V8, and ICU.
* Simplicity. It should be easy to get up and running.

## Not yet implemented
* Support building on Windows. The current configurations have been tested for Linux and Mac.
* Platform-specific OpenSSL build configurations. The current build only supports the slowest platform-independent configuration.

## Explicit non-goals
* To translate every configuration from the GYP build.
* To support platforms not supported by Chromium.
Expand Down
12 changes: 0 additions & 12 deletions examples/BUILD.gn

This file was deleted.

Loading

0 comments on commit d728afe

Please sign in to comment.