diff --git a/atom/browser/javascript_environment.cc b/atom/browser/javascript_environment.cc index 44d76a4ded..d2aa395f1c 100644 --- a/atom/browser/javascript_environment.cc +++ b/atom/browser/javascript_environment.cc @@ -41,10 +41,10 @@ bool JavascriptEnvironment::Initialize() { if (!js_flags.empty()) v8::V8::SetFlagsFromString(js_flags.c_str(), js_flags.size()); - base::i18n::InitializeICU(); + // base::i18n::InitializeICU(); - gin::V8Initializer::LoadV8Snapshot(); - gin::V8Initializer::LoadV8Natives(); + // gin::V8Initializer::LoadV8Snapshot(); + // gin::V8Initializer::LoadV8Natives(); gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, gin::IsolateHolder::kStableV8Extras, gin::ArrayBufferAllocator::SharedInstance()); diff --git a/build/node/BUILD.gn b/build/node/BUILD.gn index e40e0c76e9..bb74c4c143 100644 --- a/build/node/BUILD.gn +++ b/build/node/BUILD.gn @@ -1,11 +1,19 @@ import("//v8/gni/v8.gni") -config("node_external_config") { +config("build_config") { defines = [ "NODE_WANT_INTERNALS=1", "NODE_SHARED_MODE", ] + include_dirs = [ + "//v8", + "//v8/include", + + ] +} + +config("node_external_config") { if (is_linux) { ldflags = [ rebase_path("$root_out_dir/lib/libnode.so", @@ -15,21 +23,19 @@ config("node_external_config") { [ rebase_path("$root_out_dir/node.dll.lib", root_build_dir) ] } else if (is_mac) { - ldflags = - [ rebase_path("$root_out_dir/libnode.dylib", - root_build_dir) ] + ldflags = [ + rebase_path("$root_out_dir/libnode.dylib", root_build_dir), + ] } } source_set("node") { public_configs = [ ":node_external_config", - "//electron/build:electron_config", ] public_deps = [ ":build_node", - "//v8:v8", ] } @@ -74,18 +80,29 @@ if (is_mac) { } action("build_node") { + public_configs = [ + ":build_config", + ] + # dummy script - these are actually produced separately through gyp script = "//electron/tools/node_gyp_build.py" + outputs = [ + "$root_out_dir/natives_blob.bin", + "$root_out_dir/snapshot_blob.bin", + "$root_out_dir/icudtl.dat", + ] if (is_mac) { - outputs = [ "$root_out_dir/libnode.dylib" ] + outputs += [ + "$root_out_dir/libnode.dylib", + ] } else if (is_win) { - outputs = [ + outputs += [ "$root_out_dir/node.dll", "$root_out_dir/node.dll.lib", ] } else if (is_linux) { - outputs = [ "$root_out_dir/lib/libnode.so" ] + outputs += [ "$root_out_dir/lib/libnode.so" ] } } diff --git a/build/node/node.gypi b/build/node/node.gypi index 4a440a9e19..eb75a93a22 100644 --- a/build/node/node.gypi +++ b/build/node/node.gypi @@ -137,10 +137,6 @@ ], }], ['_target_name=="node"', { - 'include_dirs': [ - '../v8', - '../v8/include', - ], 'cflags!': [ '-fvisibility=hidden', '-fdata-sections', @@ -192,10 +188,25 @@ ], # Node is using networking API but linking with this itself. 'libraries': [ '-lwinmm.lib' ], + 'variables': { + 'reference_symbols': [ + 'udata_setCommonData_56', + 'u_errorName_56', + 'ubidi_setPara_56', + 'ucsdet_getName_56', + 'uidna_openUTS46_56', + 'ulocdata_close_56', + 'unorm_normalize_56', + 'uregex_matches_56', + 'uspoof_open_56', + 'usearch_setPattern_56', + '?createInstance@Transliterator@icu_56@@SAPEAV12@AEBVUnicodeString@2@W4UTransDirection@@AEAW4UErrorCode@@@Z', + '??0MeasureFormat@icu_56@@QEAA@AEBVLocale@1@W4UMeasureFormatWidth@@AEAW4UErrorCode@@@Z', + ], + }, 'msvs_settings': { 'VCLinkerTool': { - 'EnableCOMDATFolding': '1', # disable - 'OptimizeReferences': '1', # disable + 'ForceSymbolReferences': [ '<@(reference_symbols)' ], }, }, }], diff --git a/build/node/v8.gypi b/build/node/v8.gypi index a1e82d1adb..716591793b 100644 --- a/build/node/v8.gypi +++ b/build/node/v8.gypi @@ -3,14 +3,14 @@ 'icu_path': '../../../third_party/icu', 'icu_use_data_file_flag': 1, # Using libc++ requires building for >= 10.7. - 'mac_deployment_target': '10.8', + # 'mac_deployment_target': '10.8', # Use the standard way of linking with msvc runtime. - 'win_use_allocator_shim': 0, + # 'win_use_allocator_shim': 0, 'v8_enable_i18n_support': 1, # The V8 libraries. 'v8_libraries': '["v8", "v8_snapshot", "v8_nosnapshot", "v8_external_snapshot", "v8_base", "v8_libbase", "v8_libplatform"]', - 'v8_use_snapshot': 'true', - 'v8_use_external_startup_data': 1, + # 'v8_use_snapshot': 'true', + # 'v8_use_external_startup_data': 1, 'icu_libraries': '["icui18n", "icuuc"]', }, 'target_defaults': { @@ -38,13 +38,21 @@ # Use C++11 library. 'CLANG_CXX_LIBRARY': 'libc++', # -stdlib=libc++ }, + 'defines': [ + 'U_COMBINED_IMPLEMENTATION', + # Defining "U_COMBINED_IMPLEMENTATION" will add "explicit" for some + # constructors, make sure it doesn' happen. + 'UNISTR_FROM_CHAR_EXPLICIT=', + 'UNISTR_FROM_STRING_EXPLICIT=', + 'U_NO_DEFAULT_INCLUDE_UTF_HEADERS=0', + ], + 'defines!': [ + 'U_STATIC_IMPLEMENTATION', + ], 'target_conditions': [ ['_type=="static_library" and _toolset=="target" and OS=="linux"', { 'standalone_static_library': 1, }], - ['_target_name in <(icu_libraries)', { - 'type': 'static_library', - }], ['_target_name in <(v8_libraries) + <(icu_libraries)', { 'xcode_settings': { 'DEAD_CODE_STRIPPING': 'NO', # -Wl,-dead_strip diff --git a/patches/master_patch.patch b/patches/master_patch.patch index a5ac9cbd43..e8a2d66faa 100644 --- a/patches/master_patch.patch +++ b/patches/master_patch.patch @@ -1,8 +1,8 @@ diff --git a/build/config/chrome_build.gni b/build/config/chrome_build.gni -index c649018a7a0aeb20caeb2bf37c60d57c48630f1b..a3a5b9507dfebf8d010e018ee1a5b11203146a67 100644 +index c649018a7a0aeb20caeb2bf37c60d57c48630f1b..e28969349e35c4bdb48c0693ce7604b269a22ca0 100644 --- a/build/config/chrome_build.gni +++ b/build/config/chrome_build.gni -@@ -8,15 +8,15 @@ declare_args() { +@@ -8,15 +8,17 @@ declare_args() { # resources). is_chrome_branded = false @@ -17,15 +17,16 @@ index c649018a7a0aeb20caeb2bf37c60d57c48630f1b..a3a5b9507dfebf8d010e018ee1a5b112 # Break chrome.dll into multple pieces based on process type. Only available # on Windows. is_multi_dll_chrome = is_win && !is_component_build - } -- +-} + -# Refers to the subdirectory for branding in various places including -# chrome/app/theme. -if (is_chrome_branded) { - branding_path_component = "google_chrome" -} else { - branding_path_component = "chromium" --} ++ muon_build = false + } diff --git a/build/toolchain/mac/BUILD.gn b/build/toolchain/mac/BUILD.gn index 0c00e995fffe139ac39badd12790acbad3a78a7a..e5651111ce284f04ce3b5d6157be84c3738e732c 100644 --- a/build/toolchain/mac/BUILD.gn @@ -2077,6 +2078,77 @@ index b93ff45d633c9330beaeb77f4772d3d8d5486245..79748cdaa5ff73ccadaecccbb88c4f9f // Called to read raw (pre-filtered) data from this Job. Reads at most // |buf_size| bytes into |buf|. // Possible return values: +diff --git a/remoting/host/BUILD.gn b/remoting/host/BUILD.gn +index eb095bc5777a6b05bc6ad1ef4ef64393dfdf0592..72eefb12d24bef531684a3f486a8e36f3763ab42 100644 +--- a/remoting/host/BUILD.gn ++++ b/remoting/host/BUILD.gn +@@ -12,6 +12,7 @@ import("//remoting/remoting_locales.gni") + import("//remoting/remoting_options.gni") + import("//remoting/remoting_version.gni") + import("//remoting/tools/build/remoting_localize.gni") ++import("//third_party/icu/config.gni") + + process_version("remoting_version") { + template_file = "//remoting/host/version.h.in" +@@ -1594,9 +1595,14 @@ if (enable_me2me_host) { + "$root_gen_dir/remoting/CREDITS.txt", + "$root_out_dir/remoting/com.google.chrome.remote_assistance.json", + "$root_out_dir/remoting/com.google.chrome.remote_desktop.json", +- "$root_out_dir/icudtl.dat", + ] + ++ if (icu_use_data_file) { ++ inputs += [ ++ "$root_out_dir/icudtl.dat", ++ ] ++ } ++ + _generated_files = rebase_path(inputs, root_build_dir) + _generated_files += [ rebase_path("//remoting/resources/chromoting.ico") ] + +diff --git a/services/shell/standalone/BUILD.gn b/services/shell/standalone/BUILD.gn +index fb55a656a2d0f9f897225d5651603dfa5bac05bc..47c63aeb45fe222d8dd53fd16ca8768d909d4a5c 100644 +--- a/services/shell/standalone/BUILD.gn ++++ b/services/shell/standalone/BUILD.gn +@@ -6,6 +6,8 @@ import("//services/shell/public/cpp/service.gni") + import("//mojo/public/tools/bindings/mojom.gni") + import("//testing/test.gni") + ++# workaround for icu linking errors on windows ++if (muon_build) { group("standalone") {} } else { + executable("standalone") { + output_name = "mojo_runner" + sources = [ +@@ -18,6 +20,7 @@ executable("standalone") { + "//build/win:default_exe_manifest", + ] + } ++} + + source_set("lib") { + sources = [ +diff --git a/services/tracing/BUILD.gn b/services/tracing/BUILD.gn +index f002ab60b88a8c8f2c9d1676eaba37e12b84ebbe..3c8517cb748e2368058bd363d20c10d7a833aa1c 100644 +--- a/services/tracing/BUILD.gn ++++ b/services/tracing/BUILD.gn +@@ -5,6 +5,8 @@ + import("//services/shell/public/cpp/service.gni") + import("//services/shell/public/service_manifest.gni") + ++# workaround for icu linking errors on windows ++if (muon_build) { group("tracing") {} } else { + service("tracing") { + sources = [ + "main.cc", +@@ -27,7 +29,7 @@ service_manifest("manifest") { + name = "tracing" + source = "manifest.json" + } +- ++} + source_set("lib") { + sources = [ + "data_sink.cc", diff --git a/third_party/WebKit/Source/core/dom/DOMArrayBuffer.h b/third_party/WebKit/Source/core/dom/DOMArrayBuffer.h index e436a079e835ad465a5262249f0a402d58e25f02..872df7f2c47de00abc32a95f7564172090b75527 100644 --- a/third_party/WebKit/Source/core/dom/DOMArrayBuffer.h @@ -2187,6 +2259,21 @@ index 82775974231274e6639751139f5c7bc9bbfaad25..8aca09939d20cc48cfa85c507fdea17c readonly attribute long long lastModified; // Non-standard APIs +diff --git a/third_party/WebKit/Source/platform/BUILD.gn b/third_party/WebKit/Source/platform/BUILD.gn +index ce25028fe74fa15fe3f9a24dd4188a6407dc7602..67b7f7a9776f16fd9ba2d99185da643982a1ee66 100644 +--- a/third_party/WebKit/Source/platform/BUILD.gn ++++ b/third_party/WebKit/Source/platform/BUILD.gn +@@ -186,6 +186,10 @@ executable("character_data_generator") { + "//build/win:default_exe_manifest", + "//third_party/icu", + ] ++ ++ if (is_mac) { ++ ldflags = [ "-Wl,-rpath,@loader_path/.", ] ++ } + } + + # Inspector protocol diff --git a/third_party/WebKit/Source/web/WebArrayBuffer.cpp b/third_party/WebKit/Source/web/WebArrayBuffer.cpp index 471ce6a5c66f6a7240732a12596746ef239a48e1..29b0bbdff9dfe9d0e1d1fb943b36bb98a7bea385 100644 --- a/third_party/WebKit/Source/web/WebArrayBuffer.cpp diff --git a/patches/third_party/icu/filter.patch b/patches/third_party/icu/filter.patch new file mode 100644 index 0000000000..2f8f69fabf --- /dev/null +++ b/patches/third_party/icu/filter.patch @@ -0,0 +1,49 @@ +diff --git a/BUILD.gn b/BUILD.gn +index 1dd7c61d5368a643cb9d8cc489f8833cd796cb5f..6a7b287db3357cdaaff4d822002cc4a8b26f4b44 100644 +--- a/BUILD.gn ++++ b/BUILD.gn +@@ -3,6 +3,7 @@ + # found in the LICENSE file. + + import("//third_party/icu/config.gni") ++import("//build/config/chrome_build.gni") + + if (is_android) { + import("//build/config/android/rules.gni") +@@ -39,7 +40,9 @@ config("icu_config") { + ] + + if (!is_component_build) { ++ if (!muon_build) { + defines += [ "U_STATIC_IMPLEMENTATION" ] ++ } + } + + include_dirs = [ +@@ -122,6 +125,21 @@ config("icu_code") { + } + } + ++if (muon_build) { ++ group("icui18n") { ++ public_deps = [ "//electron/build/node" ] ++ public_configs = [ ":icu_config" ] ++ } ++ ++ group("icuuc") { ++ public_deps = [ "//electron/build/node" ] ++ public_configs = [ ":icu_config" ] ++ } ++ ++ group("icudata") { ++ public_deps = [ "//electron/build/node:build_node" ] ++ } ++} else { + component("icui18n") { + # find source/i18n -maxdepth 1 ! -type d | egrep '\.(c|cpp|h)$' |\ + # sort | sed 's/^\(.*\)$/ "\1",/' +@@ -1054,3 +1072,4 @@ if (icu_use_data_file) { + } + } + } ++} diff --git a/patches/v8/filter.patch b/patches/v8/filter.patch index 5c9aa33bd4..e914e60f4e 100644 --- a/patches/v8/filter.patch +++ b/patches/v8/filter.patch @@ -1,29 +1,23 @@ diff --git a/BUILD.gn b/BUILD.gn -index dcefe3706b84c1f726256a6053e60134953a014d..794abe164d911861a1a91180f1ec33cf405790bd 100644 +index dcefe3706b84c1f726256a6053e60134953a014d..95000092f77c4d54801454dd0493658e1d781452 100644 --- a/BUILD.gn +++ b/BUILD.gn -@@ -45,7 +45,7 @@ declare_args() { - - # Enable ECMAScript Internationalization API. Enabling this feature will - # add a dependency on the ICU library. -- v8_enable_i18n_support = true -+ v8_enable_i18n_support = is_component_build +@@ -94,8 +94,10 @@ if (v8_enable_disassembler == "") { + v8_enable_disassembler = is_debug && !v8_optimized_debug + } - # Enable slow dchecks. - v8_enable_slow_dchecks = false -@@ -98,6 +98,7 @@ v8_generated_peephole_source = "$target_gen_dir/bytecode-peephole-table.cc" ++if (!muon_build) { + v8_generated_peephole_source = "$target_gen_dir/bytecode-peephole-table.cc" v8_random_seed = "314159265" ++} v8_toolset_for_shell = "host" -+suppress_v8 = !is_component_build ############################################################################### - # Configurations - # -@@ -106,6 +107,14 @@ config("internal_config") { +@@ -106,6 +108,14 @@ config("internal_config") { include_dirs = [ "." ] -+ if (suppress_v8) { ++ if (muon_build) { + defines = [ + "SUPPRESS_V8_SNAPSHOT", + "V8_SHARED", @@ -34,11 +28,11 @@ index dcefe3706b84c1f726256a6053e60134953a014d..794abe164d911861a1a91180f1ec33cf if (is_component_build) { defines = [ "V8_SHARED", -@@ -133,12 +142,20 @@ config("libsampler_config") { +@@ -133,12 +143,20 @@ config("libsampler_config") { # This config should only be applied to code using V8 and not any V8 code # itself. config("external_config") { -+ if (suppress_v8) { ++ if (muon_build) { + defines = [ + "V8_SHARED", + "USING_V8_SHARED", @@ -55,129 +49,68 @@ index dcefe3706b84c1f726256a6053e60134953a014d..794abe164d911861a1a91180f1ec33cf include_dirs = [ "include" ] libs = [] if (is_android && current_toolchain != host_toolchain) { -@@ -149,9 +166,9 @@ config("external_config") { - # This config should only be applied to code that needs to be explicitly - # aware of whether we are using startup data or not. - config("external_startup_data") { -- if (v8_use_external_startup_data) { -+# if (v8_use_external_startup_data) { - defines = [ "V8_USE_EXTERNAL_STARTUP_DATA" ] -- } -+# } - } - - config("features") { -@@ -186,9 +203,9 @@ config("features") { - if (v8_enable_handle_zapping) { - defines += [ "ENABLE_HANDLE_ZAPPING" ] +@@ -345,6 +363,22 @@ config("toolchain") { } -- if (v8_use_external_startup_data) { -+# if (v8_use_external_startup_data) { - defines += [ "V8_USE_EXTERNAL_STARTUP_DATA" ] -- } -+# } - } - - config("toolchain") { -@@ -726,6 +743,9 @@ source_set("v8_maybe_snapshot") { - } - - v8_source_set("v8_nosnapshot") { -+ if (suppress_v8) { -+ set_sources_assignment_filter(["*"]) -+ } - visibility = [ ":*" ] # Only targets in this file can depend on this. - - deps = [ -@@ -748,6 +768,9 @@ v8_source_set("v8_nosnapshot") { } - v8_source_set("v8_snapshot") { -+ if (suppress_v8) { -+ set_sources_assignment_filter(["*"]) ++if (muon_build) { ++ group("v8") { ++ public_deps = [ "//electron/build/node:build_node" ] ++ public_configs = [ ":external_config" ] + } - # Only targets in this file and the top-level visibility target can - # depend on this. - visibility = [ -@@ -781,6 +804,10 @@ v8_source_set("v8_snapshot") { - - if (v8_use_external_startup_data) { - v8_source_set("v8_external_snapshot") { -+ if (suppress_v8) { -+ set_sources_assignment_filter(["*"]) -+ } -+ - visibility = [ ":*" ] # Only targets in this file can depend on this. - - deps = [ -@@ -805,6 +832,10 @@ if (v8_use_external_startup_data) { - } - - v8_source_set("v8_base") { -+ if (suppress_v8) { -+ set_sources_assignment_filter(["*"]) ++ group("v8_snapshot") { ++ public_deps = [ "//electron/build/node:build_node" ] + } -+ - visibility = [ ":*" ] # Only targets in this file can depend on this. - - sources = [ -@@ -1986,8 +2017,10 @@ v8_source_set("v8_base") { - ":v8_libsampler", - ] - -- sources += [ v8_generated_peephole_source ] -- deps += [ ":run_mkpeephole" ] -+ if (!suppress_v8) { -+ sources += [ v8_generated_peephole_source ] -+ deps += [ ":run_mkpeephole" ] ++ group("v8_libplatform") { ++ public_deps = [ "//electron/build/node:build_node" ] ++ public_configs = [ ":libplatform_config" ] + } ++ group("d8") {} ++ group("postmortem-metadata") {} ++ group("gn_all") {} ++} else { + ############################################################################### + # Actions + # +@@ -2268,13 +2302,13 @@ v8_executable("mkpeephole") { + ############################################################################### + # Public targets + # +- ++} + want_v8_shell = + (current_toolchain == host_toolchain && v8_toolset_for_shell == "host") || + (current_toolchain == v8_snapshot_toolchain && + v8_toolset_for_shell == "host") || + (current_toolchain != host_toolchain && v8_toolset_for_shell == "target") +- ++if (!muon_build) { + group("gn_all") { + testonly = true - if (is_win) { - # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. -@@ -2001,8 +2034,8 @@ v8_source_set("v8_base") { +@@ -2466,7 +2500,7 @@ v8_executable("v8_parser_shell") { } - } else { - sources -= [ -- "src/i18n.cc", -- "src/i18n.h", -+ # "src/i18n.cc", -+ # "src/i18n.h", - ] } - -@@ -2013,6 +2046,10 @@ v8_source_set("v8_base") { } - - v8_source_set("v8_libbase") { -+ if (suppress_v8) { -+ set_sources_assignment_filter(["*"]) -+ } -+ - visibility = [ ":*" ] # Only targets in this file can depend on this. - - sources = [ -@@ -2146,6 +2183,10 @@ v8_source_set("v8_libbase") { +- ++} + if (want_v8_shell) { + v8_executable("v8_shell") { + sources = [ +@@ -2492,7 +2526,7 @@ if (want_v8_shell) { + } + } } +- ++if (!muon_build) { + template("v8_fuzzer") { + name = target_name + forward_variables_from(invoker, "*") +@@ -2581,3 +2615,4 @@ v8_source_set("wasm_asmjs_fuzzer") { - v8_source_set("v8_libplatform") { -+ if (suppress_v8) { -+ set_sources_assignment_filter(["*"]) -+ } -+ - sources = [ - "//base/trace_event/common/trace_event_common.h", - "include/libplatform/libplatform.h", -@@ -2175,6 +2216,10 @@ v8_source_set("v8_libplatform") { + v8_fuzzer("wasm_asmjs_fuzzer") { } - - v8_source_set("v8_libsampler") { -+ if (suppress_v8) { -+ set_sources_assignment_filter(["*"]) -+ } -+ - sources = [ - "src/libsampler/sampler.cc", - "src/libsampler/sampler.h", ++} diff --git a/src/snapshot/mksnapshot.cc b/src/snapshot/mksnapshot.cc index f4362e5077e1231e2e57ccaf06ccc9769ebaae61..e048e26d768e358a9097f35afe60585de2cde50d 100644 --- a/src/snapshot/mksnapshot.cc