BUILD.gn 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578
  1. import("//build/config/locales.gni")
  2. import("//build/config/ui.gni")
  3. import("//build/config/win/manifest.gni")
  4. import("//components/os_crypt/sync/features.gni")
  5. import("//components/spellcheck/spellcheck_build_features.gni")
  6. import("//content/public/app/mac_helpers.gni")
  7. import("//extensions/buildflags/buildflags.gni")
  8. import("//pdf/features.gni")
  9. import("//ppapi/buildflags/buildflags.gni")
  10. import("//printing/buildflags/buildflags.gni")
  11. import("//testing/test.gni")
  12. import("//third_party/electron_node/node.gni")
  13. import("//third_party/ffmpeg/ffmpeg_options.gni")
  14. import("//tools/generate_library_loader/generate_library_loader.gni")
  15. import("//tools/grit/grit_rule.gni")
  16. import("//tools/grit/repack.gni")
  17. import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
  18. import("//v8/gni/snapshot_toolchain.gni")
  19. import("build/asar.gni")
  20. import("build/extract_symbols.gni")
  21. import("build/npm.gni")
  22. import("build/templated_file.gni")
  23. import("build/tsc.gni")
  24. import("build/webpack/webpack.gni")
  25. import("buildflags/buildflags.gni")
  26. import("electron_paks.gni")
  27. import("filenames.auto.gni")
  28. import("filenames.gni")
  29. import("filenames.hunspell.gni")
  30. import("filenames.libcxx.gni")
  31. import("filenames.libcxxabi.gni")
  32. 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 headers which contain stubs for extracting function ptrs
  77. # from the gtk library. Function signatures for which stubs are
  78. # required should be declared in the sig files.
  79. generate_stubs("electron_gtk_stubs") {
  80. sigs = [ "shell/browser/ui/electron_gdk_pixbuf.sigs" ]
  81. extra_header = "shell/browser/ui/electron_gtk.fragment"
  82. output_name = "electron_gtk_stubs"
  83. public_deps = [ "//ui/gtk:gtk_config" ]
  84. logging_function = "LogNoop()"
  85. logging_include = "ui/gtk/log_noop.h"
  86. }
  87. }
  88. branding = read_file("shell/app/BRANDING.json", "json")
  89. electron_project_name = branding.project_name
  90. electron_product_name = branding.product_name
  91. electron_mac_bundle_id = branding.mac_bundle_id
  92. if (override_electron_version != "") {
  93. electron_version = override_electron_version
  94. } else {
  95. # When building from source code tarball there is no git tag available and
  96. # builders must explicitly pass override_electron_version in gn args.
  97. # This read_file call will assert if there is no git information, without it
  98. # gn will generate a malformed build configuration and ninja will get into
  99. # infinite loop.
  100. read_file(".git/packed-refs", "string")
  101. # Set electron version from git tag.
  102. electron_version = exec_script("script/get-git-version.py",
  103. [],
  104. "trim string",
  105. [
  106. ".git/packed-refs",
  107. ".git/HEAD",
  108. ])
  109. }
  110. if (is_mas_build) {
  111. assert(is_mac,
  112. "It doesn't make sense to build a MAS build on a non-mac platform")
  113. }
  114. if (enable_pdf_viewer) {
  115. assert(enable_pdf, "PDF viewer support requires enable_pdf=true")
  116. assert(enable_electron_extensions,
  117. "PDF viewer support requires enable_electron_extensions=true")
  118. }
  119. if (enable_electron_extensions) {
  120. assert(enable_extensions,
  121. "Chrome extension support requires enable_extensions=true")
  122. }
  123. config("branding") {
  124. defines = [
  125. "ELECTRON_PRODUCT_NAME=\"$electron_product_name\"",
  126. "ELECTRON_PROJECT_NAME=\"$electron_project_name\"",
  127. ]
  128. }
  129. config("electron_lib_config") {
  130. include_dirs = [ "." ]
  131. }
  132. # We generate the definitions twice here, once in //electron/electron.d.ts
  133. # and once in $target_gen_dir
  134. # The one in $target_gen_dir is used for the actual TSC build later one
  135. # and the one in //electron/electron.d.ts is used by your IDE (vscode)
  136. # for typescript prompting
  137. npm_action("build_electron_definitions") {
  138. script = "gn-typescript-definitions"
  139. args = [ rebase_path("$target_gen_dir/tsc/typings/electron.d.ts") ]
  140. inputs = auto_filenames.api_docs + [ "yarn.lock" ]
  141. outputs = [ "$target_gen_dir/tsc/typings/electron.d.ts" ]
  142. }
  143. webpack_build("electron_browser_bundle") {
  144. deps = [ ":build_electron_definitions" ]
  145. inputs = auto_filenames.browser_bundle_deps
  146. config_file = "//electron/build/webpack/webpack.config.browser.js"
  147. out_file = "$target_gen_dir/js2c/browser_init.js"
  148. }
  149. webpack_build("electron_renderer_bundle") {
  150. deps = [ ":build_electron_definitions" ]
  151. inputs = auto_filenames.renderer_bundle_deps
  152. config_file = "//electron/build/webpack/webpack.config.renderer.js"
  153. out_file = "$target_gen_dir/js2c/renderer_init.js"
  154. }
  155. webpack_build("electron_worker_bundle") {
  156. deps = [ ":build_electron_definitions" ]
  157. inputs = auto_filenames.worker_bundle_deps
  158. config_file = "//electron/build/webpack/webpack.config.worker.js"
  159. out_file = "$target_gen_dir/js2c/worker_init.js"
  160. }
  161. webpack_build("electron_sandboxed_renderer_bundle") {
  162. deps = [ ":build_electron_definitions" ]
  163. inputs = auto_filenames.sandbox_bundle_deps
  164. config_file = "//electron/build/webpack/webpack.config.sandboxed_renderer.js"
  165. out_file = "$target_gen_dir/js2c/sandbox_bundle.js"
  166. }
  167. webpack_build("electron_isolated_renderer_bundle") {
  168. deps = [ ":build_electron_definitions" ]
  169. inputs = auto_filenames.isolated_bundle_deps
  170. config_file = "//electron/build/webpack/webpack.config.isolated_renderer.js"
  171. out_file = "$target_gen_dir/js2c/isolated_bundle.js"
  172. }
  173. webpack_build("electron_node_bundle") {
  174. deps = [ ":build_electron_definitions" ]
  175. inputs = auto_filenames.node_bundle_deps
  176. config_file = "//electron/build/webpack/webpack.config.node.js"
  177. out_file = "$target_gen_dir/js2c/node_init.js"
  178. }
  179. webpack_build("electron_utility_bundle") {
  180. deps = [ ":build_electron_definitions" ]
  181. inputs = auto_filenames.utility_bundle_deps
  182. config_file = "//electron/build/webpack/webpack.config.utility.js"
  183. out_file = "$target_gen_dir/js2c/utility_init.js"
  184. }
  185. action("electron_js2c") {
  186. deps = [
  187. ":electron_browser_bundle",
  188. ":electron_isolated_renderer_bundle",
  189. ":electron_node_bundle",
  190. ":electron_renderer_bundle",
  191. ":electron_sandboxed_renderer_bundle",
  192. ":electron_utility_bundle",
  193. ":electron_worker_bundle",
  194. "//third_party/electron_node:node_js2c($electron_js2c_toolchain)",
  195. ]
  196. sources = [
  197. "$target_gen_dir/js2c/browser_init.js",
  198. "$target_gen_dir/js2c/isolated_bundle.js",
  199. "$target_gen_dir/js2c/node_init.js",
  200. "$target_gen_dir/js2c/renderer_init.js",
  201. "$target_gen_dir/js2c/sandbox_bundle.js",
  202. "$target_gen_dir/js2c/utility_init.js",
  203. "$target_gen_dir/js2c/worker_init.js",
  204. ]
  205. inputs = sources
  206. outputs = [ "$root_gen_dir/electron_natives.cc" ]
  207. script = "build/js2c.py"
  208. out_dir =
  209. get_label_info(":anything($electron_js2c_toolchain)", "root_out_dir")
  210. args = [
  211. rebase_path("$out_dir/node_js2c"),
  212. rebase_path("$root_gen_dir"),
  213. ] + rebase_path(outputs, root_gen_dir) +
  214. rebase_path(sources, root_gen_dir)
  215. }
  216. action("generate_config_gypi") {
  217. outputs = [ "$root_gen_dir/config.gypi" ]
  218. script = "script/generate-config-gypi.py"
  219. inputs = [ "//third_party/electron_node/configure.py" ]
  220. args = rebase_path(outputs) + [ target_cpu ]
  221. }
  222. target_gen_default_app_js = "$target_gen_dir/js/default_app"
  223. typescript_build("default_app_js") {
  224. deps = [ ":build_electron_definitions" ]
  225. sources = filenames.default_app_ts_sources
  226. output_gen_dir = target_gen_default_app_js
  227. output_dir_name = "default_app"
  228. tsconfig = "tsconfig.default_app.json"
  229. }
  230. copy("default_app_static") {
  231. sources = filenames.default_app_static_sources
  232. outputs = [ "$target_gen_default_app_js/{{source}}" ]
  233. }
  234. copy("default_app_octicon_deps") {
  235. sources = filenames.default_app_octicon_sources
  236. outputs = [ "$target_gen_default_app_js/electron/default_app/octicon/{{source_file_part}}" ]
  237. }
  238. asar("default_app_asar") {
  239. deps = [
  240. ":default_app_js",
  241. ":default_app_octicon_deps",
  242. ":default_app_static",
  243. ]
  244. root = "$target_gen_default_app_js/electron/default_app"
  245. sources = get_target_outputs(":default_app_js") +
  246. get_target_outputs(":default_app_static") +
  247. get_target_outputs(":default_app_octicon_deps")
  248. outputs = [ "$root_out_dir/resources/default_app.asar" ]
  249. }
  250. grit("resources") {
  251. source = "electron_resources.grd"
  252. outputs = [
  253. "grit/electron_resources.h",
  254. "electron_resources.pak",
  255. ]
  256. # Mojo manifest overlays are generated.
  257. grit_flags = [
  258. "-E",
  259. "target_gen_dir=" + rebase_path(target_gen_dir, root_build_dir),
  260. ]
  261. deps = [ ":copy_shell_devtools_discovery_page" ]
  262. output_dir = "$target_gen_dir"
  263. }
  264. copy("copy_shell_devtools_discovery_page") {
  265. sources = [ "//content/shell/resources/shell_devtools_discovery_page.html" ]
  266. outputs = [ "$target_gen_dir/shell_devtools_discovery_page.html" ]
  267. }
  268. npm_action("electron_version_args") {
  269. script = "generate-version-json"
  270. outputs = [ "$target_gen_dir/electron_version.args" ]
  271. args = rebase_path(outputs) + [ "$electron_version" ]
  272. inputs = [ "script/generate-version-json.js" ]
  273. }
  274. templated_file("electron_version_header") {
  275. deps = [ ":electron_version_args" ]
  276. template = "build/templates/electron_version.tmpl"
  277. output = "$target_gen_dir/electron_version.h"
  278. args_files = get_target_outputs(":electron_version_args")
  279. }
  280. templated_file("electron_win_rc") {
  281. deps = [ ":electron_version_args" ]
  282. template = "build/templates/electron_rc.tmpl"
  283. output = "$target_gen_dir/win-resources/electron.rc"
  284. args_files = get_target_outputs(":electron_version_args")
  285. }
  286. copy("electron_win_resource_files") {
  287. sources = [
  288. "shell/browser/resources/win/electron.ico",
  289. "shell/browser/resources/win/resource.h",
  290. ]
  291. outputs = [ "$target_gen_dir/win-resources/{{source_file_part}}" ]
  292. }
  293. templated_file("electron_version_file") {
  294. deps = [ ":electron_version_args" ]
  295. template = "build/templates/version_string.tmpl"
  296. output = "$root_build_dir/version"
  297. args_files = get_target_outputs(":electron_version_args")
  298. }
  299. group("electron_win32_resources") {
  300. public_deps = [
  301. ":electron_win_rc",
  302. ":electron_win_resource_files",
  303. ]
  304. }
  305. action("electron_fuses") {
  306. script = "build/fuses/build.py"
  307. inputs = [ "build/fuses/fuses.json5" ]
  308. outputs = [
  309. "$target_gen_dir/fuses.h",
  310. "$target_gen_dir/fuses.cc",
  311. ]
  312. args = rebase_path(outputs)
  313. }
  314. action("electron_generate_node_defines") {
  315. script = "build/generate_node_defines.py"
  316. inputs = [
  317. "//third_party/electron_node/src/tracing/trace_event_common.h",
  318. "//third_party/electron_node/src/tracing/trace_event.h",
  319. "//third_party/electron_node/src/util.h",
  320. ]
  321. outputs = [
  322. "$target_gen_dir/push_and_undef_node_defines.h",
  323. "$target_gen_dir/pop_node_defines.h",
  324. ]
  325. args = [ rebase_path(target_gen_dir) ] + rebase_path(inputs)
  326. }
  327. source_set("electron_lib") {
  328. configs += [ "//v8:external_startup_data" ]
  329. configs += [ "//third_party/electron_node:node_internals" ]
  330. public_configs = [
  331. ":branding",
  332. ":electron_lib_config",
  333. ]
  334. deps = [
  335. ":electron_fuses",
  336. ":electron_generate_node_defines",
  337. ":electron_js2c",
  338. ":electron_version_header",
  339. ":resources",
  340. "buildflags",
  341. "chromium_src:chrome",
  342. "chromium_src:chrome_spellchecker",
  343. "shell/common/api:mojo",
  344. "shell/services/node/public/mojom",
  345. "//base:base_static",
  346. "//base/allocator:buildflags",
  347. "//chrome:strings",
  348. "//chrome/app:command_ids",
  349. "//chrome/app/resources:platform_locale_settings",
  350. "//components/autofill/core/common:features",
  351. "//components/certificate_transparency",
  352. "//components/compose:buildflags",
  353. "//components/embedder_support:browser_util",
  354. "//components/language/core/browser",
  355. "//components/net_log",
  356. "//components/network_hints/browser",
  357. "//components/network_hints/common:mojo_bindings",
  358. "//components/network_hints/renderer",
  359. "//components/network_session_configurator/common",
  360. "//components/omnibox/browser:buildflags",
  361. "//components/os_crypt/async/browser",
  362. "//components/os_crypt/async/browser:key_provider_interface",
  363. "//components/os_crypt/sync",
  364. "//components/pref_registry",
  365. "//components/prefs",
  366. "//components/security_state/content",
  367. "//components/upload_list",
  368. "//components/user_prefs",
  369. "//components/viz/host",
  370. "//components/viz/service",
  371. "//components/webrtc",
  372. "//content/public/browser",
  373. "//content/public/child",
  374. "//content/public/gpu",
  375. "//content/public/renderer",
  376. "//content/public/utility",
  377. "//device/bluetooth",
  378. "//device/bluetooth/public/cpp",
  379. "//gin",
  380. "//media/capture/mojom:video_capture",
  381. "//media/mojo/mojom",
  382. "//net:extras",
  383. "//net:net_resources",
  384. "//printing/buildflags",
  385. "//services/device/public/cpp/bluetooth:bluetooth",
  386. "//services/device/public/cpp/geolocation",
  387. "//services/device/public/cpp/hid",
  388. "//services/device/public/mojom",
  389. "//services/proxy_resolver:lib",
  390. "//services/video_capture/public/mojom:constants",
  391. "//services/viz/privileged/mojom/compositing",
  392. "//services/viz/public/mojom",
  393. "//skia",
  394. "//third_party/blink/public:blink",
  395. "//third_party/blink/public:blink_devtools_inspector_resources",
  396. "//third_party/blink/public/platform/media",
  397. "//third_party/boringssl",
  398. "//third_party/electron_node:node_lib",
  399. "//third_party/inspector_protocol:crdtp",
  400. "//third_party/leveldatabase",
  401. "//third_party/libyuv",
  402. "//third_party/webrtc_overrides:webrtc_component",
  403. "//third_party/widevine/cdm:headers",
  404. "//third_party/zlib/google:zip",
  405. "//ui/base:ozone_buildflags",
  406. "//ui/base/idle",
  407. "//ui/compositor",
  408. "//ui/events:dom_keycode_converter",
  409. "//ui/gl",
  410. "//ui/native_theme",
  411. "//ui/shell_dialogs",
  412. "//ui/views",
  413. "//v8",
  414. "//v8:v8_libplatform",
  415. ]
  416. public_deps = [
  417. "//base",
  418. "//base:i18n",
  419. "//content/public/app",
  420. ]
  421. include_dirs = [
  422. ".",
  423. "$target_gen_dir",
  424. # TODO(nornagon): replace usage of SchemeRegistry by an actually exported
  425. # API of blink, then remove this from the include_dirs.
  426. "//third_party/blink/renderer",
  427. ]
  428. defines = [ "V8_DEPRECATION_WARNINGS" ]
  429. libs = []
  430. if (is_linux) {
  431. defines += [ "GDK_DISABLE_DEPRECATION_WARNINGS" ]
  432. }
  433. if (!is_mas_build) {
  434. deps += [
  435. "//components/crash/core/app",
  436. "//components/crash/core/browser",
  437. ]
  438. }
  439. configs += [ "//electron/build/config:mas_build" ]
  440. sources = filenames.lib_sources
  441. if (is_win) {
  442. sources += filenames.lib_sources_win
  443. }
  444. if (is_mac) {
  445. sources += filenames.lib_sources_mac
  446. }
  447. if (is_posix) {
  448. sources += filenames.lib_sources_posix
  449. }
  450. if (is_linux) {
  451. sources += filenames.lib_sources_linux
  452. }
  453. if (!is_mac) {
  454. sources += filenames.lib_sources_views
  455. }
  456. if (is_component_build) {
  457. defines += [ "NODE_SHARED_MODE" ]
  458. }
  459. if (enable_fake_location_provider) {
  460. sources += [
  461. "shell/browser/fake_location_provider.cc",
  462. "shell/browser/fake_location_provider.h",
  463. ]
  464. }
  465. if (is_mac) {
  466. deps += [
  467. "//components/remote_cocoa/app_shim",
  468. "//components/remote_cocoa/browser",
  469. "//content/browser:mac_helpers",
  470. "//ui/accelerated_widget_mac",
  471. ]
  472. if (!is_mas_build) {
  473. deps += [ "//third_party/crashpad/crashpad/client" ]
  474. }
  475. frameworks = [
  476. "AuthenticationServices.framework",
  477. "AVFoundation.framework",
  478. "Carbon.framework",
  479. "LocalAuthentication.framework",
  480. "QuartzCore.framework",
  481. "Quartz.framework",
  482. "Security.framework",
  483. "SecurityInterface.framework",
  484. "ServiceManagement.framework",
  485. "StoreKit.framework",
  486. ]
  487. weak_frameworks = [ "QuickLookThumbnailing.framework" ]
  488. sources += [
  489. "shell/browser/ui/views/autofill_popup_view.cc",
  490. "shell/browser/ui/views/autofill_popup_view.h",
  491. ]
  492. if (is_mas_build) {
  493. sources += [ "shell/browser/api/electron_api_app_mas.mm" ]
  494. sources -= [ "shell/browser/auto_updater_mac.mm" ]
  495. sources -= [
  496. "shell/app/electron_crash_reporter_client.cc",
  497. "shell/app/electron_crash_reporter_client.h",
  498. "shell/common/crash_keys.cc",
  499. "shell/common/crash_keys.h",
  500. ]
  501. } else {
  502. frameworks += [
  503. "Squirrel.framework",
  504. "ReactiveObjC.framework",
  505. "Mantle.framework",
  506. ]
  507. deps += [
  508. "//third_party/squirrel.mac:reactiveobjc_framework+link",
  509. "//third_party/squirrel.mac:squirrel_framework+link",
  510. ]
  511. # ReactiveObjC which is used by Squirrel requires using __weak.
  512. cflags_objcc = [ "-fobjc-weak" ]
  513. }
  514. }
  515. if (is_linux) {
  516. libs = [ "xshmfence" ]
  517. deps += [
  518. ":electron_gtk_stubs",
  519. ":libnotify_loader",
  520. "//build/config/linux/gtk",
  521. "//components/crash/content/browser",
  522. "//dbus",
  523. "//device/bluetooth",
  524. "//third_party/crashpad/crashpad/client",
  525. "//ui/base/ime/linux",
  526. "//ui/events/devices/x11",
  527. "//ui/events/platform/x11",
  528. "//ui/gtk:gtk_config",
  529. "//ui/linux:linux_ui",
  530. "//ui/linux:linux_ui_factory",
  531. "//ui/views/controls/webview",
  532. "//ui/wm",
  533. ]
  534. if (ozone_platform_x11) {
  535. sources += filenames.lib_sources_linux_x11
  536. public_deps += [
  537. "//ui/base/x",
  538. "//ui/ozone/platform/x11",
  539. ]
  540. }
  541. configs += [ ":gio_unix" ]
  542. defines += [
  543. # Disable warnings for g_settings_list_schemas.
  544. "GLIB_DISABLE_DEPRECATION_WARNINGS",
  545. ]
  546. sources += [
  547. "shell/browser/certificate_manager_model.cc",
  548. "shell/browser/certificate_manager_model.h",
  549. "shell/browser/ui/gtk_util.cc",
  550. "shell/browser/ui/gtk_util.h",
  551. ]
  552. }
  553. if (is_win) {
  554. libs += [ "dwmapi.lib" ]
  555. deps += [
  556. "//components/crash/core/app:crash_export_thunks",
  557. "//ui/native_theme:native_theme_browser",
  558. "//ui/views/controls/webview",
  559. "//ui/wm",
  560. "//ui/wm/public",
  561. ]
  562. public_deps += [
  563. "//sandbox/win:sandbox",
  564. "//third_party/crashpad/crashpad/handler",
  565. ]
  566. }
  567. if (enable_plugins) {
  568. deps += [ "chromium_src:plugins" ]
  569. sources += [
  570. "shell/common/plugin_info.cc",
  571. "shell/common/plugin_info.h",
  572. "shell/renderer/electron_renderer_pepper_host_factory.cc",
  573. "shell/renderer/electron_renderer_pepper_host_factory.h",
  574. "shell/renderer/pepper_helper.cc",
  575. "shell/renderer/pepper_helper.h",
  576. ]
  577. }
  578. if (enable_ppapi) {
  579. deps += [
  580. "//ppapi/host",
  581. "//ppapi/proxy",
  582. "//ppapi/shared_impl",
  583. ]
  584. }
  585. if (enable_views_api) {
  586. sources += [
  587. "shell/browser/api/views/electron_api_image_view.cc",
  588. "shell/browser/api/views/electron_api_image_view.h",
  589. ]
  590. }
  591. if (enable_printing) {
  592. sources += [
  593. "shell/browser/printing/print_view_manager_electron.cc",
  594. "shell/browser/printing/print_view_manager_electron.h",
  595. "shell/browser/printing/printing_utils.cc",
  596. "shell/browser/printing/printing_utils.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",
  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_asan_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++/__assertion_handler",
  1274. "//buildtools/third_party/libc++/__config_site",
  1275. ]
  1276. outputs = [ "$target_gen_dir/electron_libcxx_include/{{source_root_relative_dir}}/{{source_file_part}}" ]
  1277. }
  1278. dist_zip("libcxx_headers_zip") {
  1279. data_deps = [ ":libcxx_headers" ]
  1280. deps = data_deps
  1281. flatten = true
  1282. flatten_relative_to =
  1283. rebase_path(
  1284. "$target_gen_dir/electron_libcxx_include/third_party/libc++/src",
  1285. "$root_out_dir")
  1286. outputs = [ "$root_build_dir/libcxx_headers.zip" ]
  1287. }
  1288. copy("libcxxabi_headers") {
  1289. sources = libcxxabi_headers + libcxxabi_licenses
  1290. outputs = [ "$target_gen_dir/electron_libcxxabi_include/{{source_root_relative_dir}}/{{source_file_part}}" ]
  1291. }
  1292. dist_zip("libcxxabi_headers_zip") {
  1293. data_deps = [ ":libcxxabi_headers" ]
  1294. deps = data_deps
  1295. flatten = true
  1296. flatten_relative_to = rebase_path(
  1297. "$target_gen_dir/electron_libcxxabi_include/third_party/libc++abi/src",
  1298. "$root_out_dir")
  1299. outputs = [ "$root_build_dir/libcxxabi_headers.zip" ]
  1300. }
  1301. action("libcxx_objects_zip") {
  1302. deps = [ "//buildtools/third_party/libc++" ]
  1303. script = "build/zip_libcxx.py"
  1304. outputs = [ "$root_build_dir/libcxx_objects.zip" ]
  1305. args = rebase_path(outputs)
  1306. }
  1307. group("electron") {
  1308. public_deps = [ ":electron_app" ]
  1309. }
  1310. ##### node_headers
  1311. node_dir = "../third_party/electron_node"
  1312. node_files = read_file("$node_dir/filenames.json", "json")
  1313. node_headers_dir = "$root_gen_dir/node_headers"
  1314. header_group_index = 0
  1315. header_groups = []
  1316. foreach(header_group, node_files.headers) {
  1317. copy("node_headers_${header_group_index}") {
  1318. sources = rebase_path(header_group.files, ".", node_dir)
  1319. outputs =
  1320. [ "$node_headers_dir/${header_group.dest_dir}/{{source_file_part}}" ]
  1321. }
  1322. header_groups += [ ":node_headers_${header_group_index}" ]
  1323. header_group_index += 1
  1324. }
  1325. copy("zlib_headers") {
  1326. sources = [
  1327. "$node_dir/deps/zlib/zconf.h",
  1328. "$node_dir/deps/zlib/zlib.h",
  1329. ]
  1330. outputs = [ "$node_headers_dir/include/node/{{source_file_part}}" ]
  1331. }
  1332. copy("node_gypi_headers") {
  1333. deps = [ ":generate_config_gypi" ]
  1334. sources = [
  1335. "$node_dir/common.gypi",
  1336. "$root_gen_dir/config.gypi",
  1337. ]
  1338. outputs = [ "$node_headers_dir/include/node/{{source_file_part}}" ]
  1339. }
  1340. action("node_version_header") {
  1341. inputs = [ "$node_dir/src/node_version.h" ]
  1342. outputs = [ "$node_headers_dir/include/node/node_version.h" ]
  1343. script = "script/generate_node_version_header.py"
  1344. args = rebase_path(inputs) + rebase_path(outputs)
  1345. if (node_module_version != "") {
  1346. args += [ "$node_module_version" ]
  1347. }
  1348. }
  1349. action("tar_node_headers") {
  1350. deps = [ ":copy_node_headers" ]
  1351. outputs = [ "$root_gen_dir/node_headers.tar.gz" ]
  1352. script = "script/tar.py"
  1353. args = [
  1354. rebase_path("$root_gen_dir/node_headers"),
  1355. rebase_path(outputs[0]),
  1356. ]
  1357. }
  1358. group("copy_node_headers") {
  1359. public_deps = header_groups + [
  1360. ":node_gypi_headers",
  1361. ":node_version_header",
  1362. ":zlib_headers",
  1363. ]
  1364. }
  1365. group("node_headers") {
  1366. public_deps = [ ":tar_node_headers" ]
  1367. }