1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 import("//build/config/chrome_build.gni")
6 import("//build/config/features.gni")
7 import("//chrome/version.gni") # TODO layering violation
8 import("//media/cdm/ppapi/cdm_adapter.gni")
9 import("//third_party/widevine/cdm/widevine.gni")
11 widevine_arch = current_cpu
12 if (widevine_arch == "x86") {
13 widevine_arch = "ia32"
17 # Always available on Android regardless of branding.
18 widevine_cdm_version_h_file = "android/widevine_cdm_version.h"
19 widevine_cdm_binary_files = []
20 } else if (is_chrome_branded) {
22 widevine_cdm_version_h_file =
23 "chromeos/$widevine_arch/widevine_cdm_version.h"
24 widevine_cdm_binary_files = [ "chromeos/$widevine_arch/libwidevinecdm.so" ]
25 } else if (is_linux) {
26 widevine_cdm_version_h_file = "linux/$widevine_arch/widevine_cdm_version.h"
27 widevine_cdm_binary_files = [ "linux/$widevine_arch/libwidevinecdm.so" ]
29 widevine_cdm_version_h_file = "win/$widevine_arch/widevine_cdm_version.h"
30 widevine_cdm_binary_files = [
31 "win/$widevine_arch/widevinecdm.dll",
32 "win/$widevine_arch/widevinecdm.dll.lib",
35 widevine_cdm_version_h_file = "mac/$widevine_arch/widevine_cdm_version.h"
36 widevine_cdm_binary_files = [ "mac/$widevine_arch/libwidevinecdm.dylib" ]
38 # Other platforms, use the default one.
39 widevine_cdm_version_h_file = "widevine_cdm_version.h"
40 widevine_cdm_binary_files = []
42 } else if (enable_widevine) {
43 widevine_cdm_version_h_file = "stub/widevine_cdm_version.h"
44 widevine_cdm_binary_files = []
46 # No branding, use the default one.
47 widevine_cdm_version_h_file = "widevine_cdm_version.h"
48 widevine_cdm_binary_files = []
51 # GYP version: third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h
54 widevine_cdm_version_h_file,
57 # TODO(brettw) this should go into target_out_dir and callers should include
58 # it from there. This requires, however, renaming the default
59 # widevine_cdm_version.h in this directory to avoid conflicts.
61 "$root_gen_dir/widevine_cdm_version.h",
65 # GYP version: third_party/widevine/cdm/widevine_cdm.gyp:widevinecdm
66 if (widevine_cdm_binary_files != []) {
68 sources = widevine_cdm_binary_files
70 "$root_out_dir/{{source_file_part}}",
74 # 'COPY_PHASE_STRIP': 'NO',
76 } else if (enable_widevine && enable_pepper_cdms) {
77 assert(!is_chrome_branded, "Branded Chrome should have binary files to copy.")
78 assert(!is_android, "Android should not have enable_pepper_cdms.")
79 shared_library("widevinecdm") {
81 "//media/cdm/stub/stub_cdm.cc",
82 "//media/cdm/stub/stub_cdm.h",
85 defines = [ "CDM_IMPLEMENTATION" ]
94 # Not to strip important symbols by -Wl,-dead_strip.
95 "-Wl,-exported_symbol,_PPP_GetInterface",
96 "-Wl,-exported_symbol,_PPP_InitializeModule",
97 "-Wl,-exported_symbol,_PPP_ShutdownModule",
99 #TODO(jrummell) Mac: 'DYLIB_INSTALL_NAME_BASE': '@loader_path',
100 } else if (is_posix && !is_mac) {
101 cflags = [ "-fvisibility=hidden" ]
102 # Note GYP sets rpath but this is set by default on shared libraries in
107 group("widevinecdm") {
112 if ((is_chrome_branded || enable_widevine) && enable_pepper_cdms) {
113 # Produce and compile the .rc file.
114 process_version("widevinecdmadapter_resources") {
115 visibility = [ ":*" ]
118 "widevinecdmadapter.ver",
120 output = "$target_gen_dir/widevinecdmadapter_version.rc"
123 cdm_adapter("widevinecdmadapter") {
125 ":widevinecdmadapter_resources",
133 [ rebase_path("$root_out_dir/libwidevinecdm.so", root_build_dir) ]
137 [ rebase_path("$root_out_dir/widevinecdm.dll.lib", root_build_dir) ]
140 [ rebase_path("$root_out_dir/libwidevinecdm.dylib", root_build_dir) ]
144 # Placeholder when we're not compiling the adapter.
145 group("widevinecdmadapter") {
149 # This target exists for tests to depend on that pulls in a runtime dependency
150 # on the license server.
151 source_set("widevine_test_license_server") {
152 if (is_chrome_branded && is_linux) {
155 # This target should be removed and targets should have datadeps on this target:
156 #"//third_party/widevine/test/license_server/license_server.gyp:test_license_server"