summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authorMichaƫl Zasso <targos@protonmail.com>2021-07-03 16:36:37 +0200
committerRichard Lau <rlau@redhat.com>2021-07-23 11:41:15 +0100
commita73275f056722a6b7cdd0d8ba5fd6e5e0ad7c9ff (patch)
tree64f8b8dfdd754ff72531f3bb5fe713792f9ec8db /deps
parent492b0d6b371f8d45015564d53f6420c01a336b4f (diff)
downloadnode-new-a73275f056722a6b7cdd0d8ba5fd6e5e0ad7c9ff.tar.gz
deps: V8: cherry-pick 7b3332844212
Original commit message: [build] Move split_static_library.gni from Chromium repo We'll remove the file from Chromium in a follow up after V8 has rolled + 2 days. Bug: v8:9911 Change-Id: I69fe56855f1ba83bec0d39e0fb6acb7e4182c6b7 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1897826 Reviewed-by: Nico Weber <thakis@chromium.org> Commit-Queue: Michael Achenbach <machenbach@chromium.org> Cr-Commit-Position: refs/heads/master@{#64742} Refs: https://github.com/v8/v8/commit/7b3332844212d78ee87a9426f3a6f7f781a8fbfa PR-URL: https://github.com/nodejs/node/pull/39245 Refs: https://github.com/nodejs/build/issues/2696 Reviewed-By: Richard Lau <rlau@redhat.com>
Diffstat (limited to 'deps')
-rw-r--r--deps/v8/gni/split_static_library.gni78
-rw-r--r--deps/v8/gni/v8.gni2
2 files changed, 79 insertions, 1 deletions
diff --git a/deps/v8/gni/split_static_library.gni b/deps/v8/gni/split_static_library.gni
new file mode 100644
index 0000000000..c72665e245
--- /dev/null
+++ b/deps/v8/gni/split_static_library.gni
@@ -0,0 +1,78 @@
+# Copyright 2019 the V8 project authors. All rights reserved.
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/compiler/compiler.gni")
+
+template("split_static_library") {
+ assert(defined(invoker.split_count),
+ "Must define split_count for split_static_library")
+
+ # In many conditions the number of inputs will be 1 (because the
+ # count will be conditional on platform or configuration) and for
+ # some build configurations it's unnecessary to split libraries
+ # since the tooling will never create files of a problematic size.
+ if (invoker.split_count == 1 || use_lld) {
+ static_library(target_name) {
+ forward_variables_from(invoker, "*")
+ }
+ } else {
+ group_name = target_name
+
+ generated_static_libraries = []
+ current_library_index = 0
+ foreach(current_sources, split_list(invoker.sources, invoker.split_count)) {
+ current_name = "${target_name}_$current_library_index"
+ assert(
+ current_sources != [],
+ "Your values for splitting a static library generate one that has no sources.")
+ generated_static_libraries += [ ":$current_name" ]
+
+ static_library(current_name) {
+ # Generated static library shard gets everything but sources (which
+ # we're redefining) and visibility (which is set to be the group
+ # below).
+ forward_variables_from(invoker,
+ "*",
+ [
+ "check_includes",
+ "sources",
+ "visibility",
+ ])
+ sources = current_sources
+ visibility = [ ":$group_name" ]
+
+ # When splitting a target's sources up into a series of static
+ # libraries, those targets will naturally include headers from each
+ # other arbitrarily. We could theoretically generate a web of
+ # dependencies and allow_circular_includes_from between all pairs of
+ # targets, but that's very cumbersome. Typical usage in Chrome is that
+ # only official Windows builds use split static libraries due to the
+ # Visual Studio size limits, and this means we'll still get header
+ # checking coverage for the other configurations.
+ check_includes = false
+
+ # Uniquify the output name if one is specified.
+ if (defined(invoker.output_name)) {
+ output_name = "${invoker.output_name}_$current_library_index"
+ }
+ }
+
+ current_library_index = current_library_index + 1
+ }
+
+ group(group_name) {
+ public_deps = generated_static_libraries
+ forward_variables_from(invoker,
+ [
+ "testonly",
+ "visibility",
+ ])
+ }
+ }
+}
+
+set_defaults("split_static_library") {
+ configs = default_compiler_configs
+}
diff --git a/deps/v8/gni/v8.gni b/deps/v8/gni/v8.gni
index e7fb6a6181..db71a4188b 100644
--- a/deps/v8/gni/v8.gni
+++ b/deps/v8/gni/v8.gni
@@ -4,7 +4,7 @@
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/v8_target_cpu.gni")
-import("//build/split_static_library.gni")
+import("split_static_library.gni")
declare_args() {
# Set flags for tracking code coverage. Uses gcov with gcc and sanitizer