BUILD.gn 46 KB

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