1# Copyright (c) 2021 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 14DSOFTBUS_ROOT_PATH = "./../../../.." 15import("$DSOFTBUS_ROOT_PATH/dsoftbus.gni") 16 17NSTACKX_ROOT = "$DSOFTBUS_ROOT_PATH/components/nstackx" 18if (defined(ohos_lite)) { 19 import("//build/lite/config/component/lite_component.gni") 20 config("dfile_lite_config") { 21 cflags = [ 22 "-Wall", 23 "-fno-lto", 24 "-D_GNU_SOURCE", 25 "-DNSTACKX_WITH_LITEOS", 26 "-DLWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS", 27 "-DLWIP_LITEOS_A_COMPAT", 28 "-DMBEDTLS_INCLUDED", 29 "-DDFILE_ENABLE_HIDUMP", 30 ] 31 cflags_cc = cflags 32 } 33 34 config("dfile_linux_config") { 35 cflags = [ 36 "-Wall", 37 "-fno-lto", 38 "-DNSTACKX_WITH_HMOS_LINUX", 39 "-DMBEDTLS_INCLUDED", 40 "-DENABLE_USER_LOG", 41 ] 42 cflags_cc = cflags 43 } 44 shared_library("nstackx_dfile.open") { 45 if (ohos_kernel_type == "liteos_a") { 46 configs += [ ":dfile_lite_config" ] 47 include_dirs = [ 48 "include", 49 "interface", 50 "$NSTACKX_ROOT/nstackx_congestion/interface/", 51 "$NSTACKX_ROOT/nstackx_core", 52 "$NSTACKX_ROOT/nstackx_util/interface", 53 "$NSTACKX_ROOT/nstackx_util/platform/liteos", 54 "//third_party/bounds_checking_function/include/", 55 ] 56 sources = [ 57 "$NSTACKX_ROOT/nstackx_core/platform/liteos/dfile/sys_dfile.c", 58 "$NSTACKX_ROOT/nstackx_core/platform/liteos/dfile/sys_dfile_session.c", 59 "$NSTACKX_ROOT/nstackx_core/platform/liteos/dfile/sys_file_manager.c", 60 "core/nstackx_dfile.c", 61 "core/nstackx_dfile_config.c", 62 "core/nstackx_dfile_control.c", 63 "core/nstackx_dfile_dfx.c", 64 "core/nstackx_dfile_frame.c", 65 "core/nstackx_dfile_log.c", 66 "core/nstackx_dfile_mp.c", 67 "core/nstackx_dfile_retransmission.c", 68 "core/nstackx_dfile_send.c", 69 "core/nstackx_dfile_session.c", 70 "core/nstackx_dfile_transfer.c", 71 "core/nstackx_file_list.c", 72 "core/nstackx_file_manager.c", 73 "core/nstackx_file_manager_client.c", 74 ] 75 deps = [ 76 "$NSTACKX_ROOT/nstackx_congestion:nstackx_congestion.open", 77 "$NSTACKX_ROOT/nstackx_util:nstackx_util.open", 78 "//third_party/mbedtls", 79 "//third_party/openssl/ohos_lite:openssl_shared", 80 ] 81 } else if (ohos_kernel_type == "linux") { 82 configs += [ ":dfile_linux_config" ] 83 include_dirs = [ 84 "include", 85 "interface", 86 "$NSTACKX_ROOT/nstackx_congestion/interface/", 87 "$NSTACKX_ROOT/nstackx_core", 88 "$NSTACKX_ROOT/nstackx_util/interface", 89 "$NSTACKX_ROOT/nstackx_util/platform/unix", 90 "//third_party/bounds_checking_function/include/", 91 ] 92 sources = [ 93 "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_dfile.c", 94 "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_dfile_session.c", 95 "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_file_manager.c", 96 "core/nstackx_dfile.c", 97 "core/nstackx_dfile_config.c", 98 "core/nstackx_dfile_control.c", 99 "core/nstackx_dfile_dfx.c", 100 "core/nstackx_dfile_frame.c", 101 "core/nstackx_dfile_log.c", 102 "core/nstackx_dfile_mp.c", 103 "core/nstackx_dfile_retransmission.c", 104 "core/nstackx_dfile_send.c", 105 "core/nstackx_dfile_session.c", 106 "core/nstackx_dfile_transfer.c", 107 "core/nstackx_file_list.c", 108 "core/nstackx_file_manager.c", 109 "core/nstackx_file_manager_client.c", 110 ] 111 deps = [ 112 "$NSTACKX_ROOT/nstackx_congestion:nstackx_congestion.open", 113 "$NSTACKX_ROOT/nstackx_util:nstackx_util.open", 114 "//third_party/mbedtls", 115 "//third_party/openssl/ohos_lite:openssl_shared", 116 ] 117 } 118 } 119} else { 120 import("//build/ohos.gni") 121 122 ohos_shared_library("nstackx_dfile.open") { 123 sanitize = { 124 cfi = true 125 cfi_cross_dso = true 126 debug = false 127 } 128 branch_protector_ret = "pac_ret" 129 130 cflags = [ 131 "-Wall", 132 "-DMBEDTLS_INCLUDED", 133 "-DNSTACKX_WITH_HMOS_LINUX", 134 "-DDFILE_ENABLE_HIDUMP", 135 "-DENABLE_USER_LOG", 136 ] 137 cflags_cc = cflags 138 include_dirs = [ 139 "include", 140 "interface", 141 "$NSTACKX_ROOT/nstackx_congestion/interface/", 142 "$NSTACKX_ROOT/nstackx_core", 143 "$NSTACKX_ROOT/nstackx_util/interface", 144 "$NSTACKX_ROOT/nstackx_util/platform/unix", 145 "//commonlibrary/c_utils/base/include/", 146 "//third_party/bounds_checking_function/include", 147 ] 148 sources = [ 149 "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_dfile.c", 150 "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_dfile_session.c", 151 "$NSTACKX_ROOT/nstackx_core/platform/unix/dfile/sys_file_manager.c", 152 "core/nstackx_dfile.c", 153 "core/nstackx_dfile_config.c", 154 "core/nstackx_dfile_control.c", 155 "core/nstackx_dfile_dfx.c", 156 "core/nstackx_dfile_frame.c", 157 "core/nstackx_dfile_log.c", 158 "core/nstackx_dfile_mp.c", 159 "core/nstackx_dfile_retransmission.c", 160 "core/nstackx_dfile_send.c", 161 "core/nstackx_dfile_session.c", 162 "core/nstackx_dfile_transfer.c", 163 "core/nstackx_file_list.c", 164 "core/nstackx_file_manager.c", 165 "core/nstackx_file_manager_client.c", 166 ] 167 deps = [ 168 "$NSTACKX_ROOT/nstackx_congestion:nstackx_congestion.open", 169 "$NSTACKX_ROOT/nstackx_util:nstackx_util.open", 170 "//third_party/bounds_checking_function:libsec_shared", 171 "//third_party/mbedtls", 172 "//third_party/openssl:libcrypto_shared", 173 ] 174 innerapi_tags = [ "platformsdk_indirect" ] 175 176 install_images = [ 177 system_base_dir, 178 updater_base_dir, 179 ] 180 181 part_name = "dsoftbus" 182 subsystem_name = "communication" 183 } 184} 185