BUILD.gn 59 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849
  1. # Copyright 2014 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. import("//build/config/chrome_build.gni")
  5. import("//build/config/chromeos/ui_mode.gni")
  6. import("//build/config/compiler/compiler.gni")
  7. import("//build/config/compiler/pgo/pgo.gni")
  8. import("//build/config/features.gni")
  9. import("//build/config/locales.gni")
  10. import("//build/config/python.gni")
  11. import("//build/config/sanitizers/sanitizers.gni")
  12. import("//build/config/ui.gni")
  13. import("//build/config/win/console_app.gni")
  14. import("//build/config/win/manifest.gni")
  15. import("//build/toolchain/toolchain.gni")
  16. import("//chrome/browser/chrome_for_testing/buildflags.gni")
  17. import("//chrome/chrome_paks.gni")
  18. import("//chrome/common/features.gni")
  19. import("//chrome/process_version_rc_template.gni")
  20. import("//components/exo/buildflags.gni")
  21. import("//components/gwp_asan/buildflags/buildflags.gni")
  22. import("//components/nacl/features.gni")
  23. import("//components/optimization_guide/features.gni")
  24. import("//extensions/buildflags/buildflags.gni")
  25. import("//media/media_options.gni")
  26. import("//ppapi/buildflags/buildflags.gni")
  27. import("//third_party/blink/public/public_features.gni")
  28. import("//third_party/widevine/cdm/widevine.gni")
  29. import("//tools/resources/generate_resource_allowlist.gni")
  30. import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
  31. import("//ui/gl/features.gni")
  32. import("//v8/gni/v8.gni")
  33. if (is_android) {
  34. import("//build/config/android/rules.gni")
  35. } else if (is_linux || is_chromeos) {
  36. import("//build/linux/extract_symbols.gni")
  37. import("//build/linux/strip_binary.gni")
  38. } else if (is_mac) {
  39. import("//build/apple/compile_entitlements.gni")
  40. import("//build/apple/compile_plist.gni")
  41. import("//build/apple/tweak_info_plist.gni")
  42. import("//build/compiled_action.gni")
  43. import("//build/config/apple/symbols.gni")
  44. import("//build/config/mac/mac_sdk.gni")
  45. import("//build/config/mac/rules.gni")
  46. import("//build/util/branding.gni")
  47. import("//chrome/browser/buildflags.gni")
  48. import("//chrome/updater/branding.gni")
  49. import("//chrome/version.gni")
  50. import("//content/public/app/mac_helpers.gni")
  51. import("//media/cdm/library_cdm/cdm_paths.gni")
  52. import("//third_party/icu/config.gni")
  53. }
  54. declare_args() {
  55. # Indicates whether keystone registration framework should be enabled (see
  56. # action("keystone_registration_framework") below). There are some tests
  57. # where we'd like for it to be disabled. (https://crbug.com/909080)
  58. enable_keystone_registration_framework = true
  59. }
  60. assert(!is_ios, "Chromium/iOS shouldn't use anything in //chrome")
  61. if (is_win && enable_resource_allowlist_generation) {
  62. _chrome_resource_allowlist = "$target_gen_dir/chrome_resource_allowlist.txt"
  63. }
  64. if (is_win) {
  65. action("reorder_imports") {
  66. script = "//build/win/reorder-imports.py"
  67. # See comment in chrome_dll.gypi in the hardlink_to_output
  68. # target for why this cannot be 'initial' like the DLL.
  69. inputs = [ "$root_out_dir/initialexe/chrome.exe" ]
  70. outputs = [
  71. "$root_out_dir/chrome.exe",
  72. "$root_out_dir/chrome.exe.pdb",
  73. ]
  74. args = [
  75. "-i",
  76. rebase_path("$root_out_dir/initialexe", root_build_dir),
  77. "-o",
  78. rebase_path("$root_out_dir", root_build_dir),
  79. "-a",
  80. current_cpu,
  81. ]
  82. deps = [ ":chrome_initial" ]
  83. }
  84. }
  85. # This does not currently work. See crbug.com/1311822.
  86. # This target exists above chrome and it's main components in the dependency
  87. # tree as a central place to put assert_no_deps annotations. Since this depends
  88. # on Chrome and the main DLLs it uses, it will transitively assert that those
  89. # targets also have no deps on disallowed things.
  90. group("assert_no_deps") {
  91. deps = []
  92. if (is_android) {
  93. deps += [ "//chrome/android:chrome_public_apk" ]
  94. } else {
  95. deps += [ ":chrome" ]
  96. }
  97. if (is_win) {
  98. deps += [ ":chrome_dll" ]
  99. }
  100. # This should not pull in installer strings. This is will bloat the binary
  101. # for no reason and is easy to mess up. See the comment at the top of
  102. # //chrome/installer/util/BUILD.gn.
  103. assert_no_deps = [ "//chrome/installer/util:strings" ]
  104. }
  105. if (!is_android && !is_mac) {
  106. group("chrome") {
  107. public_deps = [ ":chrome_initial" ]
  108. data_deps = [ ":chrome_initial" ]
  109. # Do not add any more deps or data_deps to group("chrome").
  110. # Because chrome_initial sets its output name to "chrome", running commands
  111. # such as `ninja chrome` causes chrome_initial to be built instead. All
  112. # deps and data_deps should be added to the chrome_initial target instead.
  113. # Targets added here can only be built by explicitly using //chrome:chrome.
  114. # Windows-only deps are OK because chrome_initial uses initialexe/chrome as
  115. # the output name for that platform.
  116. # See crbug.com/1146571.
  117. if (is_win) {
  118. public_deps += [ ":reorder_imports" ]
  119. data_deps += [ ":reorder_imports" ]
  120. }
  121. }
  122. executable("chrome_initial") {
  123. configs -= [ "//build/config/compiler:thinlto_optimize_default" ]
  124. configs += [ "//build/config/compiler:thinlto_optimize_max" ]
  125. if (is_win) {
  126. output_name = "initialexe/chrome"
  127. } else {
  128. output_name = "chrome"
  129. }
  130. # Because the sources list varies so significantly per-platform, generally
  131. # each platform lists its own files rather than relying on filtering or
  132. # removing unused files.
  133. sources = [ "app/chrome_exe_resource.h" ]
  134. defines = []
  135. public_deps = []
  136. deps = [
  137. "//build:chromeos_buildflags",
  138. "//printing/buildflags",
  139. ]
  140. data = [ "$root_out_dir/resources.pak" ]
  141. data_deps = []
  142. if (is_chromeos_ash) {
  143. data_deps += [ "//sandbox/linux:chrome_sandbox" ]
  144. deps += [ "//components/exo/wayland:weston_test_stub" ]
  145. }
  146. if (also_build_lacros_chrome_for_architecture != "") {
  147. data_deps += [ "//chrome:chrome(//build/toolchain/cros:lacros_clang)" ]
  148. }
  149. if (is_win) {
  150. sources += [
  151. "app/chrome_exe.rc",
  152. "app/chrome_exe_main_win.cc",
  153. "app/delay_load_failure_hook_win.cc",
  154. "app/delay_load_failure_hook_win.h",
  155. "app/main_dll_loader_win.cc",
  156. "app/main_dll_loader_win.h",
  157. "common/crash_keys.cc",
  158. "common/crash_keys.h",
  159. ]
  160. deps += [
  161. ":chrome_dll",
  162. ":chrome_exe_version",
  163. ":copy_first_run",
  164. ":packed_resources_integrity",
  165. ":visual_elements_resources",
  166. "//base",
  167. "//build:branding_buildflags",
  168. "//chrome/app:chrome_exe_main_exports",
  169. "//chrome/app/version_assembly:chrome_exe_manifest",
  170. "//chrome/browser:active_use_util",
  171. "//chrome/browser:chrome_process_finder",
  172. "//chrome/browser/policy:path_parser",
  173. "//chrome/chrome_elf",
  174. "//chrome/common:constants",
  175. "//chrome/install_static:install_static_util",
  176. "//chrome/install_static:secondary_module",
  177. "//chrome/installer/util:constants",
  178. "//chrome/installer/util:did_run_support",
  179. "//components/browser_watcher:browser_watcher_client",
  180. "//components/crash/core/app",
  181. "//components/crash/core/app:run_as_crashpad_handler",
  182. "//components/crash/core/common",
  183. "//components/crash/win:chrome_wer",
  184. "//components/flags_ui:switches",
  185. "//content:sandbox_helper_win",
  186. "//content/public/common:static_switches",
  187. "//crypto",
  188. "//gpu/command_buffer/service",
  189. "//sandbox",
  190. "//sandbox/policy",
  191. "//sandbox/policy/mojom",
  192. "//third_party/breakpad:breakpad_handler",
  193. "//third_party/breakpad:breakpad_sender",
  194. "//third_party/crashpad/crashpad/util",
  195. "//ui/gl",
  196. ]
  197. data_deps = [
  198. "//chrome/app/version_assembly:version_assembly_manifest",
  199. "//chrome/browser/web_applications/chrome_pwa_launcher",
  200. "//chrome/chrome_proxy",
  201. "//chrome/elevation_service",
  202. "//chrome/notification_helper",
  203. ]
  204. defines += [ "CHROME_EXE_MAIN" ]
  205. if (win_console_app) {
  206. defines += [ "WIN_CONSOLE_APP" ]
  207. } else {
  208. # Set /SUBSYSTEM:WINDOWS for chrome.exe itself, unless a console build
  209. # has been requested.
  210. configs -= [ "//build/config/win:console" ]
  211. configs += [ "//build/config/win:windowed" ]
  212. }
  213. configs += [
  214. "//build/config/win:delayloads",
  215. "//build/config/win:delayloads_not_for_child_dll",
  216. ]
  217. if (current_cpu == "x86") {
  218. # Set the initial stack size to 0.5MiB, instead of the 1.5MiB needed by
  219. # Chrome's main thread. This saves significant memory on threads (like
  220. # those in the Windows thread pool, and others) whose stack size we can
  221. # only control through this setting. Because Chrome's main thread needs
  222. # a minimum 1.5 MiB stack, the main thread (in 32-bit builds only) uses
  223. # fibers to switch to a 1.5 MiB stack before running any other code.
  224. ldflags = [ "/STACK:0x80000" ]
  225. } else {
  226. # Increase the initial stack size. The default is 1MB, this is 8MB.
  227. ldflags = [ "/STACK:0x800000" ]
  228. }
  229. } else if (use_aura) {
  230. # Non-Windows aura entrypoint.
  231. sources += [ "app/chrome_exe_main_aura.cc" ]
  232. }
  233. if (is_linux || is_chromeos || is_fuchsia) {
  234. sources += [
  235. "app/chrome_dll_resource.h",
  236. "app/chrome_main.cc",
  237. "app/chrome_main_delegate.cc",
  238. "app/chrome_main_delegate.h",
  239. ]
  240. deps += [
  241. # On Linux, link the dependencies (libraries) that make up actual
  242. # Chromium functionality directly into the executable.
  243. ":dependencies",
  244. # For configuring PartitionAlloc
  245. "//base/allocator:buildflags",
  246. # For the sampling profiler.
  247. "//chrome/common/profiler",
  248. # Needed to use the master_preferences functions
  249. "//chrome/installer/util:with_no_strings",
  250. "//content/public/app",
  251. # For headless mode.
  252. "//headless:headless_shell_lib",
  253. ]
  254. public_deps = [ "//chrome/common:buildflags" ]
  255. if (!is_fuchsia) {
  256. public_deps += [
  257. ":xdg_mime", # Needs to be public for installer to consume files.
  258. ]
  259. data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ]
  260. }
  261. ldflags = []
  262. # On Chrome OS builds (for both ash-chrome and lacros-chrome), put
  263. # priority to the library in the installed directory.
  264. # This will avoid conflicting of exposed symbols.
  265. if (is_chromeos_device) {
  266. ldflags += [ "-L" + rebase_path(root_out_dir) ]
  267. }
  268. # On Chrome OS builds (for both ash-chrome and lacros-chrome), put
  269. # a metadata.json file in root directory containing Chrome version.
  270. if (is_chromeos) {
  271. data_deps += [ "//build:version_metadata" ]
  272. }
  273. # Chrome OS debug builds for arm need to pass --long-plt to the linker.
  274. # See https://bugs.chromium.org/p/chromium/issues/detail?id=583532
  275. if (is_chromeos_ash && is_debug && target_cpu == "arm") {
  276. ldflags += [ "-Wl,--long-plt" ]
  277. }
  278. if ((is_linux || is_chromeos_lacros) && !is_component_build &&
  279. !using_sanitizer) {
  280. version_script = "//build/linux/chrome.map"
  281. inputs = [ version_script ]
  282. ldflags += [ "-Wl,--version-script=" +
  283. rebase_path(version_script, root_build_dir) ]
  284. }
  285. if (is_chromeos_ash) {
  286. public_deps += [ "//ui/lottie" ]
  287. }
  288. if (is_chromeos_lacros) {
  289. deps += [
  290. "//chromeos/crosapi/cpp:crosapi_constants",
  291. "//chromeos/crosapi/mojom",
  292. "//chromeos/lacros:lacros_paths",
  293. "//chromeos/startup",
  294. "//ui/base",
  295. ]
  296. }
  297. }
  298. if (is_chromeos_ash || is_win) {
  299. data_deps += [ "//mojo/core:shared_library" ]
  300. }
  301. if (is_chromeos_ash) {
  302. data_deps += [ "//mojo/core:shared_libraries_for_arc" ]
  303. if (is_chromeos_device) {
  304. configs += [ "//build/config/chromeos:print_orderfile" ]
  305. configs += [ "//build/config/compiler:chrome_orderfile_config" ]
  306. }
  307. }
  308. # These files are used by the installer so we need a public dep.
  309. public_deps += [ ":packed_resources" ]
  310. # The step's output are needed at runtime, so we also need a data_dep.
  311. data_deps += [ ":packed_resources" ]
  312. # ChromeOS by design is safe to have rpath=$ORIGIN. This simplifies shared
  313. # library usage.
  314. if (is_chromeos_ash && !is_component_build) {
  315. configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
  316. }
  317. if (is_chromeos_lacros && is_chromeos_device) {
  318. configs += [ "//build/lacros:optional_shared_libgcc" ]
  319. }
  320. data_deps += [
  321. "//chrome/browser/resources/media/mei_preload:component",
  322. "//third_party/widevine/cdm",
  323. ]
  324. }
  325. } # !is_android && !is_mac
  326. if (is_win) {
  327. shared_library("chrome_dll") {
  328. configs += [ "//build/config/compiler:wexit_time_destructors" ]
  329. configs -= [ "//build/config/compiler:thinlto_optimize_default" ]
  330. configs += [ "//build/config/compiler:thinlto_optimize_max" ]
  331. defines = []
  332. sources = [
  333. "//base/win/dllmain.cc",
  334. "app/chrome_main.cc",
  335. "app/chrome_main_delegate.cc",
  336. "app/chrome_main_delegate.h",
  337. ]
  338. output_name = "chrome"
  339. deps = [
  340. ":chrome_dll_manifest",
  341. ":chrome_dll_version",
  342. ":dependencies",
  343. "//base/allocator:buildflags",
  344. "//chrome/app:chrome_dll_resources",
  345. "//chrome/app:command_ids",
  346. "//chrome/app/theme:chrome_unscaled_resources",
  347. "//chrome/chrome_elf",
  348. "//chrome/common:buildflags",
  349. "//chrome/common/profiler",
  350. "//chrome/install_static:install_static_util",
  351. "//chrome/install_static:secondary_module",
  352. "//components/browser_watcher:stability_client",
  353. "//components/crash/core/app",
  354. "//components/policy:generated",
  355. "//content/public/app",
  356. "//crypto",
  357. "//headless:headless_renderer",
  358. "//headless:headless_shell_browser_lib",
  359. "//net:net_resources",
  360. "//ppapi/buildflags",
  361. "//sandbox/win:sandbox",
  362. "//third_party/cld_3/src/src:cld_3",
  363. "//third_party/wtl",
  364. "//ui/views",
  365. ]
  366. configs += [ "//build/config/win:delayloads" ]
  367. if (use_aura) {
  368. deps += [ "//ui/compositor" ]
  369. }
  370. }
  371. copy("copy_first_run") {
  372. sources = [ "app/FirstRun" ]
  373. outputs = [ "$root_out_dir/First Run" ]
  374. }
  375. } else if (is_mac) {
  376. chrome_helper_name = chrome_product_full_name + " Helper"
  377. chrome_framework_name = chrome_product_full_name + " Framework"
  378. chrome_framework_version = chrome_version_full
  379. verify_dynamic_libraries = !is_component_build && !is_asan
  380. if (host_os == "mac") {
  381. objdump_path = mac_bin_path
  382. } else {
  383. objdump_path = rebase_path("$clang_base_path/bin/", root_build_dir)
  384. }
  385. group("chrome") {
  386. deps = [ ":chrome_app" ]
  387. data_deps = [ ":chrome_app" ]
  388. if (verify_dynamic_libraries) {
  389. deps += [ ":verify_libraries_chrome_app" ]
  390. }
  391. if (is_chrome_branded && is_official_build) {
  392. deps += [
  393. ":chrome_dsym_archive",
  394. ":chrome_dump_syms",
  395. ]
  396. }
  397. }
  398. tweak_info_plist("chrome_app_plist") {
  399. info_plist = "app/app-Info.plist"
  400. args = [
  401. "--breakpad=0",
  402. "--scm=1",
  403. "--bundle_id=$chrome_mac_bundle_id",
  404. ]
  405. if (is_chrome_branded) {
  406. args += [ "--keystone=1" ]
  407. if (current_cpu == "arm64") {
  408. args += [ "--keystone-base-tag=arm64" ]
  409. }
  410. } else {
  411. args += [ "--keystone=0" ]
  412. }
  413. if (enable_chromium_updater) {
  414. args += [ "--privileged_helper_id=$privileged_helper_name" ]
  415. }
  416. }
  417. mac_app_bundle("chrome_app") {
  418. output_name = chrome_product_full_name
  419. info_plist_target = ":chrome_app_plist"
  420. extra_substitutions = [
  421. "CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
  422. "CHROMIUM_SHORT_NAME=$chrome_product_short_name",
  423. "CHROMIUM_CREATOR=$chrome_mac_creator_code",
  424. ]
  425. sources = [ "app/chrome_exe_main_mac.cc" ]
  426. extra_configs = [ "//build/config/compiler:wexit_time_destructors" ]
  427. deps = [
  428. ":chrome_app_strings_bundle_data",
  429. ":chrome_resources",
  430. ":chrome_versioned_bundle_data",
  431. "//base/allocator:early_zone_registration_mac",
  432. "//build:branding_buildflags",
  433. "//chrome/common:buildflags",
  434. "//chrome/common:version_header",
  435. ]
  436. if (enable_stripping) {
  437. # At link time, preserve the global symbols specified in the .exports
  438. # file. All other global symbols will be marked as private. The default
  439. # //build/config/mac:strip_all config will then remove the remaining
  440. # local and debug symbols.
  441. ldflags = [ "-Wl,-exported_symbols_list," +
  442. rebase_path("app/app.exports", root_build_dir) ]
  443. }
  444. if (is_component_build) {
  445. # In a component build, the framework is directly linked to the
  446. # executable because dlopen() and loading all the dependent dylibs
  447. # is time-consuming, see https://crbug.com/1197495.
  448. deps += [ ":chrome_framework+link" ]
  449. ldflags = [ "-Wl,-rpath,@executable_path/../Frameworks" ]
  450. # The Framework is packaged inside the .app bundle. But when using the
  451. # component build, all the dependent shared libraries of :chrome_dll are
  452. # not packaged within the framework. This data_deps line makes all of
  453. # those dependent libraries runtime dependencies of the .app bundle.
  454. # This is a bit of a hack, since GN deliberately terminates its search
  455. # for runtime_deps at create_bundle nodes (https://crbug.com/1010347).
  456. data_deps = [ ":chrome_framework" ]
  457. }
  458. if (enable_chromium_updater) {
  459. deps += [ ":chromium_updater_privileged_helper" ]
  460. }
  461. }
  462. if (verify_dynamic_libraries) {
  463. action("verify_libraries_chrome_app") {
  464. script = "//chrome/tools/build/mac/verify_dynamic_libraries.py"
  465. inputs = [ "${root_out_dir}/${chrome_product_full_name}.app/Contents/MacOS/${chrome_product_full_name}" ]
  466. outputs = [ "$target_out_dir/run_$target_name.stamp" ]
  467. args = [
  468. "--stamp",
  469. rebase_path(outputs[0], root_out_dir),
  470. "-B",
  471. objdump_path,
  472. "--image",
  473. rebase_path(inputs[0], root_out_dir),
  474. "--allow",
  475. "/usr/lib/libSystem.B.dylib",
  476. ]
  477. deps = [ ":chrome_app" ]
  478. }
  479. }
  480. compiled_action("chrome_app_strings") {
  481. tool = "//chrome/tools/build/mac:infoplist_strings_util"
  482. inputs = []
  483. outputs = []
  484. foreach(locale, platform_pak_locales) {
  485. if (is_chrome_branded) {
  486. _strings_file = "google_chrome_strings"
  487. } else {
  488. _strings_file = "chromium_strings"
  489. }
  490. inputs += [ "$root_gen_dir/chrome/${_strings_file}_${locale}.pak" ]
  491. }
  492. foreach(locale, locales_as_apple_outputs) {
  493. outputs += [
  494. "$target_gen_dir/app_infoplist_strings/$locale.lproj/InfoPlist.strings",
  495. ]
  496. }
  497. args =
  498. [
  499. "-b",
  500. "${branding_path_component}_strings",
  501. "-v",
  502. chrome_version_full,
  503. "-g",
  504. rebase_path("$root_gen_dir/chrome", root_build_dir),
  505. "-o",
  506. rebase_path("$target_gen_dir/app_infoplist_strings", root_build_dir),
  507. "-t",
  508. "main",
  509. ] + platform_pak_locales
  510. if (is_chrome_branded) {
  511. deps = [ "//chrome/app:google_chrome_strings" ]
  512. } else {
  513. deps = [ "//chrome/app:chromium_strings" ]
  514. }
  515. }
  516. foreach(locale, locales_as_apple_outputs) {
  517. bundle_data("chrome_app_strings_${locale}_bundle_data") {
  518. sources = [
  519. "$target_gen_dir/app_infoplist_strings/$locale.lproj/InfoPlist.strings",
  520. ]
  521. outputs =
  522. [ "{{bundle_resources_dir}}/$locale.lproj/{{source_file_part}}" ]
  523. public_deps = [ ":chrome_app_strings" ]
  524. }
  525. }
  526. group("chrome_app_strings_bundle_data") {
  527. public_deps = []
  528. foreach(locale, locales_as_apple_outputs) {
  529. public_deps += [ ":chrome_app_strings_${locale}_bundle_data" ]
  530. }
  531. }
  532. bundle_data("chrome_app_icon") {
  533. sources = [ "app/theme/$branding_path_component/mac/app.icns" ]
  534. outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
  535. }
  536. bundle_data("chrome_resources") {
  537. sources = [
  538. "$root_out_dir/$chrome_mac_bundle_id.manifest",
  539. "app/theme/$branding_path_component/mac/document.icns",
  540. "browser/ui/cocoa/applescript/scripting.sdef",
  541. ]
  542. outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
  543. public_deps = [
  544. ":chrome_app_icon",
  545. ":chrome_app_strings",
  546. "//components/policy:chrome_manifest_bundle",
  547. ]
  548. }
  549. bundle_data("chrome_versioned_bundle_data") {
  550. sources = [ "$root_out_dir/$chrome_framework_name.framework" ]
  551. outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ]
  552. public_deps = [
  553. # Before bundling the versioned app components, delete any existing
  554. # versions.
  555. ":clean_up_old_versions",
  556. # verify_chrome_framework_order depends on :chrome_framework and, for
  557. # non-component builds, will ensure the export symbol table is correct.
  558. ":verify_chrome_framework_order",
  559. ]
  560. if (enable_widevine_cdm_host_verification) {
  561. # The :chrome_framework_widevine_signature target copies into the
  562. # :chrome_framework bundle. But because the signing file depends on the
  563. # framework itself, that would cause a cyclical dependency. Instead,
  564. # this dependency directly copies the file into the framework's
  565. # resources directory.
  566. public_deps += [ ":chrome_framework_widevine_signature" ]
  567. }
  568. }
  569. if (enable_chromium_updater) {
  570. bundle_data("chromium_updater_privileged_helper") {
  571. sources = [ "$root_out_dir/$privileged_helper_name" ]
  572. outputs = [
  573. "{{bundle_contents_dir}}/Library/LaunchServices/{{source_file_part}}",
  574. ]
  575. public_deps = [ "//chrome/updater/mac:privileged_helper" ]
  576. }
  577. }
  578. action("clean_up_old_versions") {
  579. script = "//chrome/tools/build/mac/clean_up_old_versions.py"
  580. _stamp_file = "$root_gen_dir/run_$target_name.stamp"
  581. outputs = [ _stamp_file ]
  582. _versions_dir = "$root_out_dir/$chrome_product_full_name.app/Contents/Frameworks/$chrome_framework_name.framework/Versions"
  583. args = [
  584. "--versions-dir",
  585. rebase_path(_versions_dir, root_build_dir),
  586. "--stamp",
  587. rebase_path(_stamp_file, root_build_dir),
  588. "--keep",
  589. chrome_version_full,
  590. "--keep",
  591. "Current",
  592. ]
  593. }
  594. tweak_info_plist("chrome_helper_plist") {
  595. info_plist = "app/helper-Info.plist"
  596. args = [
  597. "--breakpad=0",
  598. "--keystone=0",
  599. "--scm=0",
  600. ]
  601. }
  602. compile_entitlements("entitlements") {
  603. entitlements_templates = [ "app/app-entitlements.plist" ]
  604. if (is_chrome_branded) {
  605. # These entitlements are bound to the official Google Chrome signing
  606. # certificate and will not necessarily work in any other build.
  607. entitlements_templates += [ "app/app-entitlements-chrome.plist" ]
  608. }
  609. output_name = "$target_gen_dir/app-entitlements.plist"
  610. substitutions = [
  611. "CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
  612. "CHROMIUM_TEAM_ID=$chrome_mac_team_id",
  613. ]
  614. visibility = [ "//chrome/installer/mac:copies" ]
  615. }
  616. template("chrome_helper_app") {
  617. mac_app_bundle(target_name) {
  618. assert(defined(invoker.helper_name_suffix))
  619. assert(defined(invoker.helper_bundle_id_suffix))
  620. output_name = chrome_helper_name + invoker.helper_name_suffix
  621. if (defined(invoker.info_plist_target)) {
  622. info_plist_target = invoker.info_plist_target
  623. } else {
  624. info_plist_target = ":chrome_helper_plist"
  625. }
  626. extra_substitutions = [
  627. "CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
  628. "CHROMIUM_SHORT_NAME=$chrome_product_short_name",
  629. "CHROMIUM_HELPER_SUFFIX=${invoker.helper_name_suffix}",
  630. "CHROMIUM_HELPER_BUNDLE_ID_SUFFIX=${invoker.helper_bundle_id_suffix}",
  631. ]
  632. sources = [ "app/chrome_exe_main_mac.cc" ]
  633. extra_configs = [ "//build/config/compiler:wexit_time_destructors" ]
  634. defines = [ "HELPER_EXECUTABLE" ]
  635. deps = [
  636. "//base/allocator:early_zone_registration_mac",
  637. "//build:branding_buildflags",
  638. "//chrome/common:version_header",
  639. "//sandbox/mac:seatbelt",
  640. ]
  641. if (defined(invoker.deps)) {
  642. deps += invoker.deps
  643. }
  644. ldflags = []
  645. if (is_component_build) {
  646. # In a component build, the framework is directly linked to the
  647. # executable because dlopen() and loading all the dependent dylibs
  648. # is time-consuming, see https://crbug.com/1197495.
  649. deps += [ ":chrome_framework+link_nested" ]
  650. ldflags += [
  651. # The helper is in Chromium.app/Contents/Frameworks/Chromium Framework.framework/Versions/X/Helpers/Chromium Helper.app/Contents/MacOS
  652. # so set rpath up to the base.
  653. "-Wl,-rpath,@loader_path/../../../../../../../../../..",
  654. # ... and up to Contents/Frameworks.
  655. "-Wl,-rpath,@executable_path/../../../../../../..",
  656. ]
  657. }
  658. if (enable_stripping) {
  659. # At link time, preserve the global symbols specified in the .exports
  660. # file. All other global symbols will be marked as private. The default
  661. # //build/config/mac:strip_all config will then remove the remaining
  662. # local and debug symbols.
  663. ldflags += [ "-Wl,-exported_symbols_list," +
  664. rebase_path("app/app.exports", root_build_dir) ]
  665. }
  666. }
  667. }
  668. # The following *_helper_params are added to the ones provided by //content
  669. # listed in content_mac_helpers (see //content/public/app/mac_helpers.gni).
  670. # These allow //chrome to add custom helper apps in addition to the ones
  671. # provided by //content. The params here have the same form as the content
  672. # helpers and are defined as a tuple of these elements:
  673. # target name - A short name to be used when defining the target for that
  674. # helper variant.
  675. # bundle ID suffix - A string fragment to append to the CFBundleIdentifier of
  676. # the helper.
  677. # app name suffix - A string fragment to append to the outer bundle name as
  678. # well as the inner executable. This should be reflected in
  679. # the target's output_name.
  680. # Helper app to display alert notifications. This is necessary as an app can
  681. # only display either banner or alert style notifications and the main app
  682. # will display banners.
  683. alert_helper_params = [
  684. "alerts",
  685. ".alerts",
  686. " (Alerts)",
  687. ]
  688. # Merge all helper apps needed by //content and //chrome.
  689. chrome_mac_helpers = content_mac_helpers + [ alert_helper_params ]
  690. # Create all helper apps required by //content.
  691. foreach(helper_params, content_mac_helpers) {
  692. chrome_helper_app("chrome_helper_app_${helper_params[0]}") {
  693. helper_name_suffix = helper_params[2]
  694. helper_bundle_id_suffix = helper_params[1]
  695. }
  696. }
  697. # Create app for the alert helper manually here as we want to modify the plist
  698. # to set the alert style and add the app icon to its resources.
  699. tweak_info_plist("chrome_helper_app_alerts_plist") {
  700. deps = [ ":chrome_helper_plist" ]
  701. info_plists = get_target_outputs(":chrome_helper_plist") +
  702. [ "app/helper-alerts-Info.plist" ]
  703. }
  704. # Create and bundle an InfoPlist.strings for the alert helper app.
  705. # TODO(crbug.com/1182393): Disambiguate and localize alert helper app name.
  706. compile_plist("chrome_helper_app_alerts_plist_strings") {
  707. format = "binary1"
  708. plist_templates = [ "app/helper-alerts-InfoPlist.strings" ]
  709. substitutions = [ "CHROMIUM_FULL_NAME=$chrome_product_full_name" ]
  710. output_name = "$target_gen_dir/helper_alerts_infoplist_strings/base.lproj/InfoPlist.strings"
  711. }
  712. bundle_data("chrome_helper_app_alerts_resources") {
  713. sources = get_target_outputs(":chrome_helper_app_alerts_plist_strings")
  714. outputs = [ "{{bundle_resources_dir}}/base.lproj/{{source_file_part}}" ]
  715. public_deps = [ ":chrome_helper_app_alerts_plist_strings" ]
  716. }
  717. chrome_helper_app("chrome_helper_app_${alert_helper_params[0]}") {
  718. helper_name_suffix = alert_helper_params[2]
  719. helper_bundle_id_suffix = alert_helper_params[1]
  720. info_plist_target = ":chrome_helper_app_alerts_plist"
  721. deps = [
  722. ":chrome_app_icon",
  723. ":chrome_helper_app_alerts_resources",
  724. ]
  725. }
  726. if (verify_dynamic_libraries) {
  727. foreach(helper_params, chrome_mac_helpers) {
  728. _helper_target = helper_params[0]
  729. _helper_bundle_id = helper_params[1]
  730. _helper_suffix = helper_params[2]
  731. action("verify_libraries_chrome_helper_app_${_helper_target}") {
  732. script = "//chrome/tools/build/mac/verify_dynamic_libraries.py"
  733. inputs = [ "${root_out_dir}/${chrome_helper_name}${_helper_suffix}.app/Contents/MacOS/${chrome_helper_name}${_helper_suffix}" ]
  734. outputs = [ "$target_out_dir/run_$target_name.stamp" ]
  735. args = [
  736. "--stamp",
  737. rebase_path(outputs[0], root_out_dir),
  738. "-B",
  739. objdump_path,
  740. "--image",
  741. rebase_path(inputs[0], root_out_dir),
  742. # Do not --allow more libraries here without consulting with the
  743. # security team (security-dev@chromium.org).
  744. "--allow",
  745. "/usr/lib/libsandbox.1.dylib",
  746. "--allow",
  747. "/usr/lib/libSystem.B.dylib",
  748. ]
  749. deps = [ ":chrome_helper_app_${_helper_target}" ]
  750. }
  751. }
  752. }
  753. bundle_data("chrome_framework_helpers") {
  754. sources = [
  755. "$root_out_dir/app_mode_loader",
  756. "$root_out_dir/chrome_crashpad_handler",
  757. ]
  758. outputs = [ "{{bundle_contents_dir}}/Helpers/{{source_file_part}}" ]
  759. public_deps = [
  760. "//chrome/app_shim:app_mode_loader",
  761. "//components/crash/core/app:chrome_crashpad_handler",
  762. ]
  763. foreach(helper_params, chrome_mac_helpers) {
  764. sources +=
  765. [ "$root_out_dir/${chrome_helper_name}${helper_params[2]}.app" ]
  766. public_deps += [ ":chrome_helper_app_${helper_params[0]}" ]
  767. if (verify_dynamic_libraries) {
  768. public_deps +=
  769. [ ":verify_libraries_chrome_helper_app_${helper_params[0]}" ]
  770. }
  771. }
  772. if (enable_chromium_updater) {
  773. # A stable updater from CIPD is bundled with official builds only. For
  774. # local builds, a locally built updater will be bundled into the app.
  775. # TODO(crbug.com/1134642): Add ChromiumUpdater app to CIPD for use in
  776. # official builds.
  777. sources += [ "$root_out_dir/${updater_product_full_name}.app" ]
  778. public_deps += [
  779. "//chrome/updater/mac:browser_install_script",
  780. "//chrome/updater/mac:updater_bundle",
  781. "//chrome/updater/mac:updater_install_script",
  782. ]
  783. }
  784. }
  785. bundle_data("chrome_framework_resources") {
  786. sources = [
  787. # This image is used to badge the lock icon in the
  788. # authentication dialogs, such as those used for installation
  789. # from disk image and Keystone promotion (if so enabled). It
  790. # needs to exist as a file on disk and not just something in a
  791. # resource bundle because that's the interface that
  792. # Authorization Services uses. Also, Authorization Services
  793. # can't deal with .icns files.
  794. "app/theme/default_100_percent/$branding_path_component/product_logo_32.png",
  795. "browser/mac/install.sh",
  796. ]
  797. outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
  798. public_deps = [
  799. ":packed_resources",
  800. "//chrome/app_shim:app_mode_loader_plist_bundle_data",
  801. ]
  802. if (is_chrome_branded) {
  803. sources += [
  804. "browser/mac/keystone_promote_postflight.sh",
  805. "browser/mac/keystone_promote_preflight.sh",
  806. ]
  807. }
  808. if (icu_use_data_file) {
  809. sources += [ "$root_out_dir/icudtl.dat" ]
  810. public_deps += [ "//third_party/icu:icudata" ]
  811. }
  812. if (v8_use_external_startup_data) {
  813. public_deps += [ "//v8" ]
  814. if (use_v8_context_snapshot) {
  815. sources += [ "$root_out_dir/$v8_context_snapshot_filename" ]
  816. public_deps += [ "//tools/v8_context_snapshot" ]
  817. } else {
  818. sources += [ "$root_out_dir/snapshot_blob.bin" ]
  819. }
  820. }
  821. }
  822. if (enable_nacl) {
  823. bundle_data("chrome_framework_plugins") {
  824. sources = []
  825. outputs =
  826. [ "{{bundle_contents_dir}}/Internet Plug-Ins/{{source_file_part}}" ]
  827. public_deps = []
  828. if (enable_nacl) {
  829. if (current_cpu == "x86") {
  830. sources += [ "$root_out_dir/nacl_irt_x86_32.nexe" ]
  831. } else if (current_cpu == "x64") {
  832. sources += [ "$root_out_dir/nacl_irt_x86_64.nexe" ]
  833. }
  834. public_deps += [ "//ppapi/native_client:irt" ]
  835. }
  836. }
  837. } else {
  838. group("chrome_framework_plugins") {
  839. }
  840. }
  841. # EGL on MacOS ships with official chrome
  842. bundle_egl_libraries = use_egl
  843. if (bundle_egl_libraries) {
  844. # Add the ANGLE .dylibs in the MODULE_DIR of Chromium.app
  845. bundle_data("angle_binaries") {
  846. sources = [
  847. "$root_out_dir/egl_intermediates/libEGL.dylib",
  848. "$root_out_dir/egl_intermediates/libGLESv2.dylib",
  849. ]
  850. outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
  851. public_deps = [ "//ui/gl:angle_library_copy" ]
  852. }
  853. # Add the SwiftShader .dylibs in the MODULE_DIR of Chromium.app
  854. bundle_data("swiftshader_binaries") {
  855. sources = [
  856. "$root_out_dir/vk_intermediates/libvk_swiftshader.dylib",
  857. "$root_out_dir/vk_intermediates/vk_swiftshader_icd.json",
  858. ]
  859. outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
  860. public_deps = [ "//ui/gl:swiftshader_vk_library_copy" ]
  861. }
  862. }
  863. group("angle_library") {
  864. if (bundle_egl_libraries) {
  865. deps = [ ":angle_binaries" ]
  866. }
  867. }
  868. group("swiftshader_library") {
  869. if (bundle_egl_libraries) {
  870. deps = [ ":swiftshader_binaries" ]
  871. }
  872. }
  873. if (bundle_widevine_cdm) {
  874. bundle_data("widevine_cdm_library_binaries") {
  875. sources = [ "$root_out_dir/$widevine_cdm_path/libwidevinecdm.dylib" ]
  876. if (enable_widevine_cdm_host_verification) {
  877. sources +=
  878. [ "$root_out_dir/$widevine_cdm_path/libwidevinecdm.dylib.sig" ]
  879. }
  880. outputs = [ "{{bundle_contents_dir}}/Libraries/$widevine_cdm_path/{{source_file_part}}" ]
  881. public_deps = [ "//third_party/widevine/cdm" ]
  882. }
  883. bundle_data("widevine_cdm_library_manifest_and_license_files") {
  884. sources = [
  885. "$root_out_dir/WidevineCdm/LICENSE",
  886. "$root_out_dir/WidevineCdm/manifest.json",
  887. ]
  888. outputs = [
  889. "{{bundle_contents_dir}}/Libraries/WidevineCdm/{{source_file_part}}",
  890. ]
  891. public_deps = [ "//third_party/widevine/cdm" ]
  892. }
  893. }
  894. group("widevine_cdm_library") {
  895. if (bundle_widevine_cdm) {
  896. deps = [
  897. ":widevine_cdm_library_binaries",
  898. ":widevine_cdm_library_manifest_and_license_files",
  899. ]
  900. }
  901. }
  902. if (enable_widevine_cdm_host_verification) {
  903. widevine_sign_file("sign_chrome_framework_for_widevine") {
  904. file = "$root_out_dir/$chrome_framework_name.framework/Versions/$chrome_framework_version/$chrome_framework_name"
  905. flags = 1
  906. signature_file = "$root_out_dir/$chrome_framework_name.sig"
  907. deps = [ ":chrome_framework" ]
  908. }
  909. copy("chrome_framework_widevine_signature") {
  910. deps = [ ":sign_chrome_framework_for_widevine" ]
  911. sources = [ "$root_out_dir/$chrome_framework_name.sig" ]
  912. outputs = [ "$root_out_dir/$chrome_framework_name.framework/Resources/{{source_file_part}}" ]
  913. }
  914. }
  915. if (is_chrome_branded && enable_keystone_registration_framework) {
  916. bundle_data("keystone_registration_framework") {
  917. sources = [ "//third_party/googlemac/Releases/Keystone/KeystoneRegistration.framework" ]
  918. outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ]
  919. }
  920. } else {
  921. group("keystone_registration_framework") {
  922. }
  923. }
  924. if (build_with_internal_optimization_guide) {
  925. # Add the optimization guide .dylib in the MODULE_DIR of Chromium.app
  926. bundle_data("optimization_guide_library") {
  927. sources = [
  928. "$root_out_dir/og_intermediates/liboptimization_guide_internal.dylib",
  929. ]
  930. outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
  931. public_deps = [ "//components/optimization_guide/core:optimization_guide_internal_library_copy" ]
  932. }
  933. } else {
  934. group("optimization_guide_library") {
  935. }
  936. }
  937. tweak_info_plist("chrome_framework_plist") {
  938. info_plist = "app/framework-Info.plist"
  939. args = [
  940. "--breakpad=0",
  941. "--keystone=0",
  942. "--scm=1",
  943. "--branding",
  944. chrome_product_short_name,
  945. ]
  946. }
  947. # On Mac, speed up the component build by not re-bundling the framework
  948. # every time it changes. Instead, place all the sources and their deps in
  949. # a library that the bundled framework links (and re-exports). That way
  950. # only the library needs to be re-linked when it changes.
  951. if (is_component_build) {
  952. _dll_target_type = "shared_library"
  953. } else {
  954. _dll_target_type = "source_set"
  955. }
  956. target(_dll_target_type, "chrome_dll") {
  957. visibility = [
  958. ":chrome_framework",
  959. ":chrome_framework_create_bundle",
  960. ":chrome_framework_shared_library",
  961. ]
  962. sources = [
  963. "app/chrome_crash_reporter_client.cc",
  964. "app/chrome_crash_reporter_client.h",
  965. "app/chrome_crash_reporter_client_mac.mm",
  966. "app/chrome_dll_resource.h",
  967. "app/chrome_main.cc",
  968. "app/chrome_main_delegate.cc",
  969. "app/chrome_main_delegate.h",
  970. "app/chrome_main_mac.h",
  971. "app/chrome_main_mac.mm",
  972. ]
  973. deps = [
  974. ":dependencies",
  975. "//base/allocator:buildflags",
  976. "//build:chromeos_buildflags",
  977. "//chrome/app:command_ids",
  978. "//chrome/app:notification_metrics",
  979. "//chrome/common:buildflags",
  980. "//chrome/common/profiler",
  981. "//components/crash/core/app",
  982. "//components/policy:generated",
  983. "//content/public/app",
  984. "//headless:headless_shell_lib",
  985. "//third_party/cld_3/src/src:cld_3",
  986. ]
  987. if (is_component_build) {
  988. frameworks = [ "Carbon.framework" ]
  989. }
  990. ldflags = [
  991. "-Wl,-order_file",
  992. "-Wl," + rebase_path("app/framework.order", root_build_dir),
  993. "-ObjC",
  994. ]
  995. configs += [ "//build/config/compiler:wexit_time_destructors" ]
  996. }
  997. mac_framework_bundle("chrome_framework") {
  998. output_name = chrome_framework_name
  999. framework_version = chrome_framework_version
  1000. framework_contents = [
  1001. "Helpers",
  1002. "Libraries",
  1003. "Resources",
  1004. ]
  1005. if (is_chrome_branded) {
  1006. framework_contents += [ "Default Apps" ]
  1007. if (enable_keystone_registration_framework) {
  1008. # For KeystoneRegistration.framework.
  1009. framework_contents += [ "Frameworks" ]
  1010. }
  1011. }
  1012. if (enable_nacl) {
  1013. framework_contents += [ "Internet Plug-Ins" ]
  1014. }
  1015. configs += [ "//build/config/compiler:wexit_time_destructors" ]
  1016. configs -= [ "//build/config/compiler:thinlto_optimize_default" ]
  1017. configs += [ "//build/config/compiler:thinlto_optimize_max" ]
  1018. info_plist_target = ":chrome_framework_plist"
  1019. extra_substitutions = [
  1020. "CHROMIUM_BUNDLE_ID=$chrome_mac_bundle_id",
  1021. "CHROMIUM_SHORT_NAME=$chrome_product_short_name",
  1022. ]
  1023. public_deps = [ ":chrome_dll" ]
  1024. bundle_deps = [
  1025. ":angle_library",
  1026. ":chrome_framework_helpers",
  1027. ":chrome_framework_plugins",
  1028. ":chrome_framework_resources",
  1029. ":keystone_registration_framework",
  1030. ":optimization_guide_library",
  1031. ":swiftshader_library",
  1032. ":widevine_cdm_library",
  1033. "//chrome/browser/resources/media/mei_preload:component_bundle",
  1034. ]
  1035. if (is_chrome_branded) {
  1036. bundle_deps += [ ":preinstalled_apps" ]
  1037. }
  1038. ldflags = [
  1039. "-compatibility_version",
  1040. chrome_dylib_version,
  1041. "-current_version",
  1042. chrome_dylib_version,
  1043. "-Wl,-order_file," + rebase_path("app/framework.order", root_build_dir),
  1044. ]
  1045. if (!is_component_build) {
  1046. # Specify a sensible install_name for static builds. The library is
  1047. # dlopen()ed so this is not used to resolve the module.
  1048. ldflags += [ "-Wl,-install_name,@executable_path/../Frameworks/$chrome_framework_name.framework/Versions/$chrome_version_full/$chrome_framework_name" ]
  1049. } else {
  1050. # In the component build, both the :chrome_app and various
  1051. # :chrome_helper* targets directly link to the Framework target. Use
  1052. # @rpath-based loading so that the dylib ID does not have to be changed
  1053. # with install_name_tool.
  1054. ldflags += [
  1055. "-Wl,-install_name,@rpath/$chrome_framework_name.framework/$chrome_framework_name",
  1056. "-Wl,-rpath,@loader_path/../../../../../..",
  1057. "-Wl,-reexport_library,libchrome_dll.dylib",
  1058. ]
  1059. data_deps = [ ":chrome_dll" ]
  1060. }
  1061. }
  1062. _framework_binary_path = "$root_out_dir/$chrome_framework_name.framework/Versions/$chrome_framework_version/$chrome_framework_name"
  1063. assert(_framework_binary_path != "",
  1064. "Ignore configuration-dependent unused variable warning")
  1065. # TOOD(crbug/1163903#c8) - thakis@ look into why profile and coverage
  1066. # instrumentation adds these symbols in different orders
  1067. if (!is_component_build && chrome_pgo_phase != 1 && !using_sanitizer) {
  1068. action("verify_chrome_framework_order") {
  1069. script = "//chrome/tools/build/mac/verify_order.py"
  1070. stamp_file = "$target_out_dir/run_$target_name.stamp"
  1071. inputs = [ script ]
  1072. args = [
  1073. "--stamp=" + rebase_path(stamp_file, root_out_dir),
  1074. "--binary=" + rebase_path(_framework_binary_path, root_out_dir),
  1075. "--symbol-file=" + rebase_path("app/framework.order", root_build_dir),
  1076. ]
  1077. if (host_os == "mac") {
  1078. args += [ "--nm-path=$mac_bin_path/nm" ]
  1079. } else {
  1080. args += [ "--nm-path=" +
  1081. rebase_path("$clang_base_path/bin/llvm-nm", root_build_dir) ]
  1082. }
  1083. outputs = [ stamp_file ]
  1084. public_deps = [ ":chrome_framework" ]
  1085. }
  1086. } else {
  1087. group("verify_chrome_framework_order") {
  1088. if (is_component_build) {
  1089. # In a component build, the framework is directly linked to the
  1090. # executable because dlopen() and loading all the dependent dylibs
  1091. # is time-consuming, see https://crbug.com/1197495.
  1092. public_deps = [ ":chrome_framework+link" ]
  1093. } else {
  1094. public_deps = [ ":chrome_framework" ]
  1095. }
  1096. }
  1097. }
  1098. if (enable_dsyms && !is_component_build) {
  1099. # It is possible to run dump_syms on unstripped products without dSYMs, but
  1100. # doing so isn't logical and won't happen in practice. It's also pointless
  1101. # to run dump_syms or archive dSYMs in a component build, where all of the
  1102. # interesting symbols and debug info are tucked away in other libraries
  1103. # beyond the set explicitly listed here.
  1104. # This list must be updated with the two targets' deps list below, and
  1105. # the list of _dsyms in :chrome_dsym_archive.
  1106. _chrome_symbols_sources = [
  1107. "$root_out_dir/$chrome_product_full_name.app/Contents/MacOS/$chrome_product_full_name",
  1108. "$root_out_dir/chrome_crashpad_handler",
  1109. "$root_out_dir/libEGL.dylib",
  1110. "$root_out_dir/libGLESv2.dylib",
  1111. "$root_out_dir/libvk_swiftshader.dylib",
  1112. _framework_binary_path,
  1113. ]
  1114. if (build_with_internal_optimization_guide) {
  1115. _chrome_symbols_sources +=
  1116. [ "$root_out_dir/liboptimization_guide_internal.dylib" ]
  1117. }
  1118. foreach(helper_params, chrome_mac_helpers) {
  1119. _chrome_symbols_sources += [ "$root_out_dir/${chrome_helper_name}${helper_params[2]}.app/Contents/MacOS/${chrome_helper_name}${helper_params[2]}" ]
  1120. }
  1121. action_foreach("chrome_dump_syms") {
  1122. script = "//build/redirect_stdout.py"
  1123. sources = _chrome_symbols_sources
  1124. outputs =
  1125. [ "$root_out_dir/{{source_file_part}}-$chrome_version_full.breakpad" ]
  1126. dump_syms = "//third_party/breakpad:dump_syms($host_toolchain)"
  1127. args = rebase_path(outputs, root_build_dir) + [
  1128. rebase_path(get_label_info(dump_syms, "root_out_dir") + "/" +
  1129. get_label_info(dump_syms, "name"),
  1130. root_build_dir),
  1131. "-g",
  1132. rebase_path(
  1133. "$root_out_dir/{{source_file_part}}.dSYM/Contents/Resources/DWARF/{{source_file_part}}",
  1134. root_build_dir),
  1135. "{{source}}",
  1136. ]
  1137. deps = [
  1138. ":chrome_app",
  1139. ":chrome_framework",
  1140. "//components/crash/core/app:chrome_crashpad_handler",
  1141. "//third_party/angle:libEGL",
  1142. "//third_party/angle:libGLESv2",
  1143. "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan",
  1144. dump_syms,
  1145. ]
  1146. if (build_with_internal_optimization_guide) {
  1147. deps += [ "//components/optimization_guide/internal:optimization_guide_internal" ]
  1148. }
  1149. foreach(helper_params, chrome_mac_helpers) {
  1150. deps += [ ":chrome_helper_app_${helper_params[0]}" ]
  1151. }
  1152. }
  1153. action("chrome_dsym_archive") {
  1154. script = "//chrome/tools/build/mac/archive_symbols.py"
  1155. # These are the dSYMs that will be archived. The sources list must be
  1156. # the target outputs that correspond to the dSYMs (since a dSYM is a
  1157. # directory it cannot be listed as a source file). The targets that
  1158. # generate both the dSYM and binary image are listed in deps.
  1159. _dsyms = [
  1160. "$root_out_dir/$chrome_framework_name.dSYM",
  1161. "$root_out_dir/$chrome_product_full_name.dSYM",
  1162. "$root_out_dir/chrome_crashpad_handler.dSYM",
  1163. "$root_out_dir/libEGL.dylib.dSYM",
  1164. "$root_out_dir/libGLESv2.dylib.dSYM",
  1165. "$root_out_dir/libvk_swiftshader.dylib.dSYM",
  1166. ]
  1167. if (build_with_internal_optimization_guide) {
  1168. _dsyms += [ "$root_out_dir/liboptimization_guide_internal.dylib.dSYM" ]
  1169. }
  1170. deps = [
  1171. ":chrome_app",
  1172. ":chrome_framework",
  1173. "//components/crash/core/app:chrome_crashpad_handler",
  1174. "//third_party/angle:libEGL",
  1175. "//third_party/angle:libGLESv2",
  1176. "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan",
  1177. ]
  1178. if (build_with_internal_optimization_guide) {
  1179. deps += [ "//components/optimization_guide/internal:optimization_guide_internal" ]
  1180. }
  1181. foreach(helper_params, chrome_mac_helpers) {
  1182. _dsyms +=
  1183. [ "$root_out_dir/${chrome_helper_name}${helper_params[2]}.dSYM" ]
  1184. deps += [ ":chrome_helper_app_${helper_params[0]}" ]
  1185. }
  1186. sources = _chrome_symbols_sources
  1187. _output = "$root_out_dir/$chrome_product_full_name.dSYM.tar.bz2"
  1188. outputs = [ _output ]
  1189. args = [ rebase_path(_output, root_out_dir) ] +
  1190. rebase_path(_dsyms, root_out_dir)
  1191. }
  1192. } else {
  1193. group("chrome_dump_syms") {
  1194. }
  1195. group("chrome_dsym_archive") {
  1196. }
  1197. }
  1198. }
  1199. group("dependencies") {
  1200. public_deps = [
  1201. "//build:branding_buildflags",
  1202. "//build:chromeos_buildflags",
  1203. "//chrome/browser",
  1204. "//chrome/browser/policy:path_parser",
  1205. "//chrome/child",
  1206. "//chrome/common",
  1207. "//chrome/gpu",
  1208. "//chrome/renderer",
  1209. "//chrome/utility",
  1210. "//components/about_ui",
  1211. "//components/gwp_asan/buildflags",
  1212. "//components/heap_profiling/in_process",
  1213. "//components/power_scheduler",
  1214. "//components/services/heap_profiling",
  1215. "//components/startup_metric_utils/browser",
  1216. "//components/sync",
  1217. "//components/upload_list:upload_list",
  1218. "//content/public/child",
  1219. "//pdf",
  1220. "//services/tracing/public/cpp",
  1221. "//third_party/blink/public:blink_devtools_frontend_resources",
  1222. "//third_party/blink/public:blink_devtools_inspector_resources",
  1223. "//v8:v8_headers",
  1224. ]
  1225. if (enable_ppapi) {
  1226. public_deps += [ "//ppapi/host" ]
  1227. }
  1228. if (enable_basic_printing) {
  1229. public_deps += [ "//printing" ]
  1230. }
  1231. if (enable_gwp_asan) {
  1232. public_deps += [ "//components/gwp_asan/client" ]
  1233. }
  1234. if (enable_nacl) {
  1235. public_deps += [
  1236. "//components/nacl/browser",
  1237. "//components/nacl/renderer/plugin:nacl_trusted_plugin",
  1238. ]
  1239. }
  1240. if (is_chromeos) {
  1241. public_deps += [ "//chromeos/dbus/constants" ]
  1242. }
  1243. if (is_chromeos_lacros) {
  1244. public_deps += [
  1245. "//chromeos/lacros",
  1246. "//chromeos/lacros/dbus",
  1247. ]
  1248. }
  1249. if (is_chromeos_ash) {
  1250. public_deps += [
  1251. "//ash/constants",
  1252. "//chrome/browser/ash",
  1253. "//chromeos",
  1254. "//chromeos/ash/components/memory",
  1255. ]
  1256. }
  1257. if (!is_fuchsia) {
  1258. public_deps += [ "//components/crash/core/app" ]
  1259. }
  1260. }
  1261. if (is_win) {
  1262. process_version_rc_template("chrome_exe_version") {
  1263. sources = [ "app/chrome_exe.ver" ]
  1264. output = "$target_gen_dir/chrome_exe_version.rc"
  1265. }
  1266. process_version_rc_template("chrome_dll_version") {
  1267. sources = [ "app/chrome_dll.ver" ]
  1268. output = "$target_gen_dir/chrome_dll_version.rc"
  1269. }
  1270. # This manifest matches what GYP produced. It may not even be necessary.
  1271. windows_manifest("chrome_dll_manifest") {
  1272. sources = [
  1273. as_invoker_manifest,
  1274. common_controls_manifest,
  1275. ]
  1276. }
  1277. process_version_rc_template("nacl64_exe_version") {
  1278. sources = [ "app/nacl64_exe.ver" ]
  1279. output = "$target_gen_dir/nacl64_exe_version.rc"
  1280. }
  1281. process_version_rc_template("other_version") {
  1282. sources = [ "app/other.ver" ]
  1283. output = "$target_gen_dir/other_version.rc"
  1284. }
  1285. }
  1286. copy("visual_elements_resources") {
  1287. sources = [
  1288. "//chrome/app/theme/$branding_path_component/win/tiles/Logo.png",
  1289. "//chrome/app/theme/$branding_path_component/win/tiles/SmallLogo.png",
  1290. "app/visual_elements_resources/chrome.VisualElementsManifest.xml",
  1291. ]
  1292. if (is_chrome_branded) {
  1293. sources += [
  1294. "//chrome/app/theme/$branding_path_component/win/tiles/LogoBeta.png",
  1295. "//chrome/app/theme/$branding_path_component/win/tiles/LogoCanary.png",
  1296. "//chrome/app/theme/$branding_path_component/win/tiles/LogoDev.png",
  1297. "//chrome/app/theme/$branding_path_component/win/tiles/SmallLogoBeta.png",
  1298. "//chrome/app/theme/$branding_path_component/win/tiles/SmallLogoCanary.png",
  1299. "//chrome/app/theme/$branding_path_component/win/tiles/SmallLogoDev.png",
  1300. ]
  1301. }
  1302. outputs = [ "$root_out_dir/{{source_file_part}}" ]
  1303. }
  1304. group("resources") {
  1305. public_deps = [
  1306. "//chrome/browser:resources",
  1307. "//chrome/common:resources",
  1308. "//chrome/renderer:resources",
  1309. ]
  1310. }
  1311. group("extra_resources") {
  1312. # Deps should be same as those in chrome_extra_paks() within chrome_paks.gni.
  1313. public_deps = [
  1314. "//chrome/browser/resources:resources",
  1315. "//components/autofill/core/browser:autofill_address_rewriter_resources",
  1316. ]
  1317. }
  1318. if (is_chrome_branded && !is_android) {
  1319. if (!is_mac) {
  1320. _preinstalled_apps_target_type = "copy"
  1321. } else {
  1322. _preinstalled_apps_target_type = "bundle_data"
  1323. }
  1324. target(_preinstalled_apps_target_type, "preinstalled_apps") {
  1325. visibility = [ ":packed_resources" ]
  1326. if (is_mac) {
  1327. visibility += [
  1328. ":chrome_framework",
  1329. ":chrome_framework_shared_library",
  1330. ]
  1331. }
  1332. sources = [ "browser/resources/default_apps/external_extensions.json" ]
  1333. if (!is_mac) {
  1334. outputs = [ "$root_out_dir/default_apps/{{source_file_part}}" ]
  1335. } else {
  1336. outputs = [ "{{bundle_contents_dir}}/Default Apps/{{source_file_part}}" ]
  1337. }
  1338. # Force anybody that depends on this to get the default apps as data files.
  1339. data = process_file_template(sources, outputs)
  1340. }
  1341. }
  1342. if (!is_android) {
  1343. chrome_paks("packed_resources") {
  1344. if (is_mac) {
  1345. output_dir = "$root_gen_dir/repack"
  1346. copy_data_to_bundle = true
  1347. } else {
  1348. output_dir = root_out_dir
  1349. mark_as_data = true
  1350. }
  1351. if (enable_resource_allowlist_generation) {
  1352. repack_allowlist = _chrome_resource_allowlist
  1353. deps = [ ":resource_allowlist" ]
  1354. }
  1355. if (is_chrome_branded && !is_mac) {
  1356. public_deps = [ ":preinstalled_apps" ]
  1357. }
  1358. files_to_hash = [
  1359. "resources.pak",
  1360. "chrome_100_percent.pak",
  1361. ]
  1362. if (enable_hidpi) {
  1363. files_to_hash += [ "chrome_200_percent.pak" ]
  1364. }
  1365. }
  1366. }
  1367. repack("unit_tests_pak") {
  1368. testonly = true
  1369. sources = [ "$root_gen_dir/chrome/chrome_test_resources.pak" ]
  1370. output = "$root_out_dir/unit_tests.pak"
  1371. deps = [ "//chrome/test/data:chrome_test_resources" ]
  1372. }
  1373. repack("browser_tests_pak") {
  1374. testonly = true
  1375. sources = [ "$root_gen_dir/chrome/webui_test_resources.pak" ]
  1376. output = "$root_out_dir/browser_tests.pak"
  1377. deps = [ "//chrome/test/data:webui_test_resources" ]
  1378. if (!is_android) {
  1379. sources += [ "$root_gen_dir/chrome/webui_generated_test_resources.pak" ]
  1380. deps += [ "//chrome/test/data/webui:resources" ]
  1381. }
  1382. }
  1383. group("strings") {
  1384. public_deps = [
  1385. "//chrome/app:chromium_strings",
  1386. "//chrome/app:generated_resources",
  1387. "//chrome/app:google_chrome_strings",
  1388. "//chrome/app/resources:locale_settings",
  1389. ]
  1390. }
  1391. if (is_android) {
  1392. java_cpp_enum("partner_bookmarks_javagen") {
  1393. sources = [ "browser/android/bookmarks/partner_bookmarks_reader.h" ]
  1394. }
  1395. java_cpp_enum("offline_pages_enum_javagen") {
  1396. sources = [ "browser/offline_pages/offline_page_utils.h" ]
  1397. }
  1398. java_cpp_enum("download_enum_javagen") {
  1399. sources = [
  1400. "browser/download/android/download_open_source.h",
  1401. "browser/download/download_dialog_types.h",
  1402. "browser/download/download_prompt_status.h",
  1403. ]
  1404. }
  1405. java_cpp_enum("instant_apps_reasons_enum_javagen") {
  1406. sources = [ "browser/android/instantapps/instant_apps_settings.cc" ]
  1407. }
  1408. java_cpp_enum("supervised_user_url_filter_enum_javagen") {
  1409. sources = [ "browser/supervised_user/supervised_user_url_filter.h" ]
  1410. }
  1411. java_cpp_enum("context_menu_image_format_enum_javagen") {
  1412. sources =
  1413. [ "browser/android/context_menu/context_menu_native_delegate_impl.h" ]
  1414. }
  1415. source_set("chrome_android_core") {
  1416. sources = [
  1417. "app/android/chrome_jni_onload.cc",
  1418. "app/android/chrome_jni_onload.h",
  1419. "app/android/chrome_main_delegate_android.cc",
  1420. "app/android/chrome_main_delegate_android.h",
  1421. "app/chrome_main_delegate.cc",
  1422. "app/chrome_main_delegate.h",
  1423. ]
  1424. libs = [
  1425. "android",
  1426. "jnigraphics",
  1427. ]
  1428. public_deps = [
  1429. "//chrome/browser",
  1430. "//chrome/utility",
  1431. ]
  1432. deps = [
  1433. ":dependencies",
  1434. "//chrome/browser/ui",
  1435. "//chrome/child",
  1436. "//chrome/common",
  1437. "//chrome/common/profiler",
  1438. "//chrome/gpu",
  1439. "//chrome/renderer",
  1440. "//components/gwp_asan/buildflags",
  1441. "//components/heap_profiling/in_process",
  1442. "//components/minidump_uploader",
  1443. "//components/safe_browsing:buildflags",
  1444. "//components/safe_browsing/android:safe_browsing_api_handler",
  1445. "//components/safe_browsing/android:safe_browsing_mobile",
  1446. "//components/services/heap_profiling",
  1447. "//content/public/app",
  1448. ]
  1449. # Explicit dependency required for JNI registration to be able to
  1450. # find the native side functions.
  1451. if (is_android && is_component_build) {
  1452. deps += [
  1453. "//components/viz/service",
  1454. "//device/gamepad",
  1455. "//ui/events/devices",
  1456. ]
  1457. }
  1458. if (is_android) {
  1459. deps += [ "//components/crash/android:crash_android" ]
  1460. }
  1461. if (is_chromeos_ash) {
  1462. public_deps += [ "//ui/lottie" ]
  1463. }
  1464. if (enable_vr) {
  1465. deps += [ "//third_party/gvr-android-sdk:gvr_shim" ]
  1466. }
  1467. if (enable_gwp_asan) {
  1468. deps += [ "//components/gwp_asan/client" ]
  1469. }
  1470. }
  1471. }
  1472. # Android also supports this, but uses
  1473. # //chrome/android:${_variant}_resource_allowlist.
  1474. if (is_win && enable_resource_allowlist_generation) {
  1475. generate_resource_allowlist("resource_allowlist") {
  1476. deps = [ ":chrome_dll" ]
  1477. inputs = [ "$root_out_dir/chrome.dll.pdb" ]
  1478. output = _chrome_resource_allowlist
  1479. }
  1480. }
  1481. if (is_linux || is_chromeos) {
  1482. if (is_official_build) {
  1483. group("linux_symbols") {
  1484. deps = [
  1485. ":angle_egl_symbols",
  1486. ":angle_gles_symbols",
  1487. ":chrome_crashpad_symbols",
  1488. ":chrome_symbols",
  1489. ]
  1490. if (is_linux) {
  1491. deps += [ ":swiftshader_vk_symbols" ]
  1492. }
  1493. if (!is_chromeos) {
  1494. deps += [ ":angle_libvulkan_symbols" ]
  1495. }
  1496. if (build_with_internal_optimization_guide) {
  1497. deps += [ ":optimization_guide_symbols" ]
  1498. }
  1499. }
  1500. extract_symbols("chrome_symbols") {
  1501. binary = "$root_out_dir/chrome"
  1502. if (current_cpu == "x86") {
  1503. # GYP used "ia32" so keep that naming for back-compat.
  1504. symbol_file = "$root_out_dir/chrome.breakpad.ia32"
  1505. } else {
  1506. symbol_file = "$root_out_dir/chrome.breakpad.$current_cpu"
  1507. }
  1508. deps = [ ":chrome" ]
  1509. }
  1510. extract_symbols("chrome_crashpad_symbols") {
  1511. binary = "$root_out_dir/chrome_crashpad_handler"
  1512. if (current_cpu == "x86") {
  1513. # GYP used "ia32" so keep that naming for back-compat.
  1514. symbol_file = "$root_out_dir/crashpad.breakpad.ia32"
  1515. } else {
  1516. symbol_file = "$root_out_dir/crashpad.breakpad.$current_cpu"
  1517. }
  1518. deps = [ "//components/crash/core/app:chrome_crashpad_handler" ]
  1519. }
  1520. extract_symbols("swiftshader_vk_symbols") {
  1521. binary = "$root_out_dir/libvk_swiftshader.so"
  1522. if (current_cpu == "x86") {
  1523. # GYP used "ia32" so keep that naming for back-compat.
  1524. symbol_file = "$root_out_dir/libvk_swiftshader.breakpad.ia32"
  1525. } else {
  1526. symbol_file = "$root_out_dir/libvk_swiftshader.breakpad.$current_cpu"
  1527. }
  1528. deps = [ "//third_party/swiftshader/src/Vulkan:swiftshader_libvulkan" ]
  1529. }
  1530. extract_symbols("angle_egl_symbols") {
  1531. binary = "$root_out_dir/libEGL.so"
  1532. if (current_cpu == "x86") {
  1533. # GYP used "ia32" so keep that naming for back-compat.
  1534. symbol_file = "$root_out_dir/angle_libegl.breakpad.ia32"
  1535. } else {
  1536. symbol_file = "$root_out_dir/angle_libegl.breakpad.$current_cpu"
  1537. }
  1538. deps = [ "//third_party/angle:libEGL" ]
  1539. }
  1540. extract_symbols("angle_gles_symbols") {
  1541. binary = "$root_out_dir/libGLESv2.so"
  1542. if (current_cpu == "x86") {
  1543. # GYP used "ia32" so keep that naming for back-compat.
  1544. symbol_file = "$root_out_dir/angle_libgles.breakpad.ia32"
  1545. } else {
  1546. symbol_file = "$root_out_dir/angle_libgles.breakpad.$current_cpu"
  1547. }
  1548. deps = [ "//third_party/angle:libGLESv2" ]
  1549. }
  1550. if (!is_chromeos) {
  1551. extract_symbols("angle_libvulkan_symbols") {
  1552. binary = "$root_out_dir/libvulkan.so.1"
  1553. if (current_cpu == "x86") {
  1554. # GYP used "ia32" so keep that naming for back-compat.
  1555. symbol_file = "$root_out_dir/angle_libvulkan.breakpad.ia32"
  1556. } else {
  1557. symbol_file = "$root_out_dir/angle_libvulkan.breakpad.$current_cpu"
  1558. }
  1559. deps = [ "//third_party/vulkan-deps/vulkan-loader/src:libvulkan" ]
  1560. }
  1561. }
  1562. if (build_with_internal_optimization_guide) {
  1563. extract_symbols("optimization_guide_symbols") {
  1564. binary = "$root_out_dir/liboptimization_guide_internal.so"
  1565. if (current_cpu == "x86") {
  1566. # GYP used "ia32" so keep that naming for back-compat.
  1567. symbol_file =
  1568. "$root_out_dir/optimization_guide_internal.breakpad.ia32"
  1569. } else {
  1570. symbol_file =
  1571. "$root_out_dir/optimization_guide_internal.breakpad.$current_cpu"
  1572. }
  1573. deps = [ "//components/optimization_guide/internal:optimization_guide_internal" ]
  1574. }
  1575. }
  1576. }
  1577. # Copies some scripts and resources that are used for desktop integration.
  1578. copy("xdg_mime") {
  1579. sources = [
  1580. "//chrome/tools/build/linux/chrome-wrapper",
  1581. "//third_party/xdg-utils/scripts/xdg-mime",
  1582. "//third_party/xdg-utils/scripts/xdg-settings",
  1583. ]
  1584. if (is_linux) {
  1585. sources +=
  1586. [ "//chrome/app/theme/$branding_path_component/product_logo_48.png" ]
  1587. } else {
  1588. sources += [
  1589. "//chrome/app/theme/$branding_path_component/linux/product_logo_48.png",
  1590. ]
  1591. }
  1592. outputs = [ "$root_out_dir/{{source_file_part}}" ]
  1593. }
  1594. }
  1595. if (is_chromeos_lacros && is_official_build) {
  1596. # This will strip chrome binary and produce chrome.debug with symbols.
  1597. strip_binary("strip_chrome_binary") {
  1598. binary_input = "$root_out_dir/chrome"
  1599. symbol_output = "$root_out_dir/chrome.debug"
  1600. stripped_binary_output = "$root_out_dir/chrome.stripped"
  1601. deps = [ ":chrome" ]
  1602. }
  1603. }