1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366 |
- import("//build/config/locales.gni")
- import("//build/config/ui.gni")
- import("//build/config/win/manifest.gni")
- import("//content/public/app/mac_helpers.gni")
- import("//pdf/features.gni")
- import("//printing/buildflags/buildflags.gni")
- import("//third_party/ffmpeg/ffmpeg_options.gni")
- import("//tools/generate_library_loader/generate_library_loader.gni")
- import("//tools/grit/grit_rule.gni")
- import("//tools/grit/repack.gni")
- import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
- import("//v8/gni/snapshot_toolchain.gni")
- import("build/asar.gni")
- import("build/extract_symbols.gni")
- import("build/js_wrap.gni")
- import("build/npm.gni")
- import("build/tsc.gni")
- import("buildflags/buildflags.gni")
- import("electron_paks.gni")
- import("filenames.auto.gni")
- import("filenames.gni")
- if (is_mac) {
- import("//build/config/mac/rules.gni")
- import("//third_party/icu/config.gni")
- import("//ui/gl/features.gni")
- import("//v8/gni/v8.gni")
- }
- if (is_linux) {
- import("//build/config/linux/pkg_config.gni")
- pkg_config("gio_unix") {
- packages = [ "gio-unix-2.0" ]
- }
- pkg_config("libnotify_config") {
- packages = [
- "glib-2.0",
- "gdk-pixbuf-2.0",
- ]
- }
- }
- branding = read_file("atom/app/BRANDING.json", "json")
- electron_project_name = branding.project_name
- electron_product_name = branding.product_name
- electron_mac_bundle_id = branding.mac_bundle_id
- if (is_mas_build) {
- assert(is_mac,
- "It doesn't make sense to build a MAS build on a non-mac platform")
- }
- config("branding") {
- defines = [
- "ATOM_PRODUCT_NAME=\"$electron_product_name\"",
- "ATOM_PROJECT_NAME=\"$electron_project_name\"",
- ]
- }
- # We geneate the definitions twice here, once in //electron/electron.d.ts
- # and once in $target_gen_dir
- # The one in $target_gen_dir is used for the actual TSC build later one
- # and the one in //electron/electron.d.ts is used by your IDE (vscode)
- # for typescript prompting
- npm_action("build_electron_definitions") {
- script = "gn-typescript-definitions"
- args = [ rebase_path("$target_gen_dir/tsc/typings/electron.d.ts") ]
- inputs = auto_filenames.api_docs + [ "yarn.lock" ]
- outputs = [
- "$target_gen_dir/tsc/typings/electron.d.ts",
- ]
- }
- npm_action("atom_browserify_sandbox_unwrapped") {
- script = "browserify"
- deps = [
- ":build_electron_definitions",
- ]
- inputs = auto_filenames.sandbox_browserify_deps
- outputs = [
- "$target_gen_dir/js2c/sandbox_bundle_unwrapped.js",
- ]
- args = [
- "lib/sandboxed_renderer/init.js",
- "-r",
- "./lib/sandboxed_renderer/api/exports/electron.js:electron",
- "-t",
- "aliasify",
- "-p",
- "[",
- "tsify",
- "-p",
- "tsconfig.electron.json",
- "]",
- "--standalone",
- "sandboxed_preload",
- "-o",
- rebase_path(outputs[0]),
- ]
- }
- npm_action("atom_browserify_isolated_unwrapped") {
- script = "browserify"
- deps = [
- ":build_electron_definitions",
- ]
- inputs = auto_filenames.isolated_browserify_deps
- outputs = [
- "$target_gen_dir/js2c/isolated_bundle_unwrapped.js",
- ]
- args = [
- "lib/isolated_renderer/init.js",
- "-t",
- "aliasify",
- "-p",
- "[",
- "tsify",
- "-p",
- "tsconfig.electron.json",
- "]",
- "--standalone",
- "isolated_preload",
- "-o",
- rebase_path(outputs[0]),
- ]
- }
- npm_action("atom_browserify_content_script_unwrapped") {
- script = "browserify"
- deps = [
- ":build_electron_definitions",
- ]
- inputs = auto_filenames.context_script_browserify_deps
- outputs = [
- "$target_gen_dir/js2c/content_script_bundle_unwrapped.js",
- ]
- args = [
- "lib/content_script/init.js",
- "-t",
- "aliasify",
- "-p",
- "[",
- "tsify",
- "-p",
- "tsconfig.electron.json",
- "]",
- "--standalone",
- "content_script_preload",
- "-o",
- rebase_path(outputs[0]),
- ]
- }
- js_wrap("atom_browserify_content_script") {
- deps = [
- ":atom_browserify_content_script_unwrapped",
- ]
- inputs = [
- "$target_gen_dir/js2c/content_script_bundle_unwrapped.js",
- ]
- outputs = [
- "$target_gen_dir/js2c/content_script_bundle.js",
- ]
- }
- js_wrap("atom_browserify_isolated") {
- deps = [
- ":atom_browserify_isolated_unwrapped",
- ]
- inputs = [
- "$target_gen_dir/js2c/isolated_bundle_unwrapped.js",
- ]
- outputs = [
- "$target_gen_dir/js2c/isolated_bundle.js",
- ]
- }
- js_wrap("atom_browserify_sandbox") {
- deps = [
- ":atom_browserify_sandbox_unwrapped",
- ]
- inputs = [
- "$target_gen_dir/js2c/sandbox_bundle_unwrapped.js",
- ]
- outputs = [
- "$target_gen_dir/js2c/sandbox_bundle.js",
- ]
- }
- copy("atom_js2c_copy") {
- sources = [
- "lib/common/asar.js",
- "lib/common/asar_init.js",
- ]
- outputs = [
- "$target_gen_dir/js2c/{{source_file_part}}",
- ]
- }
- action("atom_js2c") {
- deps = [
- ":atom_browserify_content_script",
- ":atom_browserify_isolated",
- ":atom_browserify_sandbox",
- ":atom_js2c_copy",
- ]
- browserify_sources = [
- "$target_gen_dir/js2c/content_script_bundle.js",
- "$target_gen_dir/js2c/isolated_bundle.js",
- "$target_gen_dir/js2c/sandbox_bundle.js",
- ]
- sources = browserify_sources + [
- "$target_gen_dir/js2c/asar.js",
- "$target_gen_dir/js2c/asar_init.js",
- ]
- inputs = sources + [ "//third_party/electron_node/tools/js2c.py" ]
- outputs = [
- "$root_gen_dir/atom_natives.cc",
- ]
- script = "tools/js2c.py"
- args = [ rebase_path("//third_party/electron_node") ] +
- rebase_path(outputs, root_build_dir) +
- rebase_path(sources, root_build_dir)
- }
- target_gen_electron_js = "$target_gen_dir/js/electron"
- target_gen_default_app_js = "$target_gen_dir/js/default_app"
- typescript_build("lib_js") {
- deps = [
- ":build_electron_definitions",
- ]
- type_root = rebase_path("$target_gen_dir/tsc/electron/typings")
- sources = filenames.js_sources
- if (enable_desktop_capturer) {
- sources += [
- "lib/browser/desktop-capturer.js",
- "lib/renderer/api/desktop-capturer.js",
- ]
- }
- if (enable_view_api) {
- sources += [
- "lib/browser/api/views/box-layout.js",
- "lib/browser/api/views/button.js",
- "lib/browser/api/views/label-button.js",
- "lib/browser/api/views/layout-manager.js",
- "lib/browser/api/views/md-text-button.js",
- "lib/browser/api/views/resize-area.js",
- "lib/browser/api/views/text-field.js",
- ]
- }
- output_gen_dir = target_gen_electron_js
- output_dir_name = "lib"
- tsconfig = "tsconfig.electron.json"
- }
- asar("electron_asar") {
- deps = [
- ":lib_js",
- ]
- root = "$target_gen_electron_js/electron/lib"
- sources = get_target_outputs(":lib_js")
- outputs = [
- "$root_out_dir/resources/electron.asar",
- ]
- }
- typescript_build("default_app_js") {
- deps = [
- ":build_electron_definitions",
- ]
- type_root = rebase_path("$target_gen_dir/tsc/electron/typings")
- sources = filenames.default_app_ts_sources
- output_gen_dir = target_gen_default_app_js
- output_dir_name = "default_app"
- tsconfig = "tsconfig.default_app.json"
- }
- copy("default_app_static") {
- sources = filenames.default_app_static_sources
- outputs = [
- "$target_gen_default_app_js/{{source}}",
- ]
- }
- copy("default_app_octicon_deps") {
- sources = filenames.default_app_octicon_sources
- outputs = [
- "$target_gen_default_app_js/electron/default_app/octicon/{{source_file_part}}",
- ]
- }
- asar("default_app_asar") {
- deps = [
- ":default_app_js",
- ":default_app_octicon_deps",
- ":default_app_static",
- ]
- root = "$target_gen_default_app_js/electron/default_app"
- sources = get_target_outputs(":default_app_js") +
- get_target_outputs(":default_app_static") +
- get_target_outputs(":default_app_octicon_deps")
- outputs = [
- "$root_out_dir/resources/default_app.asar",
- ]
- }
- grit("resources") {
- source = "electron_resources.grd"
- outputs = [
- "grit/electron_resources.h",
- "electron_resources.pak",
- ]
- # Mojo manifest overlays are generated.
- source_is_generated = true
- grit_flags = [
- "-E",
- "target_gen_dir=" + rebase_path(target_gen_dir, root_build_dir),
- ]
- deps = [
- ":copy_shell_devtools_discovery_page",
- ]
- output_dir = "$target_gen_dir"
- }
- copy("copy_shell_devtools_discovery_page") {
- sources = [
- "//content/shell/resources/shell_devtools_discovery_page.html",
- ]
- outputs = [
- "$target_gen_dir/shell_devtools_discovery_page.html",
- ]
- }
- if (is_linux) {
- generate_library_loader("libnotify_loader") {
- name = "LibNotifyLoader"
- output_h = "libnotify_loader.h"
- output_cc = "libnotify_loader.cc"
- header = "<libnotify/notify.h>"
- config = ":libnotify_config"
- functions = [
- "notify_is_initted",
- "notify_init",
- "notify_get_server_caps",
- "notify_get_server_info",
- "notify_notification_new",
- "notify_notification_add_action",
- "notify_notification_set_image_from_pixbuf",
- "notify_notification_set_timeout",
- "notify_notification_set_hint_string",
- "notify_notification_show",
- "notify_notification_close",
- ]
- }
- }
- source_set("manifests") {
- sources = [
- "//electron/atom/app/manifests.cc",
- "//electron/atom/app/manifests.h",
- ]
- include_dirs = [ "//electron" ]
- deps = [
- "//electron/atom/common/api:mojo",
- "//printing/buildflags",
- "//services/proxy_resolver/public/cpp:manifest",
- "//services/service_manager/public/cpp",
- ]
- if (enable_basic_printing) {
- deps += [ "//components/services/pdf_compositor/public/cpp:manifest" ]
- }
- if (enable_print_preview) {
- deps += [ "//chrome/services/printing/public/cpp:manifest" ]
- }
- }
- static_library("electron_lib") {
- configs += [ "//v8:external_startup_data" ]
- configs += [ "//third_party/electron_node:node_internals" ]
- public_configs = [ ":branding" ]
- deps = [
- ":atom_js2c",
- ":manifests",
- ":resources",
- "atom/common/api:mojo",
- "buildflags",
- "chromium_src:chrome",
- "native_mate",
- "//base:base_static",
- "//base/allocator:buildflags",
- "//chrome/app/resources:platform_locale_settings",
- "//components/certificate_transparency",
- "//components/net_log",
- "//components/network_session_configurator/common",
- "//components/prefs",
- "//components/spellcheck/renderer",
- "//components/viz/host",
- "//components/viz/service",
- "//content/public/browser",
- "//content/public/child",
- "//content/public/common:service_names",
- "//content/public/renderer",
- "//content/public/utility",
- "//device/bluetooth",
- "//gin",
- "//media/capture/mojom:video_capture",
- "//media/mojo/interfaces",
- "//net:extras",
- "//net:net_resources",
- "//net:net_with_v8",
- "//ppapi/host",
- "//ppapi/proxy",
- "//ppapi/shared_impl",
- "//printing/buildflags",
- "//services/audio/public/mojom:constants",
- "//services/device/public/cpp/geolocation",
- "//services/device/public/mojom",
- "//services/proxy_resolver:lib",
- "//services/video_capture/public/mojom:constants",
- "//services/viz/privileged/interfaces/compositing",
- "//skia",
- "//third_party/blink/public:blink",
- "//third_party/boringssl",
- "//third_party/electron_node:node_lib",
- "//third_party/leveldatabase",
- "//third_party/libyuv",
- "//third_party/webrtc_overrides:init_webrtc",
- "//third_party/widevine/cdm:headers",
- "//ui/base/idle",
- "//ui/events:dom_keycode_converter",
- "//ui/gl",
- "//ui/native_theme",
- "//ui/shell_dialogs",
- "//ui/views",
- "//v8",
- "//v8:v8_libplatform",
- ]
- public_deps = [
- "//base",
- "//base:i18n",
- "//content/public/app:both",
- ]
- include_dirs = [
- "chromium_src",
- ".",
- "$target_gen_dir",
- # TODO(nornagon): replace usage of SchemeRegistry by an actually exported
- # API of blink, then remove this from the include_dirs.
- "//third_party/blink/renderer",
- ]
- defines = [ "V8_DEPRECATION_WARNINGS" ]
- libs = []
- if (is_linux) {
- defines += [ "GDK_DISABLE_DEPRECATION_WARNINGS" ]
- }
- extra_source_filters = []
- if (!is_linux) {
- extra_source_filters += [
- "*\bx/*",
- "*_x11.h",
- "*_x11.cc",
- "*_gtk.h",
- "*_gtk.cc",
- "*\blibrary_loaders/*",
- ]
- }
- if (!is_win) {
- extra_source_filters += [
- "*\bwin_*.h",
- "*\bwin_*.cc",
- ]
- }
- if (!is_posix) {
- extra_source_filters += [
- "*_posix.cc",
- "*_posix.h",
- ]
- }
- if (is_mac) {
- extra_source_filters += [
- "*_views.cc",
- "*_views.h",
- "*\bviews/*",
- ]
- }
- set_sources_assignment_filter(
- sources_assignment_filter + extra_source_filters)
- sources = filenames.lib_sources
- set_sources_assignment_filter(sources_assignment_filter)
- if (is_component_build) {
- defines += [ "NODE_SHARED_MODE" ]
- }
- if (enable_fake_location_provider) {
- sources += [
- "atom/browser/fake_location_provider.cc",
- "atom/browser/fake_location_provider.h",
- ]
- }
- if (is_mac) {
- deps += [
- "//components/remote_cocoa/app_shim",
- "//content/common:mac_helpers",
- "//ui/accelerated_widget_mac",
- ]
- sources += [
- "atom/browser/ui/views/autofill_popup_view.cc",
- "atom/browser/ui/views/autofill_popup_view.h",
- ]
- if (is_mas_build) {
- sources += [ "atom/browser/api/atom_api_app_mas.mm" ]
- sources -= [
- "atom/browser/auto_updater_mac.mm",
- "atom/common/crash_reporter/crash_reporter_mac.h",
- "atom/common/crash_reporter/crash_reporter_mac.mm",
- ]
- defines += [ "MAS_BUILD" ]
- } else {
- libs += [
- "Squirrel.framework",
- "ReactiveCocoa.framework",
- "Mantle.framework",
- ]
- cflags_objcc = [
- "-F",
- rebase_path("external_binaries", root_build_dir),
- ]
- # ReactiveCocoa which is used by Squirrel requires using __weak.
- cflags_objcc += [ "-fobjc-weak" ]
- }
- }
- if (is_linux) {
- deps += [
- ":libnotify_loader",
- "//build/config/linux/gtk",
- "//chrome/browser/ui/libgtkui",
- "//dbus",
- "//device/bluetooth",
- "//third_party/breakpad:client",
- "//ui/events/devices/x11",
- "//ui/events/platform/x11",
- "//ui/views/controls/webview",
- "//ui/wm",
- ]
- configs += [ ":gio_unix" ]
- include_dirs += [ "//third_party/breakpad" ]
- defines += [
- # Disable warnings for g_settings_list_schemas.
- "GLIB_DISABLE_DEPRECATION_WARNINGS",
- ]
- sources += filenames.lib_sources_nss
- }
- if (is_win) {
- libs += [ "dwmapi.lib" ]
- deps += [
- "//ui/native_theme:native_theme_browser",
- "//ui/views/controls/webview",
- "//ui/wm",
- "//ui/wm/public",
- ]
- public_deps += [
- "//sandbox/win:sandbox",
- "//third_party/crashpad/crashpad/handler",
- ]
- }
- if ((is_mac && !is_mas_build) || is_win) {
- sources += [
- "atom/common/crash_reporter/crash_reporter_crashpad.cc",
- "atom/common/crash_reporter/crash_reporter_crashpad.h",
- ]
- deps += [ "//third_party/crashpad/crashpad/client" ]
- }
- if (enable_pdf) {
- deps += [ "//pdf" ]
- }
- if (enable_run_as_node) {
- sources += [
- "atom/app/node_main.cc",
- "atom/app/node_main.h",
- ]
- }
- if (enable_osr) {
- sources += [
- "atom/browser/osr/osr_host_display_client.cc",
- "atom/browser/osr/osr_host_display_client.h",
- "atom/browser/osr/osr_host_display_client_mac.mm",
- "atom/browser/osr/osr_render_widget_host_view.cc",
- "atom/browser/osr/osr_render_widget_host_view.h",
- "atom/browser/osr/osr_video_consumer.cc",
- "atom/browser/osr/osr_video_consumer.h",
- "atom/browser/osr/osr_view_proxy.cc",
- "atom/browser/osr/osr_view_proxy.h",
- "atom/browser/osr/osr_web_contents_view.cc",
- "atom/browser/osr/osr_web_contents_view.h",
- "atom/browser/osr/osr_web_contents_view_mac.mm",
- ]
- deps += [
- "//components/viz/service",
- "//services/viz/public/interfaces",
- "//ui/compositor",
- ]
- }
- if (enable_desktop_capturer) {
- if (is_component_build && !is_linux) {
- deps += [ "//third_party/webrtc/modules/desktop_capture" ]
- }
- sources += [
- "atom/browser/api/atom_api_desktop_capturer.cc",
- "atom/browser/api/atom_api_desktop_capturer.h",
- ]
- }
- if (enable_view_api) {
- sources += [
- "atom/browser/api/views/atom_api_box_layout.cc",
- "atom/browser/api/views/atom_api_box_layout.h",
- "atom/browser/api/views/atom_api_button.cc",
- "atom/browser/api/views/atom_api_button.h",
- "atom/browser/api/views/atom_api_label_button.cc",
- "atom/browser/api/views/atom_api_label_button.h",
- "atom/browser/api/views/atom_api_layout_manager.cc",
- "atom/browser/api/views/atom_api_layout_manager.h",
- "atom/browser/api/views/atom_api_md_text_button.cc",
- "atom/browser/api/views/atom_api_md_text_button.h",
- "atom/browser/api/views/atom_api_resize_area.cc",
- "atom/browser/api/views/atom_api_resize_area.h",
- "atom/browser/api/views/atom_api_text_field.cc",
- "atom/browser/api/views/atom_api_text_field.h",
- ]
- }
- if (enable_basic_printing) {
- sources += [
- "atom/browser/printing/print_preview_message_handler.cc",
- "atom/browser/printing/print_preview_message_handler.h",
- "atom/renderer/printing/print_render_frame_helper_delegate.cc",
- "atom/renderer/printing/print_render_frame_helper_delegate.h",
- ]
- }
- if (enable_pepper_flash) {
- deps += [ "components/pepper_flash" ]
- }
- }
- electron_paks("packed_resources") {
- if (is_mac) {
- output_dir = "$root_gen_dir/electron_repack"
- copy_data_to_bundle = true
- } else {
- output_dir = root_out_dir
- }
- }
- if (is_mac) {
- electron_framework_name = "$electron_product_name Framework"
- electron_helper_name = "$electron_product_name Helper"
- electron_login_helper_name = "$electron_product_name Login Helper"
- electron_framework_version = "A"
- electron_version = read_file("ELECTRON_VERSION", "trim string")
- mac_xib_bundle_data("electron_xibs") {
- sources = [
- "atom/common/resources/mac/MainMenu.xib",
- ]
- }
- bundle_data("electron_framework_resources") {
- public_deps = [
- ":packed_resources",
- ]
- sources = []
- if (icu_use_data_file) {
- sources += [ "$root_out_dir/icudtl.dat" ]
- public_deps += [ "//third_party/icu:icudata" ]
- }
- if (v8_use_external_startup_data) {
- sources += [ "$root_out_dir/natives_blob.bin" ]
- public_deps += [ "//v8" ]
- if (use_v8_context_snapshot) {
- sources += [ "$root_out_dir/v8_context_snapshot.bin" ]
- public_deps += [ "//tools/v8_context_snapshot" ]
- } else {
- sources += [ "$root_out_dir/snapshot_blob.bin" ]
- }
- }
- outputs = [
- "{{bundle_resources_dir}}/{{source_file_part}}",
- ]
- }
- if (!is_component_build) {
- bundle_data("electron_framework_libraries") {
- sources = []
- public_deps = []
- if (is_component_ffmpeg) {
- sources += [ "$root_out_dir/libffmpeg.dylib" ]
- public_deps += [ "//third_party/ffmpeg:ffmpeg" ]
- }
- outputs = [
- "{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
- ]
- }
- } else {
- group("electron_framework_libraries") {
- }
- }
- if (use_egl) {
- # Add the ANGLE .dylibs in the Libraries directory of the Framework.
- bundle_data("electron_angle_binaries") {
- sources = [
- "$root_out_dir/egl_intermediates/libEGL.dylib",
- "$root_out_dir/egl_intermediates/libGLESv2.dylib",
- ]
- outputs = [
- "{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
- ]
- public_deps = [
- "//ui/gl:angle_library_copy",
- ]
- }
- # Add the SwiftShader .dylibs in the Libraries directory of the Framework.
- bundle_data("electron_swiftshader_binaries") {
- sources = [
- "$root_out_dir/egl_intermediates/libswiftshader_libEGL.dylib",
- "$root_out_dir/egl_intermediates/libswiftshader_libGLESv2.dylib",
- ]
- outputs = [
- "{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
- ]
- public_deps = [
- "//ui/gl:swiftshader_library_copy",
- ]
- }
- }
- group("electron_angle_library") {
- if (use_egl) {
- deps = [
- ":electron_angle_binaries",
- ]
- }
- }
- group("electron_swiftshader_library") {
- if (use_egl) {
- deps = [
- ":electron_swiftshader_binaries",
- ]
- }
- }
- bundle_data("electron_crashpad_helper") {
- sources = [
- "$root_out_dir/crashpad_handler",
- ]
- outputs = [
- "{{bundle_resources_dir}}/{{source_file_part}}",
- ]
- public_deps = [
- "//third_party/crashpad/crashpad/handler:crashpad_handler",
- ]
- }
- mac_framework_bundle("electron_framework") {
- output_name = electron_framework_name
- framework_version = electron_framework_version
- framework_contents = [
- "Resources",
- "Libraries",
- ]
- public_deps = [
- ":electron_lib",
- ]
- deps = [
- ":electron_angle_library",
- ":electron_framework_libraries",
- ":electron_framework_resources",
- ":electron_swiftshader_library",
- ":electron_xibs",
- ]
- if (!is_mas_build) {
- deps += [ ":electron_crashpad_helper" ]
- }
- info_plist = "atom/common/resources/mac/Info.plist"
- extra_substitutions = [
- "ATOM_BUNDLE_ID=$electron_mac_bundle_id.framework",
- "ELECTRON_VERSION=$electron_version",
- ]
- include_dirs = [ "." ]
- sources = filenames.framework_sources
- libs = [
- "AVFoundation.framework",
- "Carbon.framework",
- "LocalAuthentication.framework",
- "QuartzCore.framework",
- "Quartz.framework",
- "Security.framework",
- "SecurityInterface.framework",
- "ServiceManagement.framework",
- "StoreKit.framework",
- ]
- if (enable_osr) {
- libs += [ "IOSurface.framework" ]
- }
- ldflags = [
- "-F",
- rebase_path("external_binaries", root_build_dir),
- "-Wl,-install_name,@rpath/$output_name.framework/$output_name",
- "-rpath",
- "@loader_path/Libraries",
- ]
- if (is_component_build) {
- ldflags += [
- "-rpath",
- "@executable_path/../../../../../..",
- ]
- }
- }
- template("electron_helper_app") {
- mac_app_bundle(target_name) {
- assert(defined(invoker.helper_name_suffix))
- output_name = electron_helper_name + invoker.helper_name_suffix
- deps = [
- ":electron_framework+link",
- ]
- if (!is_mas_build) {
- deps += [ "//sandbox/mac:seatbelt" ]
- }
- defines = [ "HELPER_EXECUTABLE" ]
- sources = filenames.app_sources
- sources += [ "atom/common/atom_constants.cc" ]
- include_dirs = [ "." ]
- info_plist = "atom/renderer/resources/mac/Info.plist"
- extra_substitutions = [ "ATOM_BUNDLE_ID=$electron_mac_bundle_id.helper" ]
- ldflags = [
- "-rpath",
- "@executable_path/../../..",
- ]
- if (is_component_build) {
- ldflags += [
- "-rpath",
- "@executable_path/../../../../../..",
- ]
- }
- }
- }
- foreach(helper_params, content_mac_helpers) {
- _helper_target = helper_params[0]
- _helper_bundle_id = helper_params[1]
- _helper_suffix = helper_params[2]
- electron_helper_app("electron_helper_app_${_helper_target}") {
- helper_name_suffix = _helper_suffix
- }
- }
- bundle_data("electron_app_framework_bundle_data") {
- sources = [
- "$root_out_dir/$electron_framework_name.framework",
- ]
- if (!is_mas_build) {
- sources += [
- "external_binaries/Mantle.framework",
- "external_binaries/ReactiveCocoa.framework",
- "external_binaries/Squirrel.framework",
- ]
- }
- outputs = [
- "{{bundle_contents_dir}}/Frameworks/{{source_file_part}}",
- ]
- public_deps = [
- ":electron_framework+link",
- ]
- foreach(helper_params, content_mac_helpers) {
- sources +=
- [ "$root_out_dir/${electron_helper_name}${helper_params[2]}.app" ]
- public_deps += [ ":electron_helper_app_${helper_params[0]}" ]
- }
- }
- mac_app_bundle("electron_login_helper") {
- output_name = electron_login_helper_name
- sources = filenames.login_helper_sources
- include_dirs = [ "." ]
- libs = [ "AppKit.framework" ]
- info_plist = "atom/app/resources/mac/loginhelper-Info.plist"
- extra_substitutions =
- [ "ATOM_BUNDLE_ID=$electron_mac_bundle_id.loginhelper" ]
- }
- bundle_data("electron_login_helper_app") {
- public_deps = [
- ":electron_login_helper",
- ]
- sources = [
- "$root_out_dir/$electron_login_helper_name.app",
- ]
- outputs = [
- "{{bundle_contents_dir}}/Library/LoginItems/{{source_file_part}}",
- ]
- }
- action("electron_app_lproj_dirs") {
- outputs = []
- foreach(locale, locales_as_mac_outputs) {
- outputs += [ "$target_gen_dir/app_infoplist_strings/$locale.lproj" ]
- }
- script = "build/mac/make_locale_dirs.py"
- args = rebase_path(outputs)
- }
- foreach(locale, locales_as_mac_outputs) {
- bundle_data("electron_app_strings_${locale}_bundle_data") {
- sources = [
- "$target_gen_dir/app_infoplist_strings/$locale.lproj",
- ]
- outputs = [
- "{{bundle_resources_dir}}/$locale.lproj",
- ]
- public_deps = [
- ":electron_app_lproj_dirs",
- ]
- }
- }
- group("electron_app_strings_bundle_data") {
- public_deps = []
- foreach(locale, locales_as_mac_outputs) {
- public_deps += [ ":electron_app_strings_${locale}_bundle_data" ]
- }
- }
- bundle_data("electron_app_resources") {
- public_deps = [
- ":default_app_asar",
- ":electron_app_strings_bundle_data",
- ":electron_asar",
- ]
- sources = [
- "$root_out_dir/resources/default_app.asar",
- "$root_out_dir/resources/electron.asar",
- "atom/browser/resources/mac/electron.icns",
- ]
- outputs = [
- "{{bundle_resources_dir}}/{{source_file_part}}",
- ]
- }
- mac_app_bundle("electron_app") {
- output_name = electron_product_name
- sources = filenames.app_sources
- sources += [ "atom/common/atom_constants.cc" ]
- include_dirs = [ "." ]
- deps = [
- ":electron_app_framework_bundle_data",
- ":electron_app_resources",
- ]
- if (is_mas_build) {
- deps += [ ":electron_login_helper_app" ]
- }
- info_plist = "atom/browser/resources/mac/Info.plist"
- extra_substitutions = [ "ATOM_BUNDLE_ID=$electron_mac_bundle_id" ]
- ldflags = [
- "-rpath",
- "@executable_path/../Frameworks",
- ]
- }
- if (enable_dsyms) {
- extract_symbols("electron_framework_syms") {
- binary = "$root_out_dir/$electron_framework_name.framework/Versions/$electron_framework_version/$electron_framework_name"
- symbol_dir = "$root_out_dir/breakpad_symbols"
- dsym_file = "$root_out_dir/$electron_framework_name.dSYM/Contents/Resources/DWARF/$electron_framework_name"
- deps = [
- ":electron_framework",
- ]
- }
- foreach(helper_params, content_mac_helpers) {
- _helper_target = helper_params[0]
- _helper_bundle_id = helper_params[1]
- _helper_suffix = helper_params[2]
- extract_symbols("electron_helper_syms_${_helper_target}") {
- binary = "$root_out_dir/$electron_helper_name${_helper_suffix}.app/Contents/MacOS/$electron_helper_name${_helper_suffix}"
- symbol_dir = "$root_out_dir/breakpad_symbols"
- dsym_file = "$root_out_dir/$electron_helper_name${_helper_suffix}.dSYM/Contents/Resources/DWARF/$electron_helper_name${_helper_suffix}"
- deps = [
- ":electron_helper_app_${_helper_target}",
- ]
- }
- }
- extract_symbols("electron_app_syms") {
- binary = "$root_out_dir/$electron_product_name.app/Contents/MacOS/$electron_product_name"
- symbol_dir = "$root_out_dir/breakpad_symbols"
- dsym_file = "$root_out_dir/$electron_product_name.dSYM/Contents/Resources/DWARF/$electron_product_name"
- deps = [
- ":electron_app",
- ]
- }
- extract_symbols("swiftshader_egl_syms") {
- binary = "$root_out_dir/libswiftshader_libEGL.dylib"
- symbol_dir = "$root_out_dir/breakpad_symbols"
- dsym_file = "$root_out_dir/libswiftshader_libEGL.dylib.dSYM/Contents/Resources/DWARF/libswiftshader_libEGL.dylib"
- deps = [
- "//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL",
- ]
- }
- extract_symbols("swiftshader_gles_syms") {
- binary = "$root_out_dir/libswiftshader_libGLESv2.dylib"
- symbol_dir = "$root_out_dir/breakpad_symbols"
- dsym_file = "$root_out_dir/libswiftshader_libGLESv2.dylib.dSYM/Contents/Resources/DWARF/libswiftshader_libGLESv2.dylib"
- deps = [
- "//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2",
- ]
- }
- extract_symbols("crashpad_handler_syms") {
- binary = "$root_out_dir/crashpad_handler"
- symbol_dir = "$root_out_dir/breakpad_symbols"
- dsym_file = "$root_out_dir/crashpad_handler.dSYM/Contents/Resources/DWARF/crashpad_handler"
- deps = [
- "//third_party/crashpad/crashpad/handler:crashpad_handler",
- ]
- }
- group("electron_symbols") {
- deps = [
- ":crashpad_handler_syms",
- ":electron_app_syms",
- ":electron_framework_syms",
- ":swiftshader_egl_syms",
- ":swiftshader_gles_syms",
- ]
- foreach(helper_params, content_mac_helpers) {
- _helper_target = helper_params[0]
- deps += [ ":electron_helper_syms_${_helper_target}" ]
- }
- }
- } else {
- group("electron_symbols") {
- }
- }
- } else {
- windows_manifest("electron_app_manifest") {
- sources = [
- "atom/browser/resources/win/disable_window_filtering.manifest",
- "atom/browser/resources/win/dpi_aware.manifest",
- as_invoker_manifest,
- common_controls_manifest,
- default_compatibility_manifest,
- ]
- }
- executable("electron_app") {
- output_name = electron_project_name
- sources = filenames.app_sources
- include_dirs = [ "." ]
- deps = [
- ":default_app_asar",
- ":electron_app_manifest",
- ":electron_asar",
- ":electron_lib",
- ":packed_resources",
- "//content:sandbox_helper_win",
- "//electron/buildflags",
- "//ui/strings",
- ]
- data = []
- data += [ "$root_out_dir/resources.pak" ]
- data += [ "$root_out_dir/chrome_100_percent.pak" ]
- if (enable_hidpi) {
- data += [ "$root_out_dir/chrome_200_percent.pak" ]
- }
- foreach(locale, locales) {
- data += [ "$root_out_dir/locales/$locale.pak" ]
- }
- if (!is_mac) {
- data += [ "$root_out_dir/resources/default_app.asar" ]
- data += [ "$root_out_dir/resources/electron.asar" ]
- }
- public_deps = [
- "//tools/v8_context_snapshot:v8_context_snapshot",
- ]
- if (is_win) {
- sources += [
- # TODO: we should be generating our .rc files more like how chrome does
- "atom/browser/resources/win/atom.ico",
- "atom/browser/resources/win/atom.rc",
- "atom/browser/resources/win/resource.h",
- ]
- libs = [
- "comctl32.lib",
- "uiautomationcore.lib",
- "wtsapi32.lib",
- ]
- configs += [ "//build/config/win:windowed" ]
- ldflags = [
- # Windows 7 doesn't have these DLLs.
- # TODO: are there other DLLs we need to list here to be win7
- # compatible?
- "/DELAYLOAD:api-ms-win-core-winrt-l1-1-0.dll",
- "/DELAYLOAD:api-ms-win-core-winrt-string-l1-1-0.dll",
- ]
- # This is to support renaming of electron.exe. node-gyp has hard-coded
- # executable names which it will recognise as node. This module definition
- # file claims that the electron executable is in fact named "node.exe",
- # which is one of the executable names that node-gyp recognizes.
- # See https://github.com/nodejs/node-gyp/commit/52ceec3a6d15de3a8f385f43dbe5ecf5456ad07a
- ldflags += [ "/DEF:" + rebase_path("build/electron.def", root_build_dir) ]
- inputs = [
- "build/electron.def",
- ]
- }
- if (is_linux) {
- ldflags = [ "-pie" ]
- if (!is_component_build && is_component_ffmpeg) {
- configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
- }
- }
- }
- if (is_official_build) {
- if (is_linux) {
- _target_executable_suffix = ""
- _target_shared_library_suffix = ".so"
- } else if (is_win) {
- _target_executable_suffix = ".exe"
- _target_shared_library_suffix = ".dll"
- }
- extract_symbols("electron_app_symbols") {
- binary = "$root_out_dir/$electron_project_name$_target_executable_suffix"
- symbol_dir = "$root_out_dir/breakpad_symbols"
- deps = [
- ":electron_app",
- ]
- }
- extract_symbols("swiftshader_egl_symbols") {
- binary = "$root_out_dir/swiftshader/libEGL$_target_shared_library_suffix"
- symbol_dir = "$root_out_dir/breakpad_symbols"
- deps = [
- "//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL",
- ]
- }
- extract_symbols("swiftshader_gles_symbols") {
- binary =
- "$root_out_dir/swiftshader/libGLESv2$_target_shared_library_suffix"
- symbol_dir = "$root_out_dir/breakpad_symbols"
- deps = [
- "//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2",
- ]
- }
- group("electron_symbols") {
- deps = [
- ":electron_app_symbols",
- ":swiftshader_egl_symbols",
- ":swiftshader_gles_symbols",
- ]
- }
- }
- }
- template("dist_zip") {
- _runtime_deps_target = "${target_name}__deps"
- _runtime_deps_file =
- "$root_out_dir/gen.runtime/" + get_label_info(target_name, "dir") + "/" +
- get_label_info(target_name, "name") + ".runtime_deps"
- group(_runtime_deps_target) {
- forward_variables_from(invoker,
- [
- "deps",
- "data_deps",
- "data",
- "testonly",
- ])
- write_runtime_deps = _runtime_deps_file
- }
- action(target_name) {
- script = "//electron/build/zip.py"
- deps = [
- ":$_runtime_deps_target",
- ]
- forward_variables_from(invoker,
- [
- "outputs",
- "testonly",
- ])
- args = rebase_path(outputs + [ _runtime_deps_file ], root_build_dir) + [
- target_cpu,
- target_os,
- ]
- }
- }
- copy("electron_license") {
- sources = [
- "LICENSE",
- ]
- outputs = [
- "$root_build_dir/{{source_file_part}}",
- ]
- }
- copy("chromium_licenses") {
- deps = [
- "//components/resources:about_credits",
- ]
- sources = [
- "$root_gen_dir/components/resources/about_credits.html",
- ]
- outputs = [
- "$root_build_dir/LICENSES.chromium.html",
- ]
- }
- group("licenses") {
- data_deps = [
- ":electron_license",
- ":chromium_licenses",
- ]
- }
- copy("electron_version") {
- sources = [
- "ELECTRON_VERSION",
- ]
- outputs = [
- "$root_build_dir/version",
- ]
- }
- dist_zip("electron_dist_zip") {
- data_deps = [
- ":electron_app",
- ":licenses",
- ":electron_version",
- ]
- if (is_linux) {
- data_deps += [ "//sandbox/linux:chrome_sandbox" ]
- }
- outputs = [
- "$root_build_dir/dist.zip",
- ]
- }
- dist_zip("electron_ffmpeg_zip") {
- data_deps = [
- "//third_party/ffmpeg",
- ]
- outputs = [
- "$root_build_dir/ffmpeg.zip",
- ]
- }
- dist_zip("electron_chromedriver_zip") {
- testonly = true
- data_deps = [
- "//chrome/test/chromedriver",
- ":licenses",
- ]
- outputs = [
- "$root_build_dir/chromedriver.zip",
- ]
- }
- dist_zip("electron_mksnapshot_zip") {
- data_deps = [
- "//v8:mksnapshot($v8_snapshot_toolchain)",
- "//tools/v8_context_snapshot:v8_context_snapshot_generator",
- ":licenses",
- ]
- outputs = [
- "$root_build_dir/mksnapshot.zip",
- ]
- }
- group("electron") {
- public_deps = [
- ":electron_app",
- ]
- }
|