BUILD.gn 46 KB

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