BUILD.gn 46 KB

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