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 "../../../interfaces/innerkits/include/syspara", 24 "../../../interfaces/innerkits/syspara", 25] 26 27if (defined(ohos_lite)) { 28 static_library("libudidcomm") { 29 defines = [ 30 "_GNU_SOURCE", 31 "OHOS_LITE", 32 ] 33 if (init_lite_no_log) { 34 defines += [ "INIT_NO_LOG" ] 35 } 36 include_dirs = comm_include 37 include_dirs += [ 38 "../../../interfaces/innerkits/init_module_engine/include", 39 "../../../interfaces/hals", 40 "//base/hiviewdfx/hilog_lite/interfaces/native/kits", 41 ] 42 sources = [ 43 "udid_adp.c", 44 "udid_comm.c", 45 ] 46 47 deps = [] 48 external_deps = [] 49 if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") { 50 deps += [ "//third_party/mbedtls:mbedtls_shared" ] 51 external_deps += [ "bounds_checking_function:libsec_shared" ] 52 } else if (ohos_kernel_type == "liteos_m") { 53 deps += [ "//third_party/mbedtls:mbedtls" ] 54 external_deps += [ "bounds_checking_function:libsec_static" ] 55 } 56 57 #if product exit, use product 58 if (init_feature_begetctl_liteos) { 59 PRODUCT_HAL_SYSPARAM_PATH = 60 rebase_path("${ohos_product_adapter_dir}/utils/sys_param") 61 cmd = "if [ -f ${PRODUCT_HAL_SYSPARAM_PATH}/BUILD.gn ]; then echo true; else echo false; fi" 62 PRODUCT_HAL_SYSPARAM_EXISTS = 63 exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") 64 if (PRODUCT_HAL_SYSPARAM_EXISTS) { 65 deps += [ "$ohos_product_adapter_dir/utils/sys_param:hal_sysparam" ] 66 } 67 deps += [ "../../../interfaces/hals/utils/sys_param:hal_sys_param" ] 68 } 69 } 70} else { 71 ohos_shared_library("udidmodule") { 72 sources = [ 73 "udid_adp.c", 74 "udid_comm.c", 75 ] 76 defines = [ "_GNU_SOURCE" ] 77 include_dirs = comm_include 78 deps = [ 79 "//base/startup/init/interfaces/innerkits/init_module_engine:libinit_module_engine", 80 "//third_party/mbedtls:mbedtls_shared", 81 ] 82 83 external_deps = [ 84 "bounds_checking_function:libsec_shared", 85 "mbedtls:mbedtls_shared", 86 ] 87 88 part_name = "init" 89 subsystem_name = "startup" 90 if (target_cpu == "arm64" || target_cpu == "x86_64" || 91 target_cpu == "riscv64") { 92 module_install_dir = "lib64/init" 93 } else { 94 module_install_dir = "lib/init" 95 } 96 install_images = [ 97 "system", 98 "updater", 99 ] 100 } 101 102 config("udid_static_config") { 103 include_dirs = [ "." ] 104 } 105 106 ohos_source_set("libudid_static") { 107 sources = [ "udid_static.c" ] 108 defines = [ "_GNU_SOURCE" ] 109 include_dirs = comm_include 110 public_configs = [ ":udid_static_config" ] 111 public_configs += [ "../../../interfaces/innerkits/init_module_engine:init_module_engine_exported_config" ] 112 part_name = "init" 113 subsystem_name = "startup" 114 } 115 116 # for begetutil 117 ohos_static_library("libudidcomm") { 118 sources = [ "udid_comm.c" ] 119 defines = [ "_GNU_SOURCE" ] 120 include_dirs = comm_include 121 external_deps = [ "bounds_checking_function:libsec_shared" ] 122 123 part_name = "init" 124 subsystem_name = "startup" 125 } 126 127 ohos_static_library("libudidcomm_static") { 128 sources = [ "udid_comm.c" ] 129 defines = [ "_GNU_SOURCE" ] 130 include_dirs = comm_include 131 external_deps = [ "bounds_checking_function:libsec_static" ] 132 133 part_name = "init" 134 subsystem_name = "startup" 135 } 136} 137