• 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("//base/startup/appspawn/modules/sandbox/sandbox.gni")
16import("//build/ohos.gni")
17
18if (defined(appspawn_sandbox_new) && appspawn_sandbox_new) {
19  ohos_shared_library("appspawn_sandbox") {
20    sources += appspawn_sandbox_src
21
22    include_dirs = [
23      ".",
24      "${appspawn_path}/common",
25      "${appspawn_path}/standard",
26    ]
27
28    include_dirs += appspawn_sandbox_inc
29
30    configs = [ "${appspawn_path}:appspawn_config" ]
31
32    defines = [ "APPSPAWN_SANDBOX_NEW" ]
33    deps = [
34      "${appspawn_path}/modules/module_engine:libappspawn_module_engine",
35      "${appspawn_path}/util:libappspawn_util",
36    ]
37    external_deps = [
38      "cJSON:cjson",
39      "c_utils:utils",
40      "hilog:libhilog",
41      "init:libbegetutil",
42    ]
43    if (build_selinux) {
44      defines += [ "WITH_SELINUX" ]
45      external_deps += [ "selinux_adapter:libhap_restorecon" ]
46    }
47    if (appspawn_mount_tmpshm) {
48      defines += [ "APPSPAWN_MOUNT_TMPSHM" ]
49      if (build_selinux) {
50        external_deps += [ "selinux_adapter:librestorecon" ]
51      }
52    }
53
54    subsystem_name = "${subsystem_name}"
55    part_name = "${part_name}"
56    install_enable = true
57    if (target_cpu == "arm64" || target_cpu == "x86_64" ||
58        target_cpu == "riscv64") {
59      defines += [ "APPSPAWN_64" ]
60      module_install_dir = "lib64/appspawn/common"
61    } else {
62      module_install_dir = "lib/appspawn/common"
63    }
64
65    if (dlp_permission_enable) {
66      cflags = [ "-DWITH_DLP" ]
67      external_deps += [ "dlp_permission_service:libdlp_fuse" ]
68    }
69  }
70} else {
71  ohos_shared_library("appspawn_sandbox") {
72    sources = [
73      "${appspawn_innerkits_path}/permission/appspawn_mount_permission.c",
74      "${appspawn_path}/common/appspawn_trace.cpp",
75    ]
76    sources += appspawn_sandbox_src
77
78    include_dirs = [
79      ".",
80      "${appspawn_path}/common",
81      "${appspawn_path}/standard",
82      "${appspawn_innerkits_path}/client",
83      "${appspawn_innerkits_path}/permission",
84    ]
85    include_dirs += appspawn_sandbox_inc
86
87    configs = [ "${appspawn_path}:appspawn_config" ]
88
89    defines = [ "APPSPAWN_CLIENT" ]
90    deps = [
91      "${appspawn_path}/modules/module_engine:libappspawn_module_engine",
92      "${appspawn_path}/util:libappspawn_util",
93    ]
94    external_deps = [
95      "cJSON:cjson",
96      "c_utils:utils",
97      "config_policy:configpolicy_util",
98      "hilog:libhilog",
99      "init:libbegetutil",
100    ]
101    if (!defined(ohos_lite)) {
102      external_deps += [ "hitrace:hitrace_meter" ]
103    }
104    if (build_selinux) {
105      defines += [ "WITH_SELINUX" ]
106      external_deps += [ "selinux_adapter:libhap_restorecon" ]
107    }
108    if (appspawn_mount_tmpshm) {
109      defines += [ "APPSPAWN_MOUNT_TMPSHM" ]
110      if (build_selinux) {
111        external_deps += [ "selinux_adapter:librestorecon" ]
112      }
113    }
114    if (appspawn_report_event) {
115      defines += [ "APPSPAWN_HISYSEVENT" ]
116      external_deps += [ "hisysevent:libhisysevent" ]
117      include_dirs += [ "${appspawn_path}/modules/sysevent" ]
118      sources += [ "${appspawn_path}/modules/sysevent/hisysevent_adapter.cpp" ]
119    }
120
121    if (appspawn_support_nosharefs) {
122      defines += [ "APPSPAWN_SUPPORT_NOSHAREFS" ]
123    }
124
125    subsystem_name = "${subsystem_name}"
126    part_name = "${part_name}"
127    install_enable = true
128    if (target_cpu == "arm64" || target_cpu == "x86_64" ||
129        target_cpu == "riscv64") {
130      defines += [ "APPSPAWN_64" ]
131      module_install_dir = "lib64/appspawn/common"
132    } else {
133      module_install_dir = "lib/appspawn/common"
134    }
135
136    if (dlp_permission_enable) {
137      cflags_cc = [ "-DWITH_DLP" ]
138      external_deps += [ "dlp_permission_service:libdlp_fuse" ]
139    }
140  }
141}
142