BUILD.gn 26 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016
  1. import("//build/config/locales.gni")
  2. import("//build/config/ui.gni")
  3. import("//build/config/win/manifest.gni")
  4. import("//pdf/features.gni")
  5. import("//services/service_manager/public/service_manifest.gni")
  6. import("//third_party/ffmpeg/ffmpeg_options.gni")
  7. import("//tools/generate_library_loader/generate_library_loader.gni")
  8. import("//tools/grit/grit_rule.gni")
  9. import("//tools/grit/repack.gni")
  10. import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
  11. import("//v8/snapshot_toolchain.gni")
  12. import("build/asar.gni")
  13. import("build/npm.gni")
  14. import("buildflags/buildflags.gni")
  15. import("electron_paks.gni")
  16. import("filenames.gni")
  17. if (is_mac) {
  18. import("//build/config/mac/rules.gni")
  19. import("//third_party/icu/config.gni")
  20. import("//v8/gni/v8.gni")
  21. }
  22. if (is_linux) {
  23. import("//build/config/linux/pkg_config.gni")
  24. pkg_config("gio_unix") {
  25. packages = [ "gio-unix-2.0" ]
  26. }
  27. pkg_config("libnotify_config") {
  28. packages = [
  29. "glib-2.0",
  30. "gdk-pixbuf-2.0",
  31. ]
  32. }
  33. }
  34. branding = read_file("atom/app/BRANDING.json", "json")
  35. electron_project_name = branding.project_name
  36. electron_product_name = branding.product_name
  37. electron_mac_bundle_id = branding.mac_bundle_id
  38. if (is_mas_build) {
  39. assert(is_mac,
  40. "It doesn't make sense to build a MAS build on a non-mac platform")
  41. }
  42. config("branding") {
  43. defines = [
  44. "ATOM_PRODUCT_NAME=\"$electron_product_name\"",
  45. "ATOM_PROJECT_NAME=\"$electron_project_name\"",
  46. ]
  47. }
  48. npm_action("atom_browserify_sandbox") {
  49. script = "browserify"
  50. inputs = [
  51. # FIXME(zcbenz): The dependencies of these files are not listed here, so
  52. # the generated file will be out-dated when dependencies are modified.
  53. # Use a script to generate all dependencies and put them here.
  54. "lib/sandboxed_renderer/init.js",
  55. "lib/sandboxed_renderer/api/exports/electron.js",
  56. ]
  57. outputs = [
  58. "$target_gen_dir/js2c/preload_bundle.js",
  59. ]
  60. args = [
  61. "lib/sandboxed_renderer/init.js",
  62. "-r",
  63. "./lib/sandboxed_renderer/api/exports/electron.js:electron",
  64. "-t",
  65. "aliasify",
  66. "-o",
  67. rebase_path(outputs[0]),
  68. ]
  69. }
  70. npm_action("atom_browserify_isolated") {
  71. script = "browserify"
  72. inputs = [
  73. "lib/isolated_renderer/init.js",
  74. ]
  75. outputs = [
  76. "$target_gen_dir/js2c/isolated_bundle.js",
  77. ]
  78. args = [
  79. "lib/isolated_renderer/init.js",
  80. "-t",
  81. "aliasify",
  82. "-o",
  83. rebase_path(outputs[0]),
  84. ]
  85. }
  86. copy("atom_js2c_copy") {
  87. sources = [
  88. "lib/common/asar.js",
  89. "lib/common/asar_init.js",
  90. ]
  91. outputs = [
  92. "$target_gen_dir/js2c/{{source_file_part}}",
  93. ]
  94. }
  95. action("atom_js2c") {
  96. deps = [
  97. ":atom_browserify_isolated",
  98. ":atom_browserify_sandbox",
  99. ":atom_js2c_copy",
  100. ]
  101. browserify_sources = [
  102. "$target_gen_dir/js2c/isolated_bundle.js",
  103. "$target_gen_dir/js2c/preload_bundle.js",
  104. ]
  105. sources = browserify_sources + [
  106. "$target_gen_dir/js2c/asar.js",
  107. "$target_gen_dir/js2c/asar_init.js",
  108. ]
  109. inputs = sources
  110. outputs = [
  111. "$root_gen_dir/atom_natives.cc",
  112. ]
  113. script = "tools/js2c.py"
  114. args = [ rebase_path("//third_party/electron_node") ] +
  115. rebase_path(outputs, root_build_dir) +
  116. rebase_path(sources, root_build_dir)
  117. }
  118. target_gen_electron_js = "$target_gen_dir/js/electron"
  119. target_gen_default_app_js = "$target_gen_dir/js/default_app"
  120. # TODO(MarshallOfSound)
  121. # This copy will be replaced by a call to tsc in the future
  122. copy("lib_js") {
  123. sources = filenames.js_sources
  124. if (enable_desktop_capturer) {
  125. sources += [
  126. "lib/browser/desktop-capturer.js",
  127. "lib/renderer/api/desktop-capturer.js",
  128. ]
  129. }
  130. if (enable_view_api) {
  131. sources += [
  132. "lib/browser/api/views/box-layout.js",
  133. "lib/browser/api/views/button.js",
  134. "lib/browser/api/views/label-button.js",
  135. "lib/browser/api/views/layout-manager.js",
  136. "lib/browser/api/views/md-text-button.js",
  137. "lib/browser/api/views/resize-area.js",
  138. "lib/browser/api/views/text-field.js",
  139. ]
  140. }
  141. outputs = [
  142. "$target_gen_electron_js/{{source}}",
  143. ]
  144. }
  145. asar("electron_asar") {
  146. deps = [
  147. ":lib_js",
  148. ]
  149. root = "$target_gen_electron_js/electron/lib"
  150. sources = get_target_outputs(":lib_js")
  151. outputs = [
  152. "$root_out_dir/resources/electron.asar",
  153. ]
  154. }
  155. copy("default_app_js") {
  156. sources = filenames.default_app_sources
  157. outputs = [
  158. "$target_gen_default_app_js/{{source}}",
  159. ]
  160. }
  161. copy("default_app_octicon_deps") {
  162. sources = filenames.default_app_octicon_sources
  163. outputs = [
  164. "$target_gen_default_app_js/electron/default_app/octicon/{{source_file_part}}",
  165. ]
  166. }
  167. asar("default_app_asar") {
  168. deps = [
  169. ":default_app_js",
  170. ":default_app_octicon_deps",
  171. ]
  172. root = "$target_gen_default_app_js/electron/default_app"
  173. sources = get_target_outputs(":default_app_js") +
  174. get_target_outputs(":default_app_octicon_deps")
  175. outputs = [
  176. "$root_out_dir/resources/default_app.asar",
  177. ]
  178. }
  179. grit("resources") {
  180. source = "electron_resources.grd"
  181. outputs = [
  182. "grit/electron_resources.h",
  183. "electron_resources.pak",
  184. ]
  185. # Mojo manifest overlays are generated.
  186. source_is_generated = true
  187. grit_flags = [
  188. "-E",
  189. "target_gen_dir=" + rebase_path(target_gen_dir, root_build_dir),
  190. ]
  191. deps = [
  192. ":copy_shell_devtools_discovery_page",
  193. ":electron_content_manifest_overlays",
  194. ]
  195. output_dir = "$target_gen_dir"
  196. }
  197. copy("copy_shell_devtools_discovery_page") {
  198. sources = [
  199. "//content/shell/resources/shell_devtools_discovery_page.html",
  200. ]
  201. outputs = [
  202. "$target_gen_dir/shell_devtools_discovery_page.html",
  203. ]
  204. }
  205. if (is_linux) {
  206. generate_library_loader("libnotify_loader") {
  207. name = "LibNotifyLoader"
  208. output_h = "libnotify_loader.h"
  209. output_cc = "libnotify_loader.cc"
  210. header = "<libnotify/notify.h>"
  211. config = ":libnotify_config"
  212. functions = [
  213. "notify_is_initted",
  214. "notify_init",
  215. "notify_get_server_caps",
  216. "notify_get_server_info",
  217. "notify_notification_new",
  218. "notify_notification_add_action",
  219. "notify_notification_set_image_from_pixbuf",
  220. "notify_notification_set_timeout",
  221. "notify_notification_set_hint_string",
  222. "notify_notification_show",
  223. "notify_notification_close",
  224. ]
  225. }
  226. }
  227. static_library("electron_lib") {
  228. configs += [ "//v8:external_startup_data" ]
  229. configs += [ "//third_party/electron_node:node_internals" ]
  230. public_configs = [ ":branding" ]
  231. deps = [
  232. ":atom_js2c",
  233. "buildflags",
  234. "chromium_src:chrome",
  235. "native_mate",
  236. "//base",
  237. "//base:base_static",
  238. "//base:i18n",
  239. "//chrome/app/resources:platform_locale_settings",
  240. "//components/certificate_transparency",
  241. "//components/net_log",
  242. "//components/network_session_configurator/common",
  243. "//components/prefs",
  244. "//components/spellcheck/renderer",
  245. "//components/viz/host",
  246. "//components/viz/service",
  247. "//content/public/app:both",
  248. "//content/public/browser",
  249. "//content/public/child",
  250. "//content/public/common:service_names",
  251. "//gin",
  252. "//media/capture/mojom:video_capture",
  253. "//media/mojo/interfaces",
  254. "//net:extras",
  255. "//net:net_resources",
  256. "//net:net_with_v8",
  257. "//ppapi/host",
  258. "//ppapi/proxy",
  259. "//ppapi/shared_impl",
  260. "//services/device/public/mojom",
  261. "//services/proxy_resolver:lib",
  262. "//services/viz/privileged/interfaces/compositing",
  263. "//skia",
  264. "//third_party/blink/public:blink",
  265. "//third_party/boringssl",
  266. "//third_party/electron_node:node_lib",
  267. "//third_party/leveldatabase",
  268. "//third_party/libyuv",
  269. "//third_party/webrtc_overrides:init_webrtc",
  270. "//third_party/widevine/cdm:headers",
  271. "//ui/events:dom_keycode_converter",
  272. "//ui/gl",
  273. "//ui/views",
  274. "//v8",
  275. ]
  276. include_dirs = [
  277. "chromium_src",
  278. ".",
  279. "$target_gen_dir",
  280. # TODO(nornagon): replace usage of SchemeRegistry by an actually exported
  281. # API of blink, then remove this from the include_dirs.
  282. "//third_party/blink/renderer",
  283. ]
  284. defines = [ "V8_DEPRECATION_WARNINGS" ]
  285. libs = []
  286. if (is_linux) {
  287. defines += [ "GDK_DISABLE_DEPRECATION_WARNINGS" ]
  288. }
  289. extra_source_filters = []
  290. if (!is_linux) {
  291. extra_source_filters += [
  292. "*\bx/*",
  293. "*_x11.h",
  294. "*_x11.cc",
  295. "*_gtk.h",
  296. "*_gtk.cc",
  297. "*\blibrary_loaders/*",
  298. ]
  299. }
  300. if (!is_win) {
  301. extra_source_filters += [
  302. "*\bwin_*.h",
  303. "*\bwin_*.cc",
  304. ]
  305. }
  306. if (!is_posix) {
  307. extra_source_filters += [
  308. "*_posix.cc",
  309. "*_posix.h",
  310. ]
  311. }
  312. if (is_mac) {
  313. extra_source_filters += [
  314. "*_views.cc",
  315. "*_views.h",
  316. "*\bviews/*",
  317. "*/autofill_popup.cc",
  318. "*/autofill_popup.h",
  319. ]
  320. }
  321. set_sources_assignment_filter(
  322. sources_assignment_filter + extra_source_filters)
  323. sources = filenames.lib_sources
  324. set_sources_assignment_filter(sources_assignment_filter)
  325. if (is_component_build) {
  326. defines += [ "NODE_SHARED_MODE" ]
  327. }
  328. if (enable_fake_location_provider) {
  329. sources += [
  330. "atom/browser/fake_location_provider.cc",
  331. "atom/browser/fake_location_provider.h",
  332. ]
  333. }
  334. if (is_mac) {
  335. deps += [
  336. "//third_party/crashpad/crashpad/client",
  337. "//ui/accelerated_widget_mac",
  338. ]
  339. include_dirs += [
  340. # NOTE(nornagon): other chromium files use the full path to include
  341. # crashpad; this is just here for compatibility between GN and GYP, so that
  342. # the #includes can be agnostic about where crashpad is vendored.
  343. "//third_party/crashpad",
  344. ]
  345. if (is_mas_build) {
  346. deps -= [ "//third_party/crashpad/crashpad/client" ]
  347. sources += [ "atom/browser/api/atom_api_app_mas.mm" ]
  348. sources -= [
  349. "atom/browser/auto_updater_mac.mm",
  350. "atom/common/crash_reporter/crash_reporter_mac.h",
  351. "atom/common/crash_reporter/crash_reporter_mac.mm",
  352. ]
  353. defines += [ "MAS_BUILD" ]
  354. } else {
  355. libs += [
  356. "Squirrel.framework",
  357. "ReactiveCocoa.framework",
  358. "Mantle.framework",
  359. ]
  360. cflags_objcc = [
  361. "-F",
  362. rebase_path("external_binaries", root_build_dir),
  363. ]
  364. # ReactiveCocoa which is used by Squirrel requires using __weak.
  365. cflags_objcc += [ "-fobjc-weak" ]
  366. }
  367. }
  368. if (is_linux) {
  369. deps += [
  370. ":libnotify_loader",
  371. "//build/config/linux/gtk",
  372. "//chrome/browser/ui/libgtkui",
  373. "//dbus",
  374. "//device/bluetooth",
  375. "//ui/events/devices/x11",
  376. "//ui/events/platform/x11",
  377. "//ui/native_theme",
  378. "//ui/views/controls/webview",
  379. "//ui/wm",
  380. ]
  381. configs += [ ":gio_unix" ]
  382. defines += [
  383. # Disable warnings for g_settings_list_schemas.
  384. "GLIB_DISABLE_DEPRECATION_WARNINGS",
  385. ]
  386. sources += filenames.lib_sources_nss
  387. }
  388. if (is_win) {
  389. libs += [ "dwmapi.lib" ]
  390. }
  391. if (is_linux || is_win) {
  392. deps += [ "//third_party/breakpad:client" ]
  393. include_dirs += [ "//third_party/breakpad" ]
  394. }
  395. if (enable_pdf) {
  396. deps += [ "//pdf" ]
  397. }
  398. if (enable_run_as_node) {
  399. sources += [
  400. "atom/app/node_main.cc",
  401. "atom/app/node_main.h",
  402. ]
  403. }
  404. if (enable_osr) {
  405. sources += [
  406. "atom/browser/osr/osr_output_device.cc",
  407. "atom/browser/osr/osr_output_device.h",
  408. "atom/browser/osr/osr_render_widget_host_view.cc",
  409. "atom/browser/osr/osr_render_widget_host_view.h",
  410. "atom/browser/osr/osr_render_widget_host_view_mac.mm",
  411. "atom/browser/osr/osr_view_proxy.cc",
  412. "atom/browser/osr/osr_view_proxy.h",
  413. "atom/browser/osr/osr_web_contents_view.cc",
  414. "atom/browser/osr/osr_web_contents_view.h",
  415. "atom/browser/osr/osr_web_contents_view_mac.mm",
  416. ]
  417. deps += [
  418. "//components/viz/service",
  419. "//services/viz/public/interfaces",
  420. "//ui/compositor",
  421. ]
  422. }
  423. if (enable_desktop_capturer) {
  424. if (is_component_build && is_win) {
  425. # On windows the implementation relies on unexported
  426. # DxgiDuplicatorController class.
  427. deps += [ "//third_party/webrtc/modules/desktop_capture" ]
  428. }
  429. sources += [
  430. "atom/browser/api/atom_api_desktop_capturer.cc",
  431. "atom/browser/api/atom_api_desktop_capturer.h",
  432. ]
  433. }
  434. if (enable_view_api) {
  435. sources += [
  436. "atom/browser/api/views/atom_api_box_layout.cc",
  437. "atom/browser/api/views/atom_api_box_layout.h",
  438. "atom/browser/api/views/atom_api_button.cc",
  439. "atom/browser/api/views/atom_api_button.h",
  440. "atom/browser/api/views/atom_api_label_button.cc",
  441. "atom/browser/api/views/atom_api_label_button.h",
  442. "atom/browser/api/views/atom_api_layout_manager.cc",
  443. "atom/browser/api/views/atom_api_layout_manager.h",
  444. "atom/browser/api/views/atom_api_md_text_button.cc",
  445. "atom/browser/api/views/atom_api_md_text_button.h",
  446. "atom/browser/api/views/atom_api_resize_area.cc",
  447. "atom/browser/api/views/atom_api_resize_area.h",
  448. "atom/browser/api/views/atom_api_text_field.cc",
  449. "atom/browser/api/views/atom_api_text_field.h",
  450. ]
  451. }
  452. if (enable_basic_printing) {
  453. sources += [
  454. "atom/browser/printing/print_preview_message_handler.cc",
  455. "atom/browser/printing/print_preview_message_handler.h",
  456. "atom/renderer/printing/print_render_frame_helper_delegate.cc",
  457. "atom/renderer/printing/print_render_frame_helper_delegate.h",
  458. ]
  459. }
  460. if (enable_pepper_flash) {
  461. deps += [ "components/pepper_flash" ]
  462. }
  463. }
  464. electron_paks("packed_resources") {
  465. if (is_mac) {
  466. output_dir = "$root_gen_dir/electron_repack"
  467. copy_data_to_bundle = true
  468. } else {
  469. output_dir = root_out_dir
  470. }
  471. }
  472. if (is_mac) {
  473. electron_framework_name = "$electron_product_name Framework"
  474. electron_helper_name = "$electron_product_name Helper"
  475. electron_login_helper_name = "$electron_product_name Login Helper"
  476. electron_framework_version = "A"
  477. mac_xib_bundle_data("electron_xibs") {
  478. sources = [
  479. "atom/common/resources/mac/MainMenu.xib",
  480. ]
  481. }
  482. bundle_data("electron_framework_resources") {
  483. public_deps = [
  484. ":packed_resources",
  485. ]
  486. sources = []
  487. if (icu_use_data_file) {
  488. sources += [ "$root_out_dir/icudtl.dat" ]
  489. public_deps += [ "//third_party/icu:icudata" ]
  490. }
  491. if (v8_use_external_startup_data) {
  492. sources += [ "$root_out_dir/natives_blob.bin" ]
  493. public_deps += [ "//v8" ]
  494. if (use_v8_context_snapshot) {
  495. sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
  496. public_deps += [ "//tools/v8_context_snapshot" ]
  497. } else {
  498. sources += [ "$root_out_dir/snapshot_blob.bin" ]
  499. }
  500. }
  501. outputs = [
  502. "{{bundle_resources_dir}}/{{source_file_part}}",
  503. ]
  504. }
  505. if (!is_component_build) {
  506. bundle_data("electron_framework_libraries") {
  507. sources = []
  508. public_deps = []
  509. if (is_component_ffmpeg) {
  510. sources += [ "$root_out_dir/libffmpeg.dylib" ]
  511. public_deps += [ "//third_party/ffmpeg:ffmpeg" ]
  512. }
  513. outputs = [
  514. "{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
  515. ]
  516. }
  517. } else {
  518. group("electron_framework_libraries") {
  519. }
  520. }
  521. bundle_data("electron_crashpad_helper") {
  522. sources = [
  523. "$root_out_dir/crashpad_handler",
  524. ]
  525. outputs = [
  526. "{{bundle_resources_dir}}/{{source_file_part}}",
  527. ]
  528. public_deps = [
  529. "//third_party/crashpad/crashpad/handler:crashpad_handler",
  530. ]
  531. }
  532. mac_framework_bundle("electron_framework") {
  533. output_name = electron_framework_name
  534. framework_version = electron_framework_version
  535. framework_contents = [
  536. "Resources",
  537. "Libraries",
  538. ]
  539. public_deps = [
  540. ":electron_lib",
  541. ]
  542. deps = [
  543. ":electron_framework_libraries",
  544. ":electron_framework_resources",
  545. ":electron_xibs",
  546. ]
  547. if (!is_mas_build) {
  548. deps += [ ":electron_crashpad_helper" ]
  549. }
  550. info_plist = "atom/common/resources/mac/Info.plist"
  551. electron_version = read_file("ELECTRON_VERSION", "trim string")
  552. extra_substitutions = [
  553. "ATOM_BUNDLE_ID=$electron_mac_bundle_id.framework",
  554. "ELECTRON_VERSION=$electron_version",
  555. ]
  556. include_dirs = [ "." ]
  557. sources = filenames.framework_sources
  558. libs = [
  559. "AVFoundation.framework",
  560. "Carbon.framework",
  561. "QuartzCore.framework",
  562. "Quartz.framework",
  563. "Security.framework",
  564. "SecurityInterface.framework",
  565. "ServiceManagement.framework",
  566. "StoreKit.framework",
  567. ]
  568. ldflags = [
  569. "-F",
  570. rebase_path("external_binaries", root_build_dir),
  571. "-Wl,-install_name,@rpath/$output_name.framework/$output_name",
  572. "-rpath",
  573. "@loader_path/Libraries",
  574. ]
  575. if (is_component_build) {
  576. ldflags += [
  577. "-rpath",
  578. "@executable_path/../../../../../..",
  579. ]
  580. }
  581. }
  582. mac_app_bundle("electron_helper_app") {
  583. output_name = electron_helper_name
  584. deps = [
  585. ":electron_framework+link",
  586. "//sandbox/mac:seatbelt",
  587. ]
  588. defines = [ "HELPER_EXECUTABLE" ]
  589. sources = filenames.app_sources
  590. include_dirs = [ "." ]
  591. info_plist = "atom/renderer/resources/mac/Info.plist"
  592. extra_substitutions = [ "ATOM_BUNDLE_ID=$electron_mac_bundle_id.helper" ]
  593. ldflags = [
  594. "-rpath",
  595. "@executable_path/../../..",
  596. ]
  597. if (is_component_build) {
  598. ldflags += [
  599. "-rpath",
  600. "@executable_path/../../../../../..",
  601. ]
  602. }
  603. }
  604. bundle_data("electron_app_framework_bundle_data") {
  605. sources = [
  606. "$root_out_dir/$electron_framework_name.framework",
  607. "$root_out_dir/$electron_helper_name.app",
  608. ]
  609. if (!is_mas_build) {
  610. sources += [
  611. "external_binaries/Mantle.framework",
  612. "external_binaries/ReactiveCocoa.framework",
  613. "external_binaries/Squirrel.framework",
  614. ]
  615. }
  616. outputs = [
  617. "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}",
  618. ]
  619. public_deps = [
  620. ":electron_framework+link",
  621. ":electron_helper_app",
  622. ]
  623. }
  624. mac_app_bundle("electron_login_helper") {
  625. output_name = electron_login_helper_name
  626. sources = filenames.login_helper_sources
  627. include_dirs = [ "." ]
  628. libs = [ "AppKit.framework" ]
  629. info_plist = "atom/app/resources/mac/loginhelper-Info.plist"
  630. extra_substitutions =
  631. [ "ATOM_BUNDLE_ID=$electron_mac_bundle_id.loginhelper" ]
  632. }
  633. bundle_data("electron_login_helper_app") {
  634. public_deps = [
  635. ":electron_login_helper",
  636. ]
  637. sources = [
  638. "$root_out_dir/$electron_login_helper_name.app",
  639. ]
  640. outputs = [
  641. "{{bundle_contents_dir}}/Library/LoginItems/{{source_file_part}}",
  642. ]
  643. }
  644. action("electron_app_lproj_dirs") {
  645. outputs = []
  646. foreach(locale, locales_as_mac_outputs) {
  647. outputs += [ "$target_gen_dir/app_infoplist_strings/$locale.lproj" ]
  648. }
  649. script = "build/mac/make_locale_dirs.py"
  650. args = rebase_path(outputs)
  651. }
  652. foreach(locale, locales_as_mac_outputs) {
  653. bundle_data("electron_app_strings_${locale}_bundle_data") {
  654. sources = [
  655. "$target_gen_dir/app_infoplist_strings/$locale.lproj",
  656. ]
  657. outputs = [
  658. "{{bundle_resources_dir}}/$locale.lproj",
  659. ]
  660. public_deps = [
  661. ":electron_app_lproj_dirs",
  662. ]
  663. }
  664. }
  665. group("electron_app_strings_bundle_data") {
  666. public_deps = []
  667. foreach(locale, locales_as_mac_outputs) {
  668. public_deps += [ ":electron_app_strings_${locale}_bundle_data" ]
  669. }
  670. }
  671. bundle_data("electron_app_resources") {
  672. public_deps = [
  673. ":default_app_asar",
  674. ":electron_app_strings_bundle_data",
  675. ":electron_asar",
  676. ]
  677. sources = [
  678. "$root_out_dir/resources/default_app.asar",
  679. "$root_out_dir/resources/electron.asar",
  680. "atom/browser/resources/mac/electron.icns",
  681. ]
  682. outputs = [
  683. "{{bundle_resources_dir}}/{{source_file_part}}",
  684. ]
  685. }
  686. mac_app_bundle("electron_app") {
  687. output_name = electron_product_name
  688. sources = filenames.app_sources
  689. include_dirs = [ "." ]
  690. deps = [
  691. ":electron_app_framework_bundle_data",
  692. ":electron_app_resources",
  693. ]
  694. if (is_mas_build) {
  695. deps += [ ":electron_login_helper_app" ]
  696. }
  697. info_plist = "atom/browser/resources/mac/Info.plist"
  698. extra_substitutions = [ "ATOM_BUNDLE_ID=$electron_mac_bundle_id" ]
  699. ldflags = [
  700. "-rpath",
  701. "@executable_path/../Frameworks",
  702. ]
  703. }
  704. } else {
  705. windows_manifest("electron_app_manifest") {
  706. sources = [
  707. "atom/browser/resources/win/disable_window_filtering.manifest",
  708. "atom/browser/resources/win/dpi_aware.manifest",
  709. as_invoker_manifest,
  710. common_controls_manifest,
  711. default_compatibility_manifest,
  712. ]
  713. }
  714. executable("electron_app") {
  715. output_name = electron_project_name
  716. sources = filenames.app_sources
  717. include_dirs = [ "." ]
  718. deps = [
  719. ":default_app_asar",
  720. ":electron_app_manifest",
  721. ":electron_asar",
  722. ":electron_lib",
  723. ":packed_resources",
  724. "//content:sandbox_helper_win",
  725. "//ui/strings",
  726. ]
  727. data = []
  728. data += [ "$root_out_dir/resources.pak" ]
  729. data += [ "$root_out_dir/chrome_100_percent.pak" ]
  730. if (enable_hidpi) {
  731. data += [ "$root_out_dir/chrome_200_percent.pak" ]
  732. }
  733. foreach(locale, locales) {
  734. data += [ "$root_out_dir/locales/$locale.pak" ]
  735. }
  736. if (!is_mac) {
  737. data += [ "$root_out_dir/resources/default_app.asar" ]
  738. data += [ "$root_out_dir/resources/electron.asar" ]
  739. }
  740. public_deps = [
  741. "//tools/v8_context_snapshot:v8_context_snapshot",
  742. ]
  743. if (is_win) {
  744. sources += [
  745. # TODO: we should be generating our .rc files more like how chrome does
  746. "atom/browser/resources/win/atom.ico",
  747. "atom/browser/resources/win/atom.rc",
  748. "atom/browser/resources/win/resources.h",
  749. ]
  750. deps += [
  751. "//third_party/breakpad:breakpad_handler",
  752. "//third_party/breakpad:breakpad_sender",
  753. "//ui/native_theme:native_theme_browser",
  754. "//ui/shell_dialogs",
  755. "//ui/views/controls/webview",
  756. "//ui/wm",
  757. "//ui/wm/public",
  758. ]
  759. libs = [
  760. "comctl32.lib",
  761. "uiautomationcore.lib",
  762. "wtsapi32.lib",
  763. ]
  764. configs += [ "//build/config/win:windowed" ]
  765. ldflags = [
  766. # Windows 7 doesn't have these DLLs.
  767. # TODO: are there other DLLs we need to list here to be win7
  768. # compatible?
  769. "/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
  770. "/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll",
  771. ]
  772. # This is to support renaming of electron.exe. node-gyp has hard-coded
  773. # executable names which it will recognise as node. This module definition
  774. # file claims that the electron executable is in fact named "node.exe",
  775. # which is one of the executable names that node-gyp recognizes.
  776. # See https://github.com/nodejs/node-gyp/commit/52ceec3a6d15de3a8f385f43dbe5ecf5456ad07a
  777. ldflags += [ "/DEF:" + rebase_path("build/electron.def", root_build_dir) ]
  778. inputs = [
  779. "build/electron.def",
  780. ]
  781. }
  782. if (is_linux) {
  783. ldflags = [ "-pie" ]
  784. if (!is_component_build && is_component_ffmpeg) {
  785. configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
  786. }
  787. }
  788. }
  789. }
  790. template("dist_zip") {
  791. _runtime_deps_target = "${target_name}__deps"
  792. _runtime_deps_file =
  793. "$root_out_dir/gen.runtime/" + get_label_info(target_name, "dir") + "/" +
  794. get_label_info(target_name, "name") + ".runtime_deps"
  795. group(_runtime_deps_target) {
  796. forward_variables_from(invoker,
  797. [
  798. "deps",
  799. "data_deps",
  800. "data",
  801. ])
  802. write_runtime_deps = _runtime_deps_file
  803. }
  804. action(target_name) {
  805. script = "//electron/build/zip.py"
  806. deps = [
  807. ":$_runtime_deps_target",
  808. ]
  809. forward_variables_from(invoker, [ "outputs" ])
  810. args = rebase_path(outputs + [ _runtime_deps_file ], root_build_dir) + [
  811. target_cpu,
  812. target_os,
  813. ]
  814. }
  815. }
  816. copy("electron_license") {
  817. sources = [
  818. "LICENSE",
  819. ]
  820. outputs = [
  821. "$root_build_dir/{{source_file_part}}",
  822. ]
  823. }
  824. copy("chromium_licenses") {
  825. deps = [
  826. "//components/resources:about_credits",
  827. ]
  828. sources = [
  829. "$root_gen_dir/components/resources/about_credits.html",
  830. ]
  831. outputs = [
  832. "$root_build_dir/LICENSES.chromium.html",
  833. ]
  834. }
  835. group("licenses") {
  836. data_deps = [
  837. ":electron_license",
  838. ":chromium_licenses",
  839. ]
  840. }
  841. copy("electron_version") {
  842. sources = [
  843. "ELECTRON_VERSION",
  844. ]
  845. outputs = [
  846. "$root_build_dir/version",
  847. ]
  848. }
  849. dist_zip("electron_dist_zip") {
  850. data_deps = [
  851. ":electron_app",
  852. ":licenses",
  853. ":electron_version",
  854. ]
  855. outputs = [
  856. "$root_build_dir/dist.zip",
  857. ]
  858. }
  859. dist_zip("electron_ffmpeg_zip") {
  860. data_deps = [
  861. "//third_party/ffmpeg",
  862. ]
  863. outputs = [
  864. "$root_build_dir/ffmpeg.zip",
  865. ]
  866. }
  867. dist_zip("electron_chromedriver_zip") {
  868. data_deps = [
  869. "//chrome/test/chromedriver",
  870. ":licenses",
  871. ]
  872. outputs = [
  873. "$root_build_dir/chromedriver.zip",
  874. ]
  875. }
  876. dist_zip("electron_mksnapshot_zip") {
  877. data_deps = [
  878. "//v8:mksnapshot($v8_snapshot_toolchain)",
  879. "//tools/v8_context_snapshot:v8_context_snapshot_generator",
  880. ":licenses",
  881. ]
  882. outputs = [
  883. "$root_build_dir/mksnapshot.zip",
  884. ]
  885. }
  886. group("electron") {
  887. public_deps = [
  888. ":electron_app",
  889. ]
  890. }
  891. group("electron_content_manifest_overlays") {
  892. deps = [
  893. ":electron_content_browser_manifest_overlay",
  894. ":electron_content_packaged_services_manifest_overlay",
  895. ]
  896. }
  897. service_manifest("electron_content_packaged_services_manifest_overlay") {
  898. source = "//electron/manifests/electron_content_packaged_services_manifest_overlay.json"
  899. packaged_services = [ "//services/proxy_resolver:proxy_resolver_manifest" ]
  900. if (enable_basic_printing) {
  901. packaged_services += [
  902. "//chrome/services/printing:manifest",
  903. "//components/services/pdf_compositor:pdf_compositor_manifest",
  904. ]
  905. }
  906. }
  907. service_manifest("electron_content_browser_manifest_overlay") {
  908. source = "//electron/manifests/electron_content_browser_manifest_overlay.json"
  909. }