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