BUILD.gn 3.6 KB
Newer Older
C
chengjinsong2 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
# Copyright (c) 2023 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/startup/init/begetd.gni")
import("//build/ohos.gni")

comm_include = [
  ".",
  "..",
  "../init_hook",
  "../../include/param",
  "../../../interfaces/innerkits/include",
  "../../../interfaces/innerkits/include/syspara",
  "../../../interfaces/innerkits/syspara",
]

if (defined(ohos_lite)) {
  static_library("libudidcomm") {
    defines = [
      "_GNU_SOURCE",
      "OHOS_LITE",
    ]
C
cheng_jinsong 已提交
33 34 35
    if (config_ohos_startup_init_lite_no_log) {
      defines += [ "INIT_NO_LOG" ]
    }
C
chengjinsong2 已提交
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
    include_dirs = comm_include
    include_dirs += [
      "../../../interfaces/innerkits/init_module_engine/include",
      "../../../interfaces/hals",
    ]
    sources = [
      "udid_adp.c",
      "udid_comm.c",
    ]

    deps = []
    if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") {
      deps += [
        "//third_party/bounds_checking_function:libsec_shared",
        "//third_party/mbedtls:mbedtls_shared",
      ]
    } else if (ohos_kernel_type == "liteos_m") {
      deps += [
        "//third_party/bounds_checking_function:libsec_static",
        "//third_party/mbedtls:mbedtls",
      ]
    }

    #if product exit, use product
    if (enable_ohos_startup_init_feature_begetctl_liteos) {
      PRODUCT_HAL_SYSPARAM_PATH =
          rebase_path("${ohos_product_adapter_dir}/utils/sys_param")
      cmd = "if [ -f ${PRODUCT_HAL_SYSPARAM_PATH}/BUILD.gn ]; then echo true; else echo false; fi"
      PRODUCT_HAL_SYSPARAM_EXISTS =
          exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value")
      if (PRODUCT_HAL_SYSPARAM_EXISTS) {
        deps += [ "$ohos_product_adapter_dir/utils/sys_param:hal_sysparam" ]
      }
      deps += [ "../../../interfaces/hals/utils/sys_param:hal_sys_param" ]
    }
  }
} else {
  ohos_shared_library("udidmodule") {
    sources = [
      "udid_adp.c",
      "udid_comm.c",
    ]
    defines = [ "_GNU_SOURCE" ]
    include_dirs = comm_include
    deps = [
C
chengjinsong2 已提交
81
      "//base/startup/init/interfaces/innerkits/init_module_engine:libinit_module_engine",
C
chengjinsong2 已提交
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
      "//third_party/bounds_checking_function:libsec_shared",
      "//third_party/mbedtls:mbedtls_shared",
    ]

    part_name = "init"
    subsystem_name = "startup"
    if (target_cpu == "arm64") {
      module_install_dir = "lib64/init"
    } else {
      module_install_dir = "lib/init"
    }
    install_images = [
      "system",
      "updater",
    ]
  }

  config("udid_static_config") {
    include_dirs = [ "." ]
  }

  ohos_source_set("libudid_static") {
    sources = [ "udid_static.c" ]
    defines = [ "_GNU_SOURCE" ]
    include_dirs = comm_include
    public_configs = [ ":udid_static_config" ]
    public_configs += [ "../../../interfaces/innerkits/init_module_engine:init_module_engine_exported_config" ]
    part_name = "init"
    subsystem_name = "startup"
  }

  # for begetutil
  ohos_static_library("libudidcomm") {
    sources = [ "udid_comm.c" ]
    defines = [ "_GNU_SOURCE" ]
    include_dirs = comm_include
    deps = [ "//third_party/bounds_checking_function:libsec_shared" ]

    part_name = "init"
    subsystem_name = "startup"
  }
}