BUILD.gn 46 KB

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