Zzhuofan0129feat: improve rom
e5243462创建于 2024年8月5日历史提交
# Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//base/security/device_security_level/common/dslm.gni")
import("//build/ohos.gni")

# sa lib
if (defined(ohos_lite)) {
  group("dslm_service") {
  }
  if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") {
    ohos_static_library("service_sa_static") {
      sources = [ "common/dslm_rpc_process.c" ]

      include_dirs = [
        "common",
        "../dslm",
        "../include",
        "../../common/include",
        "../../interfaces/inner_api/include",
        "../../oem_property/include",
      ]

      deps = [
        "$dslm_hilog_path/featured:hilog_shared",
        "$dslm_lite_component_path/cJSON:cjson_static",
        "$dslm_samgr_path/samgr_lite/samgr:samgr",
        "../../baselib/utils:utils_static",
        "../common:service_common_obj",
        "../dslm:service_dslm_obj",
        "../msg:service_msg_obj",
      ]

      configs = [
        "../../common:common_configs",
        "../../common:common_lite_configs",
      ]

      part_name = "device_security_level"
      subsystem_name = "security"
    }

    ohos_executable("dslm_server") {
      sources = [
        "lite/dslm_service.c",
        "lite/small/dslm_ipc_process.c",
        "lite/small/dslm_service_feature.c",
        "lite/small/dslm_service_main.c",
      ]

      include_dirs = [
        "common",
        "lite/small",
        "../include",
        "../../baselib/utils/include",
        "../../interfaces/inner_api/include",
      ]

      deps = [
        ":service_sa_static",
        "$dslm_hilog_path/featured:hilog_shared",
        "$dslm_ipc_path/interfaces/innerkits/c/ipc:ipc_single",
        "$dslm_lite_component_path/cJSON:cjson_shared",
        "$dslm_samgr_path/samgr_lite/samgr:samgr",
        "../../oem_property/ohos/lite:dslm_ohos_cred_obj",
      ]
    }
  } else if (ohos_kernel_type == "liteos_m") {
    ohos_source_set("service_sa_obj") {
      sources = [ "common/dslm_rpc_process.c" ]

      include_dirs = [
        "common",
        "../dslm",
        "../include",
        "../../common/include",
        "../../interfaces/inner_api/include",
        "../../oem_property/include",
        "../../oem_property/ohos/lite",
      ]

      deps = [
        "$dslm_hilog_path/featured:hilog_static",
        "$dslm_lite_component_path/cJSON:cjson_shared",
        "$dslm_samgr_path/samgr_lite/samgr:samgr",
        "../../baselib/utils:utils_static",
        "../common:service_common_obj",
        "../dslm:service_dslm_obj",
        "../msg:service_msg_obj",
      ]

      configs = [
        "../../common:common_configs",
        "../../common:common_lite_configs",
      ]

      part_name = "device_security_level"
      subsystem_name = "security"
    }

    ohos_static_library("dslm_server") {
      sources = [
        "lite/dslm_service.c",
        "lite/mini/dslm_inner_process.c",
        "lite/mini/dslm_service_feature.c",
      ]

      include_dirs = [
        "common",
        "lite/mini",
        "../include",
        "../../baselib/utils/include",
        "../../interfaces/inner_api/include",
        "../../interfaces/inner_api/src/lite/include",
      ]

      configs = [
        "../../common:common_configs",
        "../../common:common_lite_configs",
      ]

      deps = [
        ":service_sa_obj",
        "$dslm_hilog_path/featured:hilog_static",
        "$dslm_lite_component_path/cJSON:cjson_static",
        "$dslm_samgr_path/samgr_lite/samgr:samgr",
        "../../oem_property/ohos/lite:dslm_ohos_cred_obj",
      ]
    }
  }
} else {
  config("dslm_service_config") {
    include_dirs = [ "../../oem_property/include" ]
  }
  declare_args() {
    device_security_level_feature_plugin_path = ""
  }
  ohos_shared_library("dslm_service") {
    shlib_type = "sa"
    version_script = "dslm.versionscript"

    sanitize = {
      integer_overflow = true
      ubsan = true
      boundary_sanitize = true
      cfi = true
      cfi_cross_dso = true
      blocklist = "../../cfi_blocklist.txt"
    }
    branch_protector_ret = "pac_ret"

    sources = [
      "common/dslm_rpc_process.c",
      "standard/dslm_callback_proxy.cpp",
      "standard/dslm_ipc_process.cpp",
      "standard/dslm_service.cpp",
    ]

    include_dirs = [
      "common",
      "../dslm",
      "../include",
      "../../common/include",
      "../../interfaces/inner_api/include",
    ]

    deps = [
      "../../baselib/utils:utils_static",
      "../../oem_property:dslm_oem_ext",
      "../common:service_common_obj",
      "../dfx:dslm_extension_dfx",
      "../dslm:service_dslm_obj",
      "../msg:service_msg_obj",
    ]

    if (device_security_level_feature_plugin_path != "") {
      defines =
          [ "PLUGIN_SO_PATH=\"${device_security_level_feature_plugin_path}\"" ]

      deps -= [ "../../oem_property:dslm_oem_ext" ]

      sources += [ "../../oem_property/common/dslm_credential.c" ]

      include_dirs += [ "../../oem_property/include" ]
    }

    external_deps = [
      "c_utils:utils",
      "hilog:libhilog",
      "ipc:ipc_core",
      "safwk:system_ability_fwk",
      "samgr:samgr_proxy",
    ]

    configs = [ "../../common:common_configs" ]
    public_configs = [ ":dslm_service_config" ]
    part_name = "device_security_level"
    subsystem_name = "security"
  }
}