169570cc8Sopenharmony_ci# Copyright (c) 2024 Huawei Device Co., Ltd. 269570cc8Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 369570cc8Sopenharmony_ci# you may not use this file except in compliance with the License. 469570cc8Sopenharmony_ci# You may obtain a copy of the License at 569570cc8Sopenharmony_ci# 669570cc8Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 769570cc8Sopenharmony_ci# 869570cc8Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 969570cc8Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 1069570cc8Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1169570cc8Sopenharmony_ci# See the License for the specific language governing permissions and 1269570cc8Sopenharmony_ci# limitations under the License. 1369570cc8Sopenharmony_ci 1469570cc8Sopenharmony_ciimport("//base/startup/appspawn/appspawn.gni") 1569570cc8Sopenharmony_ciimport("//build/ohos.gni") 1669570cc8Sopenharmony_ci 1769570cc8Sopenharmony_ciif (defined(appspawn_sandbox_new) && appspawn_sandbox_new) { 1869570cc8Sopenharmony_ci ohos_shared_library("appspawn_sandbox") { 1969570cc8Sopenharmony_ci sources = [ 2069570cc8Sopenharmony_ci "appspawn_mount_template.c", 2169570cc8Sopenharmony_ci "appspawn_permission.c", 2269570cc8Sopenharmony_ci "appspawn_sandbox.c", 2369570cc8Sopenharmony_ci "sandbox_adapter.cpp", 2469570cc8Sopenharmony_ci "sandbox_cfgvar.c", 2569570cc8Sopenharmony_ci "sandbox_expand.c", 2669570cc8Sopenharmony_ci "sandbox_load.c", 2769570cc8Sopenharmony_ci "sandbox_manager.c", 2869570cc8Sopenharmony_ci ] 2969570cc8Sopenharmony_ci 3069570cc8Sopenharmony_ci include_dirs = [ 3169570cc8Sopenharmony_ci ".", 3269570cc8Sopenharmony_ci "${appspawn_path}/common", 3369570cc8Sopenharmony_ci "${appspawn_path}/standard", 3469570cc8Sopenharmony_ci ] 3569570cc8Sopenharmony_ci 3669570cc8Sopenharmony_ci configs = [ "${appspawn_path}:appspawn_config" ] 3769570cc8Sopenharmony_ci 3869570cc8Sopenharmony_ci defines = [ "APPSPAWN_SANDBOX_NEW" ] 3969570cc8Sopenharmony_ci deps = [ 4069570cc8Sopenharmony_ci "${appspawn_path}/modules/module_engine:libappspawn_module_engine", 4169570cc8Sopenharmony_ci "${appspawn_path}/util:libappspawn_util", 4269570cc8Sopenharmony_ci ] 4369570cc8Sopenharmony_ci external_deps = [ 4469570cc8Sopenharmony_ci "cJSON:cjson", 4569570cc8Sopenharmony_ci "c_utils:utils", 4669570cc8Sopenharmony_ci "hilog:libhilog", 4769570cc8Sopenharmony_ci "init:libbegetutil", 4869570cc8Sopenharmony_ci ] 4969570cc8Sopenharmony_ci if (build_selinux) { 5069570cc8Sopenharmony_ci defines += [ "WITH_SELINUX" ] 5169570cc8Sopenharmony_ci external_deps += [ "selinux_adapter:libhap_restorecon" ] 5269570cc8Sopenharmony_ci } 5369570cc8Sopenharmony_ci if (appspawn_mount_tmpshm) { 5469570cc8Sopenharmony_ci defines += [ "APPSPAWN_MOUNT_TMPSHM" ] 5569570cc8Sopenharmony_ci if (build_selinux) { 5669570cc8Sopenharmony_ci external_deps += [ "selinux_adapter:librestorecon" ] 5769570cc8Sopenharmony_ci } 5869570cc8Sopenharmony_ci } 5969570cc8Sopenharmony_ci 6069570cc8Sopenharmony_ci subsystem_name = "${subsystem_name}" 6169570cc8Sopenharmony_ci part_name = "${part_name}" 6269570cc8Sopenharmony_ci install_enable = true 6369570cc8Sopenharmony_ci if (target_cpu == "arm64" || target_cpu == "x86_64" || 6469570cc8Sopenharmony_ci target_cpu == "riscv64") { 6569570cc8Sopenharmony_ci defines += [ "APPSPAWN_64" ] 6669570cc8Sopenharmony_ci module_install_dir = "lib64/appspawn/common" 6769570cc8Sopenharmony_ci } else { 6869570cc8Sopenharmony_ci module_install_dir = "lib/appspawn/common" 6969570cc8Sopenharmony_ci } 7069570cc8Sopenharmony_ci 7169570cc8Sopenharmony_ci if (dlp_permission_enable) { 7269570cc8Sopenharmony_ci cflags_cc = [ "-DWITH_DLP" ] 7369570cc8Sopenharmony_ci external_deps += [ "dlp_permission_service:libdlp_fuse" ] 7469570cc8Sopenharmony_ci } 7569570cc8Sopenharmony_ci } 7669570cc8Sopenharmony_ci} else { 7769570cc8Sopenharmony_ci ohos_shared_library("appspawn_sandbox") { 7869570cc8Sopenharmony_ci sources = [ 7969570cc8Sopenharmony_ci "${appspawn_innerkits_path}/permission/appspawn_mount_permission.c", 8069570cc8Sopenharmony_ci "appspawn_permission.c", 8169570cc8Sopenharmony_ci "sandbox_utils.cpp", 8269570cc8Sopenharmony_ci ] 8369570cc8Sopenharmony_ci 8469570cc8Sopenharmony_ci include_dirs = [ 8569570cc8Sopenharmony_ci ".", 8669570cc8Sopenharmony_ci "${appspawn_path}/common", 8769570cc8Sopenharmony_ci "${appspawn_path}/standard", 8869570cc8Sopenharmony_ci "${appspawn_innerkits_path}/client", 8969570cc8Sopenharmony_ci "${appspawn_innerkits_path}/permission", 9069570cc8Sopenharmony_ci ] 9169570cc8Sopenharmony_ci 9269570cc8Sopenharmony_ci configs = [ "${appspawn_path}:appspawn_config" ] 9369570cc8Sopenharmony_ci 9469570cc8Sopenharmony_ci defines = [ "APPSPAWN_CLIENT" ] 9569570cc8Sopenharmony_ci deps = [ 9669570cc8Sopenharmony_ci "${appspawn_path}/modules/module_engine:libappspawn_module_engine", 9769570cc8Sopenharmony_ci "${appspawn_path}/util:libappspawn_util", 9869570cc8Sopenharmony_ci ] 9969570cc8Sopenharmony_ci external_deps = [ 10069570cc8Sopenharmony_ci "cJSON:cjson", 10169570cc8Sopenharmony_ci "c_utils:utils", 10269570cc8Sopenharmony_ci "config_policy:configpolicy_util", 10369570cc8Sopenharmony_ci "hilog:libhilog", 10469570cc8Sopenharmony_ci "init:libbegetutil", 10569570cc8Sopenharmony_ci "json:nlohmann_json_static", 10669570cc8Sopenharmony_ci ] 10769570cc8Sopenharmony_ci if (build_selinux) { 10869570cc8Sopenharmony_ci defines += [ "WITH_SELINUX" ] 10969570cc8Sopenharmony_ci external_deps += [ "selinux_adapter:libhap_restorecon" ] 11069570cc8Sopenharmony_ci } 11169570cc8Sopenharmony_ci if (appspawn_mount_tmpshm) { 11269570cc8Sopenharmony_ci defines += [ "APPSPAWN_MOUNT_TMPSHM" ] 11369570cc8Sopenharmony_ci if (build_selinux) { 11469570cc8Sopenharmony_ci external_deps += [ "selinux_adapter:librestorecon" ] 11569570cc8Sopenharmony_ci } 11669570cc8Sopenharmony_ci } 11769570cc8Sopenharmony_ci 11869570cc8Sopenharmony_ci subsystem_name = "${subsystem_name}" 11969570cc8Sopenharmony_ci part_name = "${part_name}" 12069570cc8Sopenharmony_ci install_enable = true 12169570cc8Sopenharmony_ci if (target_cpu == "arm64" || target_cpu == "x86_64" || 12269570cc8Sopenharmony_ci target_cpu == "riscv64") { 12369570cc8Sopenharmony_ci defines += [ "APPSPAWN_64" ] 12469570cc8Sopenharmony_ci module_install_dir = "lib64/appspawn/common" 12569570cc8Sopenharmony_ci } else { 12669570cc8Sopenharmony_ci module_install_dir = "lib/appspawn/common" 12769570cc8Sopenharmony_ci } 12869570cc8Sopenharmony_ci 12969570cc8Sopenharmony_ci if (dlp_permission_enable) { 13069570cc8Sopenharmony_ci cflags_cc = [ "-DWITH_DLP" ] 13169570cc8Sopenharmony_ci external_deps += [ "dlp_permission_service:libdlp_fuse" ] 13269570cc8Sopenharmony_ci } 13369570cc8Sopenharmony_ci } 13469570cc8Sopenharmony_ci} 135