Update V8 to version 4.7.52.
[chromium-blink-merge.git] / third_party / widevine / cdm / BUILD.gn
blob8a540f0ea2de03e7e198d42397595342c261e595
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"
16 if (is_android) {
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) {
21   if (is_chromeos) {
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" ]
28   } else if (is_win) {
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",
33     ]
34   } else if (is_mac) {
35     widevine_cdm_version_h_file = "mac/$widevine_arch/widevine_cdm_version.h"
36     widevine_cdm_binary_files = [ "mac/$widevine_arch/libwidevinecdm.dylib" ]
37   } else {
38     # Other platforms, use the default one.
39     widevine_cdm_version_h_file = "widevine_cdm_version.h"
40     widevine_cdm_binary_files = []
41   }
42 } else if (enable_widevine) {
43   widevine_cdm_version_h_file = "stub/widevine_cdm_version.h"
44   widevine_cdm_binary_files = []
45 } else {
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
52 copy("version_h") {
53   sources = [
54     widevine_cdm_version_h_file,
55   ]
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.
60   outputs = [
61     "$root_gen_dir/widevine_cdm_version.h",
62   ]
65 # GYP version: third_party/widevine/cdm/widevine_cdm.gyp:widevinecdm
66 if (widevine_cdm_binary_files != []) {
67   copy("widevinecdm") {
68     sources = widevine_cdm_binary_files
69     outputs = [
70       "$root_out_dir/{{source_file_part}}",
71     ]
73     # TODO(jrummell)
74     # 'COPY_PHASE_STRIP': 'NO',
75   }
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") {
80     sources = [
81       "//media/cdm/stub/stub_cdm.cc",
82       "//media/cdm/stub/stub_cdm.h",
83     ]
85     defines = [ "CDM_IMPLEMENTATION" ]
87     deps = [
88       ":version_h",
89       "//base",
90       "//build/config/sanitizers:deps",
91     ]
93     if (is_mac) {
94       ldflags = [
95         # Not to strip important symbols by -Wl,-dead_strip.
96         "-Wl,-exported_symbol,_PPP_GetInterface",
97         "-Wl,-exported_symbol,_PPP_InitializeModule",
98         "-Wl,-exported_symbol,_PPP_ShutdownModule",
99       ]
100       #TODO(jrummell) Mac: 'DYLIB_INSTALL_NAME_BASE': '@loader_path',
101     } else if (is_posix && !is_mac) {
102       cflags = [ "-fvisibility=hidden" ]
103       # Note GYP sets rpath but this is set by default on shared libraries in
104       # the GN build.
105     }
106   }
107 } else {
108   group("widevinecdm") {
109     # NOP
110   }
113 if ((is_chrome_branded || enable_widevine) && enable_pepper_cdms) {
114   # Produce and compile the .rc file.
115   process_version("widevinecdmadapter_resources") {
116     visibility = [ ":*" ]
117     template_file = chrome_version_rc_template
118     sources = [
119       "BRANDING",
120       "widevinecdmadapter.ver",
121     ]
122     output = "$target_gen_dir/widevinecdmadapter_version.rc"
123   }
125   cdm_adapter("widevinecdmadapter") {
126     deps = [
127       ":widevinecdmadapter_resources",
128       ":widevinecdm",
129       ":version_h",
130       "//ppapi/cpp",
131     ]
133     if (is_linux) {
134       ldflags =
135           [ rebase_path("$root_out_dir/libwidevinecdm.so", root_build_dir) ]
136       libs = [ "rt" ]
137     } else if (is_win) {
138       ldflags =
139           [ rebase_path("$root_out_dir/widevinecdm.dll.lib", root_build_dir) ]
140     } else if (is_mac) {
141       ldflags =
142           [ rebase_path("$root_out_dir/libwidevinecdm.dylib", root_build_dir) ]
143     }
144   }
145 } else {
146   # Placeholder when we're not compiling the adapter.
147   group("widevinecdmadapter") {
148   }
151 # This target exists for tests to depend on that pulls in a runtime dependency
152 # on the license server.
153 source_set("widevine_test_license_server") {
154   if (is_chrome_branded && is_linux) {
155     deps = [
156       # TODO(jrummell)
157       # This target should be removed and targets should have data_deps on this target:
158       #"//third_party/widevine/test/license_server/license_server.gyp:test_license_server"
159     ]
160   }