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_cfgvar.c", 24 "sandbox_expand.c", 25 "sandbox_load.c", 26 "sandbox_manager.c", 27 ] 28 29 include_dirs = [ 30 ".", 31 "${appspawn_path}/common", 32 "${appspawn_path}/standard", 33 ] 34 35 configs = [ "${appspawn_path}:appspawn_config" ] 36 37 defines = [ "APPSPAWN_SANDBOX_NEW" ] 38 deps = [ 39 "${appspawn_path}/modules/module_engine:libappspawn_module_engine", 40 "${appspawn_path}/util:libappspawn_util", 41 ] 42 external_deps = [ 43 "cJSON:cjson", 44 "c_utils:utils", 45 "hilog:libhilog", 46 "init:libbegetutil", 47 ] 48 if (build_selinux) { 49 defines += [ "WITH_SELINUX" ] 50 external_deps += [ "selinux_adapter:libhap_restorecon" ] 51 } 52 53 subsystem_name = "${subsystem_name}" 54 part_name = "${part_name}" 55 install_enable = true 56 if (target_cpu == "arm64" || target_cpu == "x86_64" || 57 target_cpu == "riscv64") { 58 defines += [ "APPSPAWN_64" ] 59 module_install_dir = "lib64/appspawn/common" 60 } else { 61 module_install_dir = "lib/appspawn/common" 62 } 63 64 if (dlp_permission_enable) { 65 cflags_cc = [ "-DWITH_DLP" ] 66 external_deps += [ "dlp_permission_service:libdlp_fuse" ] 67 } 68 } 69} else { 70 ohos_shared_library("appspawn_sandbox") { 71 sources = [ 72 "${appspawn_innerkits_path}/permission/appspawn_mount_permission.c", 73 "${appspawn_path}/common/appspawn_trace.cpp", 74 "appspawn_permission.c", 75 "sandbox_shared_mount.cpp", 76 "sandbox_utils.cpp", 77 ] 78 79 include_dirs = [ 80 ".", 81 "${appspawn_path}/common", 82 "${appspawn_path}/standard", 83 "${appspawn_innerkits_path}/client", 84 "${appspawn_innerkits_path}/permission", 85 ] 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 "hitrace:hitrace_meter", 100 "init:libbegetutil", 101 ] 102 if (build_selinux) { 103 defines += [ "WITH_SELINUX" ] 104 external_deps += [ "selinux_adapter:libhap_restorecon" ] 105 } 106 if (appspawn_report_event) { 107 defines += [ "APPSPAWN_HISYSEVENT" ] 108 external_deps += [ "hisysevent:libhisysevent" ] 109 include_dirs += [ "${appspawn_path}/modules/sysevent" ] 110 sources += [ "${appspawn_path}/modules/sysevent/hisysevent_adapter.cpp" ] 111 } 112 113 subsystem_name = "${subsystem_name}" 114 part_name = "${part_name}" 115 install_enable = true 116 if (target_cpu == "arm64" || target_cpu == "x86_64" || 117 target_cpu == "riscv64") { 118 defines += [ "APPSPAWN_64" ] 119 module_install_dir = "lib64/appspawn/common" 120 } else { 121 module_install_dir = "lib/appspawn/common" 122 } 123 124 if (dlp_permission_enable) { 125 cflags_cc = [ "-DWITH_DLP" ] 126 external_deps += [ "dlp_permission_service:libdlp_fuse" ] 127 } 128 } 129} 130