| # 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/buildflag_header.gni") |
| 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") |
| |
| buildflag_header("buildflags") { |
| header = "buildflags.h" |
| |
| flags = [ |
| "ENABLE_WIDEVINE=$enable_widevine", |
| "BUNDLE_WIDEVINE_CDM=$bundle_widevine_cdm", |
| "ENABLE_WIDEVINE_CDM_COMPONENT=$enable_widevine_cdm_component", |
| ] |
| } |
| |
| widevine_arch = current_cpu |
| if (widevine_arch == "x86") { |
| widevine_arch = "ia32" |
| } |
| |
| widevine_cdm_binary_files = [] |
| widevine_cdm_manifest_and_license_files = [] |
| |
| # TODO(xhwang): widevine_cdm_version.h is only used in few places. Clean this up |
| # so we don't need to copy it in most cases. |
| if (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" ] |
| widevine_cdm_manifest_and_license_files = [ |
| "linux/$widevine_arch/manifest.json", |
| "../LICENSE", |
| ] |
| } 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" ] |
| widevine_cdm_manifest_and_license_files = [ |
| "win/$widevine_arch/manifest.json", |
| "../LICENSE", |
| ] |
| } 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_and_license_files = [ |
| "mac/$widevine_arch/manifest.json", |
| "../LICENSE", |
| ] |
| } else { |
| assert(false, "Platform not supported to bundle Widevine CDM.") |
| } |
| } else { |
| # No branding, use the default one. |
| widevine_cdm_version_h_file = "widevine_cdm_version.h" |
| } |
| |
| if (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. |
| "//base", |
| "//media:media_buildflags", |
| ] |
| } |
| |
| if (widevine_cdm_manifest_and_license_files != []) { |
| copy("widevine_cdm_manifest_and_license") { |
| sources = widevine_cdm_manifest_and_license_files |
| outputs = [ |
| "$root_out_dir/WidevineCdm/{{source_file_part}}", |
| ] |
| } |
| } else { |
| group("widevine_cdm_manifest_and_license") { |
| # 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_and_license", |
| ] |
| |
| # Needed at build time e.g. for mac bundle (//chrome:chrome_framework). |
| public_deps = [ |
| ":widevine_cdm_binary", |
| ":widevine_cdm_manifest_and_license", |
| ] |
| } |
| |
| # This target exists for tests to depend on that pulls in a runtime dependency |
| # on the license server. |
| group("widevine_test_license_server") { |
| if (bundle_widevine_cdm && is_linux) { |
| data = [ |
| "//third_party/widevine/test/license_server/", |
| ] |
| } |
| } |