# 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/certificate_manager/cert_manager.gni")
import("//build/ohos.gni")

ohos_prebuilt_etc("cert_manager_service.rc") {
  source = "cert_manager_service.cfg"
  relative_install_dir = "init"
  subsystem_name = "security"
  part_name = "certificate_manager"
}

ohos_shared_library("cert_manager_service") {
  branch_protector_ret = "pac_ret"
  sanitize = {
    cfi = true
    cfi_cross_dso = true
    boundary_sanitize = true
    debug = false
    integer_overflow = true
    ubsan = true
    stack_protector_ret = true
  }
  subsystem_name = "security"
  part_name = "certificate_manager"
  defines = []

  if (!certificate_manager_feature_ca_enabled) {
    defines += [ "CERTIFICATE_MANAGER_FEATURE_CA_DISABLED" ]
  }
  if (!certificate_manager_feature_credential_enabled) {
    defines += [ "CERTIFICATE_MANAGER_FEATURE_CREDENTIAL_DISABLED" ]
  }

  deps = [
    ":cert_manager_service.rc",
    "cert_manager_engine/main/rdb:libcert_manager_rdb_static",
    "cert_manager_service/main/os_dependency:libcert_manager_service_os_dependency_standard_static",
  ]
  external_deps = [
    "hilog:libhilog",
    "ipc:ipc_core",
    "safwk:system_ability_fwk",
    "samgr:samgr_proxy",
  ]
}