BUILD.gn 46 KB

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