BUILD.gn 46 KB

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