BUILD.gn 46 KB

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