├── .gitignore ├── .gn ├── DEPS ├── LICENSE ├── Makefile ├── README.md ├── build_overrides ├── codereview.settings ├── gn ├── BUILD.gn ├── node │ ├── BUILD.gn │ ├── deps │ │ ├── brotli │ │ │ └── c │ │ │ │ └── BUILD.gn │ │ ├── cares │ │ │ └── BUILD.gn │ │ ├── histogram │ │ │ └── BUILD.gn │ │ ├── http_parser │ │ │ └── BUILD.gn │ │ ├── llhttp │ │ │ └── BUILD.gn │ │ ├── nghttp2 │ │ │ └── BUILD.gn │ │ ├── openssl │ │ │ └── BUILD.gn │ │ ├── uv │ │ │ └── BUILD.gn │ │ └── zlib │ │ │ └── BUILD.gn │ ├── node.gni │ ├── node_files.gni │ ├── src │ │ └── inspector │ │ │ └── BUILD.gn │ ├── test │ │ ├── BUILD.gn │ │ ├── addons │ │ │ └── BUILD.gn │ │ ├── js-native-api │ │ │ └── BUILD.gn │ │ └── node-api │ │ │ └── BUILD.gn │ └── tools │ │ └── doc │ │ └── BUILD.gn └── third_party │ └── googletest │ └── BUILD.gn ├── test ├── testing └── tools ├── generate_code_cache.py ├── generate_config_gypi.py ├── generate_node_files_json.py ├── gn-gen.py ├── memory ├── asan │ └── blacklist.txt └── tsan_v2 │ └── ignores.txt ├── mirror_removal.py ├── run_executable_in_dir.py ├── run_in_dir.py ├── test.py ├── ubsan ├── blacklist.txt └── vptr_blacklist.txt └── whitespace.txt /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | /base 3 | /build 4 | /buildtools/ 5 | /node 6 | /third_party 7 | /tools/clang 8 | /v8 9 | 10 | # Output folder 11 | /out 12 | 13 | # Generated 14 | /node_files.json 15 | -------------------------------------------------------------------------------- /.gn: -------------------------------------------------------------------------------- 1 | # Copyright 2019 the V8 project authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | # This file is used by the GN meta build system to find the root of the source 6 | # tree and to set startup options. For documentation on the values set in this 7 | # file, run "gn help dotfile" at the command line. 8 | 9 | import("//build/dotfile_settings.gni") 10 | 11 | # The location of the build configuration file. 12 | buildconfig = "//build/config/BUILDCONFIG.gn" 13 | 14 | # The secondary source root is a parallel directory tree where 15 | # GN build files are placed when they can not be placed directly 16 | # in the source tree, e.g. for third party source trees. 17 | secondary_source = "//gn/" 18 | 19 | # These are the targets to check headers for by default. The files in targets 20 | # matching these patterns (see "gn help label_pattern" for format) will have 21 | # their includes checked for proper dependencies when you run either 22 | # "gn check" or "gn gen --check". 23 | check_targets = ["*"] 24 | 25 | # These are the list of GN files that run exec_script. This whitelist exists 26 | # to force additional review for new uses of exec_script, which is strongly 27 | # discouraged except for gypi_to_gn calls. 28 | exec_script_whitelist = build_dotfile_settings.exec_script_whitelist + 29 | [ "//node/node_files.gni" ] 30 | 31 | default_args = { 32 | ######################################################### 33 | # Changeable defaults 34 | # General build options 35 | use_sysroot = false 36 | use_custom_libcxx = false 37 | is_component_build = false 38 | 39 | # Node.js defaults. 40 | node_report = true 41 | is_debug = false 42 | 43 | # V8 options. 44 | v8_embedder_string = "-node.0" 45 | v8_enable_embedded_builtins = true 46 | v8_enable_i18n_support = true 47 | 48 | # V8 debug options. 49 | v8_enable_disassembler = true 50 | v8_deprecation_warnings = false 51 | v8_imminent_deprecation_warnings = false 52 | v8_enable_handle_zapping = false 53 | v8_enable_pointer_compression = false 54 | v8_optimized_debug = false 55 | v8_enable_fast_mksnapshot = false 56 | 57 | ######################################################### 58 | # Alternative configuration not supported. Do not change. 59 | # General build options. 60 | clang_use_chrome_plugins = false 61 | icu_use_data_file = false 62 | symbol_level = 1 63 | 64 | # Node.js options. Do not change. 65 | node_use_v8_platform = true 66 | 67 | # V8 options catering towards Node.js use case. 68 | v8_postmortem_support = true 69 | v8_promise_internal_field_count = 1 70 | v8_use_snapshot = true 71 | v8_use_external_startup_data = false 72 | v8_untrusted_code_mitigations = false 73 | v8_enable_pointer_compression = false 74 | v8_enable_31bit_smis_on_64bit_arch = false 75 | v8_use_siphash = true 76 | v8_expose_symbols = true 77 | 78 | # V8 options. 79 | v8_experimental_extra_library_files = [] 80 | v8_extra_library_files = [] 81 | } 82 | -------------------------------------------------------------------------------- /DEPS: -------------------------------------------------------------------------------- 1 | # Copyright 2019 the V8 project authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | vars = { 6 | 'build_url': 'https://chromium.googlesource.com/chromium/src/build.git', 7 | 'build_revision': 'ebd384ac0066c979fa8fcd69b139e05407618820', 8 | 9 | 'buildtools_url': 'https://chromium.googlesource.com/chromium/src/buildtools.git', 10 | 'buildtools_revision': '3e50219fc4503f461b2176a9976891b28d80f9ab', 11 | 12 | 'clang_url': 'https://chromium.googlesource.com/chromium/src/tools/clang.git', 13 | 'clang_revision': '987f14b1d69362d837743b9807e2b14caf55688f', 14 | 15 | 'depot_tools_url': 'https://chromium.googlesource.com/chromium/tools/depot_tools.git', 16 | 'depot_tools_revision': '95ea36ed70541b2ad01c33656c9504b7dc6404d0', 17 | 18 | 'googletest_url': 'https://chromium.googlesource.com/external/github.com/google/googletest.git', 19 | 'googletest_revision': '37ae1fc5e6be26f367d76c078beabd7024fed53a', 20 | 21 | 'icu_url': 'https://chromium.googlesource.com/chromium/deps/icu.git', 22 | 'icu_revision': '960f195aa87acaec46e6104ec93a596da7ae0843', 23 | 24 | 'jinja2_url': 'https://chromium.googlesource.com/chromium/src/third_party/jinja2.git', 25 | 'jinja2_revision': 'b41863e42637544c2941b574c7877d3e1f663e25', 26 | 27 | 'markupsafe_url': 'https://chromium.googlesource.com/chromium/src/third_party/markupsafe.git', 28 | 'markupsafe_revision': '8f45f5cfa0009d2a70589bcda0349b8cb2b72783', 29 | 30 | 'node_url': 'https://chromium.googlesource.com/external/github.com/v8/node.git', 31 | 'node_revision': '7ef2a111be4e64365832e17cb0ecc4cc8860bced', 32 | 33 | 'trace_common_url': 'https://chromium.googlesource.com/chromium/src/base/trace_event/common.git', 34 | 'trace_common_revision' : '936ba8a963284a6b3737cf2f0474a7131073abee', 35 | 36 | 'v8_url': 'https://chromium.googlesource.com/v8/v8.git', 37 | 'v8_revision': 'a8a45e41213d51590a1b9b0a629afece1751555c', 38 | } 39 | 40 | deps = { 41 | 'node-ci/base/trace_event/common': Var('trace_common_url') + '@' + Var('trace_common_revision'), 42 | 'node-ci/build': Var('build_url') + '@' + Var('build_revision'), 43 | 'node-ci/buildtools': Var('buildtools_url') + '@' + Var('buildtools_revision'), 44 | 'node-ci/tools/clang': Var('clang_url') + '@' + Var('clang_revision'), 45 | 'node-ci/third_party/depot_tools': Var('depot_tools_url') + '@' + Var('depot_tools_revision'), 46 | 'node-ci/third_party/googletest/src': Var('googletest_url') + '@' + Var('googletest_revision'), 47 | 'node-ci/third_party/icu': Var('icu_url') + '@' + Var('icu_revision'), 48 | 'node-ci/third_party/jinja2': Var('jinja2_url') + '@' + Var('jinja2_revision'), 49 | 'node-ci/third_party/markupsafe': Var('markupsafe_url') + '@' + Var('markupsafe_revision'), 50 | 'node-ci/v8': Var('v8_url') + '@' + Var('v8_revision'), 51 | 'node-ci/node': Var('node_url') + '@' + Var('node_revision'), 52 | } 53 | 54 | recursedeps = [ 55 | 'node-ci/buildtools', 56 | ] 57 | 58 | hooks = [ 59 | { 60 | 'name': 'clang', 61 | 'pattern': '.', 62 | 'action': ['python', 'node-ci/tools/clang/scripts/update.py'], 63 | }, 64 | { 65 | 'name': 'generate_node_filelist', 66 | 'pattern': 'node-ci/node', 67 | 'action': ['python', 'node-ci/tools/generate_node_files_json.py'], 68 | }, 69 | # Pull GN using checked-in hashes. 70 | { 71 | 'name': 'gn_win', 72 | 'pattern': '.', 73 | 'condition': 'host_os == "win"', 74 | 'action': [ 'download_from_google_storage', 75 | '--no_resume', 76 | '--platform=win32', 77 | '--no_auth', 78 | '--bucket', 'chromium-gn', 79 | '-s', 'node-ci/buildtools/win/gn.exe.sha1', 80 | ], 81 | }, 82 | { 83 | 'name': 'gn_mac', 84 | 'pattern': '.', 85 | 'condition': 'host_os == "mac"', 86 | 'action': [ 'download_from_google_storage', 87 | '--no_resume', 88 | '--platform=darwin', 89 | '--no_auth', 90 | '--bucket', 'chromium-gn', 91 | '-s', 'node-ci/buildtools/mac/gn.sha1', 92 | ], 93 | }, 94 | { 95 | 'name': 'gn_linux', 96 | 'pattern': '.', 97 | 'condition': 'host_os == "linux"', 98 | 'action': [ 'download_from_google_storage', 99 | '--no_resume', 100 | '--platform=linux*', 101 | '--no_auth', 102 | '--bucket', 'chromium-gn', 103 | '-s', 'node-ci/buildtools/linux64/gn.sha1', 104 | ], 105 | }, 106 | { 107 | 'name': 'sysroot_x64', 108 | 'pattern': '.', 109 | 'condition': 'checkout_linux and checkout_x64', 110 | 'action': ['python', 111 | 'node-ci/build/linux/sysroot_scripts/install-sysroot.py', 112 | '--arch=x64'], 113 | }, 114 | ] 115 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2019 GitHub Inc. 2 | Copyright 2019, the V8 project authors. 3 | 4 | Permission is hereby granted, free of charge, to any person obtaining 5 | a copy of this software and associated documentation files (the 6 | "Software"), to deal in the Software without restriction, including 7 | without limitation the rights to use, copy, modify, merge, publish, 8 | distribute, sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, subject to 10 | the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 2019 the V8 project authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | ifdef JOBS 6 | PARALLEL_ARGS = -j $(JOBS) 7 | endif 8 | 9 | BUILDDEPS_FLAGS = --no-nacl --no-chromeos-fonts --no-arm --lib32 10 | 11 | # Gclient sync and check build deps 12 | deps: 13 | gclient sync 14 | build/install-build-deps.sh --quick-check $(BUILDDEPS_FLAGS) ||\ 15 | build/install-build-deps.sh $(BUILDDEPS_FLAGS) 16 | 17 | # Generate GN configs 18 | out/Release: 19 | tools/gn-gen.py out/Release 20 | 21 | out/Debug: 22 | tools/gn-gen.py out/Debug --debug 23 | 24 | # Build 25 | .PHONY: build.Release 26 | build.Release: out/Release 27 | autoninja -C $< test_all 28 | 29 | .PHONY: 30 | build.Debug: out/Debug 31 | autoninja -C $< test_all 32 | 33 | # Link node binary 34 | node: build.Release 35 | if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/Release/node $@; fi 36 | 37 | node_g: build.Debug 38 | if [ ! -r $@ -o ! -L $@ ]; then ln -fs out/Debug/node $@; fi 39 | 40 | # Run cctest 41 | .PHONY: cctest.Release 42 | cctest.Release: build.Release 43 | out/Release/node_cctest 44 | 45 | .PHONY: cctest.Debug 46 | cctest.Debug: build.Debug 47 | out/Debug/node_cctest 48 | 49 | # Run JS tests 50 | .PHONY: jstest.Release 51 | jstest.Release: build.Release 52 | tools/test.py $(PARALLEL_ARGS) -m release 53 | 54 | .PHONY: jstest.Debug 55 | jstest.Debug: build.Debug 56 | tools/test.py $(PARALLEL_ARGS) -m debug 57 | 58 | # Run all tests 59 | .PHONY: test 60 | test: cctest.Release jstest.Release\ 61 | test-addons.Release test-node-api.Release test-js-native-api.Release 62 | 63 | .PHONY: test_g 64 | test_g: cctest.Debug jstest.Debug\ 65 | test-addons.Debug test-node-api.Debug test-js-native-api.Debug 66 | 67 | # Clean 68 | .PHONY: clean 69 | clean: 70 | rm -rf out 71 | 72 | # Test js-native-api 73 | .PHONY: test-js-native-api.Release 74 | test-js-native-api.Release: build.Release 75 | tools/test.py --test-root out/Release/gen/node/test\ 76 | $(PARALLEL_ARGS) -m release js-native-api 77 | 78 | .PHONY: test-js-native-api.Debug 79 | test-js-native-api.Debug: build.Debug 80 | tools/test.py --test-root out/Debug/gen/node/test\ 81 | $(PARALLEL_ARGS) -m debug js-native-api 82 | 83 | # Test node-api 84 | .PHONY: test-node-api.Release 85 | test-node-api.Release: build.Release 86 | tools/test.py --test-root out/Release/gen/node/test\ 87 | $(PARALLEL_ARGS) -m release node-api 88 | 89 | # Test node-api 90 | .PHONY: test-node-api.Debug 91 | test-node-api.Debug: build.Debug 92 | tools/test.py --test-root out/Debug/gen/node/test\ 93 | $(PARALLEL_ARGS) -m debug node-api 94 | 95 | # Test addons 96 | .PHONY: test-addons.Debug 97 | test-addons.Release: build.Release 98 | tools/test.py --test-root out/Release/gen/node/test\ 99 | $(PARALLEL_ARGS) -m release addons 100 | 101 | .PHONY: test-addons.Debug 102 | test-addons.Debug: build.Debug 103 | tools/test.py --test-root out/Debug/gen/node/test\ 104 | $(PARALLEL_ARGS) -m debug addons 105 | 106 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Node.js built with GN 2 | 3 | This project is a set of dependency and build configurations to build Node.js with GN. 4 | 5 | ## Background 6 | V8 was originally built with SCons. Following Chromium, it made the switch to GYP, completing around 2012. That was when Node.js started its success story. However, again following Chromium, V8 made the switch to GN, completing in 2016. So far, Node.js has hesitated in adopting GN. One of the reasons is its now established native modules ecosystem that relies on GYP for build configuration. 7 | 8 | Electron, having both Chromium and Node.js as its dependencies, adopted GN. Many files in this repository have been derived from the [Electron project](https://github.com/electron/node), with appropriate changes to avoid the need for forking files, to implement a standalone build, or to fix test failures. 9 | 10 | Some reading material: 11 | * [GN build system](https://www.chromium.org/developers/gn-build-configuration) 12 | * [Discussion on building Node.js with GN](https://github.com/nodejs/node/issues/21410) 13 | * [Discussion on building Node.js with cmake](https://github.com/nodejs/TSC/issues/648) 14 | * [Discussion on building Node.js with Bazel](https://github.com/nodejs/TSC/issues/464) 15 | * [Document on GYP deprecation and Node.js](https://docs.google.com/document/d/1gvHuesiuvLzD6X6ONddxXRxhODlOJlxgfoTNZTlKLGA/edit) 16 | * [Document on Bazel for Node.js](https://docs.google.com/document/d/101BP4BpZoP4tsMGo4j_MhoyLv169-2Oq_HeyWykCNGc/edit) 17 | 18 | ## Instructions 19 | 20 | ### Checking out source 21 | 22 | [Get depot_tools](https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up) first. 23 | 24 | ```bash 25 | mkdir node-ci 26 | cd node-ci 27 | fetch node-ci 28 | ``` 29 | 30 | Alternatively, you can 31 | ```bash 32 | mkdir node-ci 33 | cd node-ci 34 | git clone https://chromium.googlesource.com/v8/node-ci 35 | gclient config https://chromium.googlesource.com/v8/node-ci --unmanaged 36 | ``` 37 | 38 | ### Build 39 | 40 | ```bash 41 | cd node-ci 42 | make deps 43 | make node 44 | ``` 45 | 46 | ### Test 47 | 48 | ```bash 49 | JOBS=4 make test 50 | ``` 51 | 52 | ### Advanced build configurations 53 | 54 | For more advanced build options, check out `tools/gn-gen.py --help`. 55 | 56 | ### Update dependencies 57 | 58 | To update a dependency, e.g. V8 or Node.js, use gclient to update DEPS. 59 | 60 | ```bash 61 | gclient setdep --var=v8_revision= 62 | ``` 63 | 64 | To apply changes, e.g. for local testing, use git: 65 | 66 | ```bash 67 | cd v8 68 | git remote add local-v8 /.git 69 | git fetch local-v8 70 | git checkout local-v8/ 71 | ``` 72 | 73 | ## Project priorities 74 | * Stay as slim as possible. By avoiding to fork files from dependencies, future maintenance becomes less a hassle. 75 | * Pull necessary sources as dependencies rather than checking in the sources. 76 | * 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. 77 | * Simplicity. It should be easy to get up and running. 78 | 79 | ## Not yet implemented 80 | * Support building on Windows. The current configurations have been tested for Linux and Mac. 81 | * Platform-specific OpenSSL build configurations. The current build only supports the slowest platform-independent configuration. 82 | 83 | ## Explicit non-goals 84 | * To translate every configuration from the GYP build. 85 | * To support platforms not supported by Chromium. 86 | * To replace Node.js' test runner with the one used by V8. 87 | * To use GN to build native modules. 88 | 89 | ## Advantages over upstream Node.js 90 | * Proper dependency management. Upgrading dependencies is just a small change in `DEPS`. 91 | * No need to port V8 changes to GYP. 92 | * Availability of sanitizers. 93 | * Ability to use GN features such as jumbo builds. 94 | * Toolchain to build is bundled as dependency. 95 | -------------------------------------------------------------------------------- /build_overrides: -------------------------------------------------------------------------------- 1 | v8/build_overrides -------------------------------------------------------------------------------- /codereview.settings: -------------------------------------------------------------------------------- 1 | GERRIT_HOST: True 2 | CC_LIST: v8-reviews@googlegroups.com 3 | -------------------------------------------------------------------------------- /gn/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright 2019 the V8 project authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | group("test_all") { 6 | testonly = true 7 | deps = [ 8 | "//node:node", 9 | "//node:node_cctest", 10 | "//node/test/addons:build", 11 | "//node/test/node-api:build", 12 | "//node/test/js-native-api:build", 13 | ] 14 | } 15 | -------------------------------------------------------------------------------- /gn/node/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013-2019 GitHub Inc. 2 | # Copyright 2019 the V8 project authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | import("//v8/gni/v8.gni") 7 | import("//node/node_files.gni") 8 | 9 | declare_args() { 10 | # Enable the V8 inspector protocol for use with node. 11 | node_enable_inspector = true 12 | 13 | # Build node with SSL support. 14 | # The variable is called "openssl" for parity with node's GYP build. 15 | node_use_openssl = true 16 | 17 | # Use the specified path to system CA (PEM format) in addition to 18 | # the BoringSSL supplied CA store or compiled-in Mozilla CA copy. 19 | node_openssl_system_ca_path = "" 20 | 21 | # Initialize v8 platform during node.js startup. 22 | node_use_v8_platform = true 23 | 24 | # Build with DTrace support. 25 | node_use_dtrace = false 26 | 27 | # Build with ETW support. 28 | node_use_etw = false 29 | 30 | # Build JavaScript in lib/ with DCHECK macros. 31 | node_debug_lib = false 32 | 33 | # Custom build tag. 34 | node_tag = "" 35 | 36 | # V8 options to pass, see `node --v8-options` for examples. 37 | node_v8_options = "" 38 | 39 | # Provide a custom URL prefix for the `process.release` properties 40 | # `sourceUrl` and `headersUrl`. When compiling a release build, this will 41 | # default to https://nodejs.org/download/release/'). 42 | node_release_urlbase = "" 43 | 44 | # Enable node_report. 45 | node_report = true 46 | 47 | # Use code cache to speed up startup. 48 | node_use_code_cache = true 49 | } 50 | 51 | assert(!node_use_dtrace, "node_use_dtrace not supported in GN") 52 | assert(!node_use_etw, "node_use_etw not supported in GN") 53 | 54 | assert(!node_enable_inspector || node_use_openssl, 55 | "node_enable_inspector requires node_use_openssl") 56 | 57 | template("chdir_action") { 58 | action(target_name) { 59 | forward_variables_from(invoker, 60 | "*", 61 | [ 62 | "script", 63 | "args", 64 | ]) 65 | assert(defined(cwd), "Need cwd in $target_name") 66 | script = "//tools/run_in_dir.py" 67 | if (defined(sources)) { 68 | sources += [ invoker.script ] 69 | } else { 70 | assert(defined(inputs)) 71 | inputs += [ invoker.script ] 72 | } 73 | args = [ 74 | rebase_path(cwd), 75 | rebase_path(invoker.script), 76 | ] 77 | args += invoker.args 78 | } 79 | } 80 | 81 | copy("node_js2c_inputs") { 82 | sources = node_files.node_library_files 83 | outputs = [ 84 | "$target_gen_dir/js2c_inputs/{{source_target_relative}}", 85 | ] 86 | } 87 | 88 | copy("node_v8_js2c_inputs") { 89 | sources = node_files.v8_library_files 90 | outputs = [ 91 | "$target_gen_dir/js2c_inputs/deps/navigation/{{source_target_relative}}", 92 | ] 93 | } 94 | 95 | action("generate_config_gypi") { 96 | script = "//tools/generate_config_gypi.py" 97 | outputs = [ "$target_gen_dir/js2c_inputs/config.gypi", ] 98 | depfile = "$target_gen_dir/$target_name.d" 99 | 100 | script_args = [ "//third_party", "$root_out_dir" ] 101 | script_args += outputs 102 | script_args += [ depfile ] 103 | args = rebase_path(script_args, root_build_dir) 104 | } 105 | 106 | chdir_action("node_js2c") { 107 | deps = [ 108 | ":generate_config_gypi", 109 | ":node_js2c_inputs", 110 | ":node_v8_js2c_inputs", 111 | ] 112 | 113 | macro_inputs = [] 114 | if (!node_use_dtrace && !node_use_etw) { 115 | macro_inputs += [ "src/notrace_macros.py" ] 116 | } 117 | if (node_debug_lib) { 118 | macro_inputs += [ "tools/nodcheck_macros.py" ] 119 | } else { 120 | macro_inputs += [ "tools/dcheck_macros.py" ] 121 | } 122 | macro_inputs += [ "tools/check_macros.py" ] 123 | config_gypi = [ "$target_gen_dir/js2c_inputs/config.gypi" ] 124 | # We use a relative path to work around an assertion in js2c.py. 125 | config_gypi_relative_path = ["config.gypi"] 126 | 127 | library_files = node_files.all_library_files 128 | inputs = get_target_outputs(":node_js2c_inputs") + 129 | get_target_outputs(":node_v8_js2c_inputs") + 130 | macro_inputs + config_gypi 131 | outputs = [ "$target_gen_dir/node_javascript.cc" ] 132 | 133 | cwd = "$target_gen_dir/js2c_inputs" 134 | script = "tools/js2c.py" 135 | args = rebase_path(outputs) 136 | args += library_files 137 | args += rebase_path(macro_inputs) + config_gypi_relative_path 138 | } 139 | 140 | config("node_base_external") { 141 | include_dirs = [ "src" ] 142 | defines = [ "NODE_WANT_INTERNALS=1" ] 143 | configs = [ "//v8:external_config" ] 144 | } 145 | 146 | config("node_base_internal") { 147 | visibility = [ ":*", "src/inspector:*" ] 148 | configs = [ ":node_base_external" ] 149 | cflags = [ "-Wno-microsoft-include" ] 150 | libs = [] 151 | cflags_cc = [ 152 | "-Wno-deprecated-declarations", 153 | "-Wno-implicit-fallthrough", 154 | "-Wno-return-type", 155 | "-Wno-sometimes-uninitialized", 156 | "-Wno-unused-label", 157 | "-Wno-unused-private-field", 158 | "-Wno-unused-variable", 159 | "-Wno-string-plus-int", 160 | "-Wno-string-conversion", 161 | ] 162 | 163 | if (target_cpu == "x86") { 164 | node_arch = "ia32" 165 | } else { 166 | node_arch = target_cpu 167 | } 168 | if (target_os == "win") { 169 | node_platform = "win32" 170 | } else if (target_os == "mac") { 171 | node_platform = "darwin" 172 | } else { 173 | node_platform = target_os 174 | } 175 | defines = [ 176 | "NODE_ARCH=\"$node_arch\"", 177 | "NODE_PLATFORM=\"$node_platform\"", 178 | ] 179 | 180 | if (is_win) { 181 | defines += [ 182 | "NOMINMAX", 183 | "_UNICODE=1", 184 | ] 185 | libs += [ "psapi.lib" ] 186 | } else { 187 | defines += [ "__POSIX__" ] 188 | } 189 | if (is_mac) { 190 | libs += [ "CoreFoundation.framework" ] 191 | } 192 | if (node_tag != "") { 193 | defines += [ "NODE_TAG=\"$node_tag\"" ] 194 | } 195 | if (node_v8_options != "") { 196 | defines += [ "NODE_V8_OPTIONS=\"$node_v8_options\"" ] 197 | } 198 | if (node_release_urlbase != "") { 199 | defines += [ "NODE_RELEASE_URLBASE=\"$node_release_urlbase\"" ] 200 | } 201 | if (node_use_openssl) { 202 | defines += [ 203 | "NODE_OPENSSL_SYSTEM_CERT_PATH=\"$node_openssl_system_ca_path\"", 204 | "HAVE_OPENSSL=1", 205 | ] 206 | } else { 207 | defines += [ "HAVE_OPENSSL=0" ] 208 | } 209 | if (node_use_v8_platform) { 210 | defines += [ "NODE_USE_V8_PLATFORM=1" ] 211 | } else { 212 | defines += [ "NODE_USE_V8_PLATFORM=0" ] 213 | } 214 | if (node_report) { 215 | defines += [ "NODE_REPORT" ] 216 | } 217 | if (node_enable_inspector) { 218 | defines += [ "HAVE_INSPECTOR=1" ] 219 | } else { 220 | defines += [ "HAVE_INSPECTOR=0" ] 221 | } 222 | if (v8_enable_i18n_support) { 223 | defines += [ "NODE_HAVE_I18N_SUPPORT=1" ] 224 | } else { 225 | defines += [ "NODE_HAVE_I18N_SUPPORT=0" ] 226 | } 227 | } 228 | 229 | source_set("node_base") { 230 | deps = [ 231 | ":node_js2c", 232 | "deps/brotli/c:brotli", 233 | "deps/cares", 234 | "deps/histogram", 235 | "deps/http_parser", 236 | "deps/llhttp", 237 | "deps/nghttp2", 238 | "deps/zlib", 239 | "//v8:v8_libplatform", 240 | ] 241 | public_deps = [ 242 | "deps/uv", 243 | "//v8", 244 | ] 245 | public_configs = [ 246 | ":node_base_external", 247 | "//build/config/compiler:no_chromium_code", 248 | "//build/config/gcc:symbol_visibility_default", 249 | ] 250 | configs += [ ":node_base_internal" ] 251 | configs -= [ "//build/config/clang:find_bad_constructs" ] 252 | 253 | sources = node_files.node_sources 254 | sources += [ 255 | "$target_gen_dir/node_javascript.cc", 256 | ] 257 | 258 | if (v8_enable_i18n_support) { 259 | deps += [ "//third_party/icu" ] 260 | } 261 | 262 | if (node_enable_inspector) { 263 | deps += [ "src/inspector" ] 264 | } 265 | 266 | if (node_use_openssl) { 267 | deps += [ "deps/openssl" ] 268 | sources += [ 269 | "src/node_crypto.cc", 270 | "src/node_crypto.h", 271 | "src/node_crypto_bio.cc", 272 | "src/node_crypto_bio.h", 273 | "src/node_crypto_clienthello-inl.h", 274 | "src/node_crypto_clienthello.cc", 275 | "src/node_crypto_clienthello.h", 276 | "src/node_crypto_groups.h", 277 | "src/tls_wrap.cc", 278 | "src/tls_wrap.h", 279 | ] 280 | } 281 | 282 | if (node_report) { 283 | sources += [ 284 | "src/node_report.cc", 285 | "src/node_report_module.cc", 286 | "src/node_report_utils.cc", 287 | ] 288 | } 289 | } 290 | 291 | if (node_use_code_cache) { 292 | executable("node_no_cache") { 293 | sources = [ 294 | "src/node_main.cc", 295 | "src/node_code_cache_stub.cc", 296 | ] 297 | deps = [ ":node_base" ] 298 | } 299 | 300 | action("generate_code_cache") { 301 | script = "//tools/generate_code_cache.py" 302 | inputs = [ "tools/generate_code_cache.js" ] 303 | outputs = [ "$target_gen_dir/node_code_cache.cc" ] 304 | node_no_cache = [ "$root_out_dir/node_no_cache" ] 305 | 306 | args = rebase_path(node_no_cache + inputs + outputs, root_build_dir) 307 | deps = [":node_no_cache"] 308 | } 309 | 310 | component("node_lib") { 311 | sources = [ 312 | "src/node_main.cc", 313 | "$target_gen_dir/node_code_cache.cc", 314 | ] 315 | public_deps = [ ":node_base" ] 316 | deps = [ ":generate_code_cache" ] 317 | output_name = "node" 318 | } 319 | } else { 320 | component("node_lib") { 321 | sources = [ 322 | "src/node_main.cc", 323 | "src/node_code_cache_stub.cc", 324 | ] 325 | public_deps = [ ":node_base" ] 326 | output_name = "node" 327 | } 328 | } 329 | 330 | executable("node") { 331 | sources = [ "src/node_main.cc" ] 332 | deps = [ ":node_lib" ] 333 | } 334 | 335 | executable("node_cctest") { 336 | testonly = true 337 | deps = [ 338 | ":node_base", 339 | "//testing/gtest:gtest_main", 340 | ] 341 | configs += [ ":node_base_internal" ] 342 | sources = node_files.cctest_sources 343 | sources += [ "src/node_code_cache_stub.cc" ] 344 | if (node_enable_inspector) { 345 | sources += [ 346 | "test/cctest/test_inspector_socket.cc", 347 | "test/cctest/test_inspector_socket_server.cc", 348 | ] 349 | } 350 | } 351 | -------------------------------------------------------------------------------- /gn/node/deps/brotli/c/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright 2014 The Chromium Authors. All rights reserved. 2 | # Copyright 2019 the V8 project authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | import("//node/node.gni") 7 | 8 | if (is_win) { 9 | import("//build/config/win/visual_studio_version.gni") 10 | } 11 | 12 | config("includes") { 13 | include_dirs = [ "include" ] 14 | } 15 | 16 | source_set("headers") { 17 | sources = [ 18 | "include/brotli/decode.h", 19 | "include/brotli/encode.h", 20 | "include/brotli/port.h", 21 | "include/brotli/types.h", 22 | ] 23 | } 24 | 25 | common_sources = [ 26 | "common/constants.h", 27 | "common/context.h", 28 | "common/dictionary.c", 29 | "common/dictionary.h", 30 | "common/platform.h", 31 | "common/transform.c", 32 | "common/transform.h", 33 | "common/version.h", 34 | ] 35 | 36 | source_set("common") { 37 | sources = common_sources 38 | public_configs = [ ":includes" ] 39 | deps = [ 40 | ":headers", 41 | ] 42 | } 43 | 44 | source_set("common_no_dictionary_data") { 45 | sources = common_sources 46 | public_configs = [ ":includes" ] 47 | deps = [ 48 | ":headers", 49 | ] 50 | defines = [ "BROTLI_EXTERNAL_DICTIONARY_DATA" ] 51 | } 52 | 53 | dec_sources = [ 54 | "dec/bit_reader.c", 55 | "dec/bit_reader.h", 56 | "dec/decode.c", 57 | "dec/huffman.c", 58 | "dec/huffman.h", 59 | "dec/prefix.h", 60 | "dec/state.c", 61 | "dec/state.h", 62 | ] 63 | 64 | enc_sources = [ 65 | "enc/backward_references.c", 66 | "enc/backward_references.h", 67 | "enc/backward_references_hq.c", 68 | "enc/backward_references_hq.h", 69 | "enc/backward_references_inc.h", 70 | "enc/bit_cost.c", 71 | "enc/bit_cost.h", 72 | "enc/bit_cost_inc.h", 73 | "enc/block_encoder_inc.h", 74 | "enc/block_splitter.c", 75 | "enc/block_splitter.h", 76 | "enc/block_splitter_inc.h", 77 | "enc/brotli_bit_stream.c", 78 | "enc/brotli_bit_stream.h", 79 | "enc/cluster.c", 80 | "enc/cluster.h", 81 | "enc/cluster_inc.h", 82 | "enc/command.h", 83 | "enc/compress_fragment.c", 84 | "enc/compress_fragment.h", 85 | "enc/compress_fragment_two_pass.c", 86 | "enc/compress_fragment_two_pass.h", 87 | "enc/dictionary_hash.c", 88 | "enc/dictionary_hash.h", 89 | "enc/encode.c", 90 | "enc/encoder_dict.c", 91 | "enc/encoder_dict.h", 92 | "enc/entropy_encode.c", 93 | "enc/entropy_encode.h", 94 | "enc/entropy_encode_static.h", 95 | "enc/fast_log.h", 96 | "enc/find_match_length.h", 97 | "enc/hash.h", 98 | "enc/hash_composite_inc.h", 99 | "enc/hash_forgetful_chain_inc.h", 100 | "enc/hash_longest_match64_inc.h", 101 | "enc/hash_longest_match_inc.h", 102 | "enc/hash_longest_match_quickly_inc.h", 103 | "enc/hash_rolling_inc.h", 104 | "enc/hash_to_binary_tree_inc.h", 105 | "enc/histogram.c", 106 | "enc/histogram.h", 107 | "enc/histogram_inc.h", 108 | "enc/literal_cost.c", 109 | "enc/literal_cost.h", 110 | "enc/memory.c", 111 | "enc/memory.h", 112 | "enc/metablock.c", 113 | "enc/metablock.h", 114 | "enc/metablock_inc.h", 115 | "enc/params.h", 116 | "enc/prefix.h", 117 | "enc/quality.h", 118 | "enc/ringbuffer.h", 119 | "enc/static_dict.c", 120 | "enc/static_dict.h", 121 | "enc/static_dict_lut.h", 122 | "enc/utf8_util.c", 123 | "enc/utf8_util.h", 124 | "enc/write_bits.h", 125 | ] 126 | 127 | node_dep("brotli") { 128 | sources = enc_sources + dec_sources 129 | public_configs = [ ":includes" ] 130 | 131 | public_deps = [ ":headers" ] 132 | deps = [ ":common" ] 133 | } 134 | -------------------------------------------------------------------------------- /gn/node/deps/cares/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013-2019 GitHub Inc. 2 | # Copyright 2019 the V8 project authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | import("//node/node.gni") 7 | 8 | config("cares_config") { 9 | include_dirs = [ "include" ] 10 | } 11 | 12 | node_dep("cares") { 13 | defines = [ "CARES_STATICLIB" ] 14 | include_dirs = [ 15 | "include", 16 | "src", 17 | ] 18 | public_configs = [ ":cares_config" ] 19 | 20 | libs = [] 21 | cflags_c = [ 22 | "-Wno-logical-not-parentheses", 23 | "-Wno-sign-compare", 24 | ] 25 | 26 | sources = [ 27 | "include/ares.h", 28 | "include/ares_rules.h", 29 | "include/ares_version.h", 30 | "include/nameser.h", 31 | "src/ares__close_sockets.c", 32 | "src/ares__get_hostent.c", 33 | "src/ares__read_line.c", 34 | "src/ares__timeval.c", 35 | "src/ares_android.c", 36 | "src/ares_cancel.c", 37 | "src/ares_create_query.c", 38 | "src/ares_data.c", 39 | "src/ares_data.h", 40 | "src/ares_destroy.c", 41 | "src/ares_dns.h", 42 | "src/ares_expand_name.c", 43 | "src/ares_expand_string.c", 44 | "src/ares_fds.c", 45 | "src/ares_free_hostent.c", 46 | "src/ares_free_string.c", 47 | "src/ares_getenv.h", 48 | "src/ares_gethostbyaddr.c", 49 | "src/ares_gethostbyname.c", 50 | "src/ares_getnameinfo.c", 51 | "src/ares_getopt.c", 52 | "src/ares_getopt.h", 53 | "src/ares_getsock.c", 54 | "src/ares_inet_net_pton.h", 55 | "src/ares_init.c", 56 | "src/ares_ipv6.h", 57 | "src/ares_library_init.c", 58 | "src/ares_library_init.h", 59 | "src/ares_llist.c", 60 | "src/ares_llist.h", 61 | "src/ares_mkquery.c", 62 | "src/ares_nowarn.c", 63 | "src/ares_nowarn.h", 64 | "src/ares_options.c", 65 | "src/ares_parse_a_reply.c", 66 | "src/ares_parse_aaaa_reply.c", 67 | "src/ares_parse_mx_reply.c", 68 | "src/ares_parse_naptr_reply.c", 69 | "src/ares_parse_ns_reply.c", 70 | "src/ares_parse_ptr_reply.c", 71 | "src/ares_parse_soa_reply.c", 72 | "src/ares_parse_srv_reply.c", 73 | "src/ares_parse_txt_reply.c", 74 | "src/ares_platform.h", 75 | "src/ares_private.h", 76 | "src/ares_process.c", 77 | "src/ares_query.c", 78 | "src/ares_search.c", 79 | "src/ares_send.c", 80 | "src/ares_setup.h", 81 | "src/ares_strcasecmp.c", 82 | "src/ares_strcasecmp.h", 83 | "src/ares_strdup.c", 84 | "src/ares_strdup.h", 85 | "src/ares_strerror.c", 86 | "src/ares_strsplit.c", 87 | "src/ares_timeout.c", 88 | "src/ares_version.c", 89 | "src/ares_writev.c", 90 | "src/ares_writev.h", 91 | "src/bitncmp.c", 92 | "src/bitncmp.h", 93 | "src/inet_net_pton.c", 94 | "src/inet_ntop.c", 95 | "src/setup_once.h", 96 | ] 97 | 98 | if (!is_win) { 99 | defines += [ 100 | "_DARWIN_USE_64_BIT_INODE=1", 101 | "_LARGEFILE_SOURCE", 102 | "_FILE_OFFSET_BITS=64", 103 | "_GNU_SOURCE", 104 | ] 105 | } 106 | 107 | if (is_win) { 108 | defines += [ "CARES_PULL_WS2TCPIP_H=1" ] 109 | include_dirs += [ "config/win32" ] 110 | sources += [ 111 | "src/ares_getenv.c", 112 | "src/ares_iphlpapi.h", 113 | "src/ares_platform.c", 114 | "src/config-win32.h", 115 | "src/windows_port.c", 116 | ] 117 | libs += [ 118 | "ws2_32.lib", 119 | "iphlpapi.lib", 120 | ] 121 | } else { 122 | defines += [ "HAVE_CONFIG_H" ] 123 | } 124 | 125 | if (is_linux) { 126 | include_dirs += [ "config/linux" ] 127 | sources += [ "config/linux/ares_config.h" ] 128 | } 129 | 130 | if (is_mac) { 131 | include_dirs += [ "config/darwin" ] 132 | sources += [ "config/darwin/ares_config.h" ] 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /gn/node/deps/histogram/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013-2019 GitHub Inc. 2 | # Copyright 2019 the V8 project authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | import("//node/node.gni") 7 | 8 | config("external_config") { 9 | defines = [ "HTTP_PARSER_STRICT=0" ] 10 | include_dirs = [ "src" ] 11 | } 12 | 13 | node_dep("histogram") { 14 | public_configs = [ ":external_config" ] 15 | sources = [ "src/hdr_histogram.c" ] 16 | } 17 | -------------------------------------------------------------------------------- /gn/node/deps/http_parser/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013-2019 GitHub Inc. 2 | # Copyright 2019 the V8 project authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | import("//node/node.gni") 7 | 8 | config("http_parser_config") { 9 | defines = [ "HTTP_PARSER_STRICT=0" ] 10 | include_dirs = [ "." ] 11 | } 12 | 13 | node_dep("http_parser") { 14 | include_dirs = [ "." ] 15 | public_configs = [ ":http_parser_config" ] 16 | cflags_c = [ "-Wno-string-conversion" ] 17 | sources = [ "http_parser.c" ] 18 | } 19 | -------------------------------------------------------------------------------- /gn/node/deps/llhttp/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013-2019 GitHub Inc. 2 | # Copyright 2019 the V8 project authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | import("//node/node.gni") 7 | 8 | config("llhttp_config") { 9 | include_dirs = [ "include" ] 10 | } 11 | 12 | node_dep("llhttp") { 13 | include_dirs = [ "include" ] 14 | public_configs = [ ":llhttp_config" ] 15 | sources = [ 16 | "src/api.c", 17 | "src/http.c", 18 | "src/llhttp.c", 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /gn/node/deps/nghttp2/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013-2019 GitHub Inc. 2 | # Copyright 2019 the V8 project authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | import("//node/node.gni") 7 | 8 | config("nghttp2_config") { 9 | defines = [ "NGHTTP2_STATICLIB" ] 10 | include_dirs = [ "lib/includes" ] 11 | } 12 | 13 | node_dep("nghttp2") { 14 | public_configs = [ ":nghttp2_config" ] 15 | defines = [ 16 | "_U_", 17 | "BUILDING_NGHTTP2", 18 | "NGHTTP2_STATICLIB", 19 | ] 20 | include_dirs = [ "lib/includes" ] 21 | if (is_win) { 22 | defines += [ "HAVE_CONFIG_H" ] 23 | } 24 | 25 | cflags_c = [ 26 | "-Wno-implicit-function-declaration", 27 | "-Wno-string-plus-int" 28 | ] 29 | 30 | sources = [ 31 | "lib/nghttp2_buf.c", 32 | "lib/nghttp2_callbacks.c", 33 | "lib/nghttp2_debug.c", 34 | "lib/nghttp2_frame.c", 35 | "lib/nghttp2_hd.c", 36 | "lib/nghttp2_hd_huffman.c", 37 | "lib/nghttp2_hd_huffman_data.c", 38 | "lib/nghttp2_helper.c", 39 | "lib/nghttp2_http.c", 40 | "lib/nghttp2_map.c", 41 | "lib/nghttp2_mem.c", 42 | "lib/nghttp2_npn.c", 43 | "lib/nghttp2_option.c", 44 | "lib/nghttp2_outbound_item.c", 45 | "lib/nghttp2_pq.c", 46 | "lib/nghttp2_priority_spec.c", 47 | "lib/nghttp2_queue.c", 48 | "lib/nghttp2_rcbuf.c", 49 | "lib/nghttp2_session.c", 50 | "lib/nghttp2_stream.c", 51 | "lib/nghttp2_submit.c", 52 | "lib/nghttp2_version.c", 53 | ] 54 | } 55 | -------------------------------------------------------------------------------- /gn/node/deps/openssl/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright 2019 the V8 project authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | import("//node/node_files.gni") 6 | import("//node/node.gni") 7 | 8 | config("external_config") { 9 | include_dirs = [ "openssl/include" ] 10 | } 11 | 12 | config("internal_config") { 13 | if (is_posix || is_fuchsia) { 14 | cflags_c = ["-Wno-implicit-function-declaration" ] 15 | asmflags = [ "-fPIC" ] 16 | cflags = [ "-fPIC" ] 17 | ldflags = [ "-fPIC" ] 18 | } 19 | cflags_cc = [ "-Wno-sign-compare" ] 20 | include_dirs = [ 21 | "openssl", 22 | "openssl/crypto/", 23 | "openssl/crypto/include/", 24 | "openssl/crypto/include/internal", 25 | "openssl/crypto/modes/", 26 | "openssl/crypto/ec/curve448", 27 | "openssl/crypto/ec/curve448/arch_32", 28 | "config/archs/linux-x86_64/no-asm/crypto", 29 | "config", 30 | ] 31 | } 32 | 33 | openssl_defines = [ 34 | "NDEBUG", 35 | "OPENSSL_USE_NODELETE", 36 | "L_ENDIAN", 37 | "OPENSSL_PIC", 38 | "OPENSSL_NO_ASM", 39 | "OPENSSL_NO_HW", 40 | "OPENSSLDIR=\"/etc/ssl\"", 41 | "ENGINESDIR=\"/dev/null\"", 42 | "TERMIOS", 43 | ] 44 | 45 | node_dep("openssl") { 46 | sources = node_files.openssl_sources 47 | defines = openssl_defines 48 | 49 | include_dirs = [ 50 | "openssl", 51 | "openssl/crypto/", 52 | "openssl/crypto/include/", 53 | "openssl/crypto/modes/", 54 | "openssl/crypto/ec/curve448", 55 | "openssl/crypto/ec/curve448/arch_32", 56 | "openssl/config/archs/linux-x86_64/no-asm/crypto", 57 | ] 58 | 59 | public_configs = [ ":external_config" ] 60 | configs = [ ":internal_config" ] 61 | remove_configs = [ "//build/config/compiler:compiler" ] 62 | } 63 | -------------------------------------------------------------------------------- /gn/node/deps/uv/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013-2019 GitHub Inc. 2 | # Copyright 2019 the V8 project authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | import("//node/node.gni") 7 | 8 | config("libuv_config") { 9 | include_dirs = [ "include" ] 10 | 11 | defines = [] 12 | 13 | if (is_linux) { 14 | defines += [ "_POSIX_C_SOURCE=200112" ] 15 | } 16 | if (!is_win) { 17 | defines += [ 18 | "_LARGEFILE_SOURCE", 19 | "_FILE_OFFSET_BITS=64", 20 | ] 21 | } 22 | if (is_mac) { 23 | defines += [ "_DARWIN_USE_64_BIT_INODE=1" ] 24 | } 25 | } 26 | 27 | node_dep("uv") { 28 | include_dirs = [ 29 | "include", 30 | "src", 31 | ] 32 | 33 | public_configs = [ ":libuv_config" ] 34 | 35 | ldflags = [] 36 | 37 | defines = [] 38 | 39 | # This only has an effect on Windows, where it will cause libuv's 40 | # symbols to be exported in node.lib 41 | defines += [ "BUILDING_UV_SHARED=1" ] 42 | 43 | cflags_c = [ 44 | "-Wno-bitwise-op-parentheses", 45 | "-Wno-implicit-function-declaration", 46 | "-Wno-missing-braces", 47 | "-Wno-sign-compare", 48 | "-Wno-sometimes-uninitialized", 49 | "-Wno-string-conversion", 50 | "-Wno-switch", 51 | "-Wno-unused-function", 52 | "-Wno-unused-variable", 53 | ] 54 | 55 | libs = [] 56 | 57 | sources = [ 58 | "include/uv.h", 59 | "include/uv/errno.h", 60 | "include/uv/threadpool.h", 61 | "include/uv/tree.h", 62 | "include/uv/version.h", 63 | "src/fs-poll.c", 64 | "src/heap-inl.h", 65 | "src/idna.c", 66 | "src/idna.h", 67 | "src/inet.c", 68 | "src/queue.h", 69 | "src/strscpy.c", 70 | "src/strscpy.h", 71 | "src/threadpool.c", 72 | "src/timer.c", 73 | "src/uv-common.c", 74 | "src/uv-common.h", 75 | "src/uv-data-getter-setters.c", 76 | "src/version.c", 77 | ] 78 | 79 | if (is_win) { 80 | defines += [ "_GNU_SOURCE" ] 81 | sources += [ 82 | "include/uv/win.h", 83 | "src/win/async.c", 84 | "src/win/atomicops-inl.h", 85 | "src/win/core.c", 86 | "src/win/detect-wakeup.c", 87 | "src/win/dl.c", 88 | "src/win/error.c", 89 | "src/win/fs-event.c", 90 | "src/win/fs.c", 91 | "src/win/getaddrinfo.c", 92 | "src/win/getnameinfo.c", 93 | "src/win/handle-inl.h", 94 | "src/win/handle.c", 95 | "src/win/internal.h", 96 | "src/win/loop-watcher.c", 97 | "src/win/pipe.c", 98 | "src/win/poll.c", 99 | "src/win/process-stdio.c", 100 | "src/win/process.c", 101 | "src/win/req-inl.h", 102 | "src/win/signal.c", 103 | "src/win/snprintf.c", 104 | "src/win/stream-inl.h", 105 | "src/win/stream.c", 106 | "src/win/tcp.c", 107 | "src/win/thread.c", 108 | "src/win/tty.c", 109 | "src/win/udp.c", 110 | "src/win/util.c", 111 | "src/win/winapi.c", 112 | "src/win/winapi.h", 113 | "src/win/winsock.c", 114 | "src/win/winsock.h", 115 | ] 116 | libs += [ 117 | "advapi32.lib", 118 | "iphlpapi.lib", 119 | "psapi.lib", 120 | "shell32.lib", 121 | "user32.lib", 122 | "userenv.lib", 123 | "ws2_32.lib", 124 | ] 125 | } else { 126 | sources += [ 127 | "include/uv/aix.h", 128 | "include/uv/bsd.h", 129 | "include/uv/darwin.h", 130 | "include/uv/linux.h", 131 | "include/uv/sunos.h", 132 | "include/uv/unix.h", 133 | "src/unix/async.c", 134 | "src/unix/atomic-ops.h", 135 | "src/unix/core.c", 136 | "src/unix/dl.c", 137 | "src/unix/fs.c", 138 | "src/unix/getaddrinfo.c", 139 | "src/unix/getnameinfo.c", 140 | "src/unix/internal.h", 141 | "src/unix/loop-watcher.c", 142 | "src/unix/loop.c", 143 | "src/unix/pipe.c", 144 | "src/unix/poll.c", 145 | "src/unix/process.c", 146 | "src/unix/pthread-fixes.c", 147 | "src/unix/signal.c", 148 | "src/unix/spinlock.h", 149 | "src/unix/stream.c", 150 | "src/unix/tcp.c", 151 | "src/unix/thread.c", 152 | "src/unix/tty.c", 153 | "src/unix/udp.c", 154 | ] 155 | libs += [ "m" ] 156 | ldflags += [ "-pthread" ] 157 | } 158 | if (is_mac || is_linux) { 159 | sources += [ "src/unix/proctitle.c" ] 160 | } 161 | if (is_mac) { 162 | sources += [ 163 | "src/unix/darwin-proctitle.c", 164 | "src/unix/darwin.c", 165 | "src/unix/fsevents.c", 166 | ] 167 | defines += [ 168 | "_DARWIN_USE_64_BIT_INODE=1", 169 | "_DARWIN_UNLIMITED_SELECT=1", 170 | ] 171 | } 172 | if (is_linux) { 173 | defines += [ "_GNU_SOURCE" ] 174 | sources += [ 175 | "src/unix/linux-core.c", 176 | "src/unix/linux-inotify.c", 177 | "src/unix/linux-syscalls.c", 178 | "src/unix/linux-syscalls.h", 179 | "src/unix/procfs-exepath.c", 180 | "src/unix/sysinfo-loadavg.c", 181 | "src/unix/sysinfo-memory.c", 182 | ] 183 | libs += [ 184 | "dl", 185 | "rt", 186 | ] 187 | } 188 | if (is_mac) { # is_bsd 189 | sources += [ 190 | "src/unix/bsd-ifaddrs.c", 191 | "src/unix/kqueue.c", 192 | ] 193 | } 194 | } 195 | -------------------------------------------------------------------------------- /gn/node/deps/zlib/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013-2019 GitHub Inc. 2 | # Copyright 2019 the V8 project authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | import("//node/node.gni") 7 | 8 | config("includes") { 9 | include_dirs = [ "." ] 10 | } 11 | 12 | config("ignored_warnings") { 13 | if (is_win) { 14 | cflags = [ 15 | "/wd4131", # old-style declarator 16 | "/wd4127", # conditional expression is constant 17 | "/wd4244", # possible loss of data on type conversion 18 | "/wd4996", # deprecated 'open' 19 | ] 20 | } else { 21 | cflags = [ 22 | "-Wno-implicit-function-declaration", 23 | "-Wno-shift-negative-value", 24 | ] 25 | } 26 | } 27 | 28 | node_dep("zlib") { 29 | sources = [ 30 | "adler32.c", 31 | "compress.c", 32 | "crc32.c", 33 | "crc32.h", 34 | "deflate.c", 35 | "deflate.h", 36 | "gzclose.c", 37 | "gzguts.h", 38 | "gzlib.c", 39 | "gzread.c", 40 | "gzwrite.c", 41 | "infback.c", 42 | "inffast.c", 43 | "inffast.h", 44 | "inffixed.h", 45 | "inflate.c", 46 | "inflate.h", 47 | "inftrees.c", 48 | "inftrees.h", 49 | "trees.c", 50 | "trees.h", 51 | "uncompr.c", 52 | "zconf.h", 53 | "zlib.h", 54 | "zutil.c", 55 | "zutil.h", 56 | ] 57 | 58 | if (is_win) { 59 | defines = [ "ZLIB_DLL" ] 60 | } 61 | 62 | public_configs = [ 63 | ":includes", 64 | ":ignored_warnings" 65 | ] 66 | } 67 | -------------------------------------------------------------------------------- /gn/node/node.gni: -------------------------------------------------------------------------------- 1 | # Copyright 2019 the V8 project authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | node_exe = "$root_out_dir/node" 6 | 7 | template("node_dep") { 8 | static_library(target_name) { 9 | forward_variables_from(invoker, "*", ["configs", "remove_configs"]) 10 | if (defined(invoker.configs)) { 11 | configs += invoker.configs 12 | } 13 | configs -= [ "//build/config/gcc:symbol_visibility_hidden" ] 14 | configs += [ "//build/config/gcc:symbol_visibility_default" ] 15 | configs += [ "//build/config/compiler:no_chromium_code" ] 16 | configs -= [ "//build/config/compiler:chromium_code" ] 17 | if (defined(invoker.remove_configs)) { 18 | configs -= invoker.remove_configs 19 | } 20 | } 21 | } 22 | 23 | template("call_node") { 24 | action(target_name) { 25 | deps = invoker.deps + [ "//node:node" ] 26 | script = "//tools/run_executable_in_dir.py" 27 | inputs = invoker.inputs 28 | stamp = "$target_gen_dir/$target_name.stamp" 29 | outputs = [ stamp ] 30 | base = invoker.base 31 | env = [] 32 | if (defined(invoker.env)) { 33 | env = invoker.env 34 | } 35 | args = [ 36 | rebase_path(base, root_build_dir), 37 | rebase_path(stamp, root_build_dir), 38 | ] + env + [ 39 | rebase_path(node_exe, base), 40 | ] + invoker.args 41 | } 42 | } 43 | 44 | # TODO: add correct list of outputs. 45 | template("build_addons") { 46 | call_node(target_name) { 47 | deps = invoker.deps 48 | build_scripts = [ 49 | "//node/tools/build-addons.js", 50 | "//node/deps/npm/node_modules/node-gyp/bin/node-gyp.js", 51 | ] 52 | inputs = invoker.inputs + build_scripts 53 | base = root_gen_dir 54 | env = [ 55 | "--env", "npm_config_loglevel", "silent", 56 | "--env", "npm_config_python", "python", 57 | "--env", "npm_config_nodedir", 58 | rebase_path("$root_gen_dir/node", root_build_dir), 59 | ] 60 | args = rebase_path(build_scripts, base) + 61 | [ rebase_path(target_gen_dir, base) ] 62 | } 63 | } 64 | 65 | template("sync_files") { 66 | copy("$target_name.copy") { 67 | sources = invoker.sources 68 | outputs = [ "$target_gen_dir/{{source_target_relative}}" ] 69 | } 70 | action(target_name) { 71 | script = "//tools/mirror_removal.py" 72 | inputs = [ "//node_files.json" ] 73 | outputs = [ "$target_gen_dir/$target_name.stamp" ] 74 | args = rebase_path([ 75 | ".", 76 | target_gen_dir, 77 | ] + outputs, root_build_dir) 78 | public_deps = [":$target_name.copy"] 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /gn/node/node_files.gni: -------------------------------------------------------------------------------- 1 | # Copyright 2019 the V8 project authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | node_files = read_file("//node_files.json", "json") 6 | 7 | npm_cli = "//node/deps/npm/bin/npm-cli.js" 8 | 9 | node_headers = [ 10 | "//node/deps/uv/include", 11 | "//node/deps/openssl/openssl/include", 12 | "//node/deps/openssl/config", 13 | "//node/src/node.h", 14 | "//node/src/node_buffer.h", 15 | "//node/src/node_object_wrap.h", 16 | "//node/src/node_version.h", 17 | "//node/common.gypi", 18 | ] 19 | 20 | node_api_headers = [ 21 | "//node/src/node_api.h", 22 | "//node/src/node_api_types.h", 23 | "//node/src/js_native_api.h", 24 | "//node/src/js_native_api_types.h", 25 | "//node/src/js_native_api_v8.h", 26 | "//node/src/js_native_api_v8_internals.h", 27 | ] 28 | -------------------------------------------------------------------------------- /gn/node/src/inspector/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013-2019 GitHub Inc. 2 | # Copyright 2019 the V8 project authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | import("//v8/gni/v8.gni") 7 | import("//node/node.gni") 8 | import("//node/node_files.gni") 9 | 10 | inspector_protocol_dir = "../../tools/inspector_protocol" 11 | 12 | config("inspector_config") { 13 | include_dirs = [ 14 | "$target_gen_dir", 15 | "$target_gen_dir/src", 16 | ] 17 | } 18 | 19 | _protocol_generated = [ 20 | "protocol/Forward.h", 21 | "protocol/Protocol.cpp", 22 | "protocol/Protocol.h", 23 | "protocol/NodeWorker.cpp", 24 | "protocol/NodeWorker.h", 25 | "protocol/NodeTracing.cpp", 26 | "protocol/NodeTracing.h", 27 | ] 28 | 29 | # These are from node_protocol_config.json 30 | # These convoluted path hacks are to work around the fact that node.js is very 31 | # confused about what paths are in its includes, without changing node at all. 32 | # Hopefully, keying everything in this file off the paths that are in 33 | # node_protocol_config.json will mean that the paths stay in sync. 34 | inspector_protocol_package = "src/node/inspector/protocol" 35 | inspector_protocol_output = "node/inspector/protocol" 36 | 37 | node_dep("inspector") { 38 | sources = node_files.inspector_sources 39 | sources += rebase_path(_protocol_generated, 40 | ".", 41 | "$target_gen_dir/$inspector_protocol_package/..") 42 | include_dirs = [ 43 | "$target_gen_dir", 44 | "$target_gen_dir/src", 45 | "//v8/include", 46 | "..", 47 | ] 48 | deps = [ 49 | ":protocol_generated_sources", 50 | ":v8_inspector_compress_protocol_json", 51 | "../../deps/uv", 52 | "../../deps/llhttp", 53 | "//third_party/icu:icuuc", 54 | ] 55 | public_configs = [ ":inspector_config" ] 56 | configs = [ "//node:node_base_internal" ] 57 | } 58 | 59 | # This based on the template from //v8/../inspector_protocol.gni 60 | action("protocol_generated_sources") { 61 | # This is to ensure that the output directory exists--the code generator 62 | # doesn't create it. 63 | write_file("$target_gen_dir/$inspector_protocol_package/.dummy", "") 64 | script = "$inspector_protocol_dir/CodeGenerator.py" 65 | 66 | inputs = [ 67 | "$target_gen_dir/node_protocol_config.json", 68 | "$target_gen_dir/node_protocol.json", 69 | "$inspector_protocol_dir/lib/Allocator_h.template", 70 | "$inspector_protocol_dir/lib/Array_h.template", 71 | "$inspector_protocol_dir/lib/Collections_h.template", 72 | "$inspector_protocol_dir/lib/DispatcherBase_cpp.template", 73 | "$inspector_protocol_dir/lib/DispatcherBase_h.template", 74 | "$inspector_protocol_dir/lib/ErrorSupport_cpp.template", 75 | "$inspector_protocol_dir/lib/ErrorSupport_h.template", 76 | "$inspector_protocol_dir/lib/Forward_h.template", 77 | "$inspector_protocol_dir/lib/FrontendChannel_h.template", 78 | "$inspector_protocol_dir/lib/Maybe_h.template", 79 | "$inspector_protocol_dir/lib/Object_cpp.template", 80 | "$inspector_protocol_dir/lib/Object_h.template", 81 | "$inspector_protocol_dir/lib/Parser_cpp.template", 82 | "$inspector_protocol_dir/lib/Parser_h.template", 83 | "$inspector_protocol_dir/lib/Protocol_cpp.template", 84 | "$inspector_protocol_dir/lib/ValueConversions_h.template", 85 | "$inspector_protocol_dir/lib/Values_cpp.template", 86 | "$inspector_protocol_dir/lib/Values_h.template", 87 | "$inspector_protocol_dir/templates/Exported_h.template", 88 | "$inspector_protocol_dir/templates/Imported_h.template", 89 | "$inspector_protocol_dir/templates/TypeBuilder_cpp.template", 90 | "$inspector_protocol_dir/templates/TypeBuilder_h.template", 91 | ] 92 | 93 | deps = [ 94 | ":node_protocol_config", 95 | ":node_protocol_json", 96 | ] 97 | 98 | args = [ 99 | "--jinja_dir", 100 | rebase_path("//third_party/", root_build_dir), # jinja is in chromium's third_party 101 | "--output_base", 102 | rebase_path("$target_gen_dir/src", root_build_dir), 103 | "--config", 104 | rebase_path("$target_gen_dir/node_protocol_config.json", root_build_dir), 105 | ] 106 | 107 | outputs = 108 | get_path_info(rebase_path(rebase_path(_protocol_generated, 109 | ".", 110 | "$inspector_protocol_output/.."), 111 | ".", 112 | "$target_gen_dir/src"), 113 | "abspath") 114 | } 115 | 116 | template("generate_protocol_json") { 117 | copy_target_name = target_name + "_copy" 118 | copy(copy_target_name) { 119 | sources = invoker.sources 120 | outputs = [ 121 | "$target_gen_dir/{{source_file_part}}", 122 | ] 123 | } 124 | copied_pdl = get_target_outputs(":$copy_target_name") 125 | action(target_name) { 126 | deps = [ 127 | ":$copy_target_name", 128 | ] 129 | sources = copied_pdl 130 | outputs = invoker.outputs 131 | script = "//v8/third_party/inspector_protocol/convert_protocol_to_json.py" 132 | args = rebase_path(sources + outputs, root_build_dir) 133 | } 134 | } 135 | 136 | copy("node_protocol_config") { 137 | sources = [ 138 | "node_protocol_config.json", 139 | ] 140 | outputs = [ 141 | "$target_gen_dir/{{source_file_part}}", 142 | ] 143 | } 144 | 145 | generate_protocol_json("node_protocol_json") { 146 | sources = [ 147 | "node_protocol.pdl", 148 | ] 149 | outputs = [ 150 | "$target_gen_dir/node_protocol.json", 151 | ] 152 | } 153 | 154 | generate_protocol_json("v8_protocol_json") { 155 | sources = [ 156 | "//v8/src/inspector/js_protocol.pdl", 157 | ] 158 | outputs = [ 159 | "$target_gen_dir/js_protocol.json", 160 | ] 161 | } 162 | 163 | action("concatenate_protocols") { 164 | deps = [ 165 | ":node_protocol_json", 166 | ":v8_protocol_json", 167 | ] 168 | inputs = [ 169 | "$target_gen_dir/js_protocol.json", 170 | "$target_gen_dir/node_protocol.json", 171 | ] 172 | outputs = [ 173 | "$target_gen_dir/concatenated_protocol.json", 174 | ] 175 | script = "$inspector_protocol_dir/ConcatenateProtocols.py" 176 | args = rebase_path(inputs + outputs, root_build_dir) 177 | } 178 | 179 | action("v8_inspector_compress_protocol_json") { 180 | deps = [ 181 | ":concatenate_protocols", 182 | ] 183 | inputs = [ 184 | "$target_gen_dir/concatenated_protocol.json", 185 | ] 186 | outputs = [ 187 | "$target_gen_dir/v8_inspector_protocol_json.h", 188 | ] 189 | script = "../../tools/compress_json.py" 190 | args = rebase_path(inputs + outputs, root_build_dir) 191 | } 192 | -------------------------------------------------------------------------------- /gn/node/test/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright 2019 the V8 project authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | import("//node/node_files.gni") 6 | 7 | copy("copy_node_headers") { 8 | sources = node_headers 9 | outputs = [ "$root_gen_dir/{{source}}" ] 10 | } 11 | 12 | copy("copy_v8_headers") { 13 | sources = node_files.v8_headers 14 | outputs = [ "$root_gen_dir/node/deps/{{source}}" ] 15 | } 16 | 17 | copy("copy_node_api_headers") { 18 | sources = node_api_headers 19 | outputs = [ "$root_gen_dir/{{source}}" ] 20 | } 21 | 22 | copy("copy_test_files") { 23 | sources = [ 24 | "//node/test/common", 25 | "//node/test/testpy", 26 | ] 27 | outputs = [ "$root_gen_dir/{{source}}" ] 28 | } 29 | -------------------------------------------------------------------------------- /gn/node/test/addons/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright 2019 the V8 project authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | import("//node/node_files.gni") 6 | import("//node/node.gni") 7 | 8 | sync_files("sync_files") { 9 | sources = node_files.test_addons_files 10 | } 11 | 12 | build_addons("build") { 13 | deps = [ 14 | ":sync_files", 15 | "..:copy_node_headers", 16 | "..:copy_v8_headers", 17 | "..:copy_test_files", 18 | "//node/tools/doc:generate_addons", 19 | ] 20 | inputs = node_files.test_addons_files + 21 | node_files.v8_headers + 22 | node_headers 23 | } 24 | -------------------------------------------------------------------------------- /gn/node/test/js-native-api/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright 2019 the V8 project authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | import("//node/node_files.gni") 6 | import("//node/node.gni") 7 | 8 | sync_files("sync_files") { 9 | sources = node_files.test_js_native_api_files 10 | } 11 | 12 | build_addons("build") { 13 | deps = [ 14 | ":sync_files", 15 | "..:copy_node_api_headers", 16 | "..:copy_test_files", 17 | ] 18 | inputs = node_files.test_js_native_api_files + 19 | node_api_headers 20 | } 21 | -------------------------------------------------------------------------------- /gn/node/test/node-api/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright 2019 the V8 project authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | import("//node/node_files.gni") 6 | import("//node/node.gni") 7 | 8 | sync_files("sync_files") { 9 | sources = node_files.test_node_api_files 10 | } 11 | 12 | build_addons("build") { 13 | deps = [ 14 | ":sync_files", 15 | "..:copy_node_api_headers", 16 | "..:copy_test_files", 17 | "../js-native-api:sync_files", 18 | ] 19 | inputs = node_api_headers + 20 | node_files.test_js_native_api_files + 21 | node_files.test_node_api_files 22 | } 23 | -------------------------------------------------------------------------------- /gn/node/tools/doc/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright 2019 the V8 project authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | import("//node/node_files.gni") 6 | import("//node/node.gni") 7 | 8 | sync_files("sync_files") { 9 | sources = node_files.tools_doc_files 10 | } 11 | 12 | copy("copy_addons_md") { 13 | sources = [ "//node/doc/api/addons.md" ] 14 | outputs = [ "$root_gen_dir/node/doc/api/addons.md" ] 15 | } 16 | 17 | call_node("npm_install_dependencies") { 18 | deps = [ ":sync_files" ] 19 | inputs = [ 20 | npm_cli, 21 | "$target_gen_dir/package.json" 22 | ] 23 | base = target_gen_dir 24 | args = [ 25 | rebase_path(npm_cli, base), 26 | "ci", 27 | ] 28 | } 29 | 30 | action("generate_addons") { 31 | deps = [ 32 | ":npm_install_dependencies", 33 | ":sync_files", 34 | ":copy_addons_md", 35 | "//node/test/addons:sync_files", 36 | "//node:node", 37 | ] 38 | script = "//tools/run_executable_in_dir.py" 39 | inputs = [ 40 | "$target_gen_dir/addon-verify.js", 41 | "//node/doc/api/addons.md", 42 | ] 43 | stamp = "$target_gen_dir/generate_addons.stamp" 44 | outputs = [ stamp ] 45 | base = root_gen_dir 46 | args = [ 47 | rebase_path(base, root_build_dir), 48 | rebase_path(stamp, root_build_dir), 49 | rebase_path(node_exe, base), 50 | ] + rebase_path(inputs, base) 51 | } 52 | -------------------------------------------------------------------------------- /gn/third_party/googletest/BUILD.gn: -------------------------------------------------------------------------------- 1 | # Copyright 2014 The Chromium Authors. All rights reserved. 2 | # Copyright 2019 the V8 project authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | config("gtest_config") { 7 | visibility = [ ":*" ] # gmock also shares this config. 8 | 9 | defines = [ 10 | # Chromium always links googletest statically, so no API qualifier is 11 | # necessary. The definition in gtest-port.h at the time of this writing 12 | # causes crashes in content_browsertests. 13 | "GTEST_API_=", 14 | 15 | # In order to allow regex matches in gtest to be shared between Windows 16 | # and other systems, we tell gtest to always use its internal engine. 17 | "GTEST_HAS_POSIX_RE=0", 18 | 19 | # Enables C++11 features. 20 | "GTEST_LANG_CXX11=1", 21 | 22 | # Prevents gtest from including both and . 23 | "GTEST_HAS_TR1_TUPLE=0", 24 | ] 25 | 26 | # Gtest headers need to be able to find themselves. 27 | include_dirs = [ 28 | # TODO(crbug.com/829773): Remove this after transitioning off . 29 | "custom", 30 | 31 | "src/googletest/include", 32 | ] 33 | 34 | if (is_win) { 35 | cflags = [ "/wd4800" ] # Unused variable warning. 36 | } 37 | } 38 | 39 | config("gmock_config") { 40 | # Gmock headers need to be able to find themselves. 41 | include_dirs = [ 42 | # TODO(crbug.com/829773): Add "custom" here after transitioning off 43 | # . 44 | "src/googlemock/include", 45 | ] 46 | } 47 | 48 | # Do NOT depend on this directly. Use //testing/gtest instead. 49 | # See README.chromium for details. 50 | source_set("gtest") { 51 | testonly = true 52 | sources = [ 53 | # TODO(crbug.com/829773): Remove this after transitioning off . 54 | "custom/gmock/internal/custom/gmock-port.h", 55 | "src/googletest/include/gtest/gtest-death-test.h", 56 | "src/googletest/include/gtest/gtest-matchers.h", 57 | "src/googletest/include/gtest/gtest-message.h", 58 | "src/googletest/include/gtest/gtest-param-test.h", 59 | "src/googletest/include/gtest/gtest-printers.h", 60 | "src/googletest/include/gtest/gtest-spi.h", 61 | "src/googletest/include/gtest/gtest-test-part.h", 62 | "src/googletest/include/gtest/gtest-typed-test.h", 63 | "src/googletest/include/gtest/gtest.h", 64 | "src/googletest/include/gtest/gtest_pred_impl.h", 65 | "src/googletest/include/gtest/internal/gtest-death-test-internal.h", 66 | "src/googletest/include/gtest/internal/gtest-filepath.h", 67 | "src/googletest/include/gtest/internal/gtest-internal.h", 68 | "src/googletest/include/gtest/internal/gtest-linked_ptr.h", 69 | "src/googletest/include/gtest/internal/gtest-param-util-generated.h", 70 | "src/googletest/include/gtest/internal/gtest-param-util.h", 71 | "src/googletest/include/gtest/internal/gtest-port.h", 72 | "src/googletest/include/gtest/internal/gtest-string.h", 73 | "src/googletest/include/gtest/internal/gtest-tuple.h", 74 | "src/googletest/include/gtest/internal/gtest-type-util.h", 75 | 76 | #"src/googletest/src/gtest-all.cc", # Not needed by our build. 77 | "src/googletest/src/gtest-death-test.cc", 78 | "src/googletest/src/gtest-filepath.cc", 79 | "src/googletest/src/gtest-internal-inl.h", 80 | "src/googletest/src/gtest-matchers.cc", 81 | "src/googletest/src/gtest-port.cc", 82 | "src/googletest/src/gtest-printers.cc", 83 | "src/googletest/src/gtest-test-part.cc", 84 | "src/googletest/src/gtest-typed-test.cc", 85 | "src/googletest/src/gtest.cc", 86 | ] 87 | 88 | # Some files include "src/gtest-internal-inl.h". 89 | include_dirs = [ "src/googletest" ] 90 | 91 | all_dependent_configs = [ ":gtest_config" ] 92 | 93 | configs -= [ "//build/config/compiler:chromium_code" ] 94 | configs += [ "//build/config/compiler:no_chromium_code" ] 95 | 96 | deps = [] 97 | 98 | if (is_fuchsia) { 99 | deps += [ 100 | "//third_party/fuchsia-sdk/sdk:fdio", 101 | "//third_party/fuchsia-sdk/sdk:zx", 102 | ] 103 | } 104 | } 105 | 106 | # Do NOT depend on this directly. Use //testing/gtest:gtest_main instead. 107 | # See README.chromium for details. 108 | source_set("gtest_main") { 109 | testonly = true 110 | sources = [ 111 | "src/googletest/src/gtest_main.cc", 112 | ] 113 | deps = [ 114 | ":gtest", 115 | ] 116 | } 117 | 118 | # Do NOT depend on this directly. Use //testing/gmock:gmock_main instead. 119 | # See README.chromium for details. 120 | source_set("gmock") { 121 | testonly = true 122 | sources = [ 123 | "src/googlemock/include/gmock/gmock-actions.h", 124 | "src/googlemock/include/gmock/gmock-cardinalities.h", 125 | "src/googlemock/include/gmock/gmock-function-mocker.h", 126 | "src/googlemock/include/gmock/gmock-generated-actions.h", 127 | "src/googlemock/include/gmock/gmock-generated-function-mockers.h", 128 | "src/googlemock/include/gmock/gmock-generated-matchers.h", 129 | "src/googlemock/include/gmock/gmock-generated-nice-strict.h", 130 | "src/googlemock/include/gmock/gmock-matchers.h", 131 | "src/googlemock/include/gmock/gmock-more-actions.h", 132 | "src/googlemock/include/gmock/gmock-more-matchers.h", 133 | "src/googlemock/include/gmock/gmock-nice-strict.h", 134 | "src/googlemock/include/gmock/gmock-spec-builders.h", 135 | "src/googlemock/include/gmock/gmock.h", 136 | "src/googlemock/include/gmock/internal/gmock-generated-internal-utils.h", 137 | "src/googlemock/include/gmock/internal/gmock-internal-utils.h", 138 | "src/googlemock/include/gmock/internal/gmock-port.h", 139 | "src/googlemock/include/gmock/internal/gmock-pp.h", 140 | 141 | # gmock helpers. 142 | "custom/gmock/internal/custom/gmock-port.h", 143 | 144 | #"src/googlemock/src/gmock-all.cc", # Not needed by our build. 145 | "src/googlemock/src/gmock-cardinalities.cc", 146 | "src/googlemock/src/gmock-internal-utils.cc", 147 | "src/googlemock/src/gmock-matchers.cc", 148 | "src/googlemock/src/gmock-spec-builders.cc", 149 | "src/googlemock/src/gmock.cc", 150 | ] 151 | 152 | public_configs = [ 153 | ":gmock_config", 154 | ":gtest_config", 155 | ] 156 | } 157 | 158 | # Do NOT depend on this directly. Use //testing/gmock:gmock_main instead. 159 | # See README.chromium for details. 160 | static_library("gmock_main") { 161 | testonly = true 162 | sources = [ 163 | "src/googlemock/src/gmock_main.cc", 164 | ] 165 | deps = [ 166 | ":gmock", 167 | ] 168 | } 169 | -------------------------------------------------------------------------------- /test: -------------------------------------------------------------------------------- 1 | node/test -------------------------------------------------------------------------------- /testing: -------------------------------------------------------------------------------- 1 | v8/testing -------------------------------------------------------------------------------- /tools/generate_code_cache.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 the V8 project authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | import os 6 | import subprocess 7 | import sys 8 | 9 | def main(node_exe, script, output): 10 | node_exe = os.path.abspath(node_exe) 11 | subprocess.check_output( 12 | [node_exe, '--expose-internals', script, output]) 13 | 14 | if __name__ == '__main__': 15 | main(sys.argv[1], sys.argv[2], sys.argv[3]) 16 | -------------------------------------------------------------------------------- /tools/generate_config_gypi.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013-2019 GitHub Inc. 2 | # Copyright 2019 the V8 project authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | import re 7 | import os 8 | import subprocess 9 | import sys 10 | 11 | root_dir = os.path.dirname(os.path.dirname(__file__)) 12 | sys.path.append(os.path.join(root_dir, 'node', 'tools')) 13 | import getmoduleversion 14 | 15 | GN_RE = re.compile(r'(\w+)\s+=\s+(.*?)$', re.MULTILINE) 16 | 17 | def bool_string_to_number(v): 18 | return 1 if v == 'true' else 0 19 | 20 | def string_to_number(v): 21 | return int(v) 22 | 23 | def translate_config(config): 24 | if sys.platform == 'darwin': 25 | shlib_suffix = 'dylib' 26 | else: 27 | shlib_suffix = 'so' 28 | 29 | return { 30 | 'target_defaults': { 31 | 'default_configuration': 32 | 'Debug' if config['is_debug'] == 'true' else 'Release', 33 | }, 34 | 'variables': { 35 | 'asan': bool_string_to_number(config['is_asan']), 36 | 'node_module_version': string_to_number(config['node_module_version']), 37 | 'node_report': config['node_report'], 38 | 'node_shared': bool_string_to_number(config['is_component_build']), 39 | 'node_code_cache_path': 40 | 'node_code_cache.cc' if config['node_use_code_cache'] else '', 41 | 'shlib_suffix': shlib_suffix, 42 | # v8_enable_inspector is actually a misnomer, and only affects node. 43 | 'v8_enable_inspector': 44 | bool_string_to_number(config['node_enable_inspector']), 45 | 'v8_enable_i18n_support': 46 | bool_string_to_number(config['v8_enable_i18n_support']), 47 | # introduced for building addons. 48 | 'node_use_openssl': config['node_use_openssl'], 49 | 'build_v8_with_gn': 'false', 50 | 'enable_lto': 'false', 51 | 'openssl_fips': '', 52 | } 53 | } 54 | 55 | def main(jinja_dir, gn_out_dir, output_file, depfile): 56 | # Get GN config and parse into a dictionary. 57 | gnconfig = subprocess.check_output( 58 | ['gn', 'args', '--list', '--short', '-C', gn_out_dir]) 59 | config = dict(re.findall(GN_RE, gnconfig)) 60 | config['node_module_version'] = getmoduleversion.get_version() 61 | 62 | # Write output. 63 | with open(output_file, 'w') as f: 64 | f.write(repr(translate_config(config))) 65 | 66 | # Write depfile. Force regenerating config.gypi when GN configs change. 67 | with open(depfile, 'w') as f: 68 | dot_gn = os.path.abspath(os.path.join(root_dir, '.gn')) 69 | args_gn = os.path.abspath(os.path.join(gn_out_dir, 'args.gn')) 70 | if not os.path.exists(args_gn): 71 | with open(args_gn, 'w') as args_file: 72 | args_file.write('# Dummy args.gn file') 73 | f.write('%s: %s %s' %(output_file, dot_gn, args_gn)) 74 | 75 | if __name__ == '__main__': 76 | main(sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4]) 77 | -------------------------------------------------------------------------------- /tools/generate_node_files_json.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013-2019 GitHub Inc. 2 | # Copyright 2019 the V8 project authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | import json 7 | import os 8 | import subprocess 9 | import sys 10 | 11 | basedir = os.path.dirname(__file__) 12 | sys.path.append(os.path.join(basedir, os.pardir, 'node', 'tools')) 13 | import install 14 | 15 | def LoadPythonDictionary(path): 16 | file_string = open(path).read() 17 | try: 18 | file_data = eval(file_string, {'__builtins__': None}, None) 19 | except SyntaxError, e: 20 | e.filename = path 21 | raise 22 | except Exception, e: 23 | raise Exception('Unexpected error while reading %s: %s' % (path, str(e))) 24 | 25 | assert isinstance(file_data, dict), '%s does not eval to a dictionary' % path 26 | 27 | return file_data 28 | 29 | 30 | FILENAMES_JSON_HEADER = ''' 31 | // This file is automatically generated by generate_gn_filenames_json.py 32 | // DO NOT EDIT 33 | '''.lstrip() 34 | 35 | def RedirectV8(list): 36 | return [f.replace('deps/v8/', '../v8/', 1) for f in list] 37 | 38 | def GitLsFiles(path, prefix): 39 | output = subprocess.check_output(['git', 'ls-files'], cwd=path) 40 | return [prefix + x for x in output.splitlines()] 41 | 42 | if __name__ == '__main__': 43 | # Set up paths. 44 | root_dir = os.path.dirname(os.path.dirname(__file__)) 45 | node_dir = os.path.join(root_dir, 'node') 46 | node_gyp_file = os.path.join(node_dir, 'node.gyp') 47 | out_file = os.path.join(root_dir, 'node_files.json') 48 | inspector_gyp_file = os.path.join(node_dir, 49 | 'src', 'inspector', 'node_inspector.gypi') 50 | openssl_gyp_file = os.path.join(node_dir, 51 | 'deps', 'openssl', 'config', 'archs', 52 | 'linux-x86_64', 'no-asm', 'openssl.gypi') 53 | out = {} 54 | # Load file lists from gyp files. 55 | node_gyp = LoadPythonDictionary(node_gyp_file) 56 | inspector_gyp = LoadPythonDictionary(inspector_gyp_file) 57 | openssl_gyp = LoadPythonDictionary(openssl_gyp_file) 58 | # Find JS lib file and single out files from V8. 59 | library_files = node_gyp['variables']['library_files'] 60 | out['v8_library_files'] = [ 61 | f.replace('deps/', '../') for f in library_files if f.startswith('deps/v8')] 62 | out['node_library_files'] = [ 63 | f for f in library_files if not f.startswith('deps/v8')] 64 | out['all_library_files'] = library_files 65 | 66 | # Find C++ source files. 67 | node_lib_target = next( 68 | t for t in node_gyp['targets'] 69 | if t['target_name'] == '<(node_lib_target_name)') 70 | node_source_blacklist = { 71 | '<@(library_files)', 72 | 'common.gypi', 73 | '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc', 74 | } 75 | node_sources = [ 76 | f for f in node_lib_target['sources'] 77 | if f not in node_source_blacklist] 78 | out['node_sources'] = [ 79 | f.replace('deps/v8/', '../v8/', 1) for f in node_sources] 80 | 81 | # Find cctest files. 82 | cctest_target = next( 83 | t for t in node_gyp['targets'] 84 | if t['target_name'] == 'cctest') 85 | out['cctest_sources'] = cctest_target['sources'] 86 | 87 | # Find inspector sources. 88 | inspector_sources = inspector_gyp['sources'] 89 | out['inspector_sources'] = inspector_sources 90 | 91 | # Find OpenSSL sources. 92 | openssl_sources = openssl_gyp['variables']['openssl_sources'] 93 | out['openssl_sources'] = openssl_sources 94 | # Find node/tools/doc content. 95 | tools_doc_dir = os.path.join(node_dir, 'tools', 'doc') 96 | out['tools_doc_files'] = GitLsFiles(tools_doc_dir, '//node/tools/doc/') 97 | 98 | # Find node/test/addons content. 99 | test_addons_dir = os.path.join(node_dir, 'test', 'addons') 100 | out['test_addons_files'] = GitLsFiles(test_addons_dir, '//node/test/addons/') 101 | 102 | # Find node/test/node-api content. 103 | test_node_api_dir = os.path.join(node_dir, 'test', 'node-api') 104 | out['test_node_api_files'] = GitLsFiles(test_node_api_dir, 105 | '//node/test/node-api/') 106 | # Find node/test/js-native-api content. 107 | test_js_native_api_dir = os.path.join(node_dir, 'test', 'js-native-api') 108 | out['test_js_native_api_files'] = GitLsFiles(test_js_native_api_dir, 109 | '//node/test/js-native-api/') 110 | 111 | # Find v8/include content. 112 | v8_include_dir = os.path.join(root_dir, 'v8', 'include') 113 | out['v8_headers'] = GitLsFiles(v8_include_dir, '//v8/include/') 114 | 115 | # Write file list as JSON. 116 | with open(out_file, 'w') as f: 117 | f.write(FILENAMES_JSON_HEADER) 118 | f.write(json.dumps(out, sort_keys=True, indent=2, separators=(',', ': '))) 119 | f.write('\n') 120 | -------------------------------------------------------------------------------- /tools/gn-gen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright 2019 the V8 project authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | import argparse 7 | import os 8 | import subprocess 9 | import sys 10 | 11 | def ToBool(option): 12 | return 'true' if option else 'false' 13 | 14 | def GenerateBuildFiles(options): 15 | gn_args = [] 16 | # Only one sanitizer is enabled. 17 | assert(options.asan + options.tsan + options.ubsan + options.ubsan_vptr <= 1) 18 | 19 | if options.asan or options.tsan or options.ubsan or options.ubsan_vptr: 20 | options.shared = False 21 | options.debug = False 22 | options.sysroot = True 23 | gn_args.append('v8_enable_test_features=true') 24 | 25 | if options.sysroot: 26 | gn_args.append('use_sysroot=true') 27 | gn_args.append('use_custom_libcxx=true') 28 | 29 | if options.asan: 30 | gn_args.append('is_lsan=true') 31 | gn_args.append('is_asan=true') 32 | 33 | if options.tsan: 34 | gn_args.append('is_tsan=true') 35 | 36 | if options.ubsan: 37 | gn_args.append('is_ubsan=true') 38 | gn_args.append('is_ubsan_no_recover=true') 39 | 40 | if options.ubsan_vptr: 41 | gn_args.append('is_ubsan_vptr=true') 42 | gn_args.append('is_ubsan_no_recover=true') 43 | 44 | gn_args.append('is_debug=%s' % ToBool(options.debug)) 45 | gn_args.append('use_goma=%s' % ToBool(options.goma)) 46 | gn_args.append('use_jumbo_build=%s' % ToBool(options.jumbo)) 47 | gn_args.append('is_component_build=%s' % ToBool(options.shared)) 48 | gn_args.append('node_use_code_cache=%s' % ToBool(not options.no_cache)) 49 | 50 | flattened_args = ' '.join(gn_args) 51 | args = ['gn', 'gen', options.out_dir, '-q', '--args=' + flattened_args] 52 | print('\n'.join(gn_args)) 53 | subprocess.check_call(args) 54 | 55 | def ParseOptions(args): 56 | parser = argparse.ArgumentParser( 57 | description='Generate GN build configurations') 58 | parser.add_argument('out_dir', help='build directory') 59 | parser.add_argument('--goma', help='use goma to speed up compile', 60 | action='store_true') 61 | parser.add_argument('--jumbo', help='use jumbo to speed up compile', 62 | action='store_true') 63 | parser.add_argument('--asan', help='build with address sanitizer', 64 | action='store_true', default=False) 65 | parser.add_argument('--tsan', help='build with thread sanitizer', 66 | action='store_true', default=False) 67 | parser.add_argument('--ubsan', help='build with undefined-behavior sanitizer', 68 | action='store_true', default=False) 69 | parser.add_argument('--ubsan-vptr', 70 | help='build with undefined-behavior (vptr) sanitizer', 71 | action='store_true', default=False) 72 | parser.add_argument('--shared', help='shared library build', 73 | action='store_true', default=False) 74 | parser.add_argument('--sysroot', help='use bundled sysroot', 75 | action='store_true', default=False) 76 | parser.add_argument('--debug', help='debug build', 77 | action='store_true', default=False) 78 | parser.add_argument('--no-cache', help='do not use Node.js code cache', 79 | action='store_true', default=False) 80 | return parser.parse_args(args) 81 | 82 | if __name__ == '__main__': 83 | options = ParseOptions(sys.argv[1:]) 84 | GenerateBuildFiles(options) 85 | -------------------------------------------------------------------------------- /tools/memory/asan/blacklist.txt: -------------------------------------------------------------------------------- 1 | # The rules in this file are only applied at compile time. If you can modify the 2 | # source in question, consider function attributes to disable instrumentation. 3 | # 4 | # Please think twice before you add or remove these rules. -------------------------------------------------------------------------------- /tools/memory/tsan_v2/ignores.txt: -------------------------------------------------------------------------------- 1 | # The rules in this file are only applied at compile time. If you can modify the 2 | # source in question, consider function attributes to disable instrumentation. 3 | # 4 | # Please think twice before you add or remove these rules. 5 | # Data races should typically go to suppressions.txt. -------------------------------------------------------------------------------- /tools/mirror_removal.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 the V8 project authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | # This script recursively removes files from to_dir that do not exist 6 | # in from_dir. This is to remove outdated artifacts in incremental builds. 7 | 8 | import os 9 | import shutil 10 | import sys 11 | 12 | def mirror_removal(from_dir, to_dir, dirpath, list, remove): 13 | for file in list: 14 | if not os.path.exists(os.path.join(from_dir, dirpath, file)): 15 | delete_file = os.path.join(to_dir, dirpath, file) 16 | if os.path.exists(delete_file): 17 | remove(delete_file) 18 | 19 | def main(from_dir, to_dir, stamp): 20 | os.chdir(to_dir) 21 | for dirpath, dirs, files in os.walk(".", topdown=False): 22 | mirror_removal(from_dir, to_dir, dirpath, files, lambda x: os.unlink(x)) 23 | mirror_removal(from_dir, to_dir, dirpath, dirs, lambda x: shutil.rmtree(x)) 24 | 25 | with open(stamp, 'w') as file: 26 | file.write('stamp') 27 | 28 | if __name__ == '__main__': 29 | main(os.path.abspath(sys.argv[1]), 30 | os.path.abspath(sys.argv[2]), 31 | os.path.abspath(sys.argv[3])) 32 | -------------------------------------------------------------------------------- /tools/run_executable_in_dir.py: -------------------------------------------------------------------------------- 1 | # Copyright 2019 the V8 project authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | import os 6 | import subprocess 7 | import sys 8 | 9 | def main(argv): 10 | stamp = argv[2] 11 | arg_start = 3 12 | 13 | # Parse env variables provided in the form `--env name value`. 14 | # Convert paths to absolute paths. 15 | env = os.environ.copy() 16 | while argv[arg_start] == '--env': 17 | value = argv[arg_start + 2] 18 | if os.path.exists(value): 19 | value = os.path.abspath(value) 20 | env[argv[arg_start + 1]] = value 21 | arg_start = arg_start + 3 22 | 23 | try: 24 | subprocess.check_output(argv[arg_start:], cwd=argv[1], env=env, 25 | stderr=subprocess.STDOUT) 26 | except subprocess.CalledProcessError as exc: 27 | print(exc.output) 28 | raise 29 | 30 | with open(stamp, 'w') as file: 31 | file.write('stamp') 32 | 33 | if __name__ == '__main__': 34 | main(sys.argv) 35 | -------------------------------------------------------------------------------- /tools/run_in_dir.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2013-2019 GitHub Inc. 2 | # Copyright 2019 the V8 project authors. All rights reserved. 3 | # Use of this source code is governed by a BSD-style license that can be 4 | # found in the LICENSE file. 5 | 6 | import os 7 | import subprocess 8 | import sys 9 | 10 | def main(argv): 11 | cwd = argv[1] 12 | os.chdir(cwd) 13 | os.execv(sys.executable, [sys.executable] + argv[2:]) 14 | 15 | if __name__ == '__main__': 16 | main(sys.argv) 17 | -------------------------------------------------------------------------------- /tools/test.py: -------------------------------------------------------------------------------- 1 | ../node/tools/test.py -------------------------------------------------------------------------------- /tools/ubsan/blacklist.txt: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | # UBSan blacklist. 3 | 4 | # UBSan bug, fixed in LLVM r350779. Drop this suppression when that 5 | # revision has rolled into Chromium's bundled Clang. 6 | fun:*v8*internal*NewArray* 7 | 8 | # Bug 8735: PropertyCallbackInfo vs PropertyCallbackInfo. 9 | fun:*v8*internal*PropertyCallbackArguments*CallAccessorSetter* 10 | fun:*v8*internal*PropertyCallbackArguments*BasicCallNamedGetterCallback* 11 | fun:*v8*internal*InvokeAccessorGetterCallback* 12 | 13 | # Bug 8735: WeakCallbackInfo vs. WeakCallbackInfo. 14 | fun:*v8*internal*GlobalHandles*PendingPhantomCallback*Invoke* 15 | fun:*v8*internal*GlobalHandles*Node*PostGarbageCollectionProcessing* 16 | -------------------------------------------------------------------------------- /tools/ubsan/vptr_blacklist.txt: -------------------------------------------------------------------------------- 1 | ############################################################################# 2 | # UBSan vptr blacklist. 3 | # Function and type based blacklisting use a mangled name, and it is especially 4 | # tricky to represent C++ types. For now, any possible changes by name manglings 5 | # are simply represented as wildcard expressions of regexp, and thus it might be 6 | # over-blacklisted. 7 | 8 | ############################################################################# 9 | # UBsan goes into an infinite recursion when __dynamic_cast instrumented with 10 | # "vptr". See crbug.com/609786. 11 | 12 | src:*/third_party/libc\+\+abi/trunk/src/private_typeinfo.cpp 13 | -------------------------------------------------------------------------------- /tools/whitespace.txt: -------------------------------------------------------------------------------- 1 | . 2 | --------------------------------------------------------------------------------