# Copyright 2015 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/chrome_build.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/chromeos/ui_mode.gni")
import("//media/media_options.gni")
declare_args() {
# Enables Widevine key system support. Enabled by default in Google Chrome,
# Google Chrome for Testing and Android. For Fuchsia, see crbug.com/1354347.
# Can be optionally enabled in Chromium on non-Android platforms. Please see
# //src/third_party/widevine/LICENSE file for details.
enable_widevine = ((is_chrome_branded || is_chrome_for_testing_branded) &&
!is_fuchsia) || is_android
}
# Disable Widevine when running linux-chromeos.
if (is_chromeos && !is_chromeos_device) {
enable_widevine = false
}
# Widevine CDM is available as a library CDM on the following platforms and
# architectures. Notably on Android library CDM is not used and Widevine is
# supported via Android MediaDrm API.
library_widevine_cdm_available =
(is_chromeos &&
(target_cpu == "x64" || target_cpu == "arm" || target_cpu == "arm64")) ||
(target_os == "linux" && target_cpu == "x64") ||
(target_os == "mac" && (target_cpu == "x64" || target_cpu == "arm64")) ||
(target_os == "win" &&
(target_cpu == "x86" || target_cpu == "x64" || target_cpu == "arm64"))
# Widevine CDM is available as a library CDM and it's supported by Chromium.
# This does not define how the CDM will be deployed. It can be bundled or
# component updated. See below.
enable_library_widevine_cdm =
enable_widevine && enable_library_cdms && library_widevine_cdm_available
# Widevine CDM can be deployed as a component. Currently only supported on
# desktop platforms. Not enabled for lacros (as it is changing to use the
# ash updated version). The CDM can be bundled regardless whether it's a
# component. See below.
enable_widevine_cdm_component =
enable_library_widevine_cdm &&
(is_win || is_mac || is_linux || is_chromeos_ash)
# Enable (Windows) Media Foundation Widevine CDM component.
declare_args() {
enable_media_foundation_widevine_cdm =
is_win && enable_widevine && is_chrome_branded
}
assert(!enable_media_foundation_widevine_cdm || is_win)
assert(!enable_media_foundation_widevine_cdm || enable_widevine)
declare_args() {
# Widevine CDM is bundled as part of Google Chrome and
# Google Chrome for Testing builds.
bundle_widevine_cdm = enable_library_widevine_cdm &&
(is_chrome_branded || is_chrome_for_testing_branded)
# Relative root directory to //third_party/widevine/cdm for CDM files.
# Can be overridden if the CDM files are located in other places.
widevine_root = "."
}
# Enable Widevine CDM host verification, which will sign additional binaries
# with Widevine certs and copy signature files as needed.
enable_widevine_cdm_host_verification =
enable_library_widevine_cdm && enable_cdm_host_verification
declare_args() {
# If set, and Widevine CDM host verification signing failed due to no signing
# cert, the failure will be ignored. Otherwise the build process will fail.
# Set to false by default for official build to catch missing cert error.
# For developers building with "is_official_build" locally without Widevine
# signing certs, please manually set `ignore_missing_widevine_signing_cert`
# to true to suppress the error.
ignore_missing_widevine_signing_cert = !is_official_build
}
template("widevine_sign_file") {
# For official builds, generate a signature file for |file| which will
# be used by Widevine. If |signature_file| is not specified, the signature
# file will be in the same directory as |file|.
action(target_name) {
forward_variables_from(invoker,
[
"file",
"signature_file",
"flags",
"deps",
])
assert(defined(file), "File to be signed must be specified.")
if (!defined(signature_file)) {
signature_file = "$file.sig"
}
if (!defined(flags)) {
flags = 0
}
script = "//third_party/widevine/scripts/signature_generator.py"
sources = [ "$file" ]
outputs = [ "$signature_file" ]
args = [
"--input_file",
rebase_path("$file", root_build_dir),
"--output_file",
rebase_path("$signature_file", root_build_dir),
"--flags",
"$flags",
]
if (ignore_missing_widevine_signing_cert) {
args += [ "--ignore_missing_cert" ]
}
}
}