123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920 |
- # 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/chromeos/ui_mode.gni")
- import("//build/config/compiler/compiler.gni")
- import("//build/config/compiler/pgo/pgo.gni")
- import("//build/config/features.gni")
- import("//build/config/locales.gni")
- import("//build/config/python.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/exo/buildflags.gni")
- import("//components/gwp_asan/buildflags/buildflags.gni")
- import("//components/nacl/features.gni")
- import("//components/optimization_guide/features.gni")
- import("//extensions/buildflags/buildflags.gni")
- import("//media/media_options.gni")
- import("//ppapi/buildflags/buildflags.gni")
- import("//third_party/blink/public/public_features.gni")
- import("//third_party/widevine/cdm/widevine.gni")
- import("//tools/resources/generate_resource_allowlist.gni")
- import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
- import("//ui/gl/features.gni")
- import("//v8/gni/v8.gni")
- if (is_android) {
- import("//build/config/android/rules.gni")
- } else if (is_linux || is_chromeos) {
- import("//build/linux/extract_symbols.gni")
- import("//build/linux/strip_binary.gni")
- } else if (is_mac) {
- import("//build/apple/compile_entitlements.gni")
- import("//build/apple/compile_plist.gni")
- import("//build/apple/tweak_info_plist.gni")
- import("//build/compiled_action.gni")
- import("//build/config/apple/symbols.gni")
- import("//build/config/mac/mac_sdk.gni")
- import("//build/config/mac/rules.gni")
- import("//build/util/branding.gni")
- import("//build/util/version.gni")
- import("//chrome/browser/buildflags.gni")
- import("//chrome/updater/branding.gni")
- import("//content/public/app/mac_helpers.gni")
- import("//media/cdm/library_cdm/cdm_paths.gni")
- import("//third_party/icu/config.gni")
- }
- declare_args() {
- # Indicates whether keystone registration framework should be enabled (see
- # action("keystone_registration_framework") below). There are some tests
- # where we'd like for it to be disabled. (https://crbug.com/909080)
- enable_keystone_registration_framework = true
- }
- assert(!is_ios, "Chromium/iOS shouldn't use anything in //chrome")
- if (is_win && enable_resource_allowlist_generation) {
- _chrome_resource_allowlist = "$target_gen_dir/chrome_resource_allowlist.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/nw.exe" ]
- outputs = [
- "$root_out_dir/nw.exe",
- "$root_out_dir/nw.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" ]
- }
- # 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" ]
- # Do not add any more deps or data_deps to group("chrome").
- # Because chrome_initial sets its output name to "chrome", running commands
- # such as `ninja chrome` causes chrome_initial to be built instead. All
- # deps and data_deps should be added to the chrome_initial target instead.
- # Targets added here can only be built by explicitly using //chrome:chrome.
- # Windows-only deps are OK because chrome_initial uses initialexe/chrome as
- # the output name for that platform.
- # See crbug.com/1146571.
- if (is_win) {
- public_deps += [ ":reorder_imports" ]
- data_deps += [ ":reorder_imports" ]
- }
- }
- executable("chrome_initial") {
- configs -= [ "//build/config/compiler:thinlto_optimize_default" ]
- configs += [ "//build/config/compiler:thinlto_optimize_max" ]
- if (is_win) {
- output_name = "initialexe/nw"
- } else {
- output_name = "nw"
- }
- # 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:chromeos_buildflags",
- "//printing/buildflags",
- ]
- data = [ "$root_out_dir/resources.pak" ]
- data_deps = []
- if (is_chromeos_ash) {
- data_deps += [ "//sandbox/linux:chrome_sandbox" ]
- deps += [ "//components/exo/wayland:weston_test_stub" ]
- }
- if (also_build_lacros_chrome_for_architecture != "") {
- data_deps += [ "//chrome:chrome(//build/toolchain/cros:lacros_clang)" ]
- }
- if (is_win) {
- sources += [
- "app/chrome_exe.rc",
- "app/chrome_exe_main_win.cc",
- "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",
- ":packed_resources_integrity",
- ":visual_elements_resources",
- "//base",
- "//build:branding_buildflags",
- "//chrome/app:chrome_exe_main_exports",
- "//chrome/app/version_assembly:chrome_exe_manifest",
- "//chrome/browser:active_use_util",
- "//chrome/browser:chrome_process_finder",
- "//chrome/browser/policy:path_parser",
- "//chrome/chrome_elf",
- "//chrome/common:constants",
- "//chrome/install_static:install_static_util",
- "//chrome/install_static:secondary_module",
- "//chrome/installer/util:constants",
- "//chrome/installer/util:did_run_support",
- "//components/browser_watcher:browser_watcher_client",
- "//components/crash/core/app",
- "//components/crash/core/app:run_as_crashpad_handler",
- "//components/crash/core/common",
- "//components/flags_ui:switches",
- "//content:sandbox_helper_win",
- "//content/public/common:static_switches",
- "//crypto",
- "//gpu/command_buffer/service",
- "//sandbox",
- "//sandbox/policy",
- "//sandbox/policy/mojom",
- "//third_party/breakpad:breakpad_handler",
- "//third_party/breakpad:breakpad_sender",
- "//third_party/crashpad/crashpad/util",
- "//ui/gl",
- ]
- data_deps = [
- "//chrome/app/version_assembly:version_assembly_manifest",
- "//chrome/browser/web_applications/chrome_pwa_launcher",
- "//chrome/chrome_proxy",
- "//chrome/elevation_service",
- "//chrome/notification_helper",
- ]
- defines += [ "CHROME_EXE_MAIN" ]
- 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" ]
- }
- configs += [
- "//build/config/win:delayloads",
- "//build/config/win:delayloads_not_for_child_dll",
- ]
- if (current_cpu == "x86") {
- # Set the initial stack size to 0.5MiB, instead of the 1.5MiB needed by
- # Chrome's main thread. This saves significant memory on threads (like
- # those in the Windows thread pool, and others) whose stack size we can
- # only control through this setting. Because Chrome's main thread needs
- # a minimum 1.5 MiB stack, the main thread (in 32-bit builds only) uses
- # fibers to switch to a 1.5 MiB stack before running any other code.
- ldflags = [ "/STACK:0x80000" ]
- } 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" ]
- }
- if (is_linux || is_chromeos || is_fuchsia) {
- if (!is_component_build) {
- configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
- }
- if (is_component_build) {
- sources += [
- "app/chrome_dll_resource.h",
- "app/chrome_main.cc",
- "app/chrome_main_delegate.cc",
- "app/chrome_main_delegate.h",
- ]
- }
- if (is_component_build) {
- deps += [
- # On Linux, link the dependencies (libraries) that make up actual
- # Chromium functionality directly into the executable.
- ":dependencies",
- # For configuring PartitionAlloc
- "//base/allocator:buildflags",
- # For the sampling profiler.
- "//chrome/common/profiler",
- # Needed to use the master_preferences functions
- "//chrome/installer/util:with_no_strings",
- "//content/public/app",
- # For headless mode.
- "//headless:headless_shell_lib",
- ]
- } else {
- deps += [
- ":chrome_dll",
- ]
- }
- if (is_component_build) {
- public_deps = [ "//chrome/common:buildflags" ]
- if (!is_fuchsia) {
- public_deps += [
- ":xdg_mime", # Needs to be public for installer to consume files.
- ]
- data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ]
- }
- }
- ldflags = []
- # On Chrome OS builds (for both ash-chrome and lacros-chrome), put
- # priority to the library in the installed directory.
- # This will avoid conflicting of exposed symbols.
- if (is_chromeos_device) {
- ldflags += [ "-L" + rebase_path(root_out_dir) ]
- }
- # 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_ash && is_debug && target_cpu == "arm") {
- ldflags += [ "-Wl,--long-plt" ]
- }
- if ((is_linux || is_chromeos_lacros) && !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_ash) {
- public_deps += [ "//ui/lottie" ]
- }
- if (is_chromeos_lacros) {
- deps += [ "//chromeos/crosapi/mojom" ]
- }
- }
- if (is_chromeos_ash || is_win) {
- data_deps += [ "//mojo/core:shared_library" ]
- }
- if (is_chromeos_ash) {
- data_deps += [ "//mojo/core:shared_libraries_for_arc" ]
- if (is_chromeos_device) {
- configs += [ "//build/config/chromeos:print_orderfile" ]
- configs += [ "//build/config/compiler:chrome_orderfile_config" ]
- }
- }
- # These files are used by the installer so we need a public dep.
- public_deps += [ ":packed_resources" ]
- # The step's output are needed at runtime, so we also need a data_dep.
- data_deps += [ ":packed_resources" ]
- deps += [
- "//content/nw:nw_base",
- ]
- # ChromeOS by design is safe to have rpath=$ORIGIN. This simplifies shared
- # library usage.
- if (is_chromeos_ash && !is_component_build) {
- configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
- }
- if (is_chromeos_lacros && is_chromeos_device) {
- configs += [ "//build/lacros:optional_shared_libgcc" ]
- }
- data_deps += [
- "//chrome/browser/resources/media/mei_preload:component",
- "//third_party/widevine/cdm",
- ]
- }
- } # !is_android && !is_mac
- if (is_win || (is_linux && !is_component_build)) {
- shared_library("chrome_dll") {
- configs += [ "//build/config/compiler:wexit_time_destructors" ]
- configs -= [ "//build/config/compiler:thinlto_optimize_default" ]
- configs += [ "//build/config/compiler:thinlto_optimize_max" ]
- defines = []
- ldflags = []
- sources = [
- "app/chrome_main.cc",
- "app/chrome_main_delegate.cc",
- "app/chrome_main_delegate.h",
- ]
- if (is_win) {
- sources += [ "//base/win/dllmain.cc" ]
- }
- output_name = "nw"
- deps = [
- ":dependencies",
- "//base/allocator:buildflags",
- "//chrome/app:chrome_dll_resources",
- "//chrome/app:command_ids",
- "//chrome/common:buildflags",
- "//chrome/common/profiler",
- ]
- # reverts commit a2052ac9b6ec749735f3d8e269bf5a5600935914
- if (is_win) {
- configs += [ "//build/config/win:delayloads" ]
- deps += [
- ":chrome_dll_manifest",
- ":chrome_dll_version",
- "//chrome/app/theme:chrome_unscaled_resources",
- "//chrome/install_static:install_static_util",
- "//chrome/install_static:secondary_module",
- "//chrome/chrome_elf",
- "//components/browser_watcher:stability_client",
- "//components/crash/core/app",
- "//components/policy:generated",
- "//content/app/resources",
- "//crypto",
- "//headless:headless_renderer",
- "//headless:headless_shell_browser_lib",
- "//net:net_resources",
- "//ppapi/buildflags",
- "//sandbox/win:sandbox",
- "//third_party/wtl",
- "//ui/views",
- ]
- if (!is_component_build) {
- deps += [
- "//v8:v8_initializers",
- ]
- }
-
- } #is_win
- if (use_aura) {
- deps += [ "//ui/compositor" ]
- }
- if (is_linux) {
- deps += [ "//headless:headless_shell_lib", ]
- }
- }
- if (is_win) {
- 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 = chrome_version_full
- verify_dynamic_libraries = !is_component_build && !is_asan
- if (host_os == "mac") {
- objdump_path = mac_bin_path
- } else {
- objdump_path = rebase_path("$clang_base_path/bin/", root_build_dir)
- }
- group("chrome") {
- deps = [ ":chrome_app" ]
- data_deps = [ ":chrome_app" ]
- if (verify_dynamic_libraries) {
- deps += [ ":verify_libraries_chrome_app" ]
- }
- if (is_chrome_branded && is_official_build) {
- deps += [
- ":chrome_dsym_archive",
- ":chrome_dump_syms",
- ]
- }
- }
- tweak_info_plist("chrome_app_plist") {
- info_plist = "app/app-Info.plist"
- args = [
- "--breakpad=0",
- "--scm=1",
- "--bundle_id=$chrome_mac_bundle_id",
- ]
- if (is_chrome_branded) {
- args += [ "--keystone=1" ]
- if (current_cpu == "arm64") {
- args += [ "--keystone-base-tag=arm64" ]
- }
- } else {
- args += [ "--keystone=0" ]
- }
- if (enable_chromium_updater) {
- args += [ "--privileged_helper_id=$privileged_helper_name" ]
- }
- }
- 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",
- "//base/allocator:early_zone_registration_mac",
- "//build:branding_buildflags",
- "//chrome/common:buildflags",
- "//chrome/common:version_header",
- ]
- if (false) {
- # At link time, preserve the global symbols specified in the .exports
- # file. All other global symbols will be marked as private. The default
- # //build/config/mac:strip_all config will then remove the remaining
- # local and debug symbols.
- ldflags = [ "-Wl,-exported_symbols_list," +
- rebase_path("app/app.exports", root_build_dir) ]
- }
- if (is_component_build) {
- # In a component build, the framework is directly linked to the
- # executable because dlopen() and loading all the dependent dylibs
- # is time-consuming, see https://crbug.com/1197495.
- deps += [ ":chrome_framework+link" ]
- ldflags = [ "-Wl,-rpath,@executable_path/../Frameworks" ]
- # 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" ]
- }
- if (enable_chromium_updater) {
- deps += [ ":chromium_updater_privileged_helper" ]
- }
- }
- if (verify_dynamic_libraries) {
- action("verify_libraries_chrome_app") {
- script = "//chrome/tools/build/mac/verify_dynamic_libraries.py"
- inputs = [ "${root_out_dir}/${chrome_product_full_name}.app/Contents/MacOS/${chrome_product_full_name}" ]
- outputs = [ "$target_out_dir/run_$target_name.stamp" ]
- args = [
- "--stamp",
- rebase_path(outputs[0], root_out_dir),
- "-B",
- objdump_path,
- "--image",
- rebase_path(inputs[0], root_out_dir),
- "--allow",
- "/usr/lib/libSystem.B.dylib",
- ]
- deps = [ ":chrome_app" ]
- }
- }
- compiled_action("chrome_app_strings") {
- tool = "//chrome/tools/build/mac:infoplist_strings_util"
- inputs = []
- outputs = []
- foreach(locale, platform_pak_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_apple_outputs) {
- outputs += [
- "$target_gen_dir/app_infoplist_strings/$locale.lproj/InfoPlist.strings",
- ]
- }
- args =
- [
- "-b",
- "${branding_path_component}_strings",
- "-v",
- chrome_version_full,
- "-g",
- rebase_path("$root_gen_dir/chrome", root_build_dir),
- "-o",
- rebase_path("$target_gen_dir/app_infoplist_strings", root_build_dir),
- "-t",
- "main",
- ] + platform_pak_locales
- if (is_chrome_branded) {
- deps = [ "//chrome/app:google_chrome_strings" ]
- } else {
- deps = [ "//chrome/app:chromium_strings" ]
- }
- }
- foreach(locale, locales_as_apple_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_apple_outputs) {
- public_deps += [ ":chrome_app_strings_${locale}_bundle_data" ]
- }
- }
- bundle_data("chrome_app_icon") {
- sources = [ "app/theme/$branding_path_component/mac/app.icns" ]
- outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
- }
- bundle_data("chrome_resources") {
- sources = [
- "$root_out_dir/$chrome_mac_bundle_id.manifest",
- "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_icon",
- ":chrome_app_strings",
- "//components/policy:chrome_manifest_bundle",
- ]
- }
- bundle_data("chrome_versioned_bundle_data") {
- sources = [ "$root_out_dir/$chrome_framework_name.framework" ]
- outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ]
- public_deps = [
- # Before bundling the versioned app components, delete any existing
- # versions.
- ":clean_up_old_versions",
- # 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",
- ]
- if (enable_widevine_cdm_host_verification) {
- # The :chrome_framework_widevine_signature target copies into the
- # :chrome_framework bundle. But because the signing file depends on the
- # framework itself, that would cause a cyclical dependency. Instead,
- # this dependency directly copies the file into the framework's
- # resources directory.
- public_deps += [ ":chrome_framework_widevine_signature" ]
- }
- }
- if (enable_chromium_updater) {
- bundle_data("chromium_updater_privileged_helper") {
- sources = [ "$root_out_dir/$privileged_helper_name" ]
- outputs = [
- "{{bundle_contents_dir}}/Library/LaunchServices/{{source_file_part}}",
- ]
- public_deps = [ "//chrome/updater/mac:privileged_helper" ]
- }
- }
- action("clean_up_old_versions") {
- script = "//chrome/tools/build/mac/clean_up_old_versions.py"
- _stamp_file = "$root_gen_dir/run_$target_name.stamp"
- outputs = [ _stamp_file ]
- _versions_dir = "$root_out_dir/$chrome_product_full_name.app/Contents/Frameworks/$chrome_framework_name.framework/Versions"
- args = [
- "--versions-dir",
- rebase_path(_versions_dir, root_build_dir),
- "--stamp",
- rebase_path(_stamp_file, root_build_dir),
- "--keep",
- chrome_version_full,
- "--keep",
- "Current",
- ]
- }
- tweak_info_plist("chrome_helper_plist") {
- info_plist = "app/helper-Info.plist"
- args = [
- "--breakpad=0",
- "--keystone=0",
- "--scm=0",
- ]
- }
- compile_entitlements("entitlements") {
- entitlements_templates = [ "app/app-entitlements.plist" ]
- if (is_chrome_branded) {
- # These entitlements are bound to the official Google Chrome signing
- # certificate and will not necessarily work in any other build.
- entitlements_templates += [ "app/app-entitlements-chrome.plist" ]
- }
- output_name = "$target_gen_dir/app-entitlements.plist"
- substitutions = [
- "CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
- "CHROMIUM_TEAM_ID=$chrome_mac_team_id",
- ]
- visibility = [ "//chrome/installer/mac:copies" ]
- }
- template("chrome_helper_app") {
- mac_app_bundle(target_name) {
- assert(defined(invoker.helper_name_suffix))
- assert(defined(invoker.helper_bundle_id_suffix))
- output_name = chrome_helper_name + invoker.helper_name_suffix
- if (defined(invoker.info_plist_target)) {
- info_plist_target = invoker.info_plist_target
- } else {
- info_plist_target = ":chrome_helper_plist"
- }
- extra_substitutions = [
- "CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
- "CHROMIUM_SHORT_NAME=$chrome_product_short_name",
- "CHROMIUM_HELPER_SUFFIX=${invoker.helper_name_suffix}",
- "CHROMIUM_HELPER_BUNDLE_ID_SUFFIX=${invoker.helper_bundle_id_suffix}",
- ]
- sources = [ "app/chrome_exe_main_mac.cc" ]
- extra_configs = [ "//build/config/compiler:wexit_time_destructors" ]
- defines = [ "HELPER_EXECUTABLE" ]
- deps = [
- "//base/allocator:early_zone_registration_mac",
- "//build:branding_buildflags",
- "//chrome/common:version_header",
- "//sandbox/mac:seatbelt",
- ]
- if (defined(invoker.deps)) {
- deps += invoker.deps
- }
- ldflags = []
- if (is_component_build) {
- # In a component build, the framework is directly linked to the
- # executable because dlopen() and loading all the dependent dylibs
- # is time-consuming, see https://crbug.com/1197495.
- deps += [ ":chrome_framework+link_nested" ]
- ldflags += [
- # The helper is in Chromium.app/Contents/Frameworks/Chromium Framework.framework/Versions/X/Helpers/Chromium Helper.app/Contents/MacOS
- # so set rpath up to the base.
- "-Wl,-rpath,@loader_path/../../../../../../../../../..",
- # ... and up to Contents/Frameworks.
- "-Wl,-rpath,@executable_path/../../../../../../..",
- ]
- }
- if (false) {
- # At link time, preserve the global symbols specified in the .exports
- # file. All other global symbols will be marked as private. The default
- # //build/config/mac:strip_all config will then remove the remaining
- # local and debug symbols.
- ldflags += [ "-Wl,-exported_symbols_list," +
- rebase_path("app/app.exports", root_build_dir) ]
- }
- }
- }
- # The following *_helper_params are added to the ones provided by //content
- # listed in content_mac_helpers (see //content/public/app/mac_helpers.gni).
- # These allow //chrome to add custom helper apps in addition to the ones
- # provided by //content. The params here have the same form as the content
- # helpers and are defined as a tuple of these elements:
- # target name - A short name to be used when defining the target for that
- # helper variant.
- # bundle ID suffix - A string fragment to append to the CFBundleIdentifier of
- # the helper.
- # app name suffix - A string fragment to append to the outer bundle name as
- # well as the inner executable. This should be reflected in
- # the target's output_name.
- # Helper app to display alert notifications. This is necessary as an app can
- # only display either banner or alert style notifications and the main app
- # will display banners.
- alert_helper_params = [
- "alerts",
- ".alerts",
- " (Alerts)",
- ]
- # Merge all helper apps needed by //content and //chrome.
- chrome_mac_helpers = content_mac_helpers + [ alert_helper_params ]
- # Create all helper apps required by //content.
- foreach(helper_params, content_mac_helpers) {
- chrome_helper_app("chrome_helper_app_${helper_params[0]}") {
- helper_name_suffix = helper_params[2]
- helper_bundle_id_suffix = helper_params[1]
- }
- }
- # Create app for the alert helper manually here as we want to modify the plist
- # to set the alert style and add the app icon to its resources.
- tweak_info_plist("chrome_helper_app_alerts_plist") {
- deps = [ ":chrome_helper_plist" ]
- info_plists = get_target_outputs(":chrome_helper_plist") +
- [ "app/helper-alerts-Info.plist" ]
- }
- # Create and bundle an InfoPlist.strings for the alert helper app.
- # TODO(crbug.com/1182393): Disambiguate and localize alert helper app name.
- compile_plist("chrome_helper_app_alerts_plist_strings") {
- format = "binary1"
- plist_templates = [ "app/helper-alerts-InfoPlist.strings" ]
- substitutions = [ "CHROMIUM_FULL_NAME=$chrome_product_full_name" ]
- output_name = "$target_gen_dir/helper_alerts_infoplist_strings/base.lproj/InfoPlist.strings"
- }
- bundle_data("chrome_helper_app_alerts_resources") {
- sources = get_target_outputs(":chrome_helper_app_alerts_plist_strings")
- outputs = [ "{{bundle_resources_dir}}/base.lproj/{{source_file_part}}" ]
- public_deps = [ ":chrome_helper_app_alerts_plist_strings" ]
- }
- chrome_helper_app("chrome_helper_app_${alert_helper_params[0]}") {
- helper_name_suffix = alert_helper_params[2]
- helper_bundle_id_suffix = alert_helper_params[1]
- info_plist_target = ":chrome_helper_app_alerts_plist"
- deps = [
- ":chrome_app_icon",
- ":chrome_helper_app_alerts_resources",
- ]
- }
- if (verify_dynamic_libraries) {
- foreach(helper_params, chrome_mac_helpers) {
- _helper_target = helper_params[0]
- _helper_bundle_id = helper_params[1]
- _helper_suffix = helper_params[2]
- action("verify_libraries_chrome_helper_app_${_helper_target}") {
- script = "//chrome/tools/build/mac/verify_dynamic_libraries.py"
- inputs = [ "${root_out_dir}/${chrome_helper_name}${_helper_suffix}.app/Contents/MacOS/${chrome_helper_name}${_helper_suffix}" ]
- outputs = [ "$target_out_dir/run_$target_name.stamp" ]
- args = [
- "--stamp",
- rebase_path(outputs[0], root_out_dir),
- "-B",
- objdump_path,
- "--image",
- rebase_path(inputs[0], root_out_dir),
- # Do not --allow more libraries here without consulting with the
- # security team (security-dev@chromium.org).
- "--allow",
- "/usr/lib/libsandbox.1.dylib",
- "--allow",
- "/usr/lib/libSystem.B.dylib",
- ]
- deps = [ ":chrome_helper_app_${_helper_target}" ]
- }
- }
- }
- bundle_data("chrome_framework_helpers") {
- sources = [
- "$root_out_dir/app_mode_loader",
- "$root_out_dir/chrome_crashpad_handler",
- ]
- outputs = [ "{{bundle_contents_dir}}/Helpers/{{source_file_part}}" ]
- public_deps = [
- "//chrome/app_shim:app_mode_loader",
- "//components/crash/core/app:chrome_crashpad_handler",
- ]
- foreach(helper_params, chrome_mac_helpers) {
- sources +=
- [ "$root_out_dir/${chrome_helper_name}${helper_params[2]}.app" ]
- public_deps += [ ":chrome_helper_app_${helper_params[0]}" ]
- if (verify_dynamic_libraries) {
- public_deps +=
- [ ":verify_libraries_chrome_helper_app_${helper_params[0]}" ]
- }
- }
- if (enable_chromium_updater) {
- # A stable updater from CIPD is bundled with official builds only. For
- # local builds, a locally built updater will be bundled into the app.
- # TODO(crbug.com/1134642): Add ChromiumUpdater app to CIPD for use in
- # official builds.
- sources += [ "$root_out_dir/${updater_product_full_name}.app" ]
- public_deps += [
- "//chrome/updater/mac:browser_install_script",
- "//chrome/updater/mac:updater_bundle",
- "//chrome/updater/mac:updater_install_script",
- ]
- }
- }
- bundle_data("chrome_framework_resources") {
- sources = [
- # 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_plist_bundle_data",
- ]
- 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) {
- public_deps += [ "//v8" ]
- if (use_v8_context_snapshot) {
- sources += [ "$root_out_dir/$v8_context_snapshot_filename" ]
- public_deps += [ "//tools/v8_context_snapshot" ]
- } else {
- sources += [ "$root_out_dir/snapshot_blob.bin" ]
- }
- }
- }
- 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" ]
- }
- sources += [ "$root_out_dir/pnacl" ]
- public_deps += [ "//ppapi/native_client:irt", "//ppapi/native_client/src/untrusted/pnacl_support_extension:pnacl_support_extension" ]
- }
- }
- } else {
- group("chrome_framework_plugins") {
- }
- }
- # EGL on MacOS ships with official chrome
- bundle_egl_libraries = use_egl
- if (bundle_egl_libraries) {
- # Add the ANGLE .dylibs in the MODULE_DIR of Chromium.app
- bundle_data("angle_binaries") {
- sources = [
- "$root_out_dir/egl_intermediates/libEGL.dylib",
- "$root_out_dir/egl_intermediates/libGLESv2.dylib",
- ]
- outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
- public_deps = [ "//ui/gl:angle_library_copy" ]
- }
- # Add the SwiftShader .dylibs in the MODULE_DIR of Chromium.app
- bundle_data("swiftshader_binaries") {
- sources = [
- "$root_out_dir/vk_intermediates/libvk_swiftshader.dylib",
- "$root_out_dir/vk_intermediates/vk_swiftshader_icd.json",
- ]
- outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
- public_deps = [ "//ui/gl:swiftshader_vk_library_copy" ]
- }
- }
- group("angle_library") {
- if (bundle_egl_libraries) {
- deps = [ ":angle_binaries" ]
- }
- }
- group("swiftshader_library") {
- if (bundle_egl_libraries) {
- deps = [ ":swiftshader_binaries" ]
- }
- }
- if (bundle_widevine_cdm) {
- bundle_data("widevine_cdm_library_binaries") {
- sources = [ "$root_out_dir/$widevine_cdm_path/libwidevinecdm.dylib" ]
- if (enable_widevine_cdm_host_verification) {
- sources +=
- [ "$root_out_dir/$widevine_cdm_path/libwidevinecdm.dylib.sig" ]
- }
- outputs = [ "{{bundle_contents_dir}}/Libraries/$widevine_cdm_path/{{source_file_part}}" ]
- public_deps = [ "//third_party/widevine/cdm" ]
- }
- bundle_data("widevine_cdm_library_manifest_and_license_files") {
- sources = [
- "$root_out_dir/WidevineCdm/LICENSE",
- "$root_out_dir/WidevineCdm/manifest.json",
- ]
- outputs = [
- "{{bundle_contents_dir}}/Libraries/WidevineCdm/{{source_file_part}}",
- ]
- public_deps = [ "//third_party/widevine/cdm" ]
- }
- }
- group("widevine_cdm_library") {
- if (bundle_widevine_cdm) {
- deps = [
- ":widevine_cdm_library_binaries",
- ":widevine_cdm_library_manifest_and_license_files",
- ]
- }
- }
- if (enable_widevine_cdm_host_verification) {
- widevine_sign_file("sign_chrome_framework_for_widevine") {
- file = "$root_out_dir/$chrome_framework_name.framework/Versions/$chrome_framework_version/$chrome_framework_name"
- flags = 1
- signature_file = "$root_out_dir/$chrome_framework_name.sig"
- deps = [ ":chrome_framework" ]
- }
- copy("chrome_framework_widevine_signature") {
- deps = [ ":sign_chrome_framework_for_widevine" ]
- sources = [ "$root_out_dir/$chrome_framework_name.sig" ]
- outputs = [ "$root_out_dir/$chrome_framework_name.framework/Resources/{{source_file_part}}" ]
- }
- }
- if (is_chrome_branded && enable_keystone_registration_framework) {
- bundle_data("keystone_registration_framework") {
- sources = [ "//third_party/googlemac/Releases/Keystone/KeystoneRegistration.framework" ]
- outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ]
- }
- } else {
- group("keystone_registration_framework") {
- }
- }
- if (build_with_internal_optimization_guide) {
- # Add the optimization guide .dylib in the MODULE_DIR of Chromium.app
- bundle_data("optimization_guide_library") {
- sources = [
- "$root_out_dir/og_intermediates/liboptimization_guide_internal.dylib",
- ]
- outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
- public_deps = [ "//components/optimization_guide/core:optimization_guide_internal_library_copy" ]
- }
- } else {
- group("optimization_guide_library") {
- }
- }
- 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",
- ]
- output_name = "nw"
- 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 = [
- ":dependencies",
- "//base/allocator:buildflags",
- "//build:chromeos_buildflags",
- "//chrome/app:command_ids",
- "//chrome/app:notification_metrics",
- "//chrome/common:buildflags",
- "//chrome/common/profiler",
- "//components/crash/core/app",
- "//components/policy:generated",
- "//content/public/app",
- "//headless:headless_shell_lib",
- #"//third_party/cld_3/src/src:cld_3",
- "//ui/events:dom_keycode_converter",
- ]
- if (is_component_build) {
- frameworks = [ "Carbon.framework" ]
- }
- ldflags = [
- "-Wl,-order_file",
- "-Wl," + rebase_path("app/framework.order", root_build_dir),
- "-ObjC",
- ]
- configs += [ "//build/config/compiler:wexit_time_destructors" ]
- configs += [ "//tools/v8_context_snapshot:use_v8_context_snapshot" ]
- }
- mac_framework_bundle("chrome_framework") {
- output_name = chrome_framework_name
- framework_version = chrome_framework_version
- framework_contents = [
- "Helpers",
- "Libraries",
- "Resources",
- ]
- if (is_chrome_branded) {
- framework_contents += [ "Default Apps" ]
- if (enable_keystone_registration_framework) {
- # For KeystoneRegistration.framework.
- framework_contents += [ "Frameworks" ]
- }
- }
- if (enable_nacl) {
- framework_contents += [ "Internet Plug-Ins" ]
- }
- configs += [ "//build/config/compiler:wexit_time_destructors" ]
- configs -= [ "//build/config/compiler:thinlto_optimize_default" ]
- configs += [ "//build/config/compiler:thinlto_optimize_max" ]
- 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" ]
- bundle_deps = [
- ":angle_library",
- ":chrome_framework_helpers",
- ":chrome_framework_plugins",
- ":chrome_framework_resources",
- ":keystone_registration_framework",
- ":optimization_guide_library",
- ":swiftshader_library",
- ":widevine_cdm_library",
- "//chrome/browser/resources/media/mei_preload:component_bundle",
- ]
- if (is_chrome_branded) {
- bundle_deps += [ ":preinstalled_apps" ]
- }
- ldflags = [
- "-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) {
- # Specify a sensible install_name for static builds. The library is
- # dlopen()ed so this is not used to resolve the module.
- ldflags += [ "-Wl,-install_name,@executable_path/../Frameworks/$chrome_framework_name.framework/Versions/$chrome_version_full/$chrome_framework_name" ]
- } else {
- # In the component build, both the :chrome_app and various
- # :chrome_helper* targets directly link to the Framework target. Use
- # @rpath-based loading so that the dylib ID does not have to be changed
- # with install_name_tool.
- ldflags += [
- "-Wl,-install_name,@rpath/$chrome_framework_name.framework/$chrome_framework_name",
- "-Wl,-rpath,@loader_path/../../../../../..",
- "-Wl,-reexport_library,libnw.dylib",
- ]
- data_deps = [ ":chrome_dll" ]
- }
- }
- _framework_binary_path = "$root_out_dir/$chrome_framework_name.framework/Versions/$chrome_framework_version/$chrome_framework_name"
- assert(_framework_binary_path != "",
- "Ignore configuration-dependent unused variable warning")
- # TOOD(crbug/1163903#c8) - thakis@ look into why profile and coverage
- # instrumentation adds these symbols in different orders
- if (false && !is_component_build && chrome_pgo_phase != 1) {
- action("verify_chrome_framework_order") {
- script = "//chrome/tools/build/mac/verify_order.py"
- stamp_file = "$target_out_dir/run_$target_name.stamp"
- inputs = [ script ]
- args = [
- "--stamp=" + rebase_path(stamp_file, root_out_dir),
- "--binary=" + rebase_path(_framework_binary_path, root_out_dir),
- "--symbol-file=" + rebase_path("app/framework.order", root_build_dir),
- ]
- if (host_os == "mac") {
- args += [ "--nm-path=$mac_bin_path/nm" ]
- } else {
- args += [ "--nm-path=" +
- rebase_path("$clang_base_path/bin/llvm-nm", root_build_dir) ]
- }
- outputs = [ stamp_file ]
- public_deps = [ ":chrome_framework" ]
- }
- } else {
- group("verify_chrome_framework_order") {
- if (is_component_build) {
- # In a component build, the framework is directly linked to the
- # executable because dlopen() and loading all the dependent dylibs
- # is time-consuming, see https://crbug.com/1197495.
- public_deps = [ ":chrome_framework+link" ]
- } else {
- public_deps = [ ":chrome_framework" ]
- }
- }
- }
- if (enable_dsyms && !is_component_build) {
- # It is possible to run dump_syms on unstripped products without dSYMs, but
- # doing so isn't logical and won't happen in practice. It's also pointless
- # to run dump_syms or archive dSYMs in a component build, where all of the
- # interesting symbols and debug info are tucked away in other libraries
- # beyond the set explicitly listed here.
- # This list must be updated with the two targets' deps list below, and
- # the list of _dsyms in :chrome_dsym_archive.
- _chrome_symbols_sources = [
- "$root_out_dir/$chrome_product_full_name.app/Contents/MacOS/$chrome_product_full_name",
- "$root_out_dir/chrome_crashpad_handler",
- "$root_out_dir/libEGL.dylib",
- "$root_out_dir/libGLESv2.dylib",
- "$root_out_dir/libvk_swiftshader.dylib",
- _framework_binary_path,
- ]
- if (build_with_internal_optimization_guide) {
- _chrome_symbols_sources +=
- [ "$root_out_dir/liboptimization_guide_internal.dylib" ]
- }
- foreach(helper_params, chrome_mac_helpers) {
- _chrome_symbols_sources += [ "$root_out_dir/${chrome_helper_name}${helper_params[2]}.app/Contents/MacOS/${chrome_helper_name}${helper_params[2]}" ]
- }
- 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" ]
- dump_syms = "//third_party/breakpad:dump_syms($host_toolchain)"
- args = rebase_path(outputs, root_build_dir) + [
- rebase_path(get_label_info(dump_syms, "root_out_dir") + "/" +
- get_label_info(dump_syms, "name"),
- root_build_dir),
- "-a", "x86_64",
- "-g",
- rebase_path(
- "$root_out_dir/{{source_file_part}}.dSYM/Contents/Resources/DWARF/{{source_file_part}}",
- root_build_dir),
- "{{source}}",
- ]
- deps = [
- ":chrome_app",
- ":chrome_framework",
- "//components/crash/core/app:chrome_crashpad_handler",
- "//third_party/angle:libEGL",
- "//third_party/angle:libGLESv2",
- "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan",
- dump_syms,
- ]
- if (build_with_internal_optimization_guide) {
- deps += [ "//components/optimization_guide/internal:optimization_guide_internal" ]
- }
- foreach(helper_params, chrome_mac_helpers) {
- deps += [ ":chrome_helper_app_${helper_params[0]}" ]
- }
- }
- action("nw_sym_archive") {
- script = "//content/nw/tools/archive_symbols.py"
- _syms = [
- "$root_out_dir/$chrome_framework_name-$chrome_version_full.breakpad",
- "$root_out_dir/$chrome_helper_name-$chrome_version_full.breakpad",
- "$root_out_dir/$chrome_product_full_name-$chrome_version_full.breakpad",
- ]
- sources = _chrome_symbols_sources
- _output = "$root_out_dir/nwjs.breakpad.tar"
- outputs = [
- _output,
- ]
- args = [ rebase_path(_output, root_out_dir) ] +
- rebase_path(_syms, root_out_dir)
- deps = [
- ":chrome_app",
- ":chrome_framework",
- ":chrome_dump_syms",
- "//components/crash/core/app:chrome_crashpad_handler",
- "//third_party/angle:libEGL",
- "//third_party/angle:libGLESv2",
- "//third_party/crashpad/crashpad/handler:crashpad_handler",
- "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan",
- ]
- foreach(helper_params, chrome_mac_helpers) {
- deps += [ ":chrome_helper_app_${helper_params[0]}" ]
- }
- }
- 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/$chrome_framework_name.dSYM",
- "$root_out_dir/$chrome_product_full_name.dSYM",
- "$root_out_dir/chrome_crashpad_handler.dSYM",
- "$root_out_dir/libEGL.dylib.dSYM",
- "$root_out_dir/libGLESv2.dylib.dSYM",
- "$root_out_dir/libvk_swiftshader.dylib.dSYM",
- ]
- if (build_with_internal_optimization_guide) {
- _dsyms += [ "$root_out_dir/liboptimization_guide_internal.dylib.dSYM" ]
- }
- deps = [
- ":chrome_app",
- ":chrome_framework",
- "//components/crash/core/app:chrome_crashpad_handler",
- "//third_party/angle:libEGL",
- "//third_party/angle:libGLESv2",
- "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan",
- ]
- if (build_with_internal_optimization_guide) {
- deps += [ "//components/optimization_guide/internal:optimization_guide_internal" ]
- }
- foreach(helper_params, chrome_mac_helpers) {
- _dsyms +=
- [ "$root_out_dir/${chrome_helper_name}${helper_params[2]}.dSYM" ]
- deps += [ ":chrome_helper_app_${helper_params[0]}" ]
- }
- 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)
- }
- } else {
- group("chrome_dump_syms") {
- }
- group("chrome_dsym_archive") {
- }
- }
- }
- group("dependencies") {
- public_deps = [
- "//build:branding_buildflags",
- "//build:chromeos_buildflags",
- "//chrome/browser",
- "//chrome/browser/policy:path_parser",
- "//chrome/child",
- "//chrome/common",
- "//chrome/gpu",
- "//chrome/renderer",
- "//chrome/utility",
- "//components/gwp_asan/buildflags",
- "//components/heap_profiling/in_process",
- "//components/power_scheduler",
- "//components/services/heap_profiling",
- "//components/startup_metric_utils/browser",
- "//components/sync",
- "//components/upload_list:upload_list",
- "//content/public/child",
- "//pdf",
- "//services/tracing/public/cpp",
- "//third_party/blink/public:blink_devtools_frontend_resources",
- "//third_party/blink/public:blink_devtools_inspector_resources",
- "//third_party/libvpx",
- "//v8:v8_headers",
- ]
- if (enable_plugins) {
- public_deps += [ "//ppapi/host" ]
- }
- if (enable_basic_printing) {
- public_deps += [ "//printing" ]
- }
- if (enable_gwp_asan) {
- public_deps += [ "//components/gwp_asan/client" ]
- }
- if (enable_nacl) {
- public_deps += [
- "//components/nacl/browser",
- "//components/nacl/renderer/plugin:nacl_trusted_plugin",
- ]
- }
- if (is_chromeos) {
- public_deps += [ "//chromeos/dbus/constants" ]
- }
- if (is_chromeos_lacros) {
- public_deps += [
- "//chromeos/lacros",
- "//chromeos/lacros/dbus",
- ]
- }
- if (is_chromeos_ash) {
- public_deps += [
- "//ash/constants",
- "//chrome/browser/chromeos",
- "//chromeos",
- "//chromeos/memory",
- ]
- }
- if (!is_fuchsia) {
- public_deps += [ "//components/crash/core/app" ]
- }
- }
- 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"
- }
- }
- 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:resources",
- "//components/autofill/core/browser:autofill_address_rewriter_resources",
- ]
- }
- if (is_chrome_branded && !is_android) {
- if (!is_mac) {
- _preinstalled_apps_target_type = "copy"
- } else {
- _preinstalled_apps_target_type = "bundle_data"
- }
- target(_preinstalled_apps_target_type, "preinstalled_apps") {
- visibility = [ ":packed_resources" ]
- if (is_mac) {
- visibility += [
- ":chrome_framework",
- ":chrome_framework_shared_library",
- ]
- }
- sources = [ "browser/resources/default_apps/external_extensions.json" ]
- 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)
- }
- }
- if (!is_android) {
- chrome_paks("packed_resources") {
- if (is_mac) {
- output_dir = "$root_gen_dir/repack"
- copy_data_to_bundle = true
- } else {
- output_dir = root_out_dir
- mark_as_data = true
- }
- if (enable_resource_allowlist_generation) {
- repack_allowlist = _chrome_resource_allowlist
- deps = [ ":resource_allowlist" ]
- }
- if (is_chrome_branded && !is_mac) {
- public_deps = [ ":preinstalled_apps" ]
- }
- files_to_hash = [
- "resources.pak",
- "nw_100_percent.pak",
- ]
- if (enable_hidpi) {
- files_to_hash += [ "nw_200_percent.pak" ]
- }
- }
- }
- repack("unit_tests_pak") {
- sources = [ "$root_gen_dir/chrome/chrome_test_resources.pak" ]
- output = "$root_out_dir/unit_tests.pak"
- deps = [ "//chrome/test/data:chrome_test_resources" ]
- }
- 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" ]
- if (!is_android) {
- sources += [ "$root_gen_dir/chrome/webui_generated_test_resources.pak" ]
- deps += [ "//chrome/test/data/webui: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("assist_ranker_prediction_enum_javagen") {
- sources = [
- "browser/android/contextualsearch/contextual_search_ranker_logger_impl.h",
- ]
- }
- java_cpp_enum("partner_bookmarks_javagen") {
- sources = [ "browser/android/bookmarks/partner_bookmarks_reader.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("download_enum_javagen") {
- sources = [
- "browser/download/android/download_open_source.h",
- "browser/download/download_dialog_types.h",
- "browser/download/download_prompt_status.h",
- ]
- }
- java_cpp_enum("instant_apps_reasons_enum_javagen") {
- sources = [ "browser/android/instantapps/instant_apps_settings.cc" ]
- }
- java_cpp_enum("supervised_user_url_filter_enum_javagen") {
- sources = [ "browser/supervised_user/supervised_user_url_filter.h" ]
- }
- java_cpp_enum("context_menu_image_format_enum_javagen") {
- sources =
- [ "browser/android/context_menu/context_menu_native_delegate_impl.h" ]
- }
- source_set("chrome_android_core") {
- sources = [
- "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",
- ]
- libs = [
- "android",
- "jnigraphics",
- ]
- public_deps = [
- "//chrome/browser",
- "//chrome/utility",
- ]
- deps = [
- ":dependencies",
- "//chrome/browser/ui",
- "//chrome/child",
- "//chrome/common",
- "//chrome/common/profiler",
- "//chrome/gpu",
- "//chrome/renderer",
- "//components/gwp_asan/buildflags",
- "//components/heap_profiling/in_process",
- "//components/minidump_uploader",
- "//components/safe_browsing:buildflags",
- "//components/safe_browsing/android:safe_browsing_api_handler",
- "//components/safe_browsing/android:safe_browsing_mobile",
- "//components/services/heap_profiling",
- "//content/public/app",
- ]
- # Explicit dependency required for JNI registration to be able to
- # find the native side functions.
- if (is_android && is_component_build) {
- deps += [
- "//components/viz/service",
- "//device/gamepad",
- "//ui/events/devices",
- ]
- }
- if (is_android) {
- deps += [ "//components/crash/android:crash_android" ]
- }
- if (is_chromeos_ash) {
- public_deps += [ "//ui/lottie" ]
- }
- if (enable_vr) {
- deps += [ "//third_party/gvr-android-sdk:gvr_shim" ]
- }
- if (enable_gwp_asan) {
- deps += [ "//components/gwp_asan/client" ]
- }
- }
- }
- # Android also supports this, but uses
- # //chrome/android:${_variant}_resource_allowlist.
- if (is_win && enable_resource_allowlist_generation) {
- generate_resource_allowlist("resource_allowlist") {
- deps = [ ":chrome_dll" ]
- inputs = [ "$root_out_dir/chrome.dll.pdb" ]
- output = _chrome_resource_allowlist
- }
- }
- if (is_linux || is_chromeos) {
- if (is_official_build) {
- group("linux_symbols") {
- deps = [
- ":angle_egl_symbols",
- ":angle_gles_symbols",
- ":chrome_crashpad_symbols",
- ":chrome_symbols",
- ]
- if (is_linux) {
- deps += [ ":swiftshader_vk_symbols" ]
- }
- if (!is_chromeos) {
- deps += [ ":angle_libvulkan_symbols" ]
- }
- if (build_with_internal_optimization_guide) {
- deps += [ ":optimization_guide_symbols" ]
- }
- }
- extract_symbols("chrome_symbols") {
- binary = "$root_out_dir/nw"
- if (current_cpu == "x86") {
- # GYP used "ia32" so keep that naming for back-compat.
- symbol_file = "$root_out_dir/nw.breakpad.ia32"
- } else {
- symbol_file = "$root_out_dir/nw.breakpad.$current_cpu"
- }
- deps = [ ":chrome" ]
- }
- extract_symbols("chrome_crashpad_symbols") {
- binary = "$root_out_dir/chrome_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 = [ "//components/crash/core/app:chrome_crashpad_handler" ]
- }
- extract_symbols("swiftshader_vk_symbols") {
- binary = "$root_out_dir/libvk_swiftshader.so"
- if (current_cpu == "x86") {
- # GYP used "ia32" so keep that naming for back-compat.
- symbol_file = "$root_out_dir/libvk_swiftshader.breakpad.ia32"
- } else {
- symbol_file = "$root_out_dir/libvk_swiftshader.breakpad.$current_cpu"
- }
- deps = [ "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan" ]
- }
- extract_symbols("angle_egl_symbols") {
- binary = "$root_out_dir/libEGL.so"
- if (current_cpu == "x86") {
- # GYP used "ia32" so keep that naming for back-compat.
- symbol_file = "$root_out_dir/angle_libegl.breakpad.ia32"
- } else {
- symbol_file = "$root_out_dir/angle_libegl.breakpad.$current_cpu"
- }
- deps = [ "//third_party/angle:libEGL" ]
- }
- extract_symbols("angle_gles_symbols") {
- binary = "$root_out_dir/libGLESv2.so"
- if (current_cpu == "x86") {
- # GYP used "ia32" so keep that naming for back-compat.
- symbol_file = "$root_out_dir/angle_libgles.breakpad.ia32"
- } else {
- symbol_file = "$root_out_dir/angle_libgles.breakpad.$current_cpu"
- }
- deps = [ "//third_party/angle:libGLESv2" ]
- }
- if (!is_chromeos) {
- extract_symbols("angle_libvulkan_symbols") {
- binary = "$root_out_dir/libvulkan.so.1"
- if (current_cpu == "x86") {
- # GYP used "ia32" so keep that naming for back-compat.
- symbol_file = "$root_out_dir/angle_libvulkan.breakpad.ia32"
- } else {
- symbol_file = "$root_out_dir/angle_libvulkan.breakpad.$current_cpu"
- }
- deps = [ "//third_party/vulkan-deps/vulkan-loader/src:libvulkan" ]
- }
- }
- if (build_with_internal_optimization_guide) {
- extract_symbols("optimization_guide_symbols") {
- binary = "$root_out_dir/liboptimization_guide_internal.so"
- if (current_cpu == "x86") {
- # GYP used "ia32" so keep that naming for back-compat.
- symbol_file =
- "$root_out_dir/optimization_guide_internal.breakpad.ia32"
- } else {
- symbol_file =
- "$root_out_dir/optimization_guide_internal.breakpad.$current_cpu"
- }
- deps = [ "//components/optimization_guide/internal:optimization_guide_internal" ]
- }
- }
- }
- # Copies some scripts and resources that are used for desktop integration.
- copy("xdg_mime") {
- sources = [
- "//chrome/tools/build/linux/chrome-wrapper",
- "//third_party/xdg-utils/scripts/xdg-mime",
- "//third_party/xdg-utils/scripts/xdg-settings",
- ]
- if (is_linux) {
- sources +=
- [ "//chrome/app/theme/$branding_path_component/product_logo_48.png" ]
- } else {
- sources += [
- "//chrome/app/theme/$branding_path_component/linux/product_logo_48.png",
- ]
- }
- outputs = [ "$root_out_dir/{{source_file_part}}" ]
- }
- }
- if (is_chromeos_lacros && is_official_build) {
- # This will strip chrome binary and produce chrome.debug with symbols.
- strip_binary("strip_chrome_binary") {
- binary_input = "$root_out_dir/chrome"
- symbol_output = "$root_out_dir/chrome.debug"
- stripped_binary_output = "$root_out_dir/chrome.stripped"
- deps = [ ":chrome" ]
- }
- }
|