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