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