BUILD.gn 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573
  1. import("//build/config/locales.gni")
  2. import("//build/config/ui.gni")
  3. import("//build/config/win/manifest.gni")
  4. import("//components/os_crypt/sync/features.gni")
  5. import("//components/spellcheck/spellcheck_build_features.gni")
  6. import("//content/public/app/mac_helpers.gni")
  7. import("//extensions/buildflags/buildflags.gni")
  8. import("//pdf/features.gni")
  9. import("//ppapi/buildflags/buildflags.gni")
  10. import("//printing/buildflags/buildflags.gni")
  11. import("//testing/test.gni")
  12. import("//third_party/electron_node/node.gni")
  13. import("//third_party/ffmpeg/ffmpeg_options.gni")
  14. import("//tools/generate_library_loader/generate_library_loader.gni")
  15. import("//tools/grit/grit_rule.gni")
  16. import("//tools/grit/repack.gni")
  17. import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
  18. import("//v8/gni/snapshot_toolchain.gni")
  19. import("build/asar.gni")
  20. import("build/extract_symbols.gni")
  21. import("build/npm.gni")
  22. import("build/templated_file.gni")
  23. import("build/tsc.gni")
  24. import("build/webpack/webpack.gni")
  25. import("buildflags/buildflags.gni")
  26. import("electron_paks.gni")
  27. import("filenames.auto.gni")
  28. import("filenames.gni")
  29. import("filenames.hunspell.gni")
  30. import("filenames.libcxx.gni")
  31. import("filenames.libcxxabi.gni")
  32. if (is_mac) {
  33. import("//build/config/mac/rules.gni")
  34. import("//third_party/icu/config.gni")
  35. import("//ui/gl/features.gni")
  36. import("//v8/gni/v8.gni")
  37. import("build/rules.gni")
  38. assert(
  39. mac_deployment_target == "10.15",
  40. "Chromium has updated the mac_deployment_target, please update this assert, update the supported versions documentation (docs/tutorial/support.md) and flag this as a breaking change")
  41. }
  42. if (is_linux) {
  43. import("//build/config/linux/pkg_config.gni")
  44. import("//tools/generate_stubs/rules.gni")
  45. pkg_config("gio_unix") {
  46. packages = [ "gio-unix-2.0" ]
  47. }
  48. pkg_config("libnotify_config") {
  49. packages = [
  50. "glib-2.0",
  51. "gdk-pixbuf-2.0",
  52. ]
  53. }
  54. generate_library_loader("libnotify_loader") {
  55. name = "LibNotifyLoader"
  56. output_h = "libnotify_loader.h"
  57. output_cc = "libnotify_loader.cc"
  58. header = "<libnotify/notify.h>"
  59. config = ":libnotify_config"
  60. functions = [
  61. "notify_is_initted",
  62. "notify_init",
  63. "notify_get_server_caps",
  64. "notify_get_server_info",
  65. "notify_notification_new",
  66. "notify_notification_add_action",
  67. "notify_notification_set_image_from_pixbuf",
  68. "notify_notification_set_timeout",
  69. "notify_notification_set_urgency",
  70. "notify_notification_set_hint_string",
  71. "notify_notification_show",
  72. "notify_notification_close",
  73. ]
  74. }
  75. # Generates electron_gtk_stubs.h header which contains
  76. # stubs for extracting function ptrs from the gtk library.
  77. # Function signatures for which stubs are required should be
  78. # declared in electron_gtk.sigs, currently this file contains
  79. # signatures for the functions used with native file chooser
  80. # implementation. In future, this file can be extended to contain
  81. # gtk4 stubs to switch gtk version in runtime.
  82. generate_stubs("electron_gtk_stubs") {
  83. sigs = [
  84. "shell/browser/ui/electron_gdk_pixbuf.sigs",
  85. "shell/browser/ui/electron_gtk.sigs",
  86. ]
  87. extra_header = "shell/browser/ui/electron_gtk.fragment"
  88. output_name = "electron_gtk_stubs"
  89. public_deps = [ "//ui/gtk:gtk_config" ]
  90. logging_function = "LogNoop()"
  91. logging_include = "ui/gtk/log_noop.h"
  92. }
  93. }
  94. branding = read_file("shell/app/BRANDING.json", "json")
  95. electron_project_name = branding.project_name
  96. electron_product_name = branding.product_name
  97. electron_mac_bundle_id = branding.mac_bundle_id
  98. if (override_electron_version != "") {
  99. electron_version = override_electron_version
  100. } else {
  101. # When building from source code tarball there is no git tag available and
  102. # builders must explicitly pass override_electron_version in gn args.
  103. # This read_file call will assert if there is no git information, without it
  104. # gn will generate a malformed build configuration and ninja will get into
  105. # infinite loop.
  106. read_file(".git/packed-refs", "string")
  107. # Set electron version from git tag.
  108. electron_version = exec_script("script/get-git-version.py",
  109. [],
  110. "trim string",
  111. [
  112. ".git/packed-refs",
  113. ".git/HEAD",
  114. ])
  115. }
  116. if (is_mas_build) {
  117. assert(is_mac,
  118. "It doesn't make sense to build a MAS build on a non-mac platform")
  119. }
  120. if (enable_pdf_viewer) {
  121. assert(enable_pdf, "PDF viewer support requires enable_pdf=true")
  122. assert(enable_electron_extensions,
  123. "PDF viewer support requires enable_electron_extensions=true")
  124. }
  125. if (enable_electron_extensions) {
  126. assert(enable_extensions,
  127. "Chrome extension support requires enable_extensions=true")
  128. }
  129. config("branding") {
  130. defines = [
  131. "ELECTRON_PRODUCT_NAME=\"$electron_product_name\"",
  132. "ELECTRON_PROJECT_NAME=\"$electron_project_name\"",
  133. ]
  134. }
  135. config("electron_lib_config") {
  136. include_dirs = [ "." ]
  137. }
  138. # We generate the definitions twice here, once in //electron/electron.d.ts
  139. # and once in $target_gen_dir
  140. # The one in $target_gen_dir is used for the actual TSC build later one
  141. # and the one in //electron/electron.d.ts is used by your IDE (vscode)
  142. # for typescript prompting
  143. npm_action("build_electron_definitions") {
  144. script = "gn-typescript-definitions"
  145. args = [ rebase_path("$target_gen_dir/tsc/typings/electron.d.ts") ]
  146. inputs = auto_filenames.api_docs + [ "yarn.lock" ]
  147. outputs = [ "$target_gen_dir/tsc/typings/electron.d.ts" ]
  148. }
  149. webpack_build("electron_asar_bundle") {
  150. deps = [ ":build_electron_definitions" ]
  151. inputs = auto_filenames.asar_bundle_deps
  152. config_file = "//electron/build/webpack/webpack.config.asar.js"
  153. out_file = "$target_gen_dir/js2c/asar_bundle.js"
  154. }
  155. webpack_build("electron_browser_bundle") {
  156. deps = [ ":build_electron_definitions" ]
  157. inputs = auto_filenames.browser_bundle_deps
  158. config_file = "//electron/build/webpack/webpack.config.browser.js"
  159. out_file = "$target_gen_dir/js2c/browser_init.js"
  160. }
  161. webpack_build("electron_renderer_bundle") {
  162. deps = [ ":build_electron_definitions" ]
  163. inputs = auto_filenames.renderer_bundle_deps
  164. config_file = "//electron/build/webpack/webpack.config.renderer.js"
  165. out_file = "$target_gen_dir/js2c/renderer_init.js"
  166. }
  167. webpack_build("electron_worker_bundle") {
  168. deps = [ ":build_electron_definitions" ]
  169. inputs = auto_filenames.worker_bundle_deps
  170. config_file = "//electron/build/webpack/webpack.config.worker.js"
  171. out_file = "$target_gen_dir/js2c/worker_init.js"
  172. }
  173. webpack_build("electron_sandboxed_renderer_bundle") {
  174. deps = [ ":build_electron_definitions" ]
  175. inputs = auto_filenames.sandbox_bundle_deps
  176. config_file = "//electron/build/webpack/webpack.config.sandboxed_renderer.js"
  177. out_file = "$target_gen_dir/js2c/sandbox_bundle.js"
  178. }
  179. webpack_build("electron_isolated_renderer_bundle") {
  180. deps = [ ":build_electron_definitions" ]
  181. inputs = auto_filenames.isolated_bundle_deps
  182. config_file = "//electron/build/webpack/webpack.config.isolated_renderer.js"
  183. out_file = "$target_gen_dir/js2c/isolated_bundle.js"
  184. }
  185. webpack_build("electron_utility_bundle") {
  186. deps = [ ":build_electron_definitions" ]
  187. inputs = auto_filenames.utility_bundle_deps
  188. config_file = "//electron/build/webpack/webpack.config.utility.js"
  189. out_file = "$target_gen_dir/js2c/utility_init.js"
  190. }
  191. action("electron_js2c") {
  192. deps = [
  193. ":electron_asar_bundle",
  194. ":electron_browser_bundle",
  195. ":electron_isolated_renderer_bundle",
  196. ":electron_renderer_bundle",
  197. ":electron_sandboxed_renderer_bundle",
  198. ":electron_utility_bundle",
  199. ":electron_worker_bundle",
  200. ]
  201. sources = [
  202. "$target_gen_dir/js2c/asar_bundle.js",
  203. "$target_gen_dir/js2c/browser_init.js",
  204. "$target_gen_dir/js2c/isolated_bundle.js",
  205. "$target_gen_dir/js2c/renderer_init.js",
  206. "$target_gen_dir/js2c/sandbox_bundle.js",
  207. "$target_gen_dir/js2c/utility_init.js",
  208. "$target_gen_dir/js2c/worker_init.js",
  209. ]
  210. inputs = sources + [ "//third_party/electron_node/tools/js2c.py" ]
  211. outputs = [ "$root_gen_dir/electron_natives.cc" ]
  212. script = "build/js2c.py"
  213. args = [ rebase_path("//third_party/electron_node") ] +
  214. rebase_path(outputs, root_build_dir) +
  215. rebase_path(sources, root_build_dir)
  216. }
  217. action("generate_config_gypi") {
  218. outputs = [ "$root_gen_dir/config.gypi" ]
  219. script = "script/generate-config-gypi.py"
  220. inputs = [ "//third_party/electron_node/configure.py" ]
  221. args = rebase_path(outputs) + [ target_cpu ]
  222. }
  223. target_gen_default_app_js = "$target_gen_dir/js/default_app"
  224. typescript_build("default_app_js") {
  225. deps = [ ":build_electron_definitions" ]
  226. sources = filenames.default_app_ts_sources
  227. output_gen_dir = target_gen_default_app_js
  228. output_dir_name = "default_app"
  229. tsconfig = "tsconfig.default_app.json"
  230. }
  231. copy("default_app_static") {
  232. sources = filenames.default_app_static_sources
  233. outputs = [ "$target_gen_default_app_js/{{source}}" ]
  234. }
  235. copy("default_app_octicon_deps") {
  236. sources = filenames.default_app_octicon_sources
  237. outputs = [ "$target_gen_default_app_js/electron/default_app/octicon/{{source_file_part}}" ]
  238. }
  239. asar("default_app_asar") {
  240. deps = [
  241. ":default_app_js",
  242. ":default_app_octicon_deps",
  243. ":default_app_static",
  244. ]
  245. root = "$target_gen_default_app_js/electron/default_app"
  246. sources = get_target_outputs(":default_app_js") +
  247. get_target_outputs(":default_app_static") +
  248. get_target_outputs(":default_app_octicon_deps")
  249. outputs = [ "$root_out_dir/resources/default_app.asar" ]
  250. }
  251. grit("resources") {
  252. source = "electron_resources.grd"
  253. outputs = [
  254. "grit/electron_resources.h",
  255. "electron_resources.pak",
  256. ]
  257. # Mojo manifest overlays are generated.
  258. grit_flags = [
  259. "-E",
  260. "target_gen_dir=" + rebase_path(target_gen_dir, root_build_dir),
  261. ]
  262. deps = [ ":copy_shell_devtools_discovery_page" ]
  263. output_dir = "$target_gen_dir"
  264. }
  265. copy("copy_shell_devtools_discovery_page") {
  266. sources = [ "//content/shell/resources/shell_devtools_discovery_page.html" ]
  267. outputs = [ "$target_gen_dir/shell_devtools_discovery_page.html" ]
  268. }
  269. npm_action("electron_version_args") {
  270. script = "generate-version-json"
  271. outputs = [ "$target_gen_dir/electron_version.args" ]
  272. args = rebase_path(outputs) + [ "$electron_version" ]
  273. inputs = [ "script/generate-version-json.js" ]
  274. }
  275. templated_file("electron_version_header") {
  276. deps = [ ":electron_version_args" ]
  277. template = "build/templates/electron_version.tmpl"
  278. output = "$target_gen_dir/electron_version.h"
  279. args_files = get_target_outputs(":electron_version_args")
  280. }
  281. templated_file("electron_win_rc") {
  282. deps = [ ":electron_version_args" ]
  283. template = "build/templates/electron_rc.tmpl"
  284. output = "$target_gen_dir/win-resources/electron.rc"
  285. args_files = get_target_outputs(":electron_version_args")
  286. }
  287. copy("electron_win_resource_files") {
  288. sources = [
  289. "shell/browser/resources/win/electron.ico",
  290. "shell/browser/resources/win/resource.h",
  291. ]
  292. outputs = [ "$target_gen_dir/win-resources/{{source_file_part}}" ]
  293. }
  294. templated_file("electron_version_file") {
  295. deps = [ ":electron_version_args" ]
  296. template = "build/templates/version_string.tmpl"
  297. output = "$root_build_dir/version"
  298. args_files = get_target_outputs(":electron_version_args")
  299. }
  300. group("electron_win32_resources") {
  301. public_deps = [
  302. ":electron_win_rc",
  303. ":electron_win_resource_files",
  304. ]
  305. }
  306. action("electron_fuses") {
  307. script = "build/fuses/build.py"
  308. inputs = [ "build/fuses/fuses.json5" ]
  309. outputs = [
  310. "$target_gen_dir/fuses.h",
  311. "$target_gen_dir/fuses.cc",
  312. ]
  313. args = rebase_path(outputs)
  314. }
  315. action("electron_generate_node_defines") {
  316. script = "build/generate_node_defines.py"
  317. inputs = [
  318. "//third_party/electron_node/src/tracing/trace_event_common.h",
  319. "//third_party/electron_node/src/tracing/trace_event.h",
  320. "//third_party/electron_node/src/util.h",
  321. ]
  322. outputs = [
  323. "$target_gen_dir/push_and_undef_node_defines.h",
  324. "$target_gen_dir/pop_node_defines.h",
  325. ]
  326. args = [ rebase_path(target_gen_dir) ] + rebase_path(inputs)
  327. }
  328. source_set("electron_lib") {
  329. configs += [ "//v8:external_startup_data" ]
  330. configs += [ "//third_party/electron_node:node_internals" ]
  331. public_configs = [
  332. ":branding",
  333. ":electron_lib_config",
  334. ]
  335. deps = [
  336. ":electron_fuses",
  337. ":electron_generate_node_defines",
  338. ":electron_js2c",
  339. ":electron_version_header",
  340. ":resources",
  341. "buildflags",
  342. "chromium_src:chrome",
  343. "chromium_src:chrome_spellchecker",
  344. "shell/common/api:mojo",
  345. "shell/services/node/public/mojom",
  346. "//base:base_static",
  347. "//base/allocator:buildflags",
  348. "//chrome:strings",
  349. "//chrome/app:command_ids",
  350. "//chrome/app/resources:platform_locale_settings",
  351. "//components/autofill/core/common:features",
  352. "//components/certificate_transparency",
  353. "//components/compose:buildflags",
  354. "//components/embedder_support:browser_util",
  355. "//components/language/core/browser",
  356. "//components/net_log",
  357. "//components/network_hints/browser",
  358. "//components/network_hints/common:mojo_bindings",
  359. "//components/network_hints/renderer",
  360. "//components/network_session_configurator/common",
  361. "//components/omnibox/browser:buildflags",
  362. "//components/os_crypt/async/browser",
  363. "//components/os_crypt/async/browser:key_provider_interface",
  364. "//components/os_crypt/sync",
  365. "//components/pref_registry",
  366. "//components/prefs",
  367. "//components/security_state/content",
  368. "//components/upload_list",
  369. "//components/user_prefs",
  370. "//components/viz/host",
  371. "//components/viz/service",
  372. "//components/webrtc",
  373. "//content/public/browser",
  374. "//content/public/child",
  375. "//content/public/gpu",
  376. "//content/public/renderer",
  377. "//content/public/utility",
  378. "//device/bluetooth",
  379. "//device/bluetooth/public/cpp",
  380. "//gin",
  381. "//media/capture/mojom:video_capture",
  382. "//media/mojo/mojom",
  383. "//net:extras",
  384. "//net:net_resources",
  385. "//printing/buildflags",
  386. "//services/device/public/cpp/geolocation",
  387. "//services/device/public/cpp/hid",
  388. "//services/device/public/mojom",
  389. "//services/proxy_resolver:lib",
  390. "//services/video_capture/public/mojom:constants",
  391. "//services/viz/privileged/mojom/compositing",
  392. "//services/viz/public/mojom",
  393. "//skia",
  394. "//third_party/blink/public:blink",
  395. "//third_party/blink/public:blink_devtools_inspector_resources",
  396. "//third_party/blink/public/platform/media",
  397. "//third_party/boringssl",
  398. "//third_party/electron_node:node_lib",
  399. "//third_party/inspector_protocol:crdtp",
  400. "//third_party/leveldatabase",
  401. "//third_party/libyuv",
  402. "//third_party/webrtc_overrides:webrtc_component",
  403. "//third_party/widevine/cdm:headers",
  404. "//third_party/zlib/google:zip",
  405. "//ui/base/idle",
  406. "//ui/compositor",
  407. "//ui/events:dom_keycode_converter",
  408. "//ui/gl",
  409. "//ui/native_theme",
  410. "//ui/shell_dialogs",
  411. "//ui/views",
  412. "//v8",
  413. "//v8:v8_libplatform",
  414. ]
  415. public_deps = [
  416. "//base",
  417. "//base:i18n",
  418. "//content/public/app",
  419. ]
  420. include_dirs = [
  421. ".",
  422. "$target_gen_dir",
  423. # TODO(nornagon): replace usage of SchemeRegistry by an actually exported
  424. # API of blink, then remove this from the include_dirs.
  425. "//third_party/blink/renderer",
  426. ]
  427. defines = [ "V8_DEPRECATION_WARNINGS" ]
  428. libs = []
  429. if (is_linux) {
  430. defines += [ "GDK_DISABLE_DEPRECATION_WARNINGS" ]
  431. }
  432. if (!is_mas_build) {
  433. deps += [
  434. "//components/crash/core/app",
  435. "//components/crash/core/browser",
  436. ]
  437. }
  438. configs += [ "//electron/build/config:mas_build" ]
  439. sources = filenames.lib_sources
  440. if (is_win) {
  441. sources += filenames.lib_sources_win
  442. }
  443. if (is_mac) {
  444. sources += filenames.lib_sources_mac
  445. }
  446. if (is_posix) {
  447. sources += filenames.lib_sources_posix
  448. }
  449. if (is_linux) {
  450. sources += filenames.lib_sources_linux
  451. }
  452. if (!is_mac) {
  453. sources += filenames.lib_sources_views
  454. }
  455. if (is_component_build) {
  456. defines += [ "NODE_SHARED_MODE" ]
  457. }
  458. if (enable_fake_location_provider) {
  459. sources += [
  460. "shell/browser/fake_location_provider.cc",
  461. "shell/browser/fake_location_provider.h",
  462. ]
  463. }
  464. if (is_mac) {
  465. deps += [
  466. "//components/remote_cocoa/app_shim",
  467. "//components/remote_cocoa/browser",
  468. "//content/browser:mac_helpers",
  469. "//ui/accelerated_widget_mac",
  470. ]
  471. if (!is_mas_build) {
  472. deps += [ "//third_party/crashpad/crashpad/client" ]
  473. }
  474. frameworks = [
  475. "AuthenticationServices.framework",
  476. "AVFoundation.framework",
  477. "Carbon.framework",
  478. "LocalAuthentication.framework",
  479. "QuartzCore.framework",
  480. "Quartz.framework",
  481. "Security.framework",
  482. "SecurityInterface.framework",
  483. "ServiceManagement.framework",
  484. "StoreKit.framework",
  485. ]
  486. weak_frameworks = [ "QuickLookThumbnailing.framework" ]
  487. sources += [
  488. "shell/browser/ui/views/autofill_popup_view.cc",
  489. "shell/browser/ui/views/autofill_popup_view.h",
  490. ]
  491. if (is_mas_build) {
  492. sources += [ "shell/browser/api/electron_api_app_mas.mm" ]
  493. sources -= [ "shell/browser/auto_updater_mac.mm" ]
  494. sources -= [
  495. "shell/app/electron_crash_reporter_client.cc",
  496. "shell/app/electron_crash_reporter_client.h",
  497. "shell/common/crash_keys.cc",
  498. "shell/common/crash_keys.h",
  499. ]
  500. } else {
  501. frameworks += [
  502. "Squirrel.framework",
  503. "ReactiveObjC.framework",
  504. "Mantle.framework",
  505. ]
  506. deps += [
  507. "//third_party/squirrel.mac:reactiveobjc_framework+link",
  508. "//third_party/squirrel.mac:squirrel_framework+link",
  509. ]
  510. # ReactiveObjC which is used by Squirrel requires using __weak.
  511. cflags_objcc = [ "-fobjc-weak" ]
  512. }
  513. }
  514. if (is_linux) {
  515. libs = [ "xshmfence" ]
  516. deps += [
  517. ":electron_gtk_stubs",
  518. ":libnotify_loader",
  519. "//build/config/linux/gtk",
  520. "//components/crash/content/browser",
  521. "//dbus",
  522. "//device/bluetooth",
  523. "//third_party/crashpad/crashpad/client",
  524. "//ui/base/ime/linux",
  525. "//ui/events/devices/x11",
  526. "//ui/events/platform/x11",
  527. "//ui/gtk:gtk_config",
  528. "//ui/linux:linux_ui",
  529. "//ui/linux:linux_ui_factory",
  530. "//ui/views/controls/webview",
  531. "//ui/wm",
  532. ]
  533. if (ozone_platform_x11) {
  534. sources += filenames.lib_sources_linux_x11
  535. public_deps += [
  536. "//ui/base/x",
  537. "//ui/ozone/platform/x11",
  538. ]
  539. }
  540. configs += [ ":gio_unix" ]
  541. defines += [
  542. # Disable warnings for g_settings_list_schemas.
  543. "GLIB_DISABLE_DEPRECATION_WARNINGS",
  544. ]
  545. sources += [
  546. "shell/browser/certificate_manager_model.cc",
  547. "shell/browser/certificate_manager_model.h",
  548. "shell/browser/ui/gtk_util.cc",
  549. "shell/browser/ui/gtk_util.h",
  550. ]
  551. }
  552. if (is_win) {
  553. libs += [ "dwmapi.lib" ]
  554. deps += [
  555. "//components/crash/core/app:crash_export_thunks",
  556. "//ui/native_theme:native_theme_browser",
  557. "//ui/views/controls/webview",
  558. "//ui/wm",
  559. "//ui/wm/public",
  560. ]
  561. public_deps += [
  562. "//sandbox/win:sandbox",
  563. "//third_party/crashpad/crashpad/handler",
  564. ]
  565. }
  566. if (enable_plugins) {
  567. deps += [ "chromium_src:plugins" ]
  568. sources += [
  569. "shell/common/plugin_info.cc",
  570. "shell/common/plugin_info.h",
  571. "shell/renderer/electron_renderer_pepper_host_factory.cc",
  572. "shell/renderer/electron_renderer_pepper_host_factory.h",
  573. "shell/renderer/pepper_helper.cc",
  574. "shell/renderer/pepper_helper.h",
  575. ]
  576. }
  577. if (enable_ppapi) {
  578. deps += [
  579. "//ppapi/host",
  580. "//ppapi/proxy",
  581. "//ppapi/shared_impl",
  582. ]
  583. }
  584. if (enable_views_api) {
  585. sources += [
  586. "shell/browser/api/views/electron_api_image_view.cc",
  587. "shell/browser/api/views/electron_api_image_view.h",
  588. ]
  589. }
  590. if (enable_printing) {
  591. sources += [
  592. "shell/browser/printing/print_view_manager_electron.cc",
  593. "shell/browser/printing/print_view_manager_electron.h",
  594. "shell/renderer/printing/print_render_frame_helper_delegate.cc",
  595. "shell/renderer/printing/print_render_frame_helper_delegate.h",
  596. ]
  597. deps += [
  598. "//chrome/services/printing/public/mojom",
  599. "//components/printing/common:mojo_interfaces",
  600. ]
  601. if (is_mac) {
  602. deps += [ "//chrome/services/mac_notifications/public/mojom" ]
  603. }
  604. }
  605. if (enable_electron_extensions) {
  606. sources += filenames.lib_sources_extensions
  607. deps += [
  608. "shell/browser/extensions/api:api_registration",
  609. "shell/common/extensions/api",
  610. "shell/common/extensions/api:extensions_features",
  611. "//chrome/browser/resources:component_extension_resources",
  612. "//components/guest_view/common:mojom",
  613. "//components/update_client:update_client",
  614. "//components/zoom",
  615. "//extensions/browser",
  616. "//extensions/browser/api:api_provider",
  617. "//extensions/browser/updater",
  618. "//extensions/common",
  619. "//extensions/common:core_api_provider",
  620. "//extensions/renderer",
  621. ]
  622. }
  623. if (enable_pdf) {
  624. # Printing depends on some //pdf code, so it needs to be built even if the
  625. # pdf viewer isn't enabled.
  626. deps += [
  627. "//pdf",
  628. "//pdf:features",
  629. ]
  630. }
  631. if (enable_pdf_viewer) {
  632. deps += [
  633. "//chrome/browser/resources/pdf:resources",
  634. "//components/pdf/browser",
  635. "//components/pdf/browser:interceptors",
  636. "//components/pdf/common",
  637. "//components/pdf/renderer",
  638. "//pdf",
  639. ]
  640. sources += [
  641. "shell/browser/electron_pdf_document_helper_client.cc",
  642. "shell/browser/electron_pdf_document_helper_client.h",
  643. "shell/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.cc",
  644. "shell/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.h",
  645. ]
  646. }
  647. sources += get_target_outputs(":electron_fuses")
  648. if (allow_runtime_configurable_key_storage) {
  649. defines += [ "ALLOW_RUNTIME_CONFIGURABLE_KEY_STORAGE" ]
  650. }
  651. }
  652. electron_paks("packed_resources") {
  653. if (is_mac) {
  654. output_dir = "$root_gen_dir/electron_repack"
  655. copy_data_to_bundle = true
  656. } else {
  657. output_dir = root_out_dir
  658. }
  659. }
  660. if (is_mac) {
  661. electron_framework_name = "$electron_product_name Framework"
  662. electron_helper_name = "$electron_product_name Helper"
  663. electron_login_helper_name = "$electron_product_name Login Helper"
  664. electron_framework_version = "A"
  665. mac_xib_bundle_data("electron_xibs") {
  666. sources = [ "shell/common/resources/mac/MainMenu.xib" ]
  667. }
  668. bundle_data("electron_framework_resources") {
  669. public_deps = [ ":packed_resources" ]
  670. sources = []
  671. if (icu_use_data_file) {
  672. sources += [ "$root_out_dir/icudtl.dat" ]
  673. public_deps += [ "//third_party/icu:icudata" ]
  674. }
  675. if (v8_use_external_startup_data) {
  676. public_deps += [ "//v8" ]
  677. if (use_v8_context_snapshot) {
  678. sources += [ "$root_out_dir/$v8_context_snapshot_filename" ]
  679. public_deps += [ "//tools/v8_context_snapshot" ]
  680. } else {
  681. sources += [ "$root_out_dir/snapshot_blob.bin" ]
  682. }
  683. }
  684. outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
  685. }
  686. if (!is_component_build && is_component_ffmpeg) {
  687. bundle_data("electron_framework_libraries") {
  688. sources = []
  689. public_deps = []
  690. sources += [ "$root_out_dir/libffmpeg.dylib" ]
  691. public_deps += [ "//third_party/ffmpeg:ffmpeg" ]
  692. outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
  693. }
  694. } else {
  695. group("electron_framework_libraries") {
  696. }
  697. }
  698. if (use_egl) {
  699. # Add the ANGLE .dylibs in the Libraries directory of the Framework.
  700. bundle_data("electron_angle_binaries") {
  701. sources = [
  702. "$root_out_dir/egl_intermediates/libEGL.dylib",
  703. "$root_out_dir/egl_intermediates/libGLESv2.dylib",
  704. ]
  705. outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
  706. public_deps = [ "//ui/gl:angle_library_copy" ]
  707. }
  708. # Add the SwiftShader .dylibs in the Libraries directory of the Framework.
  709. bundle_data("electron_swiftshader_binaries") {
  710. sources = [
  711. "$root_out_dir/vk_intermediates/libvk_swiftshader.dylib",
  712. "$root_out_dir/vk_intermediates/vk_swiftshader_icd.json",
  713. ]
  714. outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
  715. public_deps = [ "//ui/gl:swiftshader_vk_library_copy" ]
  716. }
  717. }
  718. group("electron_angle_library") {
  719. if (use_egl) {
  720. deps = [ ":electron_angle_binaries" ]
  721. }
  722. }
  723. group("electron_swiftshader_library") {
  724. if (use_egl) {
  725. deps = [ ":electron_swiftshader_binaries" ]
  726. }
  727. }
  728. bundle_data("electron_crashpad_helper") {
  729. sources = [ "$root_out_dir/chrome_crashpad_handler" ]
  730. outputs = [ "{{bundle_contents_dir}}/Helpers/{{source_file_part}}" ]
  731. public_deps = [ "//components/crash/core/app:chrome_crashpad_handler" ]
  732. if (is_asan) {
  733. # crashpad_handler requires the ASan runtime at its @executable_path.
  734. sources += [ "$root_out_dir/libclang_rt.asan_osx_dynamic.dylib" ]
  735. public_deps += [ "//build/config/sanitizers:copy_asan_runtime" ]
  736. }
  737. }
  738. mac_framework_bundle("electron_framework") {
  739. output_name = electron_framework_name
  740. framework_version = electron_framework_version
  741. framework_contents = [
  742. "Resources",
  743. "Libraries",
  744. ]
  745. if (!is_mas_build) {
  746. framework_contents += [ "Helpers" ]
  747. }
  748. public_deps = [
  749. ":electron_framework_libraries",
  750. ":electron_lib",
  751. ]
  752. deps = [
  753. ":electron_angle_library",
  754. ":electron_framework_libraries",
  755. ":electron_framework_resources",
  756. ":electron_swiftshader_library",
  757. ":electron_xibs",
  758. ]
  759. if (!is_mas_build) {
  760. deps += [ ":electron_crashpad_helper" ]
  761. }
  762. info_plist = "shell/common/resources/mac/Info.plist"
  763. extra_substitutions = [
  764. "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.framework",
  765. "ELECTRON_VERSION=$electron_version",
  766. ]
  767. include_dirs = [ "." ]
  768. sources = filenames.framework_sources
  769. frameworks = [ "IOSurface.framework" ]
  770. ldflags = [
  771. "-Wl,-install_name,@rpath/$output_name.framework/$output_name",
  772. "-rpath",
  773. "@loader_path/Libraries",
  774. # Required for exporting all symbols of libuv.
  775. "-Wl,-force_load,obj/third_party/electron_node/deps/uv/libuv.a",
  776. ]
  777. if (is_component_build) {
  778. ldflags += [
  779. "-rpath",
  780. "@executable_path/../../../../../..",
  781. ]
  782. }
  783. # For component ffmpeg under non-component build, it is linked from
  784. # @loader_path. However the ffmpeg.dylib is moved to a different place
  785. # when generating app bundle, and we should change to link from @rpath.
  786. if (is_component_ffmpeg && !is_component_build) {
  787. ldflags += [ "-Wcrl,installnametool,-change,@loader_path/libffmpeg.dylib,@rpath/libffmpeg.dylib" ]
  788. }
  789. }
  790. template("electron_helper_app") {
  791. mac_app_bundle(target_name) {
  792. assert(defined(invoker.helper_name_suffix))
  793. output_name = electron_helper_name + invoker.helper_name_suffix
  794. deps = [ ":electron_framework+link" ]
  795. if (!is_mas_build) {
  796. deps += [ "//sandbox/mac:seatbelt" ]
  797. }
  798. defines = [ "HELPER_EXECUTABLE" ]
  799. configs += [ "//electron/build/config:mas_build" ]
  800. sources = [
  801. "shell/app/electron_main_mac.cc",
  802. "shell/app/uv_stdio_fix.cc",
  803. "shell/app/uv_stdio_fix.h",
  804. "shell/common/electron_constants.cc",
  805. ]
  806. include_dirs = [ "." ]
  807. info_plist = "shell/renderer/resources/mac/Info.plist"
  808. extra_substitutions =
  809. [ "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.helper" ]
  810. ldflags = [
  811. "-rpath",
  812. "@executable_path/../../..",
  813. ]
  814. if (is_component_build) {
  815. ldflags += [
  816. "-rpath",
  817. "@executable_path/../../../../../..",
  818. ]
  819. }
  820. }
  821. }
  822. foreach(helper_params, content_mac_helpers) {
  823. _helper_target = helper_params[0]
  824. _helper_bundle_id = helper_params[1]
  825. _helper_suffix = helper_params[2]
  826. electron_helper_app("electron_helper_app_${_helper_target}") {
  827. helper_name_suffix = _helper_suffix
  828. }
  829. }
  830. template("stripped_framework") {
  831. action(target_name) {
  832. assert(defined(invoker.framework))
  833. script = "//electron/build/strip_framework.py"
  834. forward_variables_from(invoker, [ "deps" ])
  835. inputs = [ "$root_out_dir/" + invoker.framework ]
  836. outputs = [ "$target_out_dir/stripped_frameworks/" + invoker.framework ]
  837. args = rebase_path(inputs) + rebase_path(outputs)
  838. }
  839. }
  840. stripped_framework("stripped_mantle_framework") {
  841. framework = "Mantle.framework"
  842. deps = [ "//third_party/squirrel.mac:mantle_framework" ]
  843. }
  844. stripped_framework("stripped_reactiveobjc_framework") {
  845. framework = "ReactiveObjC.framework"
  846. deps = [ "//third_party/squirrel.mac:reactiveobjc_framework" ]
  847. }
  848. stripped_framework("stripped_squirrel_framework") {
  849. framework = "Squirrel.framework"
  850. deps = [ "//third_party/squirrel.mac:squirrel_framework" ]
  851. }
  852. bundle_data("electron_app_framework_bundle_data") {
  853. sources = [ "$root_out_dir/$electron_framework_name.framework" ]
  854. if (!is_mas_build) {
  855. sources += get_target_outputs(":stripped_mantle_framework") +
  856. get_target_outputs(":stripped_reactiveobjc_framework") +
  857. get_target_outputs(":stripped_squirrel_framework")
  858. }
  859. outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ]
  860. public_deps = [
  861. ":electron_framework+link",
  862. ":stripped_mantle_framework",
  863. ":stripped_reactiveobjc_framework",
  864. ":stripped_squirrel_framework",
  865. ]
  866. foreach(helper_params, content_mac_helpers) {
  867. sources +=
  868. [ "$root_out_dir/${electron_helper_name}${helper_params[2]}.app" ]
  869. public_deps += [ ":electron_helper_app_${helper_params[0]}" ]
  870. }
  871. }
  872. mac_app_bundle("electron_login_helper") {
  873. output_name = electron_login_helper_name
  874. sources = filenames.login_helper_sources
  875. include_dirs = [ "." ]
  876. frameworks = [ "AppKit.framework" ]
  877. info_plist = "shell/app/resources/mac/loginhelper-Info.plist"
  878. extra_substitutions =
  879. [ "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.loginhelper" ]
  880. }
  881. bundle_data("electron_login_helper_app") {
  882. public_deps = [ ":electron_login_helper" ]
  883. sources = [ "$root_out_dir/$electron_login_helper_name.app" ]
  884. outputs =
  885. [ "{{bundle_contents_dir}}/Library/LoginItems/{{source_file_part}}" ]
  886. }
  887. action("electron_app_lproj_dirs") {
  888. outputs = []
  889. foreach(locale, locales_as_apple_outputs) {
  890. outputs += [ "$target_gen_dir/app_infoplist_strings/$locale.lproj" ]
  891. }
  892. script = "build/mac/make_locale_dirs.py"
  893. args = rebase_path(outputs)
  894. }
  895. foreach(locale, locales_as_apple_outputs) {
  896. bundle_data("electron_app_strings_${locale}_bundle_data") {
  897. sources = [ "$target_gen_dir/app_infoplist_strings/$locale.lproj" ]
  898. outputs = [ "{{bundle_resources_dir}}/$locale.lproj" ]
  899. public_deps = [ ":electron_app_lproj_dirs" ]
  900. }
  901. }
  902. group("electron_app_strings_bundle_data") {
  903. public_deps = []
  904. foreach(locale, locales_as_apple_outputs) {
  905. public_deps += [ ":electron_app_strings_${locale}_bundle_data" ]
  906. }
  907. }
  908. bundle_data("electron_app_resources") {
  909. public_deps = [
  910. ":default_app_asar",
  911. ":electron_app_strings_bundle_data",
  912. ]
  913. sources = [
  914. "$root_out_dir/resources/default_app.asar",
  915. "shell/browser/resources/mac/electron.icns",
  916. ]
  917. outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
  918. }
  919. asar_hashed_info_plist("electron_app_plist") {
  920. keys = [ "DEFAULT_APP_ASAR_HEADER_SHA" ]
  921. hash_targets = [ ":default_app_asar_header_hash" ]
  922. plist_file = "shell/browser/resources/mac/Info.plist"
  923. }
  924. mac_app_bundle("electron_app") {
  925. output_name = electron_product_name
  926. sources = [
  927. "shell/app/electron_main_mac.cc",
  928. "shell/app/uv_stdio_fix.cc",
  929. "shell/app/uv_stdio_fix.h",
  930. ]
  931. include_dirs = [ "." ]
  932. deps = [
  933. ":electron_app_framework_bundle_data",
  934. ":electron_app_plist",
  935. ":electron_app_resources",
  936. ":electron_fuses",
  937. "//electron/buildflags",
  938. ]
  939. if (is_mas_build) {
  940. deps += [ ":electron_login_helper_app" ]
  941. }
  942. info_plist_target = ":electron_app_plist"
  943. extra_substitutions = [
  944. "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id",
  945. "ELECTRON_VERSION=$electron_version",
  946. ]
  947. ldflags = [
  948. "-rpath",
  949. "@executable_path/../Frameworks",
  950. ]
  951. configs += [ "//electron/build/config:mas_build" ]
  952. }
  953. if (enable_dsyms) {
  954. extract_symbols("electron_framework_syms") {
  955. binary = "$root_out_dir/$electron_framework_name.framework/Versions/$electron_framework_version/$electron_framework_name"
  956. symbol_dir = "$root_out_dir/breakpad_symbols"
  957. dsym_file = "$root_out_dir/$electron_framework_name.dSYM/Contents/Resources/DWARF/$electron_framework_name"
  958. deps = [ ":electron_framework" ]
  959. }
  960. foreach(helper_params, content_mac_helpers) {
  961. _helper_target = helper_params[0]
  962. _helper_bundle_id = helper_params[1]
  963. _helper_suffix = helper_params[2]
  964. extract_symbols("electron_helper_syms_${_helper_target}") {
  965. binary = "$root_out_dir/$electron_helper_name${_helper_suffix}.app/Contents/MacOS/$electron_helper_name${_helper_suffix}"
  966. symbol_dir = "$root_out_dir/breakpad_symbols"
  967. dsym_file = "$root_out_dir/$electron_helper_name${_helper_suffix}.dSYM/Contents/Resources/DWARF/$electron_helper_name${_helper_suffix}"
  968. deps = [ ":electron_helper_app_${_helper_target}" ]
  969. }
  970. }
  971. extract_symbols("electron_app_syms") {
  972. binary = "$root_out_dir/$electron_product_name.app/Contents/MacOS/$electron_product_name"
  973. symbol_dir = "$root_out_dir/breakpad_symbols"
  974. dsym_file = "$root_out_dir/$electron_product_name.dSYM/Contents/Resources/DWARF/$electron_product_name"
  975. deps = [ ":electron_app" ]
  976. }
  977. extract_symbols("egl_syms") {
  978. binary = "$root_out_dir/libEGL.dylib"
  979. symbol_dir = "$root_out_dir/breakpad_symbols"
  980. dsym_file = "$root_out_dir/libEGL.dylib.dSYM/Contents/Resources/DWARF/libEGL.dylib"
  981. deps = [ "//third_party/angle:libEGL" ]
  982. }
  983. extract_symbols("gles_syms") {
  984. binary = "$root_out_dir/libGLESv2.dylib"
  985. symbol_dir = "$root_out_dir/breakpad_symbols"
  986. dsym_file = "$root_out_dir/libGLESv2.dylib.dSYM/Contents/Resources/DWARF/libGLESv2.dylib"
  987. deps = [ "//third_party/angle:libGLESv2" ]
  988. }
  989. extract_symbols("crashpad_handler_syms") {
  990. binary = "$root_out_dir/chrome_crashpad_handler"
  991. symbol_dir = "$root_out_dir/breakpad_symbols"
  992. dsym_file = "$root_out_dir/chrome_crashpad_handler.dSYM/Contents/Resources/DWARF/chrome_crashpad_handler"
  993. deps = [ "//components/crash/core/app:chrome_crashpad_handler" ]
  994. }
  995. group("electron_symbols") {
  996. deps = [
  997. ":egl_syms",
  998. ":electron_app_syms",
  999. ":electron_framework_syms",
  1000. ":gles_syms",
  1001. ]
  1002. if (!is_mas_build) {
  1003. deps += [ ":crashpad_handler_syms" ]
  1004. }
  1005. foreach(helper_params, content_mac_helpers) {
  1006. _helper_target = helper_params[0]
  1007. deps += [ ":electron_helper_syms_${_helper_target}" ]
  1008. }
  1009. }
  1010. } else {
  1011. group("electron_symbols") {
  1012. }
  1013. }
  1014. } else {
  1015. windows_manifest("electron_app_manifest") {
  1016. sources = [
  1017. "shell/browser/resources/win/disable_window_filtering.manifest",
  1018. "shell/browser/resources/win/dpi_aware.manifest",
  1019. as_invoker_manifest,
  1020. common_controls_manifest,
  1021. default_compatibility_manifest,
  1022. ]
  1023. }
  1024. executable("electron_app") {
  1025. output_name = electron_project_name
  1026. if (is_win) {
  1027. sources = [ "shell/app/electron_main_win.cc" ]
  1028. } else if (is_linux) {
  1029. sources = [
  1030. "shell/app/electron_main_linux.cc",
  1031. "shell/app/uv_stdio_fix.cc",
  1032. "shell/app/uv_stdio_fix.h",
  1033. ]
  1034. }
  1035. include_dirs = [ "." ]
  1036. deps = [
  1037. ":default_app_asar",
  1038. ":electron_app_manifest",
  1039. ":electron_lib",
  1040. ":electron_win32_resources",
  1041. ":packed_resources",
  1042. "//components/crash/core/app",
  1043. "//content:sandbox_helper_win",
  1044. "//electron/buildflags",
  1045. "//ui/strings",
  1046. ]
  1047. data = []
  1048. data_deps = []
  1049. data += [ "$root_out_dir/resources.pak" ]
  1050. data += [ "$root_out_dir/chrome_100_percent.pak" ]
  1051. if (enable_hidpi) {
  1052. data += [ "$root_out_dir/chrome_200_percent.pak" ]
  1053. }
  1054. foreach(locale, platform_pak_locales) {
  1055. data += [ "$root_out_dir/locales/$locale.pak" ]
  1056. }
  1057. if (!is_mac) {
  1058. data += [ "$root_out_dir/resources/default_app.asar" ]
  1059. }
  1060. if (use_v8_context_snapshot) {
  1061. public_deps = [ "//tools/v8_context_snapshot:v8_context_snapshot" ]
  1062. }
  1063. if (is_linux) {
  1064. data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ]
  1065. }
  1066. if (is_win) {
  1067. sources += [
  1068. "$target_gen_dir/win-resources/electron.rc",
  1069. "shell/browser/resources/win/resource.h",
  1070. ]
  1071. deps += [
  1072. "//chrome/app:exit_code_watcher",
  1073. "//components/crash/core/app:run_as_crashpad_handler",
  1074. ]
  1075. ldflags = []
  1076. libs = [
  1077. "comctl32.lib",
  1078. "uiautomationcore.lib",
  1079. "wtsapi32.lib",
  1080. ]
  1081. configs -= [ "//build/config/win:console" ]
  1082. configs += [
  1083. "//build/config/win:windowed",
  1084. "//build/config/win:delayloads",
  1085. ]
  1086. if (current_cpu == "x86") {
  1087. # Set the initial stack size to 0.5MiB, instead of the 1.5MiB needed by
  1088. # Chrome's main thread. This saves significant memory on threads (like
  1089. # those in the Windows thread pool, and others) whose stack size we can
  1090. # only control through this setting. Because Chrome's main thread needs
  1091. # a minimum 1.5 MiB stack, the main thread (in 32-bit builds only) uses
  1092. # fibers to switch to a 1.5 MiB stack before running any other code.
  1093. ldflags += [ "/STACK:0x80000" ]
  1094. } else {
  1095. # Increase the initial stack size. The default is 1MB, this is 8MB.
  1096. ldflags += [ "/STACK:0x800000" ]
  1097. }
  1098. # This is to support renaming of electron.exe. node-gyp has hard-coded
  1099. # executable names which it will recognise as node. This module definition
  1100. # file claims that the electron executable is in fact named "node.exe",
  1101. # which is one of the executable names that node-gyp recognizes.
  1102. # See https://github.com/nodejs/node-gyp/commit/52ceec3a6d15de3a8f385f43dbe5ecf5456ad07a
  1103. ldflags += [ "/DEF:" + rebase_path("build/electron.def", root_build_dir) ]
  1104. inputs = [
  1105. "shell/browser/resources/win/electron.ico",
  1106. "build/electron.def",
  1107. ]
  1108. }
  1109. if (is_linux) {
  1110. ldflags = [
  1111. "-pie",
  1112. # Required for exporting all symbols of libuv.
  1113. "-Wl,--whole-archive",
  1114. "obj/third_party/electron_node/deps/uv/libuv.a",
  1115. "-Wl,--no-whole-archive",
  1116. ]
  1117. if (!is_component_build && is_component_ffmpeg) {
  1118. configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
  1119. }
  1120. if (is_linux) {
  1121. deps += [ "//sandbox/linux:chrome_sandbox" ]
  1122. }
  1123. }
  1124. }
  1125. if (is_official_build) {
  1126. if (is_linux) {
  1127. _target_executable_suffix = ""
  1128. _target_shared_library_suffix = ".so"
  1129. } else if (is_win) {
  1130. _target_executable_suffix = ".exe"
  1131. _target_shared_library_suffix = ".dll"
  1132. }
  1133. extract_symbols("electron_app_symbols") {
  1134. binary = "$root_out_dir/$electron_project_name$_target_executable_suffix"
  1135. symbol_dir = "$root_out_dir/breakpad_symbols"
  1136. deps = [ ":electron_app" ]
  1137. }
  1138. extract_symbols("egl_symbols") {
  1139. binary = "$root_out_dir/libEGL$_target_shared_library_suffix"
  1140. symbol_dir = "$root_out_dir/breakpad_symbols"
  1141. deps = [ "//third_party/angle:libEGL" ]
  1142. }
  1143. extract_symbols("gles_symbols") {
  1144. binary = "$root_out_dir/libGLESv2$_target_shared_library_suffix"
  1145. symbol_dir = "$root_out_dir/breakpad_symbols"
  1146. deps = [ "//third_party/angle:libGLESv2" ]
  1147. }
  1148. group("electron_symbols") {
  1149. deps = [
  1150. ":egl_symbols",
  1151. ":electron_app_symbols",
  1152. ":gles_symbols",
  1153. ]
  1154. }
  1155. }
  1156. }
  1157. template("dist_zip") {
  1158. _runtime_deps_target = "${target_name}__deps"
  1159. _runtime_deps_file =
  1160. "$root_out_dir/gen.runtime/" + get_label_info(target_name, "dir") + "/" +
  1161. get_label_info(target_name, "name") + ".runtime_deps"
  1162. group(_runtime_deps_target) {
  1163. forward_variables_from(invoker,
  1164. [
  1165. "deps",
  1166. "data_deps",
  1167. "data",
  1168. "testonly",
  1169. ])
  1170. write_runtime_deps = _runtime_deps_file
  1171. }
  1172. action(target_name) {
  1173. script = "//electron/build/zip.py"
  1174. deps = [ ":$_runtime_deps_target" ]
  1175. forward_variables_from(invoker,
  1176. [
  1177. "outputs",
  1178. "testonly",
  1179. ])
  1180. flatten = false
  1181. flatten_relative_to = false
  1182. if (defined(invoker.flatten)) {
  1183. flatten = invoker.flatten
  1184. if (defined(invoker.flatten_relative_to)) {
  1185. flatten_relative_to = invoker.flatten_relative_to
  1186. }
  1187. }
  1188. args = rebase_path(outputs + [ _runtime_deps_file ], root_build_dir) + [
  1189. target_cpu,
  1190. target_os,
  1191. "$flatten",
  1192. "$flatten_relative_to",
  1193. ]
  1194. }
  1195. }
  1196. copy("electron_license") {
  1197. sources = [ "LICENSE" ]
  1198. outputs = [ "$root_build_dir/{{source_file_part}}" ]
  1199. }
  1200. copy("chromium_licenses") {
  1201. deps = [ "//components/resources:about_credits" ]
  1202. sources = [ "$root_gen_dir/components/resources/about_credits.html" ]
  1203. outputs = [ "$root_build_dir/LICENSES.chromium.html" ]
  1204. }
  1205. group("licenses") {
  1206. data_deps = [
  1207. ":chromium_licenses",
  1208. ":electron_license",
  1209. ]
  1210. }
  1211. dist_zip("electron_dist_zip") {
  1212. data_deps = [
  1213. ":electron_app",
  1214. ":electron_version_file",
  1215. ":licenses",
  1216. ]
  1217. if (is_linux) {
  1218. data_deps += [ "//sandbox/linux:chrome_sandbox" ]
  1219. }
  1220. deps = data_deps
  1221. outputs = [ "$root_build_dir/dist.zip" ]
  1222. }
  1223. dist_zip("electron_ffmpeg_zip") {
  1224. data_deps = [ "//third_party/ffmpeg" ]
  1225. deps = data_deps
  1226. outputs = [ "$root_build_dir/ffmpeg.zip" ]
  1227. }
  1228. electron_chromedriver_deps = [
  1229. ":licenses",
  1230. "//chrome/test/chromedriver:chromedriver_server",
  1231. "//electron/buildflags",
  1232. ]
  1233. group("electron_chromedriver") {
  1234. testonly = true
  1235. public_deps = electron_chromedriver_deps
  1236. }
  1237. dist_zip("electron_chromedriver_zip") {
  1238. testonly = true
  1239. data_deps = electron_chromedriver_deps
  1240. deps = data_deps
  1241. outputs = [ "$root_build_dir/chromedriver.zip" ]
  1242. }
  1243. mksnapshot_deps = [
  1244. ":licenses",
  1245. "//v8:mksnapshot($v8_snapshot_toolchain)",
  1246. ]
  1247. if (use_v8_context_snapshot) {
  1248. mksnapshot_deps += [ "//tools/v8_context_snapshot:v8_context_snapshot_generator($v8_snapshot_toolchain)" ]
  1249. }
  1250. group("electron_mksnapshot") {
  1251. public_deps = mksnapshot_deps
  1252. }
  1253. dist_zip("electron_mksnapshot_zip") {
  1254. data_deps = mksnapshot_deps
  1255. deps = data_deps
  1256. outputs = [ "$root_build_dir/mksnapshot.zip" ]
  1257. }
  1258. copy("hunspell_dictionaries") {
  1259. sources = hunspell_dictionaries + hunspell_licenses
  1260. outputs = [ "$target_gen_dir/electron_hunspell/{{source_file_part}}" ]
  1261. }
  1262. dist_zip("hunspell_dictionaries_zip") {
  1263. data_deps = [ ":hunspell_dictionaries" ]
  1264. deps = data_deps
  1265. flatten = true
  1266. outputs = [ "$root_build_dir/hunspell_dictionaries.zip" ]
  1267. }
  1268. copy("libcxx_headers") {
  1269. sources = libcxx_headers + libcxx_licenses +
  1270. [ "//buildtools/third_party/libc++/__config_site" ]
  1271. outputs = [ "$target_gen_dir/electron_libcxx_include/{{source_root_relative_dir}}/{{source_file_part}}" ]
  1272. }
  1273. dist_zip("libcxx_headers_zip") {
  1274. data_deps = [ ":libcxx_headers" ]
  1275. deps = data_deps
  1276. flatten = true
  1277. flatten_relative_to =
  1278. rebase_path(
  1279. "$target_gen_dir/electron_libcxx_include/third_party/libc++/src",
  1280. "$root_out_dir")
  1281. outputs = [ "$root_build_dir/libcxx_headers.zip" ]
  1282. }
  1283. copy("libcxxabi_headers") {
  1284. sources = libcxxabi_headers + libcxxabi_licenses
  1285. outputs = [ "$target_gen_dir/electron_libcxxabi_include/{{source_root_relative_dir}}/{{source_file_part}}" ]
  1286. }
  1287. dist_zip("libcxxabi_headers_zip") {
  1288. data_deps = [ ":libcxxabi_headers" ]
  1289. deps = data_deps
  1290. flatten = true
  1291. flatten_relative_to = rebase_path(
  1292. "$target_gen_dir/electron_libcxxabi_include/third_party/libc++abi/src",
  1293. "$root_out_dir")
  1294. outputs = [ "$root_build_dir/libcxxabi_headers.zip" ]
  1295. }
  1296. action("libcxx_objects_zip") {
  1297. deps = [ "//buildtools/third_party/libc++" ]
  1298. script = "build/zip_libcxx.py"
  1299. outputs = [ "$root_build_dir/libcxx_objects.zip" ]
  1300. args = rebase_path(outputs)
  1301. }
  1302. group("electron") {
  1303. public_deps = [ ":electron_app" ]
  1304. }
  1305. ##### node_headers
  1306. node_dir = "../third_party/electron_node"
  1307. node_files = read_file("$node_dir/filenames.json", "json")
  1308. node_headers_dir = "$root_gen_dir/node_headers"
  1309. header_group_index = 0
  1310. header_groups = []
  1311. foreach(header_group, node_files.headers) {
  1312. copy("node_headers_${header_group_index}") {
  1313. sources = rebase_path(header_group.files, ".", node_dir)
  1314. outputs =
  1315. [ "$node_headers_dir/${header_group.dest_dir}/{{source_file_part}}" ]
  1316. }
  1317. header_groups += [ ":node_headers_${header_group_index}" ]
  1318. header_group_index += 1
  1319. }
  1320. copy("zlib_headers") {
  1321. sources = [
  1322. "$node_dir/deps/zlib/zconf.h",
  1323. "$node_dir/deps/zlib/zlib.h",
  1324. ]
  1325. outputs = [ "$node_headers_dir/include/node/{{source_file_part}}" ]
  1326. }
  1327. copy("node_gypi_headers") {
  1328. deps = [ ":generate_config_gypi" ]
  1329. sources = [
  1330. "$node_dir/common.gypi",
  1331. "$root_gen_dir/config.gypi",
  1332. ]
  1333. outputs = [ "$node_headers_dir/include/node/{{source_file_part}}" ]
  1334. }
  1335. action("node_version_header") {
  1336. inputs = [ "$node_dir/src/node_version.h" ]
  1337. outputs = [ "$node_headers_dir/include/node/node_version.h" ]
  1338. script = "script/generate_node_version_header.py"
  1339. args = rebase_path(inputs) + rebase_path(outputs)
  1340. if (node_module_version != "") {
  1341. args += [ "$node_module_version" ]
  1342. }
  1343. }
  1344. action("tar_node_headers") {
  1345. deps = [ ":copy_node_headers" ]
  1346. outputs = [ "$root_gen_dir/node_headers.tar.gz" ]
  1347. script = "script/tar.py"
  1348. args = [
  1349. rebase_path("$root_gen_dir/node_headers"),
  1350. rebase_path(outputs[0]),
  1351. ]
  1352. }
  1353. group("copy_node_headers") {
  1354. public_deps = header_groups + [
  1355. ":node_gypi_headers",
  1356. ":node_version_header",
  1357. ":zlib_headers",
  1358. ]
  1359. }
  1360. group("node_headers") {
  1361. public_deps = [ ":tar_node_headers" ]
  1362. }