• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2023 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6# http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//base/startup/init/begetd.gni")
15import("//build/ohos.gni")
16
17comm_include = [
18  ".",
19  "..",
20  "../init_hook",
21  "//base/startup/init/interfaces/innerkits/include/param",
22  "//base/startup/init/interfaces/innerkits/include",
23  "//base/startup/init/interfaces/innerkits/include/syspara",
24  "//base/startup/init/interfaces/innerkits/syspara",
25  "//base/hiviewdfx/hilog_lite/interfaces/native/kits",
26]
27
28if (defined(ohos_lite)) {
29  static_library("libudidcomm") {
30    defines = [
31      "_GNU_SOURCE",
32      "OHOS_LITE",
33    ]
34    if (config_ohos_startup_init_lite_no_log) {
35      defines += [ "INIT_NO_LOG" ]
36    }
37    include_dirs = comm_include
38    include_dirs += [
39      "../../../interfaces/innerkits/init_module_engine/include",
40      "../../../interfaces/hals",
41    ]
42    sources = [
43      "udid_adp.c",
44      "udid_comm.c",
45    ]
46
47    deps = []
48    if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") {
49      deps += [
50        "//third_party/bounds_checking_function:libsec_shared",
51        "//third_party/mbedtls:mbedtls_shared",
52      ]
53    } else if (ohos_kernel_type == "liteos_m") {
54      deps += [
55        "//third_party/bounds_checking_function:libsec_static",
56        "//third_party/mbedtls:mbedtls",
57      ]
58    }
59
60    #if product exit, use product
61    if (enable_ohos_startup_init_feature_begetctl_liteos) {
62      PRODUCT_HAL_SYSPARAM_PATH =
63          rebase_path("${ohos_product_adapter_dir}/utils/sys_param")
64      cmd = "if [ -f ${PRODUCT_HAL_SYSPARAM_PATH}/BUILD.gn ]; then echo true; else echo false; fi"
65      PRODUCT_HAL_SYSPARAM_EXISTS =
66          exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value")
67      if (PRODUCT_HAL_SYSPARAM_EXISTS) {
68        deps += [ "$ohos_product_adapter_dir/utils/sys_param:hal_sysparam" ]
69      }
70      deps += [ "../../../interfaces/hals/utils/sys_param:hal_sys_param" ]
71    }
72  }
73} else {
74  ohos_shared_library("udidmodule") {
75    sources = [
76      "udid_adp.c",
77      "udid_comm.c",
78    ]
79    defines = [ "_GNU_SOURCE" ]
80    include_dirs = comm_include
81    deps = [
82      "//base/startup/init/interfaces/innerkits/init_module_engine:libinit_module_engine",
83      "//third_party/bounds_checking_function:libsec_shared",
84      "//third_party/mbedtls:mbedtls_shared",
85    ]
86
87    part_name = "init"
88    subsystem_name = "startup"
89    if (target_cpu == "arm64" || target_cpu == "x86_64" ||
90        target_cpu == "riscv64") {
91      module_install_dir = "lib64/init"
92    } else {
93      module_install_dir = "lib/init"
94    }
95    install_images = [
96      "system",
97      "updater",
98    ]
99  }
100
101  config("udid_static_config") {
102    include_dirs = [ "." ]
103  }
104
105  ohos_source_set("libudid_static") {
106    sources = [ "udid_static.c" ]
107    defines = [ "_GNU_SOURCE" ]
108    include_dirs = comm_include
109    public_configs = [ ":udid_static_config" ]
110    public_configs += [ "../../../interfaces/innerkits/init_module_engine:init_module_engine_exported_config" ]
111    part_name = "init"
112    subsystem_name = "startup"
113  }
114
115  # for begetutil
116  ohos_static_library("libudidcomm") {
117    sources = [ "udid_comm.c" ]
118    defines = [ "_GNU_SOURCE" ]
119    include_dirs = comm_include
120    deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
121
122    part_name = "init"
123    subsystem_name = "startup"
124  }
125}
126