blob: 8caaa2dced2abffa3b0c83817ce2ebf46964aa3f [file] [log] [blame]
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/crypto.gni")
import("//build/config/features.gni")
import("//build/config/ui.gni")
import("//components/nacl/nacl_defines.gni")
import("//tools/grit/grit_rule.gni")
about_credits_file = "$target_gen_dir/about_credits.html"
additional_modules_list_file =
"$root_gen_dir/chrome/browser/internal/additional_modules_list.txt"
gypi_values = exec_script(
"//build/gypi_to_gn.py",
[ rebase_path("../chrome_browser.gypi") ],
"scope",
[ "../chrome_browser.gypi" ])
static_library("browser") {
configs += [ "//build/config/compiler:wexit_time_destructors" ]
defines = []
sources = []
libs = []
ldflags = []
# iOS/non-iOS shared deps. New dependencies should generally be added in the
# non-iOS deps below.
deps = [
"//base/allocator",
"//chrome:extra_resources",
"//chrome:resources",
"//chrome:strings",
"//chrome/app:generated_resources_map",
"//chrome/app/resources:platform_locale_settings",
"//chrome/app/theme:theme_resources",
"//chrome/browser/history:in_memory_url_index_cache_proto",
"//chrome/browser/net:cert_logger_proto",
"//chrome/browser/net:probe_message_proto",
"//chrome/browser/ui",
"//chrome/common",
"//chrome/common/net",
"//components/autofill/core/browser",
"//components/captive_portal",
"//components/cloud_devices/common",
"//components/content_settings/core/common",
"//components/data_reduction_proxy/browser",
"//components/domain_reliability",
"//components/favicon_base",
"//components/favicon/core",
"//components/feedback",
"//components/gcm_driver",
"//components/history/core/browser",
"//components/history/core/common",
"//components/metrics:net",
"//components/navigation_metrics",
"//components/omnibox",
"//components/os_crypt",
"//components/policy:policy_component",
"//components/query_parser",
"//components/rappor",
"//components/search",
"//components/signin/core/browser",
"//components/startup_metric_utils",
"//components/strings",
"//components/suggestions",
"//components/translate/core/browser",
"//components/translate/core/common",
"//components/url_fixer",
"//components/user_prefs",
"//components/webdata/common",
"//content/public/browser",
"//content/public/common",
"//courgette:courgette_lib",
"//crypto",
"//google_apis",
"//skia",
"//sql",
"//sync",
"//third_party/cacheinvalidation",
"//third_party/icu",
"//third_party/libxml",
"//third_party/widevine/cdm:version_h",
"//third_party/zlib",
"//third_party/zlib:minizip",
"//third_party/zlib:zip",
"//ui/base",
"//ui/events",
"//ui/gfx",
"//ui/gfx/geometry",
"//ui/message_center",
"//ui/shell_dialogs",
"//ui/strings",
"//ui/resources",
# TODO(GYP)
#"../components/components.gyp:bookmarks_browser",
#"../components/components.gyp:google_core_browser",
#"../components/components.gyp:infobars_core",
#"../components/components.gyp:invalidation",
#"../components/components.gyp:network_time",
#"../components/components.gyp:omaha_query_params",
#"../components/components.gyp:password_manager_core_browser",
#"../components/components.gyp:password_manager_core_common",
#"../components/components.gyp:precache_core",
#"../components/components.gyp:search_engines",
#"../components/components.gyp:search_provider_logos",
#"../components/components.gyp:sync_driver",
#"../jingle/jingle.gyp:notifier",
#"../third_party/libjingle/libjingle.gyp:libjingle",
]
forward_dependent_configs_from = [
"//components/autofill/core/browser",
"//content/public/browser",
"//sql",
"//sync",
]
if (!is_ios) {
sources += rebase_path(gypi_values.chrome_browser_non_ios_sources,
".", "//chrome")
#TODO(GYP) Add these sources:
# # These files are generated by GRIT.
# '<(grit_out_dir)/grit/component_extension_resources_map.cc',
# '<(grit_out_dir)/grit/theme_resources_map.cc',
# '<(SHARED_INTERMEDIATE_DIR)/ui/resources/grit/ui_resources_map.cc',
#
# # This file is generated by
# # chrome/browser/metrics/variations/generate_resources_map.py
# '<(SHARED_INTERMEDIATE_DIR)/chrome/browser/metrics/variations/generated_resources_map.cc',
defines = nacl_defines
# TODO(GYP) remove this when the real webrtc target is used below.
configs += [ "//content:webrtc_stub_config" ]
deps += [
"//cc",
"//chrome/browser/performance_monitor",
"//chrome/browser/sync_file_system:sync_file_system_proto",
"//chrome/browser/sync_file_system/drive_backend:sync_file_system_drive_proto",
"//chrome/common/extensions/api:api",
"//components/autofill/content/browser",
"//components/dom_distiller/content",
"//components/keyed_service/content",
"//components/storage_monitor",
"//components/translate/content/browser",
"//components/url_matcher",
"//components/usb_service",
"//components/visitedlink/browser",
"//components/visitedlink/common",
"//components/web_modal",
"//mojo/environment:chromium",
"//mojo/public/cpp/bindings",
"//mojo/public/js/bindings",
"//mojo/system",
"//net:net_with_v8",
"//third_party/WebKit/public:resources",
"//third_party/adobe/flash:flapper_version_h",
"//third_party/expat",
"//third_party/leveldatabase",
"//third_party/libaddressinput",
"//third_party/libyuv",
"//third_party/npapi",
"//third_party/re2",
"//third_party/smhasher:cityhash",
"//ui/gl",
"//ui/surface",
"//ui/web_dialogs",
"//v8",
"//webkit/browser:storage",
"//webkit/common",
"//webkit/common:storage",
"//webkit/glue/resources",
# TODO(GYP)
#"apps",
#"debugger",
#"installer_util",
#"../components/components.gyp:navigation_interception",
#"../components/components.gyp:password_manager_content_browser",
#"../components/components.gyp:precache_content",
#"../components/components.gyp:sessions",
#"../media/cast/cast.gyp:cast_transport",
#"../media/media.gyp:media",
## TODO(tonyg): Remove this dependency (crbug.com/280157).
#"../testing/perf/perf_test.gyp:*",
# Note: for this one also remove the webrtc_stub_config
#"../third_party/webrtc/modules/modules.gyp:desktop_capture",
]
} else { # iOS
sources += rebase_path(gypi_values.chrome_browser_ios_sources,
".", "//chrome")
deps += [
"//net",
]
libs += [
"CoreTelephony.framework",
"CoreText.framework",
"MobileCoreServices.framework",
"QuartzCore.framework",
]
ldflags += [ "-weak_framework", "CoreImage" ]
}
if (is_win || is_mac) {
sources += rebase_path(gypi_values.chrome_browser_win_mac_sources,
".", "//chrome")
}
if (!is_android && !is_ios && !is_chromeos && enable_configuration_policy) {
sources += [
"net/disk_cache_dir_policy_handler.cc",
"net/disk_cache_dir_policy_handler.h",
]
}
if (!is_android && !is_ios && enable_configuration_policy) {
sources += [
"download/download_dir_policy_handler.cc",
"download/download_dir_policy_handler.h",
]
}
if (is_mac) {
sources += rebase_path(gypi_values.chrome_browser_mac_sources,
".", "//chrome")
deps += [
#"app_shim" TODO(GYP)
]
}
if (cld2_data_source == "component") {
sources += [
"component_updater/cld_component_installer.cc",
"component_updater/cld_component_installer.h",
]
}
if (enable_extensions) {
deps += [ "//chrome/browser/extensions" ]
sources += rebase_path(gypi_values.chrome_browser_extensions_sources,
".", "//chrome")
}
if (enable_background) {
sources += rebase_path(gypi_values.chrome_browser_background_sources,
".", "//chrome")
if (!use_aura || is_win) {
sources -= [ "background/background_mode_manager_aura.cc" ]
}
}
if (enable_task_manager) {
sources += rebase_path(gypi_values.chrome_browser_task_manager_sources,
".", "//chrome")
}
if (enable_spellcheck) {
sources += rebase_path(gypi_values.chrome_browser_spellchecker_sources,
".", "//chrome")
deps += [ "//third_party/hunspell" ]
}
if (enable_nacl) {
sources += rebase_path(gypi_values.chrome_browser_nacl_sources,
".", "//chrome")
#deps += [ "//components/nacl:nacl_browser" ] TODO(GYP)
}
# ["debug_devtools==1", { TODO(GYP)
# "defines": [
# "DEBUG_DEVTOOLS=1",
# ],
if (enable_configuration_policy) {
sources += rebase_path(
gypi_values.chrome_browser_policy_shared_with_ios_sources,
".", "//chrome")
deps += [
"//components/policy",
"//components/policy/proto",
]
if (!is_ios) {
sources += rebase_path(
gypi_values.chrome_browser_policy_non_ios_sources,
".", "//chrome")
}
if (!is_chromeos) {
sources += rebase_path(
gypi_values.chrome_browser_policy_shared_with_ios_not_chromeos_sources,
".", "//chrome")
}
if (is_win || is_mac || is_desktop_linux) {
sources += rebase_path(gypi_values.chrome_browser_policy_desktop_sources,
".", "//chrome")
}
if (is_android || is_ios) {
sources += rebase_path(gypi_values.chrome_browser_mobile_sources,
".", "//chrome")
} else { # Non-mobile
deps += [
#"policy_path_parser", TODO(GYP)
]
}
} else {
# Configuration policy disabled.
sources += rebase_path(gypi_values.chrome_browser_policy_disabled_sources,
".", "//chrome")
}
if (enable_plugins) {
sources += rebase_path(gypi_values.chrome_browser_plugins_sources,
".", "//chrome")
deps += [
"//ppapi:ppapi_ipc",
]
}
if (safe_browsing_mode != 0) {
sources += rebase_path(
gypi_values.chrome_browser_basic_safe_browsing_sources,
".", "//chrome")
deps += [
"//chrome/browser/safe_browsing:chunk_proto",
"//chrome/browser/safe_browsing:report_proto",
]
if (safe_browsing_mode == 1) {
sources += rebase_path(
gypi_values.chrome_browser_full_safe_browsing_sources,
".", "//chrome")
defines += [ "FULL_SAFE_BROWSING" ]
deps += [
"//chrome/common/safe_browsing:proto",
]
} else if (safe_browsing_mode == 2) {
defines += [ "MOBILE_SAFE_BROWSING" ]
}
}
if (is_linux) {
configs += [ "//build/config/linux:udev" ]
deps += [ "//device/media_transfer_protocol" ]
}
if (is_linux && !is_chromeos) {
deps += [ "//third_party/speech-dispatcher" ]
}
if (is_chromeos) {
sources += rebase_path(gypi_values.chrome_browser_chromeos_sources,
".", "//chrome")
deps += [
#"browser_chromeos", TODO(GYP)
]
} else {
# Non-ChromeOS.
sources += rebase_path(gypi_values.chrome_browser_non_chromeos_sources,
".", "//chrome")
}
if (use_cups) {
configs += [ "//printing:cups" ]
}
if (is_desktop_linux) {
sources += rebase_path(gypi_values.chrome_browser_gnome_keyring_sources,
".", "//chrome")
configs += [ "//build/config/linux:gnome_keyring" ]
}
if (use_aura) {
sources += rebase_path(gypi_values.chrome_browser_aura_sources,
".", "//chrome")
deps += [
"//ui/aura",
"//ui/compositor",
"//ui/keyboard",
]
}
if (ui_compositor_image_transport) {
deps += [ "//ui/gl" ]
}
if (use_ash) {
sources += rebase_path(gypi_values.chrome_browser_ash_sources,
".", "//chrome")
}
if (use_x11) {
sources += rebase_path(gypi_values.chrome_browser_x11_sources,
".", "//chrome")
if (!is_chromeos) {
configs += [ "//build/config/linux:xscrnsaver" ]
}
}
if (is_posix && !is_mac && !is_ios) {
sources += [
"//chrome/app/chrome_breakpad_client.cc",
"//chrome/app/chrome_breakpad_client.h",
]
deps += [
#"../components/components.gyp:breakpad_component", TODO(GYP)
#"../components/components.gyp:breakpad_host", TODO(GYP)
]
}
if (use_nss_certs) {
sources += rebase_path(gypi_values.chrome_browser_nss_sources,
".", "//chrome")
}
if (enable_notifications) {
sources += rebase_path(gypi_values.chrome_browser_notifications_sources,
".", "//chrome")
if (!is_android) {
sources += rebase_path(
gypi_values.chrome_browser_non_android_notifications_sources,
".", "//chrome")
}
}
if (enable_themes) {
sources += rebase_path(gypi_values.chrome_browser_themes_sources,
".", "//chrome")
}
if (printing_mode != 0) {
# Some form of printing support.
sources += rebase_path(gypi_values.chrome_browser_basic_printing_sources,
".", "//chrome")
deps += [
#"../printing/printing.gyp:printing", TODO(GYP)
]
if (is_win && win_pdf_metafile_for_printing) {
sources += rebase_path(gypi_values.chrome_browser_printing_emf_sources,
".", "//chrome")
}
if (printing_mode == 1) {
# Full printing on top of the above.
sources += rebase_path(gypi_values.chrome_browser_full_printing_sources,
".", "//chrome")
} else if (printing_mode == 2) {
# Partial-only printing support.
sources += rebase_path(
gypi_values.chrome_browser_basic_only_printing_sources,
".", "//chrome")
}
}
if (enable_captive_portal_detection) {
sources += rebase_path(gypi_values.chrome_browser_captive_portal_sources,
".", "//chrome")
}
if (enable_session_service) {
sources += rebase_path(gypi_values.chrome_browser_session_service_sources,
".", "//chrome")
}
if (is_android || is_ios) {
# Mobile.
sources += rebase_path(gypi_values.chrome_browser_mobile_sources,
".", "//chrome")
} else {
# Non-mobile.
sources += rebase_path(gypi_values.chrome_browser_non_mobile_sources,
".", "//chrome")
}
if (is_android) {
sources += rebase_path(gypi_values.chrome_browser_android_sources,
".", "//chrome")
deps += [
#"../components/components.gyp:cdm_browser", TODO(GYP)
#"../components/components.gyp:web_contents_delegate_android", TODO(GYP)
#"chrome_browser_jni_headers", TODO(GYP)
]
deps -= [
"//third_party/libaddressinput",
"//components/feedback",
"//components/storage_monitor",
"//components/usb_service",
"//components/web_modal",
]
} else {
sources += rebase_path(gypi_values.chrome_browser_non_android_sources,
".", "//chrome")
}
if (is_mac) {
deps += [
"//third_party/google_toolbox_for_mac",
#"../third_party/mozilla/mozilla.gyp:mozilla", TODO(GYP)
]
libs += [
"Accelerate.framework",
"AddressBook.framework",
"AudioUnit.framework",
"DiskArbitration.framework",
"IOKit.framework",
"ImageCaptureCore.framework",
"OpenGL.framework",
"QuartzCore.framework",
"SecurityInterface.framework",
]
}
if (enable_rlz) {
sources += rebase_path(gypi_values.chrome_browser_rlz_sources,
".", "//chrome")
deps += [ "//rlz:rlz_lib" ]
}
# TODO(GYP)
# Temporary fix to break the browser target into smaller chunks so it
# will link with goma builds.
#["OS=="win" and chromium_win_pch==0", {
# "msvs_shard": 4,
#}],
if (is_win) {
sources += rebase_path(gypi_values.chrome_browser_win_sources,
".", "//chrome")
deps += [
"//third_party/wtl",
#"chrome_process_finder", TODO(GYP)
#"installer_util_strings", TODO(GYP)
#"../chrome/chrome.gyp:chrome_version_header", TODO(GYP)
#"../chrome_elf/chrome_elf.gyp:chrome_elf", TODO(GYP)
#"../chrome_elf/chrome_elf.gyp:chrome_elf_constants", TODO(GYP)
#"../chrome_elf/chrome_elf.gyp:dll_hash", TODO(GYP)
#"../google_update/google_update.gyp:google_update", TODO(GYP)
#"../third_party/iaccessible2/iaccessible2.gyp:iaccessible2", TODO(GYP)
#"../third_party/isimpledom/isimpledom.gyp:isimpledom", TODO(GYP)
#"../ui/metro_viewer/metro_viewer.gyp:metro_viewer_messages", TODO(GYP)
#"../ui/views/controls/webview/webview.gyp:webview", TODO(GYP)
#"../ui/views/views.gyp:views", TODO(GYP)
#"../win8/win8.gyp:metro_viewer", TODO(GYP)
]
forward_dependent_configs_from += [
#"../ui/views/controls/webview/webview.gyp:webview", TODO(GYP)
#"../ui/views/views.gyp:views", TODO(GYP)
]
} else {
# Non-Windows.
sources += rebase_path(gypi_values.chrome_browser_non_win_sources,
".", "//chrome")
if (toolkit_views) {
deps += [
#"../ui/views/controls/webview/webview.gyp:webview", TODO(GYP)
#"../ui/views/views.gyp:views", TODO(GYP)
]
# TODO(GYP) why is this needed? Very susicious.
# "include_dirs": [
# "<(INTERMEDIATE_DIR)/chrome",
# ],
}
}
if (is_linux) {
sources += rebase_path(gypi_values.chrome_browser_linux_sources,
".", "//chrome")
if (use_aura) {
configs += [
"//build/config/linux:dbus",
"//build/config/linux:fontconfig",
]
deps += [
"//dbus",
]
}
if (use_x11) {
configs += [ "//build/config/linux:x11" ]
deps += [ "//ui/gfx/x" ]
}
}
if (is_desktop_linux) {
sources += rebase_path(gypi_values.chrome_browser_desktop_linux_sources,
".", "//chrome")
}
if (enable_plugin_installation) {
sources += rebase_path(
gypi_values.chrome_browser_plugin_installation_sources,
".", "//chrome")
}
if (enable_app_list) {
deps += [
#"../ui/app_list/app_list.gyp:app_list", TODO(GYP)
]
}
if (enable_managed_users) {
sources += rebase_path(
gypi_values.chrome_browser_supervised_user_sources,
".", "//chrome")
}
if (enable_webrtc) {
sources += rebase_path(
gypi_values.chrome_browser_webrtc_sources,
".", "//chrome")
}
if (enable_service_discovery) {
sources += rebase_path(
gypi_values.chrome_browser_service_discovery_sources,
".", "//chrome")
}
if (enable_mdns) {
sources += rebase_path(
gypi_values.chrome_browser_mdns_sources,
".", "//chrome")
}
if (!enable_autofill_dialog || is_android || is_ios) {
sources -= [
"autofill/validation_rules_storage_factory.cc",
"autofill/validation_rules_storage_factory.h",
]
}
if (enable_wifi_bootstrapping) {
sources += rebase_path(
gypi_values.chrome_browser_wifi_bootstrapping_sources,
".", "//chrome")
if (is_win || is_mac) {
# TODO(brettw) as of this writing wifi bootstrapping is set on Windows
# and Mac, so this test is meaningless. Can we merge these lists?
sources += rebase_path(
gypi_values.chrome_browser_win_mac_wifi_bootstrapping_sources,
".", "//chrome")
}
}
}
# GYP version: chrome/chrome_resources.gyp:chrome_resources
# (generate_browser_resources action)
grit("resources") {
source = "browser_resources.grd"
output_dir = "$root_gen_dir/chrome"
outputs = [
"grit/browser_resources.h",
"browser_resources.pak",
]
omnibox_mojom_file = "$root_gen_dir/chrome/browser/ui/webui/omnibox/omnibox.mojom.js"
grit_flags = [
"-E", "about_credits_file=" +
rebase_path(about_credits_file, root_build_dir),
"-E", "additional_modules_list_file=" +
rebase_path(additional_modules_list_file, root_build_dir),
"-E", "omnibox_mojom_file=" +
rebase_path(omnibox_mojom_file, root_build_dir),
]
deps = [
":about_credits",
":chrome_internal_resources_gen",
"//chrome/browser/ui/webui/omnibox:mojo_bindings",
]
}
# GYP version: chrome/chrome_resource.gyp:about_credits
action("about_credits") {
script = "//tools/licenses.py"
# TODO(phajdan.jr): input dependencies so this can be regenerated
# automatically when one of the credits changes. The way this should work is
# that licenses.py should write a .d file listing the input dependencies (see
# "depfile" in GN).
outputs = [ about_credits_file ]
args = [
"credits",
rebase_path(about_credits_file, root_build_dir),
]
}
# GYP version: chrome/chrome_resource.gyp:chrome_internal_resources_gen
# TODO(GYP) write internal action
if (false) { #if (is_chrome_branded) {
action("chrome_internal_resources_gen") {
# TODO(GYP)
}
} else {
group("chrome_internal_resources_gen") {
# Empty placeholder.
}
}