naiveproxy/chrome/BUILD.gn

1844 lines
51 KiB
Plaintext
Raw Normal View History

2018-02-02 13:49:39 +03:00
# Copyright 2014 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/chrome_build.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/compiler/pgo/pgo.gni")
import("//build/config/features.gni")
import("//build/config/linux/pangocairo/pangocairo.gni")
import("//build/config/locales.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni")
import("//build/config/win/console_app.gni")
import("//build/config/win/manifest.gni")
import("//build/toolchain/toolchain.gni")
import("//chrome/chrome_paks.gni")
import("//chrome/common/features.gni")
import("//chrome/process_version_rc_template.gni")
import("//components/nacl/features.gni")
import("//extensions/features/features.gni")
import("//media/media_options.gni")
import("//ppapi/features/features.gni")
import("//third_party/WebKit/public/public_features.gni")
import("//third_party/widevine/cdm/widevine.gni")
import("//tools/resources/generate_resource_whitelist.gni")
import("//v8/gni/v8.gni")
if (is_android) {
import("//build/config/android/rules.gni")
} else if (is_mac) {
import("//build/compiled_action.gni")
import("//build/config/mac/rules.gni")
import("//build/config/mac/symbols.gni")
import("//build/mac/tweak_info_plist.gni")
import("//build/util/branding.gni")
import("//build/util/version.gni")
import("//media/cdm/ppapi/cdm_paths.gni")
import("//third_party/icu/config.gni")
}
assert(!is_ios, "Chromium/iOS shouldn't use anything in //chrome")
if (enable_resource_whitelist_generation) {
chrome_resource_whitelist = "$target_gen_dir/chrome_resource_whitelist.txt"
}
if (is_win) {
action("reorder_imports") {
script = "//build/win/reorder-imports.py"
# See comment in chrome_dll.gypi in the hardlink_to_output
# target for why this cannot be 'initial' like the DLL.
inputs = [
"$root_out_dir/initialexe/chrome.exe",
]
outputs = [
"$root_out_dir/chrome.exe",
]
if (symbol_level != 0) {
outputs += [ "$root_out_dir/chrome.exe.pdb" ]
}
args = [
"-i",
rebase_path("$root_out_dir/initialexe", root_build_dir),
"-o",
rebase_path("$root_out_dir", root_build_dir),
"-a",
current_cpu,
]
deps = [
":chrome_initial",
]
}
}
# This target exists above chrome and it's main components in the dependency
# tree as a central place to put assert_no_deps annotations. Since this depends
# on Chrome and the main DLLs it uses, it will transitively assert that those
# targets also have no deps on disallowed things.
group("assert_no_deps") {
deps = []
if (is_android) {
deps += [ "//chrome/android:chrome_public_apk" ]
} else {
deps += [ ":chrome" ]
}
if (is_win) {
deps += [
":chrome_dll",
":main_dll",
]
}
# This should not pull in installer strings. This is will bloat the binary
# for no reason and is easy to mess up. See the comment at the top of
# //chrome/installer/util/BUILD.gn.
assert_no_deps = [ "//chrome/installer/util:strings" ]
}
if (!is_android && !is_mac) {
group("chrome") {
public_deps = [
":chrome_initial",
]
data_deps = [
":chrome_initial",
]
if (is_win) {
public_deps += [ ":reorder_imports" ]
}
if (use_aura && (is_win || is_linux)) {
data_deps += [ "//chrome/app:service_manifests" ]
}
if (is_chromeos) {
data_deps += [ "//sandbox/linux:chrome_sandbox" ]
}
}
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 = []
}
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 += [
"//build/config:exe_and_shlib_deps",
"//printing/features",
]
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",
]
}
data_deps = []
if (is_win) {
sources += [
"app/chrome_exe.rc",
"app/chrome_exe_load_config_win.cc",
"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",
]
deps += [
":chrome_dll",
":chrome_exe_version",
":copy_first_run",
":file_pre_reader",
":visual_elements_resources",
"//base",
"//chrome/app/version_assembly:chrome_exe_manifest",
"//chrome/browser:active_use_util",
"//chrome/browser:chrome_process_finder",
"//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",
"//chrome_elf",
"//components/browser_watcher:browser_watcher_client",
"//components/crash/content/app:run_as_crashpad_handler",
"//components/flags_ui:switches",
"//content:sandbox_helper_win",
"//content/public/common:static_switches",
"//crypto",
"//gpu/config:crash_keys",
"//sandbox",
"//third_party/breakpad:breakpad_handler",
"//third_party/breakpad:breakpad_sender",
]
data_deps = [
"//chrome/app/version_assembly:version_assembly_manifest",
]
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" ]
}
ldflags = [
"/DELAYLOAD:dbghelp.dll",
"/DELAYLOAD:dwmapi.dll",
"/DELAYLOAD:uxtheme.dll",
"/DELAYLOAD:ole32.dll",
"/DELAYLOAD:oleaut32.dll",
]
if (current_cpu == "x64") {
# Increase the initial stack size. The default is 1MB, this is 2MB.
ldflags += [ "/STACK:2097152" ]
}
}
if (is_linux) {
sources += [
"app/chrome_dll_resource.h",
"app/chrome_main.cc",
"app/chrome_main_delegate.cc",
"app/chrome_main_delegate.h",
]
deps += [
# On Linux, link the dependencies (libraries) that make up actual
# Chromium functionality directly into the executable.
":browser_dependencies",
":child_dependencies",
# Needed to use the master_preferences functions
"//chrome/installer/util:with_no_strings",
"//content/public/app:both",
"//content/public/common:service_names",
# For headless mode.
"//headless:headless_shell_lib",
"//services/service_manager/embedder",
]
public_deps = [
":xdg_mime", # Needs to be public for installer to consume files.
"//chrome/common:features",
]
ldflags = [ "-pie" ]
# 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_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 (use_x11) {
configs += [
"//build/config/linux:x11",
"//build/config/linux:xext",
]
}
if (enable_mus) {
deps += [ "//mash/common" ]
}
}
# 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" ]
}
data_deps += [ "//third_party/widevine/cdm:widevinecdmadapter" ]
if (is_multi_dll_chrome) {
defines += [ "CHROME_MULTIPLE_DLL" ]
data_deps += [ ":chrome_child" ]
}
}
}
chrome_binary("chrome_initial") {
if (is_win) {
output_name = "initialexe/chrome"
} else {
output_name = "chrome"
}
sources = []
if (!is_win && use_aura) {
# Non-Windows aura entrypoint.
sources += [ "app/chrome_exe_main_aura.cc" ]
}
}
# TODO(jonross): remove this once telemetry can differentiate between linux
# and linux chromiumos.
if (enable_mus) {
chrome_binary("chrome_test") {
# Note that the output name needs to end with "chrome", because that's
# what telemetry test-runner expects.
output_name = "test_chrome"
sources = []
data = [
"$root_out_dir/chrome_200_percent.pak",
]
if (!is_win && use_aura) {
sources += [ "app/chrome_exe_main_aura.cc" ]
}
}
}
} # !is_android && !is_mac
if (is_win) {
# This target is a forwarding target to compile the necessary DLLs used
# by Chrome.
group("chrome_dll") {
data_deps = [
":main_dll",
]
if (is_multi_dll_chrome) {
data_deps += [ ":chrome_child" ]
}
}
shared_library("main_dll") {
configs += [ "//build/config/compiler:wexit_time_destructors" ]
defines = []
sources = [
"//base/win/dllmain.cc",
"app/chrome_main.cc",
"app/chrome_main_delegate.cc",
"app/chrome_main_delegate.h",
]
output_name = "chrome"
deps = [
":browser_dependencies",
":chrome_dll_manifest",
":chrome_dll_version",
"//base/trace_event/etw_manifest:chrome_events_win",
"//build/config:exe_and_shlib_deps",
"//chrome/app:chrome_dll_resources",
"//chrome/app:command_ids",
"//chrome/app/theme:chrome_unscaled_resources",
"//chrome/common:features",
"//chrome/install_static:install_static_util",
"//chrome/install_static:secondary_module",
"//chrome_elf",
"//components/crash/content/app",
"//components/policy:generated",
"//content/app/resources",
"//content/public/common:service_names",
"//crypto",
"//headless:headless_shell_browser_lib",
"//net:net_resources",
"//ppapi/features",
"//services/service_manager/embedder",
"//third_party/cld_3/src/src:cld_3",
"//third_party/wtl",
"//ui/views",
]
ldflags = [
"/DELAYLOAD:comdlg32.dll",
"/DELAYLOAD:crypt32.dll",
"/DELAYLOAD:cryptui.dll",
"/DELAYLOAD:dhcpcsvc.dll",
"/DELAYLOAD:dwmapi.dll",
"/DELAYLOAD:imagehlp.dll",
"/DELAYLOAD:imm32.dll",
"/DELAYLOAD:iphlpapi.dll",
"/DELAYLOAD:setupapi.dll",
"/DELAYLOAD:urlmon.dll",
"/DELAYLOAD:winhttp.dll",
"/DELAYLOAD:wininet.dll",
"/DELAYLOAD:winspool.drv",
"/DELAYLOAD:ws2_32.dll",
"/DELAYLOAD:wsock32.dll",
]
if (!is_component_build) {
# This is a large module that can't do incremental linking in some
# cases.
configs -= [ "//build/config/win:default_incremental_linking" ]
configs +=
[ "//build/config/win:default_large_module_incremental_linking" ]
}
if (use_aura) {
deps += [ "//ui/compositor" ]
}
if (is_multi_dll_chrome) {
defines += [ "CHROME_MULTIPLE_DLL_BROWSER" ]
deps += [ "//content/public/app:browser" ]
assert_no_deps = [
# The browser DLL may not depend on blink or v8.
"//third_party/WebKit/public:blink",
"//gin",
"//tools/v8_context_snapshot",
"//v8",
]
} else {
deps += [
":child_dependencies",
"//content/public/app:both",
]
}
if (is_clang && is_official_build && !use_lld) {
orderfile = "build/chrome.$target_cpu.orderfile"
rebased_orderfile = rebase_path(orderfile, root_build_dir)
inputs = [
orderfile,
]
ldflags += [
"/order:@$rebased_orderfile",
# Ignore warnings about missing functions or functions not in their
# own section.
"/ignore:4037",
"/ignore:4065",
]
}
}
if (is_multi_dll_chrome) {
# This manifest matches what GYP produced. It may not even be necessary.
windows_manifest("chrome_child_manifest") {
sources = [
as_invoker_manifest,
]
}
shared_library("chrome_child") {
sources = [
"app/chrome_main.cc",
"app/chrome_main_delegate.cc",
"app/chrome_main_delegate.h",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
defines = [ "CHROME_MULTIPLE_DLL_CHILD" ]
deps = [
":child_dependencies",
":chrome_child_manifest",
":chrome_dll_version",
"//build/config:exe_and_shlib_deps",
"//chrome/browser/policy:path_parser",
"//chrome/common:features",
"//chrome/install_static:install_static_util",
"//chrome/install_static:secondary_module",
"//chrome_elf",
"//components/browser_watcher:browser_watcher_client",
"//components/crash/content/app",
"//content/public/app:child",
"//content/public/common:service_names",
"//headless:headless_shell_child_lib",
"//services/service_manager/embedder",
]
ldflags = [
"/DELAYLOAD:d3d11.dll",
"/DELAYLOAD:d3d9.dll",
"/DELAYLOAD:dwmapi.dll",
"/DELAYLOAD:dxva2.dll",
"/DELAYLOAD:esent.dll",
"/DELAYLOAD:wininet.dll",
]
if (is_clang && is_official_build && !use_lld) {
orderfile = "build/chrome_child.$target_cpu.orderfile"
rebased_orderfile = rebase_path(orderfile, root_build_dir)
inputs = [
orderfile,
]
ldflags += [
"/order:@$rebased_orderfile",
# Ignore warnings about missing functions or functions not in their
# own section.
"/ignore:4037",
"/ignore:4065",
]
}
if (symbol_level == 2) {
# Incremental linking doesn't work on this target in debug mode with
# full symbols, but does work in other cases, including minimal
# symbols.
configs -= [ "//build/config/win:default_incremental_linking" ]
configs += [ "//build/config/win:no_incremental_linking" ]
}
configs += [ "//build/config/compiler/pgo:default_pgo_flags" ]
}
}
copy("copy_first_run") {
sources = [
"app/FirstRun",
]
outputs = [
"$root_out_dir/First Run",
]
}
} else if (is_mac) {
chrome_helper_name = chrome_product_full_name + " Helper"
chrome_framework_name = chrome_product_full_name + " Framework"
chrome_framework_version = "A"
group("chrome") {
deps = [
":chrome_app",
]
data_deps = [
":chrome_app",
]
if (debug_devtools) {
deps += [ ":devtools_debug_resources" ]
}
if (is_chrome_branded && is_official_build) {
deps += [
":chrome_dsym_archive",
":chrome_dump_syms",
]
}
}
bundle_data("chrome_framework_services") {
sources = [
"$root_out_dir/AlertNotificationService.xpc",
]
outputs = [
"{{bundle_contents_dir}}/XPCServices/{{source_file_part}}",
]
public_deps = [
"//chrome/browser/ui/cocoa/notifications:alert_notification_xpc_service",
]
}
tweak_info_plist("chrome_app_plist") {
info_plist = "app/app-Info.plist"
_keystone_arg = "0"
if (is_chrome_branded) {
_keystone_arg = "1"
}
args = [
"--breakpad=0",
"--keystone=$_keystone_arg",
"--scm=1",
"--bundle_id=$chrome_mac_bundle_id",
]
}
mac_app_bundle("chrome_app") {
output_name = chrome_product_full_name
info_plist_target = ":chrome_app_plist"
extra_substitutions = [
"CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
"CHROMIUM_SHORT_NAME=$chrome_product_short_name",
"CHROMIUM_CREATOR=$chrome_mac_creator_code",
]
sources = [
"app/chrome_exe_main_mac.cc",
]
extra_configs = [ "//build/config/compiler:wexit_time_destructors" ]
deps = [
":chrome_app_strings_bundle_data",
":chrome_resources",
":chrome_versioned_bundle_data",
"//build/config:exe_and_shlib_deps",
"//chrome/common:version_header",
]
if (is_chrome_branded) {
deps += [ ":chrome_helpers" ]
}
# Remove the default strip configuration (which strips all symbols) so that
# a saves file can be specified.
if (enable_stripping) {
remove_configs = [ "//build/config/mac:strip_all" ]
ldflags =
[ "-Wcrl,strip,-s," + rebase_path("app/app.saves", root_build_dir) ]
}
}
compiled_action("chrome_app_strings") {
tool = "//chrome/tools/build/mac:infoplist_strings_tool"
inputs = [
chrome_version_file,
]
outputs = []
foreach(locale, locales) {
if (is_chrome_branded) {
_strings_file = "google_chrome_strings"
} else {
_strings_file = "chromium_strings"
}
inputs += [ "$root_gen_dir/chrome/${_strings_file}_${locale}.pak" ]
}
foreach(locale, locales_as_mac_outputs) {
outputs += [ "$target_gen_dir/app_infoplist_strings/$locale.lproj/InfoPlist.strings" ]
}
args =
[
"-b",
"${branding_path_component}_strings",
"-v",
rebase_path(chrome_version_file, root_build_dir),
"-g",
rebase_path("$root_gen_dir/chrome", root_build_dir),
"-o",
rebase_path("$target_gen_dir/app_infoplist_strings", root_build_dir),
"-t",
"main",
] + locales
if (is_chrome_branded) {
deps = [
"//chrome/app:google_chrome_strings",
]
} else {
deps = [
"//chrome/app:chromium_strings",
]
}
}
foreach(locale, locales_as_mac_outputs) {
bundle_data("chrome_app_strings_${locale}_bundle_data") {
sources = [
"$target_gen_dir/app_infoplist_strings/$locale.lproj/InfoPlist.strings",
]
outputs = [
"{{bundle_resources_dir}}/$locale.lproj/{{source_file_part}}",
]
public_deps = [
":chrome_app_strings",
]
}
}
group("chrome_app_strings_bundle_data") {
public_deps = []
foreach(locale, locales_as_mac_outputs) {
public_deps += [ ":chrome_app_strings_${locale}_bundle_data" ]
}
}
bundle_data("chrome_resources") {
sources = [
"$root_out_dir/$chrome_mac_bundle_id.manifest",
"app/theme/$branding_path_component/mac/app.icns",
"app/theme/$branding_path_component/mac/document.icns",
"browser/ui/cocoa/applescript/scripting.sdef",
]
outputs = [
"{{bundle_resources_dir}}/{{source_file_part}}",
]
public_deps = [
":chrome_app_strings",
"//components/policy:chrome_manifest_bundle",
]
}
if (is_chrome_branded) {
bundle_data("chrome_helpers") {
sources = [
"installer/mac/internal/keychain_reauthorizers/$chrome_mac_bundle_id",
]
outputs = [
"{{bundle_contents_dir}}/Helpers/{{source_file_part}}",
]
}
}
bundle_data("chrome_versioned_bundle_data") {
sources = [
"$root_out_dir/$chrome_framework_name.framework",
"$root_out_dir/$chrome_helper_name.app",
]
outputs = [
"{{bundle_contents_dir}}/Versions/$chrome_version_full/{{source_file_part}}",
]
public_deps = [
":chrome_helper_app",
# Before bundling the versioned app components, delete any existing
# versions.
":clean_up_old_versions",
# keystone_registration_framework copies the framework into the framework
# bundle via a script that performs additional actions, rather than
# relying on a bundle_data to copy it.
":keystone_registration_framework",
# verify_chrome_framework_order depends on :chrome_framework and, for
# non-component builds, will ensure the export symbol table is correct.
":verify_chrome_framework_order",
]
# Only official builds that include Widevine need the widevine
# signature file.
if (is_chrome_branded && enable_library_cdms) {
sources += [ "$root_out_dir/Widevine Resources.bundle" ]
public_deps += [ ":widevine_resources_bundle" ]
}
}
action("clean_up_old_versions") {
script = "//chrome/tools/build/mac/clean_up_old_versions.py"
outputs = [
"$root_gen_dir/run_$target_name.stamp",
]
args = [
rebase_path("$root_out_dir/$chrome_product_full_name.app",
root_build_dir),
"$chrome_version_full",
] + rebase_path(outputs, root_build_dir)
}
tweak_info_plist("chrome_helper_plist") {
info_plist = "app/helper-Info.plist"
args = [
"--breakpad=0",
"--keystone=0",
"--scm=0",
]
}
mac_app_bundle("chrome_helper_app") {
output_name = chrome_helper_name
info_plist_target = ":chrome_helper_plist"
extra_substitutions = [
"CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
"CHROMIUM_SHORT_NAME=$chrome_product_short_name",
]
sources = [
"app/chrome_exe_main_mac.cc",
]
extra_configs = [ "//build/config/compiler:wexit_time_destructors" ]
defines = [ "HELPER_EXECUTABLE" ]
deps = [
"//build/config:exe_and_shlib_deps",
"//chrome/common:version_header",
"//sandbox/mac:seatbelt",
]
ldflags = []
if (is_component_build) {
ldflags += [
# The helper is in Chromium.app/Contents/Versions/X/Chromium Helper.app/Conents/MacOS/
# so set rpath up to the base.
"-rpath",
"@loader_path/../../../../../../..",
]
}
# Remove the default strip configuration (which strips all symbols) so that
# a saves file can be specified.
if (enable_stripping) {
remove_configs = [ "//build/config/mac:strip_all" ]
ldflags +=
[ "-Wcrl,strip,-s," + rebase_path("app/app.saves", root_build_dir) ]
}
}
bundle_data("chrome_framework_helpers") {
sources = [
"$root_out_dir/crashpad_handler",
]
outputs = [
"{{bundle_contents_dir}}/Helpers/{{source_file_part}}",
]
public_deps = [
"//third_party/crashpad/crashpad/handler:crashpad_handler",
]
if (using_sanitizer) {
# crashpad_handler requires the ASan runtime at its @executable_path.
sources += [ "$root_out_dir/libclang_rt.asan_osx_dynamic.dylib" ]
public_deps += [ "//build/config/sanitizers:copy_asan_runtime" ]
}
}
bundle_data("chrome_framework_resources") {
sources = [
"$root_out_dir/app_mode_loader.app",
"$root_out_dir/v8_context_snapshot.bin",
# This image is used to badge the lock icon in the
# authentication dialogs, such as those used for installation
# from disk image and Keystone promotion (if so enabled). It
# needs to exist as a file on disk and not just something in a
# resource bundle because that's the interface that
# Authorization Services uses. Also, Authorization Services
# can't deal with .icns files.
"app/theme/default_100_percent/$branding_path_component/product_logo_32.png",
"browser/mac/install.sh",
]
outputs = [
"{{bundle_resources_dir}}/{{source_file_part}}",
]
public_deps = [
":packed_resources",
"//chrome/app_shim:app_mode_loader",
"//tools/v8_context_snapshot",
]
if (is_chrome_branded) {
sources += [
"browser/mac/keystone_promote_postflight.sh",
"browser/mac/keystone_promote_preflight.sh",
]
}
if (icu_use_data_file) {
sources += [ "$root_out_dir/icudtl.dat" ]
public_deps += [ "//third_party/icu:icudata" ]
}
if (v8_use_external_startup_data) {
sources += [
"$root_out_dir/natives_blob.bin",
"$root_out_dir/snapshot_blob.bin",
]
public_deps += [ "//v8" ]
}
}
# When debug_devtools is enabled, symlink the inspector resources into the
# framework bundle. The resources go into the final output directory for the
# framework in the app bundle, rather than the framework bundle in
# root_out_dir, since copy_bundle_data copies the contents of the link
# rather than the link itself.
if (debug_devtools) {
action("devtools_debug_resources") {
_stamp = "$target_out_dir/run_${target_name}.stamp"
outputs = [
_stamp,
]
script = "//build/symlink.py"
args = [
"-f",
"--touch",
rebase_path(_stamp, root_out_dir),
# Convert the symlink source and destination to an absolute paths, which
# makes symlinking easier (now pwd manipulation).
rebase_path("$root_out_dir/resources/inspector"),
rebase_path(
"$root_out_dir/$chrome_product_full_name.app/Contents/Versions/$chrome_version_full/$chrome_framework_name.framework/Resources/inspector"),
]
deps = [
# Depend on :chrome_app to ensure that the bundle is produced before
# creating or destroying the symlink.
":chrome_app",
"//third_party/WebKit/public:blink_devtools_frontend_resources",
]
}
} else {
group("devtools_debug_resources") {
}
}
if (enable_nacl) {
bundle_data("chrome_framework_plugins") {
sources = []
outputs = [
"{{bundle_contents_dir}}/Internet Plug-Ins/{{source_file_part}}",
]
public_deps = []
if (enable_nacl) {
if (current_cpu == "x86") {
sources += [ "$root_out_dir/nacl_irt_x86_32.nexe" ]
} else if (current_cpu == "x64") {
sources += [ "$root_out_dir/nacl_irt_x86_64.nexe" ]
}
public_deps += [ "//ppapi/native_client:irt" ]
}
}
} else {
group("chrome_framework_plugins") {
}
}
_should_bundle_widevine =
(is_chrome_branded || enable_widevine) && enable_library_cdms
if (_should_bundle_widevine) {
# The Widevine CDM and manifest are either the actual Widevine CDM and
# manifest or stubs used for testing only. The choice is made within the
# corresponding Widevine targets based on branding.
bundle_data("widevine_cdm_library_binaries") {
sources = [
"$root_out_dir/$widevine_cdm_path/widevinecdmadapter.plugin",
"$root_out_dir/libwidevinecdm.dylib",
]
outputs = [
"{{bundle_contents_dir}}/Libraries/$widevine_cdm_path/{{source_file_part}}",
]
public_deps = [
# Need this intermediate dependency because "widevinecdm" is a
# shared_library if !is_chrome_branded, and then depending on
# "widevinecdm" directly would cause it to be linked into the Chromium
# Framework, which we don't want.
":widevine_cdm_library_copy",
"//third_party/widevine/cdm:widevinecdmadapter",
]
# Signatures are only generated for official chrome.
if (is_chrome_branded) {
sources += [
"$root_out_dir/$widevine_cdm_path/widevinecdmadapter.plugin.sig",
"$root_out_dir/libwidevinecdm.dylib.sig",
]
public_deps += [ ":sign_cdm_adapter_for_widevine" ]
}
}
copy("widevine_cdm_library_copy") {
sources = [
"$root_out_dir/$widevine_cdm_path/libwidevinecdm.dylib",
]
if (is_chrome_branded) {
sources +=
[ "$root_out_dir/$widevine_cdm_path/libwidevinecdm.dylib.sig" ]
}
outputs = [
"$root_out_dir/{{source_file_part}}",
]
deps = [
"//third_party/widevine/cdm:widevinecdm",
]
}
bundle_data("widevine_cdm_library_manifest") {
sources = [
"$root_out_dir/WidevineCdm/manifest.json",
]
outputs = [
"{{bundle_contents_dir}}/Libraries/WidevineCdm/{{source_file_part}}",
]
public_deps = [
"//third_party/widevine/cdm:widevine_cdm_manifest",
]
}
widevine_sign_file("sign_cdm_adapter_for_widevine") {
file = "$root_out_dir/$widevine_cdm_path/widevinecdmadapter.plugin"
flags = 0
deps = [
"//third_party/widevine/cdm:widevinecdmadapter",
]
}
widevine_sign_file("sign_chrome_framework_for_widevine") {
file = "$root_out_dir/$chrome_framework_name.framework/"
if (defined(chrome_framework_version)) {
file += "Versions/$chrome_framework_version/"
}
file += "$chrome_framework_name"
flags = 1
signature_file = "$root_out_dir/$chrome_framework_name.sig"
deps = [
":chrome_framework",
]
}
mac_info_plist("widevine_resources_plist") {
info_plist = "//third_party/widevine/cdm/widevine_resources.plist"
extra_substitutions = [
"CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
"BUNDLE_ID=widevine-resources",
]
executable_name = "Widevine Resources"
}
bundle_data("widevine_resources_plist_bundle_data") {
sources = get_target_outputs(":widevine_resources_plist")
outputs = [
"{{bundle_contents_dir}}/Info.plist",
]
public_deps = [
":widevine_resources_plist",
]
}
bundle_data("framework_widevine_signature") {
sources = [
"$root_out_dir/$chrome_framework_name.sig",
]
outputs = [
"{{bundle_resources_dir}}/{{source_file_part}}",
]
public_deps = [
":sign_chrome_framework_for_widevine",
]
}
create_bundle("widevine_resources_bundle") {
output_name = "Widevine Resources.bundle"
bundle_root_dir = "$root_build_dir/$output_name"
bundle_contents_dir = "$bundle_root_dir/Contents"
bundle_resources_dir = "$bundle_contents_dir/Resources"
deps = [
":framework_widevine_signature",
":widevine_resources_plist_bundle_data",
]
}
}
group("widevine_cdm_library") {
if (_should_bundle_widevine) {
deps = [
":widevine_cdm_library_binaries",
":widevine_cdm_library_manifest",
]
}
}
if (is_chrome_branded) {
action("keystone_registration_framework") {
script = "//chrome/tools/build/mac/copy_keystone_framework.py"
framework_path = "//third_party/googlemac/Releases/Keystone/KeystoneRegistration.framework"
output_path = "$root_out_dir/$chrome_framework_name.framework/"
if (defined(chrome_framework_version)) {
output_path += "/Versions/$chrome_framework_version/"
}
output_path += "Frameworks/"
sources = [
framework_path,
script,
]
args = [
rebase_path(framework_path, root_out_dir),
rebase_path(output_path, root_out_dir),
]
if (!use_system_xcode) {
args += [ hermetic_xcode_path ]
}
outputs = [
"$output_path/KeystoneRegistration.framework",
]
}
} else {
group("keystone_registration_framework") {
}
}
tweak_info_plist("chrome_framework_plist") {
info_plist = "app/framework-Info.plist"
args = [
"--breakpad=0",
"--keystone=0",
"--scm=1",
"--branding",
chrome_product_short_name,
]
}
# On Mac, speed up the component build by not re-bundling the framework
# every time it changes. Instead, place all the sources and their deps in
# a library that the bundled framework links (and re-exports). That way
# only the library needs to be re-linked when it changes.
if (is_component_build) {
_dll_target_type = "shared_library"
} else {
_dll_target_type = "source_set"
}
target(_dll_target_type, "chrome_dll") {
visibility = [
":chrome_framework",
":chrome_framework_create_bundle",
":chrome_framework_shared_library",
]
sources = [
"app/chrome_crash_reporter_client.cc",
"app/chrome_crash_reporter_client.h",
"app/chrome_crash_reporter_client_mac.mm",
"app/chrome_dll_resource.h",
"app/chrome_main.cc",
"app/chrome_main_delegate.cc",
"app/chrome_main_delegate.h",
"app/chrome_main_mac.h",
"app/chrome_main_mac.mm",
]
deps = [
":browser_dependencies",
":child_dependencies",
"//chrome/app:command_ids",
"//chrome/common:features",
"//components/crash/content/app",
"//components/policy:generated",
"//content/public/app:both",
"//content/public/common:service_names",
"//headless:headless_shell_lib",
"//services/service_manager/embedder",
"//third_party/cld_3/src/src:cld_3",
]
if (is_component_build) {
libs = [ "Carbon.framework" ]
}
ldflags = [
"-Wl,-order_file",
"-Wl," + rebase_path("app/framework.order", root_build_dir),
"-ObjC",
]
configs += [ "//build/config/compiler:wexit_time_destructors" ]
}
mac_framework_bundle("chrome_framework") {
output_name = chrome_framework_name
if (defined(chrome_framework_version)) {
framework_version = chrome_framework_version
framework_contents = [
"Helpers",
"Resources",
"XPCServices",
]
if (is_chrome_branded) {
framework_contents += [
"Default Apps",
"Frameworks", # For KeystoneRegistration.framework.
]
}
if (enable_nacl) {
framework_contents += [ "Internet Plug-Ins" ]
}
if (_should_bundle_widevine) {
framework_contents += [ "Libraries" ]
}
}
configs += [ "//build/config/compiler:wexit_time_destructors" ]
info_plist_target = ":chrome_framework_plist"
extra_substitutions = [
"CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
"CHROMIUM_SHORT_NAME=$chrome_product_short_name",
]
public_deps = [
":chrome_dll",
]
deps = [
":chrome_framework_helpers",
":chrome_framework_plugins",
":chrome_framework_resources",
":chrome_framework_services",
":packed_resources",
":widevine_cdm_library",
"//build/config:exe_and_shlib_deps",
"//chrome/app/nibs:chrome_xibs",
]
if (is_chrome_branded) {
deps += [ ":default_apps" ]
}
ldflags = [
"-Wl,-install_name,@executable_path/../Versions/$chrome_version_full/$chrome_framework_name.framework/$chrome_framework_name",
"-compatibility_version",
chrome_dylib_version,
"-current_version",
chrome_dylib_version,
"-Wl,-order_file," + rebase_path("app/framework.order", root_build_dir),
]
if (is_component_build) {
ldflags += [
"-rpath",
"@loader_path/../../../../..",
"-Wl,-reexport_library,libchrome_dll.dylib",
]
data_deps = [
":chrome_dll",
]
}
}
_framework_binary_path = "$root_out_dir/$chrome_framework_name.framework/"
if (defined(chrome_framework_version)) {
_framework_binary_path +=
"Versions/$chrome_framework_version/$chrome_framework_name"
} else {
_framework_binary_path += "$chrome_framework_name"
}
assert(_framework_binary_path != "",
"Ignore configuration-dependent unused variable warning")
if (!is_asan && !is_component_build) {
action("verify_chrome_framework_order") {
script = "//chrome/tools/build/mac/run_verify_order.py"
stamp_file = "$target_out_dir/run_$target_name.stamp"
inputs = [
script,
"//chrome/tools/build/mac/verify_order",
]
args = [
"--stamp",
rebase_path(stamp_file, root_out_dir),
]
if (!use_system_xcode) {
args += [
"--developer_dir",
hermetic_xcode_path,
]
}
args += [
"_ChromeMain",
rebase_path(_framework_binary_path, root_out_dir),
]
outputs = [
stamp_file,
]
public_deps = [
":chrome_framework",
]
}
} else {
group("verify_chrome_framework_order") {
public_deps = [
":chrome_framework",
]
}
}
if (enable_dsyms) {
# This list must be updated with the two targets' deps list below, and
# the list of _dsyms in :chrome_dsym_archive.
_chrome_symbols_sources = [
_framework_binary_path,
"$root_out_dir/AlertNotificationService.xpc/Contents/MacOS/AlertNotificationService",
"$root_out_dir/$chrome_helper_name.app/Contents/MacOS/$chrome_helper_name",
"$root_out_dir/$chrome_product_full_name.app/Contents/MacOS/$chrome_product_full_name",
"$root_out_dir/crashpad_handler",
]
# It is possible to run dump_syms on unstripped products without dSYMs,
# but doing so isn't logical and won't happen in practice.
action_foreach("chrome_dump_syms") {
script = "//build/redirect_stdout.py"
sources = _chrome_symbols_sources
outputs = [
"$root_out_dir/{{source_file_part}}-$chrome_version_full.breakpad",
]
# Use an absolute path to dump_syms in case a user has it in their path.
args = rebase_path(outputs, root_out_dir) + [
rebase_path("$root_out_dir/dump_syms"),
"-g",
rebase_path(
"$root_out_dir/{{source_name_part}}.dSYM/Contents/Resources/DWARF/{{source_name_part}}",
root_out_dir),
"{{source}}",
]
deps = [
":chrome_app",
":chrome_framework",
":chrome_helper_app",
"//chrome/browser/ui/cocoa/notifications:alert_notification_xpc_service",
"//third_party/breakpad:dump_syms",
"//third_party/crashpad/crashpad/handler:crashpad_handler",
]
}
action("chrome_dsym_archive") {
script = "//chrome/tools/build/mac/archive_symbols.py"
# These are the dSYMs that will be archived. The sources list must be
# the target outputs that correspond to the dSYMs (since a dSYM is a
# directory it cannot be listed as a source file). The targets that
# generate both the dSYM and binary image are listed in deps.
_dsyms = [
"$root_out_dir/AlertNotificationService.dSYM",
"$root_out_dir/$chrome_framework_name.dSYM",
"$root_out_dir/$chrome_helper_name.dSYM",
"$root_out_dir/$chrome_product_full_name.dSYM",
"$root_out_dir/crashpad_handler.dSYM",
]
sources = _chrome_symbols_sources
_output = "$root_out_dir/$chrome_product_full_name.dSYM.tar.bz2"
outputs = [
_output,
]
args = [ rebase_path(_output, root_out_dir) ] +
rebase_path(_dsyms, root_out_dir)
deps = [
":chrome_app",
":chrome_framework",
":chrome_helper_app",
"//chrome/browser/ui/cocoa/notifications:alert_notification_xpc_service",
"//third_party/crashpad/crashpad/handler:crashpad_handler",
]
}
} else {
group("chrome_dump_syms") {
}
group("chrome_dsym_archive") {
}
}
}
group("browser_dependencies") {
public_deps = [
"//chrome/browser",
"//chrome/common",
"//components/sync",
]
if (enable_plugins) {
public_deps += [ "//ppapi/host" ]
}
if (enable_basic_printing || enable_print_preview) {
public_deps += [ "//printing" ]
if (enable_print_preview && !is_chromeos) {
public_deps += [ "//chrome/service" ]
}
}
if (!is_component_build) {
assert_no_deps = [
# Blink should not be used in the browser process. In component build this
# is OK because all of content is linked into one library. Note that the
# blink_headers target is OK, so we can't do a wildcard for all blink
# targets.
"//third_party/WebKit/public:blink",
]
if (is_win) {
assert_no_deps += [
# V8/Gin should not be used in the browser DLL on Windows.
"//gin",
"//tools/v8_context_snapshot",
"//v8",
]
}
}
}
group("child_dependencies") {
public_deps = [
"//chrome/browser/devtools",
"//chrome/child",
"//chrome/common",
"//chrome/gpu",
"//chrome/profiling",
"//chrome/renderer",
"//chrome/utility",
"//components/sync",
"//content/public/child",
"//pdf",
"//third_party/WebKit/public:blink_devtools_frontend_resources",
]
if (enable_nacl) {
public_deps += [ "//components/nacl/renderer/plugin:nacl_trusted_plugin" ]
}
}
if (is_win) {
process_version_rc_template("chrome_exe_version") {
sources = [
"app/chrome_exe.ver",
]
output = "$target_gen_dir/chrome_exe_version.rc"
}
process_version_rc_template("chrome_dll_version") {
sources = [
"app/chrome_dll.ver",
]
output = "$target_gen_dir/chrome_dll_version.rc"
}
# This manifest matches what GYP produced. It may not even be necessary.
windows_manifest("chrome_dll_manifest") {
sources = [
as_invoker_manifest,
common_controls_manifest,
]
}
process_version_rc_template("nacl64_exe_version") {
sources = [
"app/nacl64_exe.ver",
]
output = "$target_gen_dir/nacl64_exe_version.rc"
}
process_version_rc_template("other_version") {
sources = [
"app/other.ver",
]
output = "$target_gen_dir/other_version.rc"
}
source_set("file_pre_reader") {
sources = [
"app/file_pre_reader_win.cc",
"app/file_pre_reader_win.h",
]
deps = [
"//base",
]
}
}
copy("visual_elements_resources") {
sources = [
"//chrome/app/theme/$branding_path_component/win/tiles/Logo.png",
"//chrome/app/theme/$branding_path_component/win/tiles/SmallLogo.png",
"app/visual_elements_resources/chrome.VisualElementsManifest.xml",
]
if (is_chrome_branded) {
sources += [
"//chrome/app/theme/$branding_path_component/win/tiles/LogoBeta.png",
"//chrome/app/theme/$branding_path_component/win/tiles/LogoCanary.png",
"//chrome/app/theme/$branding_path_component/win/tiles/LogoDev.png",
"//chrome/app/theme/$branding_path_component/win/tiles/SmallLogoBeta.png",
"//chrome/app/theme/$branding_path_component/win/tiles/SmallLogoCanary.png",
"//chrome/app/theme/$branding_path_component/win/tiles/SmallLogoDev.png",
]
}
outputs = [
"$root_out_dir/{{source_file_part}}",
]
}
group("resources") {
public_deps = [
"//chrome/browser:resources",
"//chrome/common:resources",
"//chrome/renderer:resources",
]
}
group("extra_resources") {
# Deps should be same as those in chrome_extra_paks() within chrome_paks.gni.
public_deps = [
"//chrome/browser/resources:invalidations_resources",
"//chrome/browser/resources:net_internals_resources",
"//chrome/browser/resources:quota_internals_resources",
"//chrome/browser/resources:task_scheduler_internals_resources",
"//chrome/browser/resources:translate_internals_resources",
"//chrome/browser/resources:webapks_ui_resources",
]
if (!is_android) {
public_deps += [
"//chrome/browser/resources:component_extension_resources",
"//chrome/browser/resources:settings_resources",
]
}
if (is_chromeos) {
public_deps += [
"//chrome/browser/resources/chromeos/chromevox",
"//chrome/browser/resources/chromeos/select_to_speak",
"//chrome/browser/resources/chromeos/switch_access",
]
}
if (enable_extensions) {
public_deps += [
"//chrome/browser/resources:extensions_resources",
"//chrome/browser/resources:sync_file_system_internals_resources",
]
}
if (enable_print_preview) {
public_deps += [ "//chrome/browser/resources:print_preview_resources" ]
}
}
if (is_chrome_branded && !is_android) {
if (!is_mac) {
_default_apps_target_type = "copy"
} else {
_default_apps_target_type = "bundle_data"
}
target(_default_apps_target_type, "default_apps") {
visibility = [ ":packed_resources" ]
if (is_mac) {
visibility += [
":chrome_framework",
":chrome_framework_shared_library",
]
}
sources = [
"browser/resources/default_apps/docs.crx",
"browser/resources/default_apps/drive.crx",
"browser/resources/default_apps/external_extensions.json",
"browser/resources/default_apps/gmail.crx",
"browser/resources/default_apps/youtube.crx",
]
if (!is_mac) {
outputs = [
"$root_out_dir/default_apps/{{source_file_part}}",
]
} else {
outputs = [
"{{bundle_contents_dir}}/Default Apps/{{source_file_part}}",
]
}
# Force anybody that depends on this to get the default apps as data files.
data = process_file_template(sources, outputs)
}
}
chrome_paks("packed_resources") {
if (is_mac) {
output_dir = "$root_gen_dir/repack"
copy_data_to_bundle = true
} else {
output_dir = root_out_dir
}
if (enable_resource_whitelist_generation) {
repack_whitelist = chrome_resource_whitelist
deps = [
"//chrome:resource_whitelist",
]
}
if (is_chrome_branded && !is_mac && !is_android) {
public_deps = [
":default_apps",
]
}
}
repack("browser_tests_pak") {
sources = [
"$root_gen_dir/chrome/webui_test_resources.pak",
]
output = "$root_out_dir/browser_tests.pak"
deps = [
"//chrome/test/data:webui_test_resources",
]
}
group("strings") {
public_deps = [
"//chrome/app:chromium_strings",
"//chrome/app:generated_resources",
"//chrome/app:google_chrome_strings",
"//chrome/app/resources:locale_settings",
]
}
if (is_android) {
java_cpp_enum("data_use_ui_message_enum_javagen") {
sources = [
"browser/android/data_usage/data_use_tab_ui_manager_android.cc",
]
}
java_cpp_enum("content_setting_javagen") {
sources = [
"../components/content_settings/core/common/content_settings.h",
]
}
java_cpp_enum("content_settings_type_javagen") {
sources = [
"../components/content_settings/core/common/content_settings_types.h",
]
}
java_cpp_enum("credit_card_javagen") {
sources = [
"../components/autofill/core/browser/credit_card.h",
]
}
java_cpp_enum("signin_metrics_enum_javagen") {
sources = [
"../components/signin/core/browser/signin_metrics.h",
]
}
java_cpp_enum("assist_ranker_prediction_enum_javagen") {
sources = [
"browser/android/contextualsearch/contextual_search_ranker_logger_impl.h",
]
}
java_cpp_enum("page_info_connection_type_javagen") {
sources = [
"browser/ui/android/page_info/page_info_popup_android.h",
]
}
java_cpp_enum("page_info_action_javagen") {
sources = [
"browser/ui/page_info/page_info.h",
]
}
java_cpp_enum("partner_bookmarks_javagen") {
sources = [
"browser/android/bookmarks/partner_bookmarks_reader.h",
]
}
java_cpp_enum("payments_journey_logger_enum_javagen") {
sources = [
"../components/payments/core/journey_logger.h",
]
}
java_cpp_enum("pref_enum_javagen") {
sources = [
"browser/android/preferences/prefs.h",
]
}
java_cpp_enum("quick_action_category_enum_javagen") {
sources = [
"browser/android/contextualsearch/resolved_search_term.h",
]
}
java_cpp_enum("offline_pages_enum_javagen") {
sources = [
"browser/offline_pages/offline_page_utils.h",
]
}
java_cpp_enum("sad_tab_event_enum_javagen") {
sources = [
"//components/ui_metrics/sadtab_metrics_types.h",
]
}
source_set("chrome_android_core") {
sources = [
"app/android/chrome_android_initializer.cc",
"app/android/chrome_android_initializer.h",
"app/android/chrome_jni_onload.cc",
"app/android/chrome_jni_onload.h",
"app/android/chrome_main_delegate_android.cc",
"app/android/chrome_main_delegate_android.h",
"app/chrome_main_delegate.cc",
"app/chrome_main_delegate.h",
]
include_dirs = [ android_ndk_include_dir ]
libs = [
"android",
"jnigraphics",
]
deps = [
"//chrome/browser",
"//chrome/browser/ui",
"//chrome/child",
"//chrome/common",
"//chrome/gpu",
"//chrome/profiling",
"//chrome/renderer",
"//chrome/utility",
"//components/safe_browsing/android:safe_browsing_mobile",
"//content/public/app:both",
"//content/public/common:service_names",
"//services/service_manager/embedder",
]
# Explicit dependency required for JNI registration to be able to
# find the native side functions.
if (is_android && is_component_build) {
deps += [
"//device/gamepad",
"//device/sensors",
"//ui/events/devices",
]
}
}
}
if (enable_resource_whitelist_generation) {
generate_resource_whitelist("resource_whitelist") {
deps = [
"//chrome/android:libchrome",
]
input = "$root_out_dir/libchrome$shlib_extension.whitelist"
output = chrome_resource_whitelist
}
}
if (is_linux) {
if (is_official_build) {
action("linux_symbols") {
script = "//build/linux/dump_app_syms.py"
dump_syms_label = "//third_party/breakpad:dump_syms($host_toolchain)"
dump_syms_binary =
get_label_info(dump_syms_label, "root_out_dir") + "/" + "dump_syms"
chrome_binary = "$root_out_dir/chrome"
if (current_cpu == "x86") {
# GYP used "ia32" so keep that naming for back-compat.
symbol_file = "$root_out_dir/chrome.breakpad.ia32"
} else {
symbol_file = "$root_out_dir/chrome.breakpad.$current_cpu"
}
inputs = [
chrome_binary,
dump_syms_binary,
]
outputs = [
symbol_file,
]
args = [
"./" + rebase_path(dump_syms_binary, root_build_dir),
"0", # strip_binary = false
rebase_path(chrome_binary, root_build_dir),
rebase_path(symbol_file, root_build_dir),
]
deps = [
":chrome",
dump_syms_label,
]
}
}
# Copies some scripts and resources that are used for desktop integration.
copy("xdg_mime") {
sources = [
"//chrome/app/theme/$branding_path_component/product_logo_48.png",
"//chrome/tools/build/linux/chrome-wrapper",
"//third_party/xdg-utils/scripts/xdg-mime",
"//third_party/xdg-utils/scripts/xdg-settings",
]
outputs = [
"$root_out_dir/{{source_file_part}}",
]
}
}