build: update electron patches (#14623)

* build: remove common/icu/no_inline_default_constructor.patch

It was added in https://github.com/electron/libchromiumcontent/pull/207,
the issue is no longer valid in the GN build.

* build: remove common/icu/build_gn.patch

In GN release build all code including node are linked
statically in a single binary, the workaround is no longer valid.

* build: remove ununsed patches

* build: remove is_electron_gn_build arg

* build: remove component mode crt config patch

* build: remove executable config patch for character_data_generator

* build: remove latency_info.patch

* build: remove exec_script_whitelist patch

* build: update patches/common/v8/build_gn.patch

* build: remove common/chromium/fix-arm64-linking-error.patch

It was added in a1df18ca36
to workaround a linker issue.

* build: remove common/chromium/protobuf_build_gn.patch

It was added to workaround a VS linker bug, it has been fixed
in Update 1

* build: remove common/chromium/disable-recursive-surface-sync.patch

It was added in 6bc6626e2c
to fix dcheck on macOS, it no longer appears to be an issue.
This commit is contained in:
Robo 2018-09-15 17:10:18 +05:30 committed by Charles Kerr
parent 0ea687b529
commit 66ced07545
19 changed files with 10 additions and 673 deletions

View file

@ -1,8 +1,8 @@
diff --git a/BUILD.gn b/BUILD.gn
index 494ba22f29..6071422d7d 100644
index 4b48f7d687..30e9ec34cf 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -157,7 +157,7 @@ config("internal_config") {
@@ -192,7 +192,7 @@ config("internal_config") {
include_dirs = [ "." ]
@ -11,58 +11,7 @@ index 494ba22f29..6071422d7d 100644
defines = [ "BUILDING_V8_SHARED" ]
}
}
@@ -174,6 +174,20 @@ config("libplatform_config") {
if (is_component_build) {
defines = [ "USING_V8_PLATFORM_SHARED" ]
}
+
+ # For Electron "static_library" all V8 symbols are together in one DLL.
+ # V8 targets which depend on libplatform need to be built with
+ # BUILDING_V8_PLATFORM_SHARED in order to declare its symbols as exported.
+ #
+ # Caveat:
+ # This setting applies to _all_ dependent targets, even those outside
+ # of V8! Currently there are no other targets dependent on v8_libplatform
+ # which Electron would consume, so we don't need to do more complicated tweaks
+ # but be aware of this and check that it's still the case when upgrading
+ # to newer Chromium version.
+ if (is_electron_build && !is_electron_gn_build && !is_component_build) {
+ defines = [ "BUILDING_V8_PLATFORM_SHARED" ]
+ }
}
# This config should be applied to code using the libbase.
@@ -185,6 +199,20 @@ config("libbase_config") {
if (is_android && current_toolchain != host_toolchain) {
libs += [ "log" ]
}
+
+ # For Electron "static_library" all V8 symbols are together in one DLL.
+ # V8 targets which depend on libbase need to be built with
+ # BUILDING_V8_BASE_SHARED in order to declare its symbols as exported.
+ #
+ # Caveat:
+ # This setting applies to _all_ dependent targets, even those outside
+ # of V8! Currently there are no other targets dependent on v8_libbase
+ # which Electron would consume, so we don't need to do more complicated tweaks
+ # but be aware of this and check that it's still the case when upgrading
+ # to newer Chromium version.
+ if (is_electron_build && !is_electron_gn_build && !is_component_build) {
+ defines = [ "BUILDING_V8_BASE_SHARED" ]
+ }
}
# This config should be applied to code using the libsampler.
@@ -209,7 +209,7 @@ config("libsampler_config") {
# itself.
config("external_config") {
defines = []
- if (is_component_build) {
+ if (is_component_build || (is_electron_build && !is_electron_gn_build)) {
defines += [ "USING_V8_SHARED" ]
}
if (v8_enable_v8_checks) {
@@ -2674,6 +2674,8 @@ if (current_toolchain == v8_snapshot_toolchain) {
@@ -2912,6 +2912,8 @@ if (v8_use_snapshot && current_toolchain == v8_snapshot_toolchain) {
configs = [ ":internal_config" ]
@ -71,60 +20,3 @@ index 494ba22f29..6071422d7d 100644
deps = [
":v8_base",
":v8_init",
@@ -2667,7 +2697,7 @@ group("v8_fuzzers") {
]
}
-if (is_component_build) {
+if (is_component_build || (is_electron_build && !is_electron_gn_build)) {
v8_component("v8") {
sources = [
"src/v8dll-main.cc",
@@ -2681,6 +2711,13 @@ if (is_component_build) {
configs = [ ":internal_config" ]
public_configs = [ ":external_config" ]
+
+ # For Electron "static_library" keep V8 as a shared library. This is only
+ # needed so that other targets in Chromium build cleanly. Electron doesn't
+ # need the DLL.
+ if (is_electron_build && !is_electron_gn_build && !is_component_build) {
+ static_component_type = "shared_library"
+ }
}
v8_component("v8_for_testing") {
diff --git a/gni/v8.gni b/gni/v8.gni
index 9a2bb3dff4..53be2017c7 100644
--- a/gni/v8.gni
+++ b/gni/v8.gni
@@ -164,6 +164,16 @@ template("v8_executable") {
template("v8_component") {
component(target_name) {
+ # If this is a non-component build, but this target forces itself to be
+ # a shared library, we must reset the default configs that were applied
+ # (see the set_defaults("component") statement in BUILDCONFIG.gn)
+ # and assign those for shared libraries.
+ if (defined(invoker.static_component_type) &&
+ invoker.static_component_type == "shared_library") {
+ configs = []
+ configs = default_shared_library_configs
+ }
+
forward_variables_from(invoker, "*", [ "configs" ])
configs += invoker.configs
configs -= v8_remove_configs
diff --git a/src/inspector/BUILD.gn b/src/inspector/BUILD.gn
index 699b1bcbd4..11fc31d851 100644
--- a/src/inspector/BUILD.gn
+++ b/src/inspector/BUILD.gn
@@ -79,7 +79,7 @@ action("inspector_injected_script") {
config("inspector_config") {
visibility = [ ":*" ] # Only targets in this file can depend on this.
- if (is_component_build) {
+ if (is_component_build || is_electron_build) {
defines = [ "BUILDING_V8_SHARED" ]
}
}