BUILD.gn 61 KB

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