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