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.
4
5widevine_arch = cpu_arch
6if (widevine_arch == "x86") {
7  widevine_arch = "ia32"
8}
9
10if (is_android) {
11  # Always available on Android regardless of branding.
12  widevine_cdm_version_h_file = "android/widevine_cdm_version.h"
13  widevine_cdm_binary_files = []
14} else if (is_chrome_branded) {
15  if (is_chromeos) {
16    widevine_cdm_version_h_file =
17      "chromeos/$widevine_arch/widevine_cdm_version.h"
18    widevine_cdm_binary_files = [
19      "chromeos/$widevine_arch/libwidevinecdm.so",
20    ]
21  } else if (is_linux) {
22    widevine_cdm_version_h_file =
23      "linux/$widevine_arch/widevine_cdm_version.h"
24    widevine_cdm_binary_files = [
25      "linux/$widevine_arch/libwidevinecdm.so",
26    ]
27  } else if (is_win) {
28    widevine_cdm_version_h_file =
29      "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",
33    ]
34  } else if (is_mac) {
35    widevine_cdm_version_h_file =
36      "mac/$widevine_arch/widevine_cdm_version.h"
37    widevine_cdm_binary_files = [
38      "mac/$widevine_arch/libwidevinecdm.dylib",
39    ]
40  } else {
41    # Other platforms, use the default one.
42    widevine_cdm_version_h_file = "widevine_cdm_version.h"
43    widevine_cdm_binary_files = []
44  }
45} else {
46  # No branding, use the default one.
47  widevine_cdm_version_h_file = "widevine_cdm_version.h"
48  widevine_cdm_binary_files = []
49}
50
51# GYP version: third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_version_h
52copy("version_h") {
53  sources = [ widevine_cdm_version_h_file ]
54  # TODO(brettw) this should go into target_out_dir and callers should include
55  # it from there. This requires, however, renaming the default
56  # widevine_cdm_version.h in this directory to avoid conflicts.
57  outputs = [ "$root_gen_dir/widevine_cdm_version.h" ]
58}
59
60# GYP version: third_party/widevine/cdm/widevine_cdm.gyp:widevine_cdm_binaries
61if (widevine_cdm_binary_files == []) {
62  group("binaries") {
63    # NOP
64  }
65} else {
66  copy("binaries") {
67    sources = widevine_cdm_binary_files
68    outputs = [ "$root_out_dir/{{source_file_part}}" ]
69    # TODO(GYP)
70    # 'COPY_PHASE_STRIP': 'NO',
71  }
72}
73
74source_set("adapter") {
75  if (is_chrome_branded) {
76    deps = [
77      ":version_h",
78      ":binaries",
79      "//ppapi:ppapi_cpp",
80      #'<(DEPTH)/media/media_cdm_adapter.gyp:cdmadapter',  TODO(GYP)
81    ]
82  }
83
84  if (is_linux) {
85    libs = [ "$root_out_dir/libwidevinecdm.sp" ]
86  } else if (is_win) {
87    libs = [ "$root_out_dir/widevinecdm.dll.lib" ]
88  } else if (is_mac) {
89    libs = [ "$root_out_dir/libwidevinecdm.dylib" ]
90  }
91}
92
93# This target exists for tests to depend on that pulls in a runtime dependency
94# on the license server.
95source_set("widevine_test_license_server") {
96  if (is_chrome_branded && is_linux) {
97    deps = [
98      # TODO(GYP)
99      #"//third_party/widevine/test/license_server/license_server.gyp:test_license_server"
100    ]
101  }
102}
103