BUILD.gn 46 KB

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