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