BUILD.gn 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579
  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. 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_asar_bundle") {
  151. deps = [ ":build_electron_definitions" ]
  152. inputs = auto_filenames.asar_bundle_deps
  153. config_file = "//electron/build/webpack/webpack.config.asar.js"
  154. out_file = "$target_gen_dir/js2c/asar_bundle.js"
  155. }
  156. webpack_build("electron_browser_bundle") {
  157. deps = [ ":build_electron_definitions" ]
  158. inputs = auto_filenames.browser_bundle_deps
  159. config_file = "//electron/build/webpack/webpack.config.browser.js"
  160. out_file = "$target_gen_dir/js2c/browser_init.js"
  161. }
  162. webpack_build("electron_renderer_bundle") {
  163. deps = [ ":build_electron_definitions" ]
  164. inputs = auto_filenames.renderer_bundle_deps
  165. config_file = "//electron/build/webpack/webpack.config.renderer.js"
  166. out_file = "$target_gen_dir/js2c/renderer_init.js"
  167. }
  168. webpack_build("electron_worker_bundle") {
  169. deps = [ ":build_electron_definitions" ]
  170. inputs = auto_filenames.worker_bundle_deps
  171. config_file = "//electron/build/webpack/webpack.config.worker.js"
  172. out_file = "$target_gen_dir/js2c/worker_init.js"
  173. }
  174. webpack_build("electron_sandboxed_renderer_bundle") {
  175. deps = [ ":build_electron_definitions" ]
  176. inputs = auto_filenames.sandbox_bundle_deps
  177. config_file = "//electron/build/webpack/webpack.config.sandboxed_renderer.js"
  178. out_file = "$target_gen_dir/js2c/sandbox_bundle.js"
  179. }
  180. webpack_build("electron_isolated_renderer_bundle") {
  181. deps = [ ":build_electron_definitions" ]
  182. inputs = auto_filenames.isolated_bundle_deps
  183. config_file = "//electron/build/webpack/webpack.config.isolated_renderer.js"
  184. out_file = "$target_gen_dir/js2c/isolated_bundle.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_asar_bundle",
  195. ":electron_browser_bundle",
  196. ":electron_isolated_renderer_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/asar_bundle.js",
  205. "$target_gen_dir/js2c/browser_init.js",
  206. "$target_gen_dir/js2c/isolated_bundle.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 += [ "//v8:external_startup_data" ]
  336. configs += [ "//third_party/electron_node:node_internals" ]
  337. public_configs = [
  338. ":branding",
  339. ":electron_lib_config",
  340. ]
  341. deps = [
  342. ":electron_fuses",
  343. ":electron_generate_node_defines",
  344. ":electron_js2c",
  345. ":electron_version_header",
  346. ":resources",
  347. "buildflags",
  348. "chromium_src:chrome",
  349. "chromium_src:chrome_spellchecker",
  350. "shell/common/api:mojo",
  351. "shell/services/node/public/mojom",
  352. "//base:base_static",
  353. "//base/allocator:buildflags",
  354. "//chrome:strings",
  355. "//chrome/app:command_ids",
  356. "//chrome/app/resources:platform_locale_settings",
  357. "//components/autofill/core/common:features",
  358. "//components/certificate_transparency",
  359. "//components/compose:buildflags",
  360. "//components/embedder_support:browser_util",
  361. "//components/language/core/browser",
  362. "//components/net_log",
  363. "//components/network_hints/browser",
  364. "//components/network_hints/common:mojo_bindings",
  365. "//components/network_hints/renderer",
  366. "//components/network_session_configurator/common",
  367. "//components/omnibox/browser:buildflags",
  368. "//components/os_crypt/async/browser",
  369. "//components/os_crypt/async/browser:key_provider_interface",
  370. "//components/os_crypt/sync",
  371. "//components/pref_registry",
  372. "//components/prefs",
  373. "//components/security_state/content",
  374. "//components/upload_list",
  375. "//components/user_prefs",
  376. "//components/viz/host",
  377. "//components/viz/service",
  378. "//components/webrtc",
  379. "//content/public/browser",
  380. "//content/public/child",
  381. "//content/public/gpu",
  382. "//content/public/renderer",
  383. "//content/public/utility",
  384. "//device/bluetooth",
  385. "//device/bluetooth/public/cpp",
  386. "//gin",
  387. "//media/capture/mojom:video_capture",
  388. "//media/mojo/mojom",
  389. "//net:extras",
  390. "//net:net_resources",
  391. "//printing/buildflags",
  392. "//services/device/public/cpp/geolocation",
  393. "//services/device/public/cpp/hid",
  394. "//services/device/public/mojom",
  395. "//services/proxy_resolver:lib",
  396. "//services/video_capture/public/mojom:constants",
  397. "//services/viz/privileged/mojom/compositing",
  398. "//services/viz/public/mojom",
  399. "//skia",
  400. "//third_party/blink/public:blink",
  401. "//third_party/blink/public:blink_devtools_inspector_resources",
  402. "//third_party/blink/public/platform/media",
  403. "//third_party/boringssl",
  404. "//third_party/electron_node:node_lib",
  405. "//third_party/inspector_protocol:crdtp",
  406. "//third_party/leveldatabase",
  407. "//third_party/libyuv",
  408. "//third_party/webrtc_overrides:webrtc_component",
  409. "//third_party/widevine/cdm:headers",
  410. "//third_party/zlib/google:zip",
  411. "//ui/base/idle",
  412. "//ui/compositor",
  413. "//ui/events:dom_keycode_converter",
  414. "//ui/gl",
  415. "//ui/native_theme",
  416. "//ui/shell_dialogs",
  417. "//ui/views",
  418. "//v8",
  419. "//v8:v8_libplatform",
  420. ]
  421. public_deps = [
  422. "//base",
  423. "//base:i18n",
  424. "//content/public/app",
  425. ]
  426. include_dirs = [
  427. ".",
  428. "$target_gen_dir",
  429. # TODO(nornagon): replace usage of SchemeRegistry by an actually exported
  430. # API of blink, then remove this from the include_dirs.
  431. "//third_party/blink/renderer",
  432. ]
  433. defines = [ "V8_DEPRECATION_WARNINGS" ]
  434. libs = []
  435. if (is_linux) {
  436. defines += [ "GDK_DISABLE_DEPRECATION_WARNINGS" ]
  437. }
  438. if (!is_mas_build) {
  439. deps += [
  440. "//components/crash/core/app",
  441. "//components/crash/core/browser",
  442. ]
  443. }
  444. configs += [ "//electron/build/config:mas_build" ]
  445. sources = filenames.lib_sources
  446. if (is_win) {
  447. sources += filenames.lib_sources_win
  448. }
  449. if (is_mac) {
  450. sources += filenames.lib_sources_mac
  451. }
  452. if (is_posix) {
  453. sources += filenames.lib_sources_posix
  454. }
  455. if (is_linux) {
  456. sources += filenames.lib_sources_linux
  457. }
  458. if (!is_mac) {
  459. sources += filenames.lib_sources_views
  460. }
  461. if (is_component_build) {
  462. defines += [ "NODE_SHARED_MODE" ]
  463. }
  464. if (enable_fake_location_provider) {
  465. sources += [
  466. "shell/browser/fake_location_provider.cc",
  467. "shell/browser/fake_location_provider.h",
  468. ]
  469. }
  470. if (is_mac) {
  471. deps += [
  472. "//components/remote_cocoa/app_shim",
  473. "//components/remote_cocoa/browser",
  474. "//content/browser:mac_helpers",
  475. "//ui/accelerated_widget_mac",
  476. ]
  477. if (!is_mas_build) {
  478. deps += [ "//third_party/crashpad/crashpad/client" ]
  479. }
  480. frameworks = [
  481. "AuthenticationServices.framework",
  482. "AVFoundation.framework",
  483. "Carbon.framework",
  484. "LocalAuthentication.framework",
  485. "QuartzCore.framework",
  486. "Quartz.framework",
  487. "Security.framework",
  488. "SecurityInterface.framework",
  489. "ServiceManagement.framework",
  490. "StoreKit.framework",
  491. ]
  492. weak_frameworks = [ "QuickLookThumbnailing.framework" ]
  493. sources += [
  494. "shell/browser/ui/views/autofill_popup_view.cc",
  495. "shell/browser/ui/views/autofill_popup_view.h",
  496. ]
  497. if (is_mas_build) {
  498. sources += [ "shell/browser/api/electron_api_app_mas.mm" ]
  499. sources -= [ "shell/browser/auto_updater_mac.mm" ]
  500. sources -= [
  501. "shell/app/electron_crash_reporter_client.cc",
  502. "shell/app/electron_crash_reporter_client.h",
  503. "shell/common/crash_keys.cc",
  504. "shell/common/crash_keys.h",
  505. ]
  506. } else {
  507. frameworks += [
  508. "Squirrel.framework",
  509. "ReactiveObjC.framework",
  510. "Mantle.framework",
  511. ]
  512. deps += [
  513. "//third_party/squirrel.mac:reactiveobjc_framework+link",
  514. "//third_party/squirrel.mac:squirrel_framework+link",
  515. ]
  516. # ReactiveObjC which is used by Squirrel requires using __weak.
  517. cflags_objcc = [ "-fobjc-weak" ]
  518. }
  519. }
  520. if (is_linux) {
  521. libs = [ "xshmfence" ]
  522. deps += [
  523. ":electron_gtk_stubs",
  524. ":libnotify_loader",
  525. "//build/config/linux/gtk",
  526. "//components/crash/content/browser",
  527. "//dbus",
  528. "//device/bluetooth",
  529. "//third_party/crashpad/crashpad/client",
  530. "//ui/base/ime/linux",
  531. "//ui/events/devices/x11",
  532. "//ui/events/platform/x11",
  533. "//ui/gtk:gtk_config",
  534. "//ui/linux:linux_ui",
  535. "//ui/linux:linux_ui_factory",
  536. "//ui/views/controls/webview",
  537. "//ui/wm",
  538. ]
  539. if (ozone_platform_x11) {
  540. sources += filenames.lib_sources_linux_x11
  541. public_deps += [
  542. "//ui/base/x",
  543. "//ui/ozone/platform/x11",
  544. ]
  545. }
  546. configs += [ ":gio_unix" ]
  547. defines += [
  548. # Disable warnings for g_settings_list_schemas.
  549. "GLIB_DISABLE_DEPRECATION_WARNINGS",
  550. ]
  551. sources += [
  552. "shell/browser/certificate_manager_model.cc",
  553. "shell/browser/certificate_manager_model.h",
  554. "shell/browser/ui/gtk_util.cc",
  555. "shell/browser/ui/gtk_util.h",
  556. ]
  557. }
  558. if (is_win) {
  559. libs += [ "dwmapi.lib" ]
  560. deps += [
  561. "//components/crash/core/app:crash_export_thunks",
  562. "//ui/native_theme:native_theme_browser",
  563. "//ui/views/controls/webview",
  564. "//ui/wm",
  565. "//ui/wm/public",
  566. ]
  567. public_deps += [
  568. "//sandbox/win:sandbox",
  569. "//third_party/crashpad/crashpad/handler",
  570. ]
  571. }
  572. if (enable_plugins) {
  573. deps += [ "chromium_src:plugins" ]
  574. sources += [
  575. "shell/common/plugin_info.cc",
  576. "shell/common/plugin_info.h",
  577. "shell/renderer/electron_renderer_pepper_host_factory.cc",
  578. "shell/renderer/electron_renderer_pepper_host_factory.h",
  579. "shell/renderer/pepper_helper.cc",
  580. "shell/renderer/pepper_helper.h",
  581. ]
  582. }
  583. if (enable_ppapi) {
  584. deps += [
  585. "//ppapi/host",
  586. "//ppapi/proxy",
  587. "//ppapi/shared_impl",
  588. ]
  589. }
  590. if (enable_views_api) {
  591. sources += [
  592. "shell/browser/api/views/electron_api_image_view.cc",
  593. "shell/browser/api/views/electron_api_image_view.h",
  594. ]
  595. }
  596. if (enable_printing) {
  597. sources += [
  598. "shell/browser/printing/print_view_manager_electron.cc",
  599. "shell/browser/printing/print_view_manager_electron.h",
  600. "shell/renderer/printing/print_render_frame_helper_delegate.cc",
  601. "shell/renderer/printing/print_render_frame_helper_delegate.h",
  602. ]
  603. deps += [
  604. "//chrome/services/printing/public/mojom",
  605. "//components/printing/common:mojo_interfaces",
  606. ]
  607. if (is_mac) {
  608. deps += [ "//chrome/services/mac_notifications/public/mojom" ]
  609. }
  610. }
  611. if (enable_electron_extensions) {
  612. sources += filenames.lib_sources_extensions
  613. deps += [
  614. "shell/browser/extensions/api:api_registration",
  615. "shell/common/extensions/api",
  616. "shell/common/extensions/api:extensions_features",
  617. "//chrome/browser/resources:component_extension_resources",
  618. "//components/guest_view/common:mojom",
  619. "//components/update_client:update_client",
  620. "//components/zoom",
  621. "//extensions/browser",
  622. "//extensions/browser/api:api_provider",
  623. "//extensions/browser/updater",
  624. "//extensions/common",
  625. "//extensions/common:core_api_provider",
  626. "//extensions/renderer",
  627. ]
  628. }
  629. if (enable_pdf) {
  630. # Printing depends on some //pdf code, so it needs to be built even if the
  631. # pdf viewer isn't enabled.
  632. deps += [
  633. "//pdf",
  634. "//pdf:features",
  635. ]
  636. }
  637. if (enable_pdf_viewer) {
  638. deps += [
  639. "//chrome/browser/resources/pdf:resources",
  640. "//components/pdf/browser",
  641. "//components/pdf/browser:interceptors",
  642. "//components/pdf/common",
  643. "//components/pdf/renderer",
  644. "//pdf",
  645. ]
  646. sources += [
  647. "shell/browser/electron_pdf_document_helper_client.cc",
  648. "shell/browser/electron_pdf_document_helper_client.h",
  649. "shell/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.cc",
  650. "shell/browser/extensions/api/pdf_viewer_private/pdf_viewer_private_api.h",
  651. ]
  652. }
  653. sources += get_target_outputs(":electron_fuses")
  654. if (allow_runtime_configurable_key_storage) {
  655. defines += [ "ALLOW_RUNTIME_CONFIGURABLE_KEY_STORAGE" ]
  656. }
  657. }
  658. electron_paks("packed_resources") {
  659. if (is_mac) {
  660. output_dir = "$root_gen_dir/electron_repack"
  661. copy_data_to_bundle = true
  662. } else {
  663. output_dir = root_out_dir
  664. }
  665. }
  666. if (is_mac) {
  667. electron_framework_name = "$electron_product_name Framework"
  668. electron_helper_name = "$electron_product_name Helper"
  669. electron_login_helper_name = "$electron_product_name Login Helper"
  670. electron_framework_version = "A"
  671. mac_xib_bundle_data("electron_xibs") {
  672. sources = [ "shell/common/resources/mac/MainMenu.xib" ]
  673. }
  674. bundle_data("electron_framework_resources") {
  675. public_deps = [ ":packed_resources" ]
  676. sources = []
  677. if (icu_use_data_file) {
  678. sources += [ "$root_out_dir/icudtl.dat" ]
  679. public_deps += [ "//third_party/icu:icudata" ]
  680. }
  681. if (v8_use_external_startup_data) {
  682. public_deps += [ "//v8" ]
  683. if (use_v8_context_snapshot) {
  684. sources += [ "$root_out_dir/$v8_context_snapshot_filename" ]
  685. public_deps += [ "//tools/v8_context_snapshot" ]
  686. } else {
  687. sources += [ "$root_out_dir/snapshot_blob.bin" ]
  688. }
  689. }
  690. outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
  691. }
  692. if (!is_component_build && is_component_ffmpeg) {
  693. bundle_data("electron_framework_libraries") {
  694. sources = []
  695. public_deps = []
  696. sources += [ "$root_out_dir/libffmpeg.dylib" ]
  697. public_deps += [ "//third_party/ffmpeg:ffmpeg" ]
  698. outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
  699. }
  700. } else {
  701. group("electron_framework_libraries") {
  702. }
  703. }
  704. if (use_egl) {
  705. # Add the ANGLE .dylibs in the Libraries directory of the Framework.
  706. bundle_data("electron_angle_binaries") {
  707. sources = [
  708. "$root_out_dir/egl_intermediates/libEGL.dylib",
  709. "$root_out_dir/egl_intermediates/libGLESv2.dylib",
  710. ]
  711. outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
  712. public_deps = [ "//ui/gl:angle_library_copy" ]
  713. }
  714. # Add the SwiftShader .dylibs in the Libraries directory of the Framework.
  715. bundle_data("electron_swiftshader_binaries") {
  716. sources = [
  717. "$root_out_dir/vk_intermediates/libvk_swiftshader.dylib",
  718. "$root_out_dir/vk_intermediates/vk_swiftshader_icd.json",
  719. ]
  720. outputs = [ "{{bundle_contents_dir}}/Libraries/{{source_file_part}}" ]
  721. public_deps = [ "//ui/gl:swiftshader_vk_library_copy" ]
  722. }
  723. }
  724. group("electron_angle_library") {
  725. if (use_egl) {
  726. deps = [ ":electron_angle_binaries" ]
  727. }
  728. }
  729. group("electron_swiftshader_library") {
  730. if (use_egl) {
  731. deps = [ ":electron_swiftshader_binaries" ]
  732. }
  733. }
  734. bundle_data("electron_crashpad_helper") {
  735. sources = [ "$root_out_dir/chrome_crashpad_handler" ]
  736. outputs = [ "{{bundle_contents_dir}}/Helpers/{{source_file_part}}" ]
  737. public_deps = [ "//components/crash/core/app:chrome_crashpad_handler" ]
  738. if (is_asan) {
  739. # crashpad_handler requires the ASan runtime at its @executable_path.
  740. sources += [ "$root_out_dir/libclang_rt.asan_osx_dynamic.dylib" ]
  741. public_deps += [ "//build/config/sanitizers:copy_asan_runtime" ]
  742. }
  743. }
  744. mac_framework_bundle("electron_framework") {
  745. output_name = electron_framework_name
  746. framework_version = electron_framework_version
  747. framework_contents = [
  748. "Resources",
  749. "Libraries",
  750. ]
  751. if (!is_mas_build) {
  752. framework_contents += [ "Helpers" ]
  753. }
  754. public_deps = [
  755. ":electron_framework_libraries",
  756. ":electron_lib",
  757. ]
  758. deps = [
  759. ":electron_angle_library",
  760. ":electron_framework_libraries",
  761. ":electron_framework_resources",
  762. ":electron_swiftshader_library",
  763. ":electron_xibs",
  764. ]
  765. if (!is_mas_build) {
  766. deps += [ ":electron_crashpad_helper" ]
  767. }
  768. info_plist = "shell/common/resources/mac/Info.plist"
  769. extra_substitutions = [
  770. "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.framework",
  771. "ELECTRON_VERSION=$electron_version",
  772. ]
  773. include_dirs = [ "." ]
  774. sources = filenames.framework_sources
  775. frameworks = [ "IOSurface.framework" ]
  776. ldflags = [
  777. "-Wl,-install_name,@rpath/$output_name.framework/$output_name",
  778. "-rpath",
  779. "@loader_path/Libraries",
  780. # Required for exporting all symbols of libuv.
  781. "-Wl,-force_load,obj/third_party/electron_node/deps/uv/libuv.a",
  782. ]
  783. if (is_component_build) {
  784. ldflags += [
  785. "-rpath",
  786. "@executable_path/../../../../../..",
  787. ]
  788. }
  789. # For component ffmpeg under non-component build, it is linked from
  790. # @loader_path. However the ffmpeg.dylib is moved to a different place
  791. # when generating app bundle, and we should change to link from @rpath.
  792. if (is_component_ffmpeg && !is_component_build) {
  793. ldflags += [ "-Wcrl,installnametool,-change,@loader_path/libffmpeg.dylib,@rpath/libffmpeg.dylib" ]
  794. }
  795. }
  796. template("electron_helper_app") {
  797. mac_app_bundle(target_name) {
  798. assert(defined(invoker.helper_name_suffix))
  799. output_name = electron_helper_name + invoker.helper_name_suffix
  800. deps = [ ":electron_framework+link" ]
  801. if (!is_mas_build) {
  802. deps += [ "//sandbox/mac:seatbelt" ]
  803. }
  804. defines = [ "HELPER_EXECUTABLE" ]
  805. configs += [ "//electron/build/config:mas_build" ]
  806. sources = [
  807. "shell/app/electron_main_mac.cc",
  808. "shell/app/uv_stdio_fix.cc",
  809. "shell/app/uv_stdio_fix.h",
  810. "shell/common/electron_constants.cc",
  811. ]
  812. include_dirs = [ "." ]
  813. info_plist = "shell/renderer/resources/mac/Info.plist"
  814. extra_substitutions =
  815. [ "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.helper" ]
  816. ldflags = [
  817. "-rpath",
  818. "@executable_path/../../..",
  819. ]
  820. if (is_component_build) {
  821. ldflags += [
  822. "-rpath",
  823. "@executable_path/../../../../../..",
  824. ]
  825. }
  826. }
  827. }
  828. foreach(helper_params, content_mac_helpers) {
  829. _helper_target = helper_params[0]
  830. _helper_bundle_id = helper_params[1]
  831. _helper_suffix = helper_params[2]
  832. electron_helper_app("electron_helper_app_${_helper_target}") {
  833. helper_name_suffix = _helper_suffix
  834. }
  835. }
  836. template("stripped_framework") {
  837. action(target_name) {
  838. assert(defined(invoker.framework))
  839. script = "//electron/build/strip_framework.py"
  840. forward_variables_from(invoker, [ "deps" ])
  841. inputs = [ "$root_out_dir/" + invoker.framework ]
  842. outputs = [ "$target_out_dir/stripped_frameworks/" + invoker.framework ]
  843. args = rebase_path(inputs) + rebase_path(outputs)
  844. }
  845. }
  846. stripped_framework("stripped_mantle_framework") {
  847. framework = "Mantle.framework"
  848. deps = [ "//third_party/squirrel.mac:mantle_framework" ]
  849. }
  850. stripped_framework("stripped_reactiveobjc_framework") {
  851. framework = "ReactiveObjC.framework"
  852. deps = [ "//third_party/squirrel.mac:reactiveobjc_framework" ]
  853. }
  854. stripped_framework("stripped_squirrel_framework") {
  855. framework = "Squirrel.framework"
  856. deps = [ "//third_party/squirrel.mac:squirrel_framework" ]
  857. }
  858. bundle_data("electron_app_framework_bundle_data") {
  859. sources = [ "$root_out_dir/$electron_framework_name.framework" ]
  860. if (!is_mas_build) {
  861. sources += get_target_outputs(":stripped_mantle_framework") +
  862. get_target_outputs(":stripped_reactiveobjc_framework") +
  863. get_target_outputs(":stripped_squirrel_framework")
  864. }
  865. outputs = [ "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}" ]
  866. public_deps = [
  867. ":electron_framework+link",
  868. ":stripped_mantle_framework",
  869. ":stripped_reactiveobjc_framework",
  870. ":stripped_squirrel_framework",
  871. ]
  872. foreach(helper_params, content_mac_helpers) {
  873. sources +=
  874. [ "$root_out_dir/${electron_helper_name}${helper_params[2]}.app" ]
  875. public_deps += [ ":electron_helper_app_${helper_params[0]}" ]
  876. }
  877. }
  878. mac_app_bundle("electron_login_helper") {
  879. output_name = electron_login_helper_name
  880. sources = filenames.login_helper_sources
  881. include_dirs = [ "." ]
  882. frameworks = [ "AppKit.framework" ]
  883. info_plist = "shell/app/resources/mac/loginhelper-Info.plist"
  884. extra_substitutions =
  885. [ "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id.loginhelper" ]
  886. }
  887. bundle_data("electron_login_helper_app") {
  888. public_deps = [ ":electron_login_helper" ]
  889. sources = [ "$root_out_dir/$electron_login_helper_name.app" ]
  890. outputs =
  891. [ "{{bundle_contents_dir}}/Library/LoginItems/{{source_file_part}}" ]
  892. }
  893. action("electron_app_lproj_dirs") {
  894. outputs = []
  895. foreach(locale, locales_as_apple_outputs) {
  896. outputs += [ "$target_gen_dir/app_infoplist_strings/$locale.lproj" ]
  897. }
  898. script = "build/mac/make_locale_dirs.py"
  899. args = rebase_path(outputs)
  900. }
  901. foreach(locale, locales_as_apple_outputs) {
  902. bundle_data("electron_app_strings_${locale}_bundle_data") {
  903. sources = [ "$target_gen_dir/app_infoplist_strings/$locale.lproj" ]
  904. outputs = [ "{{bundle_resources_dir}}/$locale.lproj" ]
  905. public_deps = [ ":electron_app_lproj_dirs" ]
  906. }
  907. }
  908. group("electron_app_strings_bundle_data") {
  909. public_deps = []
  910. foreach(locale, locales_as_apple_outputs) {
  911. public_deps += [ ":electron_app_strings_${locale}_bundle_data" ]
  912. }
  913. }
  914. bundle_data("electron_app_resources") {
  915. public_deps = [
  916. ":default_app_asar",
  917. ":electron_app_strings_bundle_data",
  918. ]
  919. sources = [
  920. "$root_out_dir/resources/default_app.asar",
  921. "shell/browser/resources/mac/electron.icns",
  922. ]
  923. outputs = [ "{{bundle_resources_dir}}/{{source_file_part}}" ]
  924. }
  925. asar_hashed_info_plist("electron_app_plist") {
  926. keys = [ "DEFAULT_APP_ASAR_HEADER_SHA" ]
  927. hash_targets = [ ":default_app_asar_header_hash" ]
  928. plist_file = "shell/browser/resources/mac/Info.plist"
  929. }
  930. mac_app_bundle("electron_app") {
  931. output_name = electron_product_name
  932. sources = [
  933. "shell/app/electron_main_mac.cc",
  934. "shell/app/uv_stdio_fix.cc",
  935. "shell/app/uv_stdio_fix.h",
  936. ]
  937. include_dirs = [ "." ]
  938. deps = [
  939. ":electron_app_framework_bundle_data",
  940. ":electron_app_plist",
  941. ":electron_app_resources",
  942. ":electron_fuses",
  943. "//electron/buildflags",
  944. ]
  945. if (is_mas_build) {
  946. deps += [ ":electron_login_helper_app" ]
  947. }
  948. info_plist_target = ":electron_app_plist"
  949. extra_substitutions = [
  950. "ELECTRON_BUNDLE_ID=$electron_mac_bundle_id",
  951. "ELECTRON_VERSION=$electron_version",
  952. ]
  953. ldflags = [
  954. "-rpath",
  955. "@executable_path/../Frameworks",
  956. ]
  957. configs += [ "//electron/build/config:mas_build" ]
  958. }
  959. if (enable_dsyms) {
  960. extract_symbols("electron_framework_syms") {
  961. binary = "$root_out_dir/$electron_framework_name.framework/Versions/$electron_framework_version/$electron_framework_name"
  962. symbol_dir = "$root_out_dir/breakpad_symbols"
  963. dsym_file = "$root_out_dir/$electron_framework_name.dSYM/Contents/Resources/DWARF/$electron_framework_name"
  964. deps = [ ":electron_framework" ]
  965. }
  966. foreach(helper_params, content_mac_helpers) {
  967. _helper_target = helper_params[0]
  968. _helper_bundle_id = helper_params[1]
  969. _helper_suffix = helper_params[2]
  970. extract_symbols("electron_helper_syms_${_helper_target}") {
  971. binary = "$root_out_dir/$electron_helper_name${_helper_suffix}.app/Contents/MacOS/$electron_helper_name${_helper_suffix}"
  972. symbol_dir = "$root_out_dir/breakpad_symbols"
  973. dsym_file = "$root_out_dir/$electron_helper_name${_helper_suffix}.dSYM/Contents/Resources/DWARF/$electron_helper_name${_helper_suffix}"
  974. deps = [ ":electron_helper_app_${_helper_target}" ]
  975. }
  976. }
  977. extract_symbols("electron_app_syms") {
  978. binary = "$root_out_dir/$electron_product_name.app/Contents/MacOS/$electron_product_name"
  979. symbol_dir = "$root_out_dir/breakpad_symbols"
  980. dsym_file = "$root_out_dir/$electron_product_name.dSYM/Contents/Resources/DWARF/$electron_product_name"
  981. deps = [ ":electron_app" ]
  982. }
  983. extract_symbols("egl_syms") {
  984. binary = "$root_out_dir/libEGL.dylib"
  985. symbol_dir = "$root_out_dir/breakpad_symbols"
  986. dsym_file = "$root_out_dir/libEGL.dylib.dSYM/Contents/Resources/DWARF/libEGL.dylib"
  987. deps = [ "//third_party/angle:libEGL" ]
  988. }
  989. extract_symbols("gles_syms") {
  990. binary = "$root_out_dir/libGLESv2.dylib"
  991. symbol_dir = "$root_out_dir/breakpad_symbols"
  992. dsym_file = "$root_out_dir/libGLESv2.dylib.dSYM/Contents/Resources/DWARF/libGLESv2.dylib"
  993. deps = [ "//third_party/angle:libGLESv2" ]
  994. }
  995. extract_symbols("crashpad_handler_syms") {
  996. binary = "$root_out_dir/chrome_crashpad_handler"
  997. symbol_dir = "$root_out_dir/breakpad_symbols"
  998. dsym_file = "$root_out_dir/chrome_crashpad_handler.dSYM/Contents/Resources/DWARF/chrome_crashpad_handler"
  999. deps = [ "//components/crash/core/app:chrome_crashpad_handler" ]
  1000. }
  1001. group("electron_symbols") {
  1002. deps = [
  1003. ":egl_syms",
  1004. ":electron_app_syms",
  1005. ":electron_framework_syms",
  1006. ":gles_syms",
  1007. ]
  1008. if (!is_mas_build) {
  1009. deps += [ ":crashpad_handler_syms" ]
  1010. }
  1011. foreach(helper_params, content_mac_helpers) {
  1012. _helper_target = helper_params[0]
  1013. deps += [ ":electron_helper_syms_${_helper_target}" ]
  1014. }
  1015. }
  1016. } else {
  1017. group("electron_symbols") {
  1018. }
  1019. }
  1020. } else {
  1021. windows_manifest("electron_app_manifest") {
  1022. sources = [
  1023. "shell/browser/resources/win/disable_window_filtering.manifest",
  1024. "shell/browser/resources/win/dpi_aware.manifest",
  1025. as_invoker_manifest,
  1026. common_controls_manifest,
  1027. default_compatibility_manifest,
  1028. ]
  1029. }
  1030. executable("electron_app") {
  1031. output_name = electron_project_name
  1032. if (is_win) {
  1033. sources = [ "shell/app/electron_main_win.cc" ]
  1034. } else if (is_linux) {
  1035. sources = [
  1036. "shell/app/electron_main_linux.cc",
  1037. "shell/app/uv_stdio_fix.cc",
  1038. "shell/app/uv_stdio_fix.h",
  1039. ]
  1040. }
  1041. include_dirs = [ "." ]
  1042. deps = [
  1043. ":default_app_asar",
  1044. ":electron_app_manifest",
  1045. ":electron_lib",
  1046. ":electron_win32_resources",
  1047. ":packed_resources",
  1048. "//components/crash/core/app",
  1049. "//content:sandbox_helper_win",
  1050. "//electron/buildflags",
  1051. "//ui/strings",
  1052. ]
  1053. data = []
  1054. data_deps = []
  1055. data += [ "$root_out_dir/resources.pak" ]
  1056. data += [ "$root_out_dir/chrome_100_percent.pak" ]
  1057. if (enable_hidpi) {
  1058. data += [ "$root_out_dir/chrome_200_percent.pak" ]
  1059. }
  1060. foreach(locale, platform_pak_locales) {
  1061. data += [ "$root_out_dir/locales/$locale.pak" ]
  1062. }
  1063. if (!is_mac) {
  1064. data += [ "$root_out_dir/resources/default_app.asar" ]
  1065. }
  1066. if (use_v8_context_snapshot) {
  1067. public_deps = [ "//tools/v8_context_snapshot:v8_context_snapshot" ]
  1068. }
  1069. if (is_linux) {
  1070. data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ]
  1071. }
  1072. if (is_win) {
  1073. sources += [
  1074. "$target_gen_dir/win-resources/electron.rc",
  1075. "shell/browser/resources/win/resource.h",
  1076. ]
  1077. deps += [
  1078. "//chrome/app:exit_code_watcher",
  1079. "//components/crash/core/app:run_as_crashpad_handler",
  1080. ]
  1081. ldflags = []
  1082. libs = [
  1083. "comctl32.lib",
  1084. "uiautomationcore.lib",
  1085. "wtsapi32.lib",
  1086. ]
  1087. configs -= [ "//build/config/win:console" ]
  1088. configs += [
  1089. "//build/config/win:windowed",
  1090. "//build/config/win:delayloads",
  1091. ]
  1092. if (current_cpu == "x86") {
  1093. # Set the initial stack size to 0.5MiB, instead of the 1.5MiB needed by
  1094. # Chrome's main thread. This saves significant memory on threads (like
  1095. # those in the Windows thread pool, and others) whose stack size we can
  1096. # only control through this setting. Because Chrome's main thread needs
  1097. # a minimum 1.5 MiB stack, the main thread (in 32-bit builds only) uses
  1098. # fibers to switch to a 1.5 MiB stack before running any other code.
  1099. ldflags += [ "/STACK:0x80000" ]
  1100. } else {
  1101. # Increase the initial stack size. The default is 1MB, this is 8MB.
  1102. ldflags += [ "/STACK:0x800000" ]
  1103. }
  1104. # This is to support renaming of electron.exe. node-gyp has hard-coded
  1105. # executable names which it will recognise as node. This module definition
  1106. # file claims that the electron executable is in fact named "node.exe",
  1107. # which is one of the executable names that node-gyp recognizes.
  1108. # See https://github.com/nodejs/node-gyp/commit/52ceec3a6d15de3a8f385f43dbe5ecf5456ad07a
  1109. ldflags += [ "/DEF:" + rebase_path("build/electron.def", root_build_dir) ]
  1110. inputs = [
  1111. "shell/browser/resources/win/electron.ico",
  1112. "build/electron.def",
  1113. ]
  1114. }
  1115. if (is_linux) {
  1116. ldflags = [
  1117. "-pie",
  1118. # Required for exporting all symbols of libuv.
  1119. "-Wl,--whole-archive",
  1120. "obj/third_party/electron_node/deps/uv/libuv.a",
  1121. "-Wl,--no-whole-archive",
  1122. ]
  1123. if (!is_component_build && is_component_ffmpeg) {
  1124. configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
  1125. }
  1126. if (is_linux) {
  1127. deps += [ "//sandbox/linux:chrome_sandbox" ]
  1128. }
  1129. }
  1130. }
  1131. if (is_official_build) {
  1132. if (is_linux) {
  1133. _target_executable_suffix = ""
  1134. _target_shared_library_suffix = ".so"
  1135. } else if (is_win) {
  1136. _target_executable_suffix = ".exe"
  1137. _target_shared_library_suffix = ".dll"
  1138. }
  1139. extract_symbols("electron_app_symbols") {
  1140. binary = "$root_out_dir/$electron_project_name$_target_executable_suffix"
  1141. symbol_dir = "$root_out_dir/breakpad_symbols"
  1142. deps = [ ":electron_app" ]
  1143. }
  1144. extract_symbols("egl_symbols") {
  1145. binary = "$root_out_dir/libEGL$_target_shared_library_suffix"
  1146. symbol_dir = "$root_out_dir/breakpad_symbols"
  1147. deps = [ "//third_party/angle:libEGL" ]
  1148. }
  1149. extract_symbols("gles_symbols") {
  1150. binary = "$root_out_dir/libGLESv2$_target_shared_library_suffix"
  1151. symbol_dir = "$root_out_dir/breakpad_symbols"
  1152. deps = [ "//third_party/angle:libGLESv2" ]
  1153. }
  1154. group("electron_symbols") {
  1155. deps = [
  1156. ":egl_symbols",
  1157. ":electron_app_symbols",
  1158. ":gles_symbols",
  1159. ]
  1160. }
  1161. }
  1162. }
  1163. template("dist_zip") {
  1164. _runtime_deps_target = "${target_name}__deps"
  1165. _runtime_deps_file =
  1166. "$root_out_dir/gen.runtime/" + get_label_info(target_name, "dir") + "/" +
  1167. get_label_info(target_name, "name") + ".runtime_deps"
  1168. group(_runtime_deps_target) {
  1169. forward_variables_from(invoker,
  1170. [
  1171. "deps",
  1172. "data_deps",
  1173. "data",
  1174. "testonly",
  1175. ])
  1176. write_runtime_deps = _runtime_deps_file
  1177. }
  1178. action(target_name) {
  1179. script = "//electron/build/zip.py"
  1180. deps = [ ":$_runtime_deps_target" ]
  1181. forward_variables_from(invoker,
  1182. [
  1183. "outputs",
  1184. "testonly",
  1185. ])
  1186. flatten = false
  1187. flatten_relative_to = false
  1188. if (defined(invoker.flatten)) {
  1189. flatten = invoker.flatten
  1190. if (defined(invoker.flatten_relative_to)) {
  1191. flatten_relative_to = invoker.flatten_relative_to
  1192. }
  1193. }
  1194. args = rebase_path(outputs + [ _runtime_deps_file ], root_build_dir) + [
  1195. target_cpu,
  1196. target_os,
  1197. "$flatten",
  1198. "$flatten_relative_to",
  1199. ]
  1200. }
  1201. }
  1202. copy("electron_license") {
  1203. sources = [ "LICENSE" ]
  1204. outputs = [ "$root_build_dir/{{source_file_part}}" ]
  1205. }
  1206. copy("chromium_licenses") {
  1207. deps = [ "//components/resources:about_credits" ]
  1208. sources = [ "$root_gen_dir/components/resources/about_credits.html" ]
  1209. outputs = [ "$root_build_dir/LICENSES.chromium.html" ]
  1210. }
  1211. group("licenses") {
  1212. data_deps = [
  1213. ":chromium_licenses",
  1214. ":electron_license",
  1215. ]
  1216. }
  1217. dist_zip("electron_dist_zip") {
  1218. data_deps = [
  1219. ":electron_app",
  1220. ":electron_version_file",
  1221. ":licenses",
  1222. ]
  1223. if (is_linux) {
  1224. data_deps += [ "//sandbox/linux:chrome_sandbox" ]
  1225. }
  1226. deps = data_deps
  1227. outputs = [ "$root_build_dir/dist.zip" ]
  1228. }
  1229. dist_zip("electron_ffmpeg_zip") {
  1230. data_deps = [ "//third_party/ffmpeg" ]
  1231. deps = data_deps
  1232. outputs = [ "$root_build_dir/ffmpeg.zip" ]
  1233. }
  1234. electron_chromedriver_deps = [
  1235. ":licenses",
  1236. "//chrome/test/chromedriver:chromedriver_server",
  1237. "//electron/buildflags",
  1238. ]
  1239. group("electron_chromedriver") {
  1240. testonly = true
  1241. public_deps = electron_chromedriver_deps
  1242. }
  1243. dist_zip("electron_chromedriver_zip") {
  1244. testonly = true
  1245. data_deps = electron_chromedriver_deps
  1246. deps = data_deps
  1247. outputs = [ "$root_build_dir/chromedriver.zip" ]
  1248. }
  1249. mksnapshot_deps = [
  1250. ":licenses",
  1251. "//v8:mksnapshot($v8_snapshot_toolchain)",
  1252. ]
  1253. if (use_v8_context_snapshot) {
  1254. mksnapshot_deps += [ "//tools/v8_context_snapshot:v8_context_snapshot_generator($v8_snapshot_toolchain)" ]
  1255. }
  1256. group("electron_mksnapshot") {
  1257. public_deps = mksnapshot_deps
  1258. }
  1259. dist_zip("electron_mksnapshot_zip") {
  1260. data_deps = mksnapshot_deps
  1261. deps = data_deps
  1262. outputs = [ "$root_build_dir/mksnapshot.zip" ]
  1263. }
  1264. copy("hunspell_dictionaries") {
  1265. sources = hunspell_dictionaries + hunspell_licenses
  1266. outputs = [ "$target_gen_dir/electron_hunspell/{{source_file_part}}" ]
  1267. }
  1268. dist_zip("hunspell_dictionaries_zip") {
  1269. data_deps = [ ":hunspell_dictionaries" ]
  1270. deps = data_deps
  1271. flatten = true
  1272. outputs = [ "$root_build_dir/hunspell_dictionaries.zip" ]
  1273. }
  1274. copy("libcxx_headers") {
  1275. sources = libcxx_headers + libcxx_licenses +
  1276. [ "//buildtools/third_party/libc++/__config_site" ]
  1277. outputs = [ "$target_gen_dir/electron_libcxx_include/{{source_root_relative_dir}}/{{source_file_part}}" ]
  1278. }
  1279. dist_zip("libcxx_headers_zip") {
  1280. data_deps = [ ":libcxx_headers" ]
  1281. deps = data_deps
  1282. flatten = true
  1283. flatten_relative_to =
  1284. rebase_path(
  1285. "$target_gen_dir/electron_libcxx_include/third_party/libc++/src",
  1286. "$root_out_dir")
  1287. outputs = [ "$root_build_dir/libcxx_headers.zip" ]
  1288. }
  1289. copy("libcxxabi_headers") {
  1290. sources = libcxxabi_headers + libcxxabi_licenses
  1291. outputs = [ "$target_gen_dir/electron_libcxxabi_include/{{source_root_relative_dir}}/{{source_file_part}}" ]
  1292. }
  1293. dist_zip("libcxxabi_headers_zip") {
  1294. data_deps = [ ":libcxxabi_headers" ]
  1295. deps = data_deps
  1296. flatten = true
  1297. flatten_relative_to = rebase_path(
  1298. "$target_gen_dir/electron_libcxxabi_include/third_party/libc++abi/src",
  1299. "$root_out_dir")
  1300. outputs = [ "$root_build_dir/libcxxabi_headers.zip" ]
  1301. }
  1302. action("libcxx_objects_zip") {
  1303. deps = [ "//buildtools/third_party/libc++" ]
  1304. script = "build/zip_libcxx.py"
  1305. outputs = [ "$root_build_dir/libcxx_objects.zip" ]
  1306. args = rebase_path(outputs)
  1307. }
  1308. group("electron") {
  1309. public_deps = [ ":electron_app" ]
  1310. }
  1311. ##### node_headers
  1312. node_dir = "../third_party/electron_node"
  1313. node_files = read_file("$node_dir/filenames.json", "json")
  1314. node_headers_dir = "$root_gen_dir/node_headers"
  1315. header_group_index = 0
  1316. header_groups = []
  1317. foreach(header_group, node_files.headers) {
  1318. copy("node_headers_${header_group_index}") {
  1319. sources = rebase_path(header_group.files, ".", node_dir)
  1320. outputs =
  1321. [ "$node_headers_dir/${header_group.dest_dir}/{{source_file_part}}" ]
  1322. }
  1323. header_groups += [ ":node_headers_${header_group_index}" ]
  1324. header_group_index += 1
  1325. }
  1326. copy("zlib_headers") {
  1327. sources = [
  1328. "$node_dir/deps/zlib/zconf.h",
  1329. "$node_dir/deps/zlib/zlib.h",
  1330. ]
  1331. outputs = [ "$node_headers_dir/include/node/{{source_file_part}}" ]
  1332. }
  1333. copy("node_gypi_headers") {
  1334. deps = [ ":generate_config_gypi" ]
  1335. sources = [
  1336. "$node_dir/common.gypi",
  1337. "$root_gen_dir/config.gypi",
  1338. ]
  1339. outputs = [ "$node_headers_dir/include/node/{{source_file_part}}" ]
  1340. }
  1341. action("node_version_header") {
  1342. inputs = [ "$node_dir/src/node_version.h" ]
  1343. outputs = [ "$node_headers_dir/include/node/node_version.h" ]
  1344. script = "script/generate_node_version_header.py"
  1345. args = rebase_path(inputs) + rebase_path(outputs)
  1346. if (node_module_version != "") {
  1347. args += [ "$node_module_version" ]
  1348. }
  1349. }
  1350. action("tar_node_headers") {
  1351. deps = [ ":copy_node_headers" ]
  1352. outputs = [ "$root_gen_dir/node_headers.tar.gz" ]
  1353. script = "script/tar.py"
  1354. args = [
  1355. rebase_path("$root_gen_dir/node_headers"),
  1356. rebase_path(outputs[0]),
  1357. ]
  1358. }
  1359. group("copy_node_headers") {
  1360. public_deps = header_groups + [
  1361. ":node_gypi_headers",
  1362. ":node_version_header",
  1363. ":zlib_headers",
  1364. ]
  1365. }
  1366. group("node_headers") {
  1367. public_deps = [ ":tar_node_headers" ]
  1368. }