1# Copyright (c) 2023-2024 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13import("//build/ohos.gni")
14
15ohos_shared_library("drm_service") {
16  stack_protector_ret = true
17  install_enable = true
18
19  include_dirs = [
20    "./client/include",
21    "./server/include",
22    "./server/include/v1_0",
23    "./ipc",
24    "./../../interfaces/inner_api/native",
25    "./../../interfaces/inner_api/native/drm",
26    "./../../interfaces/kits/c/drm_capi/common",
27    "./../utils",
28    "./../utils/include",
29    "//foundation//arkui/napi/interfaces/kits",
30  ]
31
32  sources = [
33    "./../utils/drm_dfx.cpp",
34    "./../utils/drm_dfx_utils.cpp",
35    "./../utils/drm_trace.cpp",
36    "./client/src/drm_listener_proxy.cpp",
37    "./client/src/key_session_service_callback_proxy.cpp",
38    "./client/src/mediakeysystem_service_callback_proxy.cpp",
39    "./server/src/drm_host_manager.cpp",
40    "./server/src/key_session_service.cpp",
41    "./server/src/key_session_service_stub.cpp",
42    "./server/src/media_decrypt_module_service.cpp",
43    "./server/src/media_decrypt_module_service_stub.cpp",
44    "./server/src/mediakeysystem_service.cpp",
45    "./server/src/mediakeysystem_service_stub.cpp",
46    "./server/src/mediakeysystemfactory_service.cpp",
47    "./server/src/mediakeysystemfactory_service_stub.cpp",
48  ]
49  deps = [ ":drm_plugin_lazyloding" ]
50  external_deps = [
51    "ability_base:want",
52    "ability_runtime:abilitykit_native",
53    "ability_runtime:napi_base_context",
54    "bundle_framework:appexecfwk_base",
55    "bundle_framework:appexecfwk_core",
56    "c_utils:utils",
57    "drivers_interface_drm:libdrm_proxy_1.0",
58    "hdf_core:libhdf_host",
59    "hdf_core:libhdf_ipc_adapter",
60    "hdf_core:libhdf_utils",
61    "hdf_core:libhdi",
62    "hicollie:libhicollie",
63    "hidumper:lib_dump_usage",
64    "hilog:libhilog",
65    "hisysevent:libhisysevent",
66    "hitrace:hitrace_meter",
67    "hitrace:libhitracechain",
68    "ipc:ipc_core",
69    "ipc:ipc_single",
70    "memmgr:memmgrclient",
71    "napi:ace_napi",
72    "safwk:system_ability_fwk",
73    "samgr:samgr_proxy",
74  ]
75
76  public_external_deps = [ "json:nlohmann_json_static" ]
77
78  cflags = [
79    "-Wall",
80    "-fPIC",
81    "-fdata-sections",
82    "-ffunction-sections",
83    "-fno-asynchronous-unwind-tables",
84    "-fno-unwind-tables",
85    "-Os",
86  ]
87  if (target_cpu == "arm") {
88    cflags += [ "-DBINDER_IPC_32BIT" ]
89  }
90
91  sanitize = {
92    integer_overflow = true
93    ubsan = true
94    boundary_sanitize = true
95    cfi = true
96    cfi_cross_dso = true
97    cfi_vcall_icall_only = true
98    debug = false
99  }
100
101  if (use_musl) {
102    if (musl_use_jemalloc && musl_use_jemalloc_dfx_intf) {
103      cflags += [ "-DCONFIG_USE_JEMALLOC_DFX_INTF" ]
104    }
105  }
106
107  cflags_cc = cflags
108
109  subsystem_name = "multimedia"
110  part_name = "drm_framework"
111}
112
113ohos_prebuilt_etc("drm_plugin_lazyloding") {
114  source = "../etc/drm_plugin_lazyloding.cfg"
115  relative_install_dir = "drm"
116  part_name = "drm_framework"
117  subsystem_name = "multimedia"
118}
119