BUILD.gn 46 KB

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