diff options
Diffstat (limited to 'chromium/chrome/BUILD.gn')
-rw-r--r-- | chromium/chrome/BUILD.gn | 414 |
1 files changed, 211 insertions, 203 deletions
diff --git a/chromium/chrome/BUILD.gn b/chromium/chrome/BUILD.gn index dd3a098632d..16653e1529b 100644 --- a/chromium/chrome/BUILD.gn +++ b/chromium/chrome/BUILD.gn @@ -130,233 +130,220 @@ if (!is_android && !is_mac) { } } - template("chrome_binary") { - executable(target_name) { - output_name = invoker.output_name - sources = invoker.sources - if (defined(invoker.deps)) { - deps = invoker.deps - } else { - deps = [] - } - if (defined(invoker.data)) { - data = invoker.data - } else { - data = [] - } + executable("chrome_initial") { + if (is_win) { + output_name = "initialexe/chrome" + } else { + output_name = "chrome" + } - if (!is_win || is_clang) { - # Normally, we need to pass specific flags to the linker to - # create an executable that gathers profile data. However, when - # using MSVC, we need to make sure we *don't* pass /GENPROFILE - # when linking without generating any code, or else the linker - # will give us fatal error LNK1264. So we add the PGO flags - # on all configurations, execpt MSVC on Windows. - configs += [ "//build/config/compiler/pgo:default_pgo_flags" ] - } + if (!is_win || is_clang) { + # Normally, we need to pass specific flags to the linker to + # create an executable that gathers profile data. However, when + # using MSVC, we need to make sure we *don't* pass /GENPROFILE + # when linking without generating any code, or else the linker + # will give us fatal error LNK1264. So we add the PGO flags + # on all configurations, execpt MSVC on Windows. + configs += [ "//build/config/compiler/pgo:default_pgo_flags" ] + } - # Because the sources list varies so significantly per-platform, generally - # each platform lists its own files rather than relying on filtering or - # removing unused files. - sources += [ "app/chrome_exe_resource.h" ] - defines = [] - public_deps = [] - deps += [ "//printing/buildflags" ] - - data += [ "$root_out_dir/resources.pak" ] - if (is_linux || is_win) { - data += [ - "$root_out_dir/chrome_100_percent.pak", - "$root_out_dir/locales/en-US.pak", - "$root_out_dir/locales/fr.pak", - ] - if (enable_hidpi) { - data += [ "$root_out_dir/chrome_200_percent.pak" ] - } - } + # Because the sources list varies so significantly per-platform, generally + # each platform lists its own files rather than relying on filtering or + # removing unused files. + sources = [ + "app/chrome_exe_resource.h", + ] + defines = [] + public_deps = [] + deps = [ + "//printing/buildflags", + ] - data_deps = [] - - if (is_win) { - sources += [ - "app/chrome_exe.rc", - "app/chrome_exe_main_win.cc", - "app/chrome_watcher_client_win.cc", - "app/chrome_watcher_client_win.h", - "app/chrome_watcher_command_line_win.cc", - "app/chrome_watcher_command_line_win.h", - "app/main_dll_loader_win.cc", - "app/main_dll_loader_win.h", - "common/crash_keys.cc", - "common/crash_keys.h", - ] + data = [ + "$root_out_dir/resources.pak", + ] + if (is_linux || is_win) { + data += [ + "$root_out_dir/chrome_100_percent.pak", + "$root_out_dir/locales/en-US.pak", + "$root_out_dir/locales/fr.pak", + ] + if (enable_hidpi) { + data += [ "$root_out_dir/chrome_200_percent.pak" ] + } + } - deps += [ - ":chrome_dll", - ":chrome_exe_version", - ":copy_first_run", - ":visual_elements_resources", - "//base", - "//chrome/app/version_assembly:chrome_exe_manifest", - "//chrome/browser:active_use_util", - "//chrome/browser:chrome_process_finder", - "//chrome/chrome_elf", - "//chrome/chrome_watcher", - "//chrome/chrome_watcher:client", - "//chrome/common:constants", - "//chrome/common:metrics_constants_util_win", - "//chrome/install_static:secondary_module", - "//chrome/installer/util:with_no_strings", - "//components/browser_watcher:browser_watcher_client", - "//components/crash/content/app:run_as_crashpad_handler", - "//components/crash/core/common", - "//components/flags_ui:switches", - "//content:sandbox_helper_win", - "//content/public/common:static_switches", - "//crypto", - "//sandbox", - "//services/service_manager/sandbox", - "//third_party/breakpad:breakpad_handler", - "//third_party/breakpad:breakpad_sender", - ] - data_deps = [ - "//chrome/app/version_assembly:version_assembly_manifest", - "//chrome/chrome_proxy", - "//chrome/elevation_service", - "//chrome/notification_helper", - ] + data_deps = [] - if (win_console_app) { - defines += [ "WIN_CONSOLE_APP" ] - } else { - # Set /SUBSYSTEM:WINDOWS for chrome.exe itself, unless a console build - # has been requested. - configs -= [ "//build/config/win:console" ] - configs += [ "//build/config/win:windowed" ] - } + if (is_win) { + sources += [ + "app/chrome_exe.rc", + "app/chrome_exe_main_win.cc", + "app/chrome_watcher_client_win.cc", + "app/chrome_watcher_client_win.h", + "app/chrome_watcher_command_line_win.cc", + "app/chrome_watcher_command_line_win.h", + "app/main_dll_loader_win.cc", + "app/main_dll_loader_win.h", + "common/crash_keys.cc", + "common/crash_keys.h", + ] - configs += [ - "//build/config/win:delayloads", - "//build/config/win:delayloads_not_for_child_dll", - ] + deps += [ + ":chrome_dll", + ":chrome_exe_version", + ":copy_first_run", + ":visual_elements_resources", + "//base", + "//build:branding_buildflags", + "//chrome/app/version_assembly:chrome_exe_manifest", + "//chrome/browser:active_use_util", + "//chrome/browser:chrome_process_finder", + "//chrome/chrome_elf", + "//chrome/chrome_watcher", + "//chrome/chrome_watcher:client", + "//chrome/common:constants", + "//chrome/common:metrics_constants_util_win", + "//chrome/install_static:secondary_module", + "//chrome/installer/util:with_no_strings", + "//components/browser_watcher:browser_watcher_client", + "//components/crash/content/app:run_as_crashpad_handler", + "//components/crash/core/common", + "//components/flags_ui:switches", + "//content:sandbox_helper_win", + "//content/public/common:static_switches", + "//crypto", + "//sandbox", + "//services/service_manager/sandbox", + "//third_party/breakpad:breakpad_handler", + "//third_party/breakpad:breakpad_sender", + ] + data_deps = [ + "//chrome/app/version_assembly:version_assembly_manifest", + "//chrome/chrome_proxy", + "//chrome/elevation_service", + "//chrome/notification_helper", + ] - if (current_cpu == "x86") { - # Increase the initial stack size. The default is 1MB, this is 1.5MB. - # To mitigate address space pressure, |CreateThreadInternal| sets the - # default back to 1MB for non-main threads. - ldflags = [ "/STACK:1572864" ] - } else { - # Increase the initial stack size. The default is 1MB, this is 8MB. - ldflags = [ "/STACK:8388608" ] - } + if (win_console_app) { + defines += [ "WIN_CONSOLE_APP" ] + } else { + # Set /SUBSYSTEM:WINDOWS for chrome.exe itself, unless a console build + # has been requested. + configs -= [ "//build/config/win:console" ] + configs += [ "//build/config/win:windowed" ] } - if (is_linux) { - sources += [ - "app/chrome_dll_resource.h", - "app/chrome_main.cc", - "app/chrome_main_delegate.cc", - "app/chrome_main_delegate.h", - ] + configs += [ + "//build/config/win:delayloads", + "//build/config/win:delayloads_not_for_child_dll", + ] - deps += [ - # On Linux, link the dependencies (libraries) that make up actual - # Chromium functionality directly into the executable. - ":browser_dependencies", - ":child_dependencies", + if (current_cpu == "x86") { + # Increase the initial stack size. The default is 1MB, this is 1.5MB. + # To mitigate address space pressure, |CreateThreadInternal| sets the + # default back to 1MB for non-main threads. + ldflags = [ "/STACK:0x180000" ] + } else { + # Increase the initial stack size. The default is 1MB, this is 8MB. + ldflags = [ "/STACK:0x800000" ] + } + } else if (use_aura) { + # Non-Windows aura entrypoint. + sources += [ "app/chrome_exe_main_aura.cc" ] + } - # For the sampling profiler. - "//chrome/common/profiler", + if (is_linux) { + sources += [ + "app/chrome_dll_resource.h", + "app/chrome_main.cc", + "app/chrome_main_delegate.cc", + "app/chrome_main_delegate.h", + ] - # Needed to use the master_preferences functions - "//chrome/installer/util:with_no_strings", - "//content/public/app:both", - "//content/public/common:service_names", + deps += [ + # On Linux, link the dependencies (libraries) that make up actual + # Chromium functionality directly into the executable. + ":browser_dependencies", + ":child_dependencies", - # For headless mode. - "//headless:headless_shell_lib", - "//services/service_manager/embedder", - ] + # For the sampling profiler. + "//chrome/common/profiler", - public_deps = [ - ":xdg_mime", # Needs to be public for installer to consume files. - "//chrome/common:buildflags", - ] + # Needed to use the master_preferences functions + "//chrome/installer/util:with_no_strings", + "//content/public/app:both", + "//content/public/common:service_names", - ldflags = [] + # For headless mode. + "//headless:headless_shell_lib", + "//services/service_manager/embedder", + ] - # Chrome OS debug builds for arm need to pass --long-plt to the linker. - # See https://bugs.chromium.org/p/chromium/issues/detail?id=583532 - if (is_chromeos && is_debug && target_cpu == "arm") { - ldflags += [ "-Wl,--long-plt" ] - } + public_deps = [ + ":xdg_mime", # Needs to be public for installer to consume files. + "//chrome/common:buildflags", + ] - if (is_desktop_linux && !is_component_build && !using_sanitizer) { - version_script = "//build/linux/chrome.map" - inputs = [ - version_script, - ] - ldflags += [ "-Wl,--version-script=" + - rebase_path(version_script, root_build_dir) ] - } + ldflags = [] - if (use_x11) { - configs += [ - "//build/config/linux:x11", - "//build/config/linux:xext", - ] - } + # Chrome OS debug builds for arm need to pass --long-plt to the linker. + # See https://bugs.chromium.org/p/chromium/issues/detail?id=583532 + if (is_chromeos && is_debug && target_cpu == "arm") { + ldflags += [ "-Wl,--long-plt" ] } - if (is_chromeos || is_win) { - data_deps += [ "//mojo/core:shared_library" ] + if (is_desktop_linux && !is_component_build && !using_sanitizer) { + version_script = "//build/linux/chrome.map" + inputs = [ + version_script, + ] + ldflags += [ "-Wl,--version-script=" + + rebase_path(version_script, root_build_dir) ] } - if (is_chromeos) { - data_deps += [ "//mojo/core:shared_libraries_for_arc" ] - configs += [ "//build/config/chromeos:print_orderfile" ] - configs += [ "//build/config/compiler:chrome_orderfile_config" ] + if (use_x11) { + configs += [ + "//build/config/linux:x11", + "//build/config/linux:xext", + ] } + } - # These files are used by the installer so we need a public dep. - public_deps += [ ":packed_resources" ] - - # Only ChromeOS has precompiled Flash that needs to get copied to the output - # directory. On other platforms, Flash is either component-updated only or - # not supported at all. - if (is_chromeos) { - deps += [ "//third_party/adobe/flash:flapper_binaries" ] - } + if (is_chromeos || is_win) { + data_deps += [ "//mojo/core:shared_library" ] + } - # ChromeOS by design is safe to have rpath=$ORIGIN. This simplifies shared - # library usage. - if (is_chromeos && !is_component_build) { - configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ] - } + if (is_chromeos) { + data_deps += [ "//mojo/core:shared_libraries_for_arc" ] + configs += [ "//build/config/chromeos:print_orderfile" ] + configs += [ "//build/config/compiler:chrome_orderfile_config" ] + } - data_deps += [ - "//chrome/browser/resources/media/mei_preload:component", - "//third_party/widevine/cdm", - ] + # These files are used by the installer so we need a public dep. + public_deps += [ ":packed_resources" ] - if (is_multi_dll_chrome) { - defines += [ "CHROME_MULTIPLE_DLL" ] - data_deps += [ ":chrome_child" ] - } + # Only ChromeOS has precompiled Flash that needs to get copied to the output + # directory. On other platforms, Flash is either component-updated only or + # not supported at all. + if (is_chromeos) { + deps += [ "//third_party/adobe/flash:flapper_binaries" ] } - } - chrome_binary("chrome_initial") { - if (is_win) { - output_name = "initialexe/chrome" - } else { - output_name = "chrome" + # ChromeOS by design is safe to have rpath=$ORIGIN. This simplifies shared + # library usage. + if (is_chromeos && !is_component_build) { + configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ] } - sources = [] - if (!is_win && use_aura) { - # Non-Windows aura entrypoint. - sources += [ "app/chrome_exe_main_aura.cc" ] + data_deps += [ + "//chrome/browser/resources/media/mei_preload:component", + "//third_party/widevine/cdm", + ] + + if (is_multi_dll_chrome) { + defines += [ "CHROME_MULTIPLE_DLL" ] + data_deps += [ ":chrome_child" ] } } } # !is_android && !is_mac @@ -611,6 +598,18 @@ if (is_win) { ldflags = [ "-Wl,-exported_symbols_list," + rebase_path("app/app.exports", root_build_dir) ] } + + if (is_component_build) { + # The Framework is packaged inside the .app bundle. But when using the + # component build, all the dependent shared libraries of :chrome_dll are + # not packaged within the framework. This data_deps line makes all of + # those dependent libraries runtime dependencies of the .app bundle. + # This is a bit of a hack, since GN deliberately terminates its search + # for runtime_deps at create_bundle nodes (https://crbug.com/1010347). + data_deps = [ + ":chrome_framework", + ] + } } compiled_action("chrome_app_strings") { @@ -1538,10 +1537,10 @@ group("extra_resources") { if (!is_android) { public_deps += [ "//chrome/browser/resources:component_extension_resources", + "//chrome/browser/resources:dev_ui_paks", "//chrome/browser/resources:downloads_resources", "//chrome/browser/resources:local_ntp_resources", "//chrome/browser/resources:settings_resources", - "//chrome/browser/resources/bluetooth_internals:resources", ] } @@ -1675,12 +1674,6 @@ if (is_android) { ] } - java_cpp_enum("signin_metrics_enum_javagen") { - sources = [ - "../components/signin/public/base/signin_metrics.h", - ] - } - java_cpp_enum("assist_ranker_prediction_enum_javagen") { sources = [ "browser/android/contextualsearch/contextual_search_ranker_logger_impl.h", @@ -1835,6 +1828,7 @@ if (is_linux) { ":angle_egl_symbols", ":angle_gles_symbols", ":chrome_symbols", + ":crashpad_symbols", ":swiftshader_egl_symbols", ":swiftshader_gles_symbols", ] @@ -1853,6 +1847,20 @@ if (is_linux) { ":chrome", ] } + extract_symbols("crashpad_symbols") { + binary = "$root_out_dir/crashpad_handler" + + if (current_cpu == "x86") { + # GYP used "ia32" so keep that naming for back-compat. + symbol_file = "$root_out_dir/crashpad.breakpad.ia32" + } else { + symbol_file = "$root_out_dir/crashpad.breakpad.$current_cpu" + } + + deps = [ + "//third_party/crashpad/crashpad/handler:crashpad_handler", + ] + } extract_symbols("swiftshader_egl_symbols") { binary = "$root_out_dir/swiftshader/libEGL.so" |