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_ciohos_shared_library("appspawn_common") { 1869570cc8Sopenharmony_ci sources = [ 1969570cc8Sopenharmony_ci "appspawn_adapter.cpp", 2069570cc8Sopenharmony_ci "appspawn_cgroup.c", 2169570cc8Sopenharmony_ci "appspawn_common.c", 2269570cc8Sopenharmony_ci "appspawn_namespace.c", 2369570cc8Sopenharmony_ci "appspawn_silk.c", 2469570cc8Sopenharmony_ci ] 2569570cc8Sopenharmony_ci if (is_debug || build_variant == "root") { 2669570cc8Sopenharmony_ci sources += [ "appspawn_begetctl.c" ] 2769570cc8Sopenharmony_ci } 2869570cc8Sopenharmony_ci 2969570cc8Sopenharmony_ci include_dirs = [ 3069570cc8Sopenharmony_ci ".", 3169570cc8Sopenharmony_ci "${appspawn_path}/common", 3269570cc8Sopenharmony_ci "${appspawn_path}/standard", 3369570cc8Sopenharmony_ci ] 3469570cc8Sopenharmony_ci cflags = [] 3569570cc8Sopenharmony_ci deps = [ 3669570cc8Sopenharmony_ci "${appspawn_path}/modules/module_engine:libappspawn_module_engine", 3769570cc8Sopenharmony_ci "${appspawn_path}/util:libappspawn_util", 3869570cc8Sopenharmony_ci ] 3969570cc8Sopenharmony_ci defines = [ "GRAPHIC_PERMISSION_CHECK" ] 4069570cc8Sopenharmony_ci external_deps = [ 4169570cc8Sopenharmony_ci "access_token:libtokenid_sdk", 4269570cc8Sopenharmony_ci "access_token:libtokensetproc_shared", 4369570cc8Sopenharmony_ci "cJSON:cjson", 4469570cc8Sopenharmony_ci "c_utils:utils", 4569570cc8Sopenharmony_ci "config_policy:configpolicy_util", 4669570cc8Sopenharmony_ci "hilog:libhilog", 4769570cc8Sopenharmony_ci "init:libbegetutil", 4869570cc8Sopenharmony_ci "netmanager_base:netsys_client", 4969570cc8Sopenharmony_ci ] 5069570cc8Sopenharmony_ci if (build_selinux) { 5169570cc8Sopenharmony_ci defines += [ "WITH_SELINUX" ] 5269570cc8Sopenharmony_ci external_deps += [ 5369570cc8Sopenharmony_ci "selinux:libselinux", 5469570cc8Sopenharmony_ci "selinux_adapter:libhap_restorecon", 5569570cc8Sopenharmony_ci ] 5669570cc8Sopenharmony_ci } 5769570cc8Sopenharmony_ci if (build_seccomp) { 5869570cc8Sopenharmony_ci defines += [ "WITH_SECCOMP" ] 5969570cc8Sopenharmony_ci if (appspawn_seccomp_privilege) { 6069570cc8Sopenharmony_ci cflags += [ "-DSECCOMP_PRIVILEGE" ] 6169570cc8Sopenharmony_ci } 6269570cc8Sopenharmony_ci external_deps += [ "init:seccomp" ] 6369570cc8Sopenharmony_ci } 6469570cc8Sopenharmony_ci 6569570cc8Sopenharmony_ci if (!defined(global_parts_info) || 6669570cc8Sopenharmony_ci defined(global_parts_info.security_security_component_manager)) { 6769570cc8Sopenharmony_ci defines += [ "SECURITY_COMPONENT_ENABLE" ] 6869570cc8Sopenharmony_ci external_deps += [ "security_component_manager:libsecurity_component_sdk" ] 6969570cc8Sopenharmony_ci } 7069570cc8Sopenharmony_ci 7169570cc8Sopenharmony_ci if (!defined(global_parts_info) || 7269570cc8Sopenharmony_ci defined(global_parts_info.security_code_signature)) { 7369570cc8Sopenharmony_ci defines += [ "CODE_SIGNATURE_ENABLE" ] 7469570cc8Sopenharmony_ci external_deps += [ "code_signature:libcode_sign_attr_utils" ] 7569570cc8Sopenharmony_ci } 7669570cc8Sopenharmony_ci 7769570cc8Sopenharmony_ci if (defined(appspawn_sandbox_new) && appspawn_sandbox_new) { 7869570cc8Sopenharmony_ci defines += [ "APPSPAWN_SANDBOX_NEW" ] 7969570cc8Sopenharmony_ci } 8069570cc8Sopenharmony_ci 8169570cc8Sopenharmony_ci subsystem_name = "${subsystem_name}" 8269570cc8Sopenharmony_ci part_name = "${part_name}" 8369570cc8Sopenharmony_ci install_enable = true 8469570cc8Sopenharmony_ci if (target_cpu == "arm64" || target_cpu == "x86_64" || 8569570cc8Sopenharmony_ci target_cpu == "riscv64") { 8669570cc8Sopenharmony_ci module_install_dir = "lib64/appspawn/common" 8769570cc8Sopenharmony_ci } else { 8869570cc8Sopenharmony_ci module_install_dir = "lib/appspawn/common" 8969570cc8Sopenharmony_ci } 9069570cc8Sopenharmony_ci} 91