1518678f8Sopenharmony_ci# Copyright (C) 2021-2022 Huawei Device Co., Ltd. 2518678f8Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 3518678f8Sopenharmony_ci# you may not use this file except in compliance with the License. 4518678f8Sopenharmony_ci# You may obtain a copy of the License at 5518678f8Sopenharmony_ci# 6518678f8Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 7518678f8Sopenharmony_ci# 8518678f8Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 9518678f8Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 10518678f8Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11518678f8Sopenharmony_ci# See the License for the specific language governing permissions and 12518678f8Sopenharmony_ci# limitations under the License. 13518678f8Sopenharmony_ci 14518678f8Sopenharmony_ciif (defined(ohos_lite)) { 15518678f8Sopenharmony_ci import("//build/lite/config/component/lite_component.gni") 16518678f8Sopenharmony_ci import("//foundation/communication/dhcp/dhcp_lite.gni") 17518678f8Sopenharmony_ci} else { 18518678f8Sopenharmony_ci import("//build/ohos.gni") 19518678f8Sopenharmony_ci import("//foundation/communication/dhcp/dhcp.gni") 20518678f8Sopenharmony_ci} 21518678f8Sopenharmony_ci 22518678f8Sopenharmony_ci################################################################################ 23518678f8Sopenharmony_cilocal_base_include_dirs = [ 24518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/interfaces", 25518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/interfaces/kits/c", 26518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/interfaces/inner_api", 27518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/interfaces/inner_api/include", 28518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/frameworks/native/include", 29518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/frameworks/native/interfaces", 30518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/frameworks/native/src", 31518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services", 32518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/include", 33518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/utils/include", 34518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/frameworks/native/c_adapter/inc", 35518678f8Sopenharmony_ci] 36518678f8Sopenharmony_ciif (defined(ohos_lite)) { 37518678f8Sopenharmony_ci shared_library("dhcp_client") { 38518678f8Sopenharmony_ci sources = [ 39518678f8Sopenharmony_ci "src/dhcp_client_callback_proxy_lite.cpp", 40518678f8Sopenharmony_ci "src/dhcp_client_service_impl.cpp", 41518678f8Sopenharmony_ci "src/dhcp_client_state_machine.cpp", 42518678f8Sopenharmony_ci "src/dhcp_client_stub_lite.cpp", 43518678f8Sopenharmony_ci "src/dhcp_function.cpp", 44518678f8Sopenharmony_ci "src/dhcp_ipv6_client.cpp", 45518678f8Sopenharmony_ci "src/dhcp_ipv6_event.cpp", 46518678f8Sopenharmony_ci "src/dhcp_options.cpp", 47518678f8Sopenharmony_ci "src/dhcp_result.cpp", 48518678f8Sopenharmony_ci "src/dhcp_socket.cpp", 49518678f8Sopenharmony_ci ] 50518678f8Sopenharmony_ci 51518678f8Sopenharmony_ci include_dirs = local_base_include_dirs 52518678f8Sopenharmony_ci include_dirs += [ 53518678f8Sopenharmony_ci "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", 54518678f8Sopenharmony_ci "//third_party/bounds_checking_function/include", 55518678f8Sopenharmony_ci "//foundation/systemabilitymgr/samgr_lite/interfaces/innerkits/registry", 56518678f8Sopenharmony_ci "//foundation/systemabilitymgr/samgr_lite/interfaces/innerkits/samgr", 57518678f8Sopenharmony_ci ] 58518678f8Sopenharmony_ci 59518678f8Sopenharmony_ci deps = [ 60518678f8Sopenharmony_ci "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", 61518678f8Sopenharmony_ci "//foundation/systemabilitymgr/samgr_lite/samgr:samgr", 62518678f8Sopenharmony_ci ] 63518678f8Sopenharmony_ci external_deps = [ "bounds_checking_function:libsec_shared" ] 64518678f8Sopenharmony_ci defines = [ 65518678f8Sopenharmony_ci "_GNU_SOURCE", 66518678f8Sopenharmony_ci "OHOS_ARCH_LITE", 67518678f8Sopenharmony_ci "VENDOR_NAME_PREFIX=\"$VENDOR_NAME\"", 68518678f8Sopenharmony_ci "DEFAULT_IPV4_DNS_PRI=\"$IPV4_DNS_PRI\"", 69518678f8Sopenharmony_ci "DEFAULT_IPV4_DNS_SEC=\"$IPV4_DNS_SEC\"", 70518678f8Sopenharmony_ci ] 71518678f8Sopenharmony_ci configs -= [ "//build/lite/config:language_cpp" ] 72518678f8Sopenharmony_ci cflags = [ 73518678f8Sopenharmony_ci "-std=c++17", 74518678f8Sopenharmony_ci "-fno-rtti", 75518678f8Sopenharmony_ci ] 76518678f8Sopenharmony_ci } 77518678f8Sopenharmony_ci} else { 78518678f8Sopenharmony_ci local_base_sources = [ 79518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_callback_proxy.cpp", 80518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_death_recipient.cpp", 81518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_service_impl.cpp", 82518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_state_machine.cpp", 83518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_stub.cpp", 84518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_function.cpp", 85518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_ipv6_client.cpp", 86518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_ipv6_event.cpp", 87518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_options.cpp", 88518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_result.cpp", 89518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_result_store_manager.cpp", 90518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_socket.cpp", 91518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_thread.cpp", 92518678f8Sopenharmony_ci ] 93518678f8Sopenharmony_ci config("dhcp_manager_service_header") { 94518678f8Sopenharmony_ci visibility = [ ":*" ] 95518678f8Sopenharmony_ci include_dirs = local_base_include_dirs 96518678f8Sopenharmony_ci } 97518678f8Sopenharmony_ci ohos_shared_library("dhcp_client") { 98518678f8Sopenharmony_ci branch_protector_ret = "pac_ret" 99518678f8Sopenharmony_ci sanitize = { 100518678f8Sopenharmony_ci cfi = true # Enable/disable control flow integrity detection 101518678f8Sopenharmony_ci boundary_sanitize = true # Enable boundary san detection 102518678f8Sopenharmony_ci cfi_cross_dso = true # Cross-SO CFI Checks 103518678f8Sopenharmony_ci integer_overflow = true # Enable integer overflow detection 104518678f8Sopenharmony_ci ubsan = true # Enable some Ubsan options 105518678f8Sopenharmony_ci debug = false 106518678f8Sopenharmony_ci } 107518678f8Sopenharmony_ci install_enable = true 108518678f8Sopenharmony_ci sources = local_base_sources 109518678f8Sopenharmony_ci include_dirs = local_base_include_dirs 110518678f8Sopenharmony_ci defines = [ 111518678f8Sopenharmony_ci "VENDOR_NAME_PREFIX=\"$VENDOR_NAME\"", 112518678f8Sopenharmony_ci "DEFAULT_IPV4_DNS_PRI=\"$IPV4_DNS_PRI\"", 113518678f8Sopenharmony_ci "DEFAULT_IPV4_DNS_SEC=\"$IPV4_DNS_SEC\"", 114518678f8Sopenharmony_ci ] 115518678f8Sopenharmony_ci if (is_asan) { 116518678f8Sopenharmony_ci defines += [ "DTFUZZ_TEST" ] 117518678f8Sopenharmony_ci } 118518678f8Sopenharmony_ci 119518678f8Sopenharmony_ci deps = [ "$DHCP_ROOT_DIR/services/utils:dhcp_utils" ] 120518678f8Sopenharmony_ci 121518678f8Sopenharmony_ci external_deps = [ 122518678f8Sopenharmony_ci "ability_runtime:wantagent_innerkits", 123518678f8Sopenharmony_ci "access_token:libaccesstoken_sdk", 124518678f8Sopenharmony_ci "access_token:libtokenid_sdk", 125518678f8Sopenharmony_ci "c_utils:utils", 126518678f8Sopenharmony_ci "hilog:libhilog", 127518678f8Sopenharmony_ci "ipc:ipc_single", 128518678f8Sopenharmony_ci "netmanager_base:net_native_manager_if", 129518678f8Sopenharmony_ci "netmanager_base:netsys_controller", 130518678f8Sopenharmony_ci "safwk:system_ability_fwk", 131518678f8Sopenharmony_ci "samgr:samgr_proxy", 132518678f8Sopenharmony_ci "time_service:time_client", 133518678f8Sopenharmony_ci ] 134518678f8Sopenharmony_ci 135518678f8Sopenharmony_ci if (defined(global_parts_info) && 136518678f8Sopenharmony_ci defined(global_parts_info.resourceschedule_ffrt)) { 137518678f8Sopenharmony_ci external_deps += [ "ffrt:libffrt" ] 138518678f8Sopenharmony_ci defines += [ "DHCP_FFRT_ENABLE" ] 139518678f8Sopenharmony_ci } 140518678f8Sopenharmony_ci 141518678f8Sopenharmony_ci if (defined(global_parts_info) && defined(global_parts_info.startup_init)) { 142518678f8Sopenharmony_ci external_deps += [ "init:libbegetutil" ] 143518678f8Sopenharmony_ci defines += [ "INIT_LIB_ENABLE" ] 144518678f8Sopenharmony_ci } 145518678f8Sopenharmony_ci cflags = [ 146518678f8Sopenharmony_ci "-std=c++17", 147518678f8Sopenharmony_ci "-fno-rtti", 148518678f8Sopenharmony_ci ] 149518678f8Sopenharmony_ci ldflags = [ 150518678f8Sopenharmony_ci "-fPIC", 151518678f8Sopenharmony_ci "-Wl,-E", 152518678f8Sopenharmony_ci ] 153518678f8Sopenharmony_ci shlib_type = "sa" 154518678f8Sopenharmony_ci version_script = "libdhcp_client.map" 155518678f8Sopenharmony_ci public_configs = [ ":dhcp_manager_service_header" ] 156518678f8Sopenharmony_ci part_name = "dhcp" 157518678f8Sopenharmony_ci subsystem_name = "communication" 158518678f8Sopenharmony_ci innerapi_tags = [ "platformsdk" ] 159518678f8Sopenharmony_ci } 160518678f8Sopenharmony_ci 161518678f8Sopenharmony_ci ohos_shared_library("dhcp_updater_client") { 162518678f8Sopenharmony_ci branch_protector_ret = "pac_ret" 163518678f8Sopenharmony_ci sanitize = { 164518678f8Sopenharmony_ci cfi = true # Enable/disable control flow integrity detection 165518678f8Sopenharmony_ci boundary_sanitize = true # Enable boundary san detection 166518678f8Sopenharmony_ci cfi_cross_dso = true # Cross-SO CFI Checks 167518678f8Sopenharmony_ci integer_overflow = true # Enable integer overflow detection 168518678f8Sopenharmony_ci ubsan = true # Enable some Ubsan options 169518678f8Sopenharmony_ci debug = false 170518678f8Sopenharmony_ci } 171518678f8Sopenharmony_ci install_enable = true 172518678f8Sopenharmony_ci sources = [ 173518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_service_impl.cpp", 174518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_state_machine.cpp", 175518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_client_stub_lite.cpp", 176518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_function.cpp", 177518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_ipv6_client.cpp", 178518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_ipv6_event.cpp", 179518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_options.cpp", 180518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_result.cpp", 181518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_result_store_manager.cpp", 182518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_socket.cpp", 183518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/dhcp_client/src/dhcp_thread.cpp", 184518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/utils/src/dhcp_arp_checker.cpp", 185518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/utils/src/dhcp_common_utils.cpp", 186518678f8Sopenharmony_ci "$DHCP_ROOT_DIR/services/utils/src/dhcp_permission_utils.cpp", 187518678f8Sopenharmony_ci ] 188518678f8Sopenharmony_ci include_dirs = local_base_include_dirs 189518678f8Sopenharmony_ci 190518678f8Sopenharmony_ci cflags_cc = [ 191518678f8Sopenharmony_ci "-std=c++17", 192518678f8Sopenharmony_ci "-Wall", 193518678f8Sopenharmony_ci ] 194518678f8Sopenharmony_ci 195518678f8Sopenharmony_ci defines = [ 196518678f8Sopenharmony_ci "OHOS_ARCH_LITE", 197518678f8Sopenharmony_ci "OHOS_EUPDATER", 198518678f8Sopenharmony_ci "VENDOR_NAME_PREFIX=\"$VENDOR_NAME\"", 199518678f8Sopenharmony_ci "DEFAULT_IPV4_DNS_PRI=\"$IPV4_DNS_PRI\"", 200518678f8Sopenharmony_ci "DEFAULT_IPV4_DNS_SEC=\"$IPV4_DNS_SEC\"", 201518678f8Sopenharmony_ci ] 202518678f8Sopenharmony_ci 203518678f8Sopenharmony_ci deps = [] 204518678f8Sopenharmony_ci 205518678f8Sopenharmony_ci external_deps = [ 206518678f8Sopenharmony_ci "bounds_checking_function:libsec_shared", 207518678f8Sopenharmony_ci "c_utils:utils", 208518678f8Sopenharmony_ci "hilog:libhilog", 209518678f8Sopenharmony_ci "netmanager_base:net_native_manager_if", 210518678f8Sopenharmony_ci "netmanager_base:netsys_controller", 211518678f8Sopenharmony_ci ] 212518678f8Sopenharmony_ci 213518678f8Sopenharmony_ci if (defined(global_parts_info) && 214518678f8Sopenharmony_ci defined(global_parts_info.resourceschedule_ffrt)) { 215518678f8Sopenharmony_ci external_deps += [ "ffrt:libffrt" ] 216518678f8Sopenharmony_ci defines += [ "DHCP_FFRT_ENABLE" ] 217518678f8Sopenharmony_ci } 218518678f8Sopenharmony_ci 219518678f8Sopenharmony_ci if (defined(global_parts_info) && defined(global_parts_info.startup_init)) { 220518678f8Sopenharmony_ci external_deps += [ "init:libbegetutil" ] 221518678f8Sopenharmony_ci defines += [ "INIT_LIB_ENABLE" ] 222518678f8Sopenharmony_ci } 223518678f8Sopenharmony_ci ldflags = [ 224518678f8Sopenharmony_ci "-fPIC", 225518678f8Sopenharmony_ci "-Wl,-E", 226518678f8Sopenharmony_ci ] 227518678f8Sopenharmony_ci install_images = [ "updater" ] 228518678f8Sopenharmony_ci part_name = "dhcp" 229518678f8Sopenharmony_ci subsystem_name = "communication" 230518678f8Sopenharmony_ci } 231518678f8Sopenharmony_ci} 232