BUILD.gn 45 KB

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