naiveproxy/third_party/widevine/cdm/BUILD.gn
2018-08-14 22:19:20 +00:00

147 lines
4.5 KiB
Plaintext

# 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/chrome_build.gni")
import("//build/config/features.gni")
import("//media/cdm/library_cdm/cdm_paths.gni")
import("//media/media_options.gni")
import("//third_party/widevine/cdm/widevine.gni")
# Internal Cast builds set enable_widevine=true to bring in Widevine support.
# TODO(xhwang): Support component updated CDM on other platforms and remove this
# assert.
assert(!enable_widevine || is_win || is_mac || is_chromecast,
"Component updated CDM only supported on Windows and Mac for now.")
widevine_arch = current_cpu
if (widevine_arch == "x86") {
widevine_arch = "ia32"
}
widevine_cdm_binary_files = []
widevine_cdm_manifest_file = []
if (should_bundle_widevine_cdm) {
if (is_chromeos) {
widevine_cdm_version_h_file =
"chromeos/$widevine_arch/widevine_cdm_version.h"
widevine_cdm_binary_files = [ "chromeos/$widevine_arch/libwidevinecdm.so" ]
} else if (is_desktop_linux) {
widevine_cdm_version_h_file = "linux/$widevine_arch/widevine_cdm_version.h"
widevine_cdm_binary_files = [ "linux/$widevine_arch/libwidevinecdm.so" ]
} else if (is_win) {
widevine_cdm_version_h_file = "win/$widevine_arch/widevine_cdm_version.h"
widevine_cdm_binary_files = [
"win/$widevine_arch/widevinecdm.dll",
"win/$widevine_arch/widevinecdm.dll.lib",
]
widevine_cdm_manifest_file = [ "win/$widevine_arch/manifest.json" ]
} else if (is_mac) {
widevine_cdm_version_h_file = "mac/$widevine_arch/widevine_cdm_version.h"
widevine_cdm_binary_files = [ "mac/$widevine_arch/libwidevinecdm.dylib" ]
widevine_cdm_manifest_file = [ "mac/$widevine_arch/manifest.json" ]
} else {
assert(false, "Platform not supported to bundle Widevine CDM.")
}
} else if (is_android) {
# Always available on Android regardless of branding.
widevine_cdm_version_h_file = "android/widevine_cdm_version.h"
} else if (enable_widevine) {
# TODO(crbug.com/349182): Remove after we replace WIDEVINE_CDM_AVAILABLE with
# ENABLE_WIDEVINE build flag.
widevine_cdm_version_h_file = "stub/widevine_cdm_version.h"
} else {
# No branding, use the default one.
widevine_cdm_version_h_file = "widevine_cdm_version.h"
}
if (should_bundle_widevine_cdm && enable_widevine_cdm_host_verification) {
if (is_win) {
widevine_cdm_binary_files += [ "win/$widevine_arch/widevinecdm.dll.sig" ]
} else if (is_mac) {
widevine_cdm_binary_files +=
[ "mac/$widevine_arch/libwidevinecdm.dylib.sig" ]
}
}
copy("version_h") {
visibility = [ ":*" ] # Depend on ":headers" instead.
sources = [
widevine_cdm_version_h_file,
]
# TODO(brettw) this should go into target_out_dir and callers should include
# it from there. This requires, however, renaming the default
# widevine_cdm_version.h in this directory to avoid conflicts.
outputs = [
"$root_gen_dir/widevine_cdm_version.h",
]
}
source_set("headers") {
public = [
"widevine_cdm_common.h",
]
public_deps = [
":version_h", # Forward permission to use version header.
"//media:media_buildflags",
]
}
if (widevine_cdm_manifest_file != []) {
copy("widevine_cdm_manifest") {
sources = widevine_cdm_manifest_file
outputs = [
"$root_out_dir/WidevineCdm/{{source_file_part}}",
]
}
} else {
group("widevine_cdm_manifest") {
# NOP
}
}
if (widevine_cdm_binary_files != []) {
copy("widevine_cdm_binary") {
sources = widevine_cdm_binary_files
outputs = [
"$root_out_dir/$widevine_cdm_path/{{source_file_part}}",
]
# TODO(jrummell)
# 'COPY_PHASE_STRIP': 'NO',
}
} else {
group("widevine_cdm_binary") {
# NOP
}
}
group("cdm") {
# Needed at run time by tests, e.g. swarming tests to generate isolate.
# See https://crbug.com/824493 for context.
data_deps = [
":widevine_cdm_binary",
":widevine_cdm_manifest",
]
# Needed at build time e.g. for mac bundle (//chrome:chrome_framework).
public_deps = [
":widevine_cdm_binary",
":widevine_cdm_manifest",
]
}
# This target exists for tests to depend on that pulls in a runtime dependency
# on the license server.
source_set("widevine_test_license_server") {
if (is_chrome_branded && is_linux) {
deps = [
# TODO(jrummell)
# This target should be removed and targets should have data_deps on this target:
#"//third_party/widevine/test/license_server/license_server.gyp:test_license_server"
]
}
}