• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 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.
13
14import("//base/startup/appspawn/appspawn.gni")
15import("//build/ohos.gni")
16
17ohos_shared_library("appspawn_common") {
18  sources = [
19    "appspawn_adapter.cpp",
20    "appspawn_cgroup.c",
21    "appspawn_common.c",
22    "appspawn_namespace.c",
23    "appspawn_silk.c",
24  ]
25  if (appspawn_use_encaps == true) {
26    sources += [ "appspawn_encaps.c" ]
27  }
28  if (is_debug || build_variant == "root") {
29    sources += [ "appspawn_begetctl.c" ]
30  }
31
32  include_dirs = [
33    ".",
34    "${appspawn_path}/common",
35    "${appspawn_path}/standard",
36  ]
37  cflags = []
38  deps = [
39    "${appspawn_path}/modules/module_engine:libappspawn_module_engine",
40    "${appspawn_path}/util:libappspawn_util",
41  ]
42  defines = [ "GRAPHIC_PERMISSION_CHECK" ]
43  external_deps = [
44    "access_token:libtokenid_sdk",
45    "access_token:libtokensetproc_shared",
46    "cJSON:cjson",
47    "c_utils:utils",
48    "config_policy:configpolicy_util",
49    "hilog:libhilog",
50    "init:libbegetutil",
51    "netmanager_base:netsys_client",
52  ]
53  if (build_selinux) {
54    defines += [ "WITH_SELINUX" ]
55    external_deps += [
56      "selinux:libselinux",
57      "selinux_adapter:libhap_restorecon",
58    ]
59  }
60  if (build_seccomp) {
61    defines += [ "WITH_SECCOMP" ]
62    external_deps += [ "init:seccomp" ]
63  }
64
65  if (!defined(global_parts_info) ||
66      defined(global_parts_info.security_security_component_manager)) {
67    defines += [ "SECURITY_COMPONENT_ENABLE" ]
68    external_deps += [ "security_component_manager:libsecurity_component_sdk" ]
69  }
70
71  if (!defined(global_parts_info) ||
72      defined(global_parts_info.security_code_signature)) {
73    defines += [ "CODE_SIGNATURE_ENABLE" ]
74    external_deps += [ "code_signature:libcode_sign_attr_utils" ]
75  }
76
77  if (defined(appspawn_sandbox_new) && appspawn_sandbox_new) {
78    defines += [ "APPSPAWN_SANDBOX_NEW" ]
79  }
80
81  if (appspawn_report_event) {
82    defines += [ "APPSPAWN_HISYSEVENT" ]
83    external_deps += [ "hisysevent:libhisysevent" ]
84    include_dirs += [ "${appspawn_path}/modules/sysevent" ]
85    sources += [ "${appspawn_path}/modules/sysevent/hisysevent_adapter.cpp" ]
86  }
87
88  subsystem_name = "${subsystem_name}"
89  part_name = "${part_name}"
90  install_enable = true
91  if (target_cpu == "arm64" || target_cpu == "x86_64" ||
92      target_cpu == "riscv64") {
93    module_install_dir = "lib64/appspawn/common"
94  } else {
95    module_install_dir = "lib/appspawn/common"
96  }
97}
98