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