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 14import("../../dsoftbus.gni") 15import("../adapter/core_adapter.gni") 16import("../authentication/authentication.gni") 17import("../bus_center/bus_center_server.gni") 18import("../common/dfx/dsoftbus_dfx.gni") 19import("../common/security/permission/permission.gni") 20import("../connection/conn.gni") 21import("../discovery/disc.gni") 22import("../transmission/trans.gni") 23 24dsoftbus_root_path = "../.." 25dsoftbus_feature_product_config_path = 26 "${dsoftbus_root_path}/adapter/default_config" 27softbus_adapter_config = "${dsoftbus_root_path}/adapter/default_config" 28dsoftbus_core_path = "${dsoftbus_root_path}/core" 29 30dsoftbus_server_common_src = 31 auth_server_src + bus_center_server_src + conn_manager_src + 32 disc_server_src + trans_session_src + softbus_permission_src 33dsoftbus_server_common_inc = 34 auth_server_inc + bus_center_server_inc + conn_manager_inc + 35 disc_server_inc + trans_session_inc + softbus_permission_inc 36dsoftbus_server_common_deps = 37 auth_server_deps + bus_center_server_deps + disc_server_deps + 38 conn_manager_common_deps + trans_session_deps + softbus_permission_deps 39 40if (defined(ohos_lite)) { 41 copy("permission_json") { 42 sources = [ "$dsoftbus_core_path/common/security/permission/softbus_trans_permission.json" ] 43 outputs = [ "$root_out_dir/etc/softbus_trans_permission.json" ] 44 } 45 if (ohos_kernel_type == "liteos_m") { 46 static_library("softbus_server_frame") { 47 defines += AUTH_SERVER_DEFINES 48 defines += [ "__STDC_FORMAT_MACROS" ] 49 include_dirs = dsoftbus_server_common_inc 50 include_dirs += [ 51 "$dsoftbus_root_path/core/frame/common/include", 52 "$dsoftbus_root_path/interfaces/kits", 53 "$dsoftbus_root_path/interfaces/kits/bus_center", 54 "$dsoftbus_root_path/interfaces/kits/transport", 55 "$dsoftbus_root_path/interfaces/kits/common", 56 "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", 57 "$dsoftbus_root_path/core/common/dfx/interface/include", 58 "$softbus_adapter_config/spec_config", 59 "//base/security/device_auth/interfaces/inner_api", 60 ] 61 sources = dsoftbus_server_common_src 62 sources += [ 63 "common/src/softbus_server_frame.c", 64 "mini/src/softbus_server_stub.c", 65 ] 66 if (board_toolchain_type != "iccarm") { 67 cflags = [ 68 "-Wall", 69 "-fPIC", 70 "-std=c99", 71 ] 72 cflags_cc = cflags 73 } else { 74 include_dirs += [ 75 "//kernel/liteos_m/components/net/lwip-2.1/porting/include", 76 "//third_party/lwip/src/include", 77 ] 78 cflags = [ 79 "--diag_suppress", 80 "Pe301", 81 ] 82 } 83 deps = dsoftbus_server_common_deps 84 deps += [ 85 "$dsoftbus_root_path/adapter:softbus_adapter", 86 "$dsoftbus_root_path/core/common:softbus_utils", 87 "$dsoftbus_root_path/core/common/dfx/hidumper_adapter:softbus_dfx_dump", 88 "//build/lite/config/component/cJSON:cjson_static", 89 ] 90 public_deps = 91 [ "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log" ] 92 if (support_bluetooth && 93 (dsoftbus_feature_conn_br || dsoftbus_feature_conn_ble)) { 94 deps += [ 95 "//foundation/communication/bluetooth/frameworks/inner:btframework", 96 ] 97 include_dirs += [ 98 "//foundation/communication/bluetooth/interfaces/inner_api/include", 99 "//foundation/communication/bluetooth/interfaces/inner_api/include/c_header", 100 ] 101 } 102 } 103 } else { 104 shared_library("softbus_server_frame") { 105 defines += AUTH_SERVER_DEFINES 106 defines += [ "__STDC_FORMAT_MACROS" ] 107 include_dirs = dsoftbus_server_common_inc 108 include_dirs += [ 109 "common/include", 110 "small/init/include", 111 "small/client_manager/include", 112 "$softbus_adapter_common/include", 113 "$softbus_adapter_config/spec_config", 114 "$dsoftbus_root_path/interfaces/kits/transport", 115 "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", 116 "$dsoftbus_root_path/core/common/dfx/interface/include", 117 "//base/security/device_auth/interfaces/inner_api", 118 "//commonlibrary/utils_lite/include", 119 "//third_party/bounds_checking_function/include", 120 ] 121 sources = dsoftbus_server_common_src 122 sources += [ 123 "common/src/softbus_server_frame.c", 124 "small/client_manager/src/softbus_client_info_manager.c", 125 "small/init/src/bus_center_server_stub.c", 126 "small/init/src/disc_server_stub.c", 127 "small/init/src/softbus_server_stub.c", 128 "small/init/src/trans_server_stub.c", 129 ] 130 131 cflags = [ 132 "-Wall", 133 "-fPIC", 134 "-fno-builtin", 135 "-std=c99", 136 ] 137 cflags_cc = cflags 138 deps = dsoftbus_server_common_deps 139 deps += [ 140 ":permission_json", 141 "$dsoftbus_root_path/adapter:softbus_adapter", 142 "$dsoftbus_root_path/core/common:softbus_utils", 143 "$dsoftbus_root_path/core/common/dfx/hidumper_adapter:softbus_dfx_dump", 144 "//build/lite/config/component/cJSON:cjson_shared", 145 "//foundation/communication/ipc/interfaces/innerkits/c/ipc:ipc_single", 146 "//foundation/systemabilitymgr/samgr_lite/samgr:samgr", 147 ] 148 public_deps = 149 [ "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log" ] 150 if (support_bluetooth && 151 (dsoftbus_feature_conn_br || dsoftbus_feature_conn_ble)) { 152 deps += [ 153 "//foundation/communication/bluetooth/frameworks/inner:btframework", 154 ] 155 include_dirs += [ 156 "//foundation/communication/bluetooth/interfaces/inner_api/include", 157 "//foundation/communication/bluetooth/interfaces/inner_api/include/c_header", 158 ] 159 } 160 } 161 executable("softbus_server") { 162 sources = [ "small/init/src/softbus_server_main.c" ] 163 include_dirs = [ "common/include" ] 164 deps = [ ":softbus_server_frame" ] 165 cflags = [ "-fPIC" ] 166 } 167 } 168} else { 169 ohos_prebuilt_etc("softbus_server.rc") { 170 relative_install_dir = "init" 171 if (use_musl) { 172 source = "$dsoftbus_root_path/core/frame/$os_type/init/src/softbus_server_musl.cfg" 173 } else { 174 source = 175 "$dsoftbus_root_path/core/frame/$os_type/init/src/softbus_server.cfg" 176 } 177 178 part_name = "dsoftbus" 179 subsystem_name = "communication" 180 } 181 ohos_prebuilt_etc("softbus_permission_json") { 182 source = "$dsoftbus_root_path/core/common/security/permission/softbus_trans_permission.json" 183 install_enable = true 184 relative_install_dir = "communication/softbus" 185 part_name = "dsoftbus" 186 } 187 ohos_shared_library("softbus_server") { 188 sanitize = { 189 cfi = true 190 cfi_cross_dso = true 191 debug = false 192 blocklist = "../cfi_blocklist.txt" 193 } 194 branch_protector_ret = "pac_ret" 195 196 defines += AUTH_SERVER_DEFINES 197 defines += [ "__STDC_FORMAT_MACROS" ] 198 include_dirs = dsoftbus_server_common_inc 199 include_dirs += [ 200 "$dsoftbus_root_path/core/frame/common/include", 201 "$dsoftbus_root_path/core/frame/$os_type/client_manager/include", 202 "$dsoftbus_root_path/core/frame/$os_type/init/include", 203 "$dsoftbus_root_path/interfaces/kits/common", 204 "$dsoftbus_root_path/interfaces/kits/transport", 205 "$dsoftbus_feature_product_config_path/spec_config", 206 "$dsoftbus_root_path/core/common/include", 207 "$dsoftbus_root_path/core/common/dfx/hidumper_adapter/include", 208 "$dsoftbus_root_path/core/common/dfx/hisysevent_adapter/include", 209 "$dsoftbus_root_path/core/common/dfx/interface/include", 210 "//base/security/access_token/interfaces/innerkits/privacy/include", 211 "//foundation/bundlemanager/bundle_framework/interfaces/inner_api/appexecfwk_core/include/bundlemgr", 212 "//foundation/bundlemanager/bundle_framework/interfaces/inner_api/appexecfwk_base/include", 213 "//base/notification/common_event_service/interfaces/inner_api", 214 "//foundation/ability/ability_base/interfaces/kits/native/want/include", 215 "//foundation/ability/ability_base/interfaces/kits/native/uri/include", 216 "//foundation/ability/ability_base/interfaces/inner_api/base/include", 217 ] 218 sources = dsoftbus_server_common_src 219 sources += [ 220 "$dsoftbus_root_path/sdk/frame/$os_type/src/if_softbus_client.cpp", 221 "$os_type/client_manager/src/permission_status_change_cb.cpp", 222 "$os_type/client_manager/src/softbus_client_info_manager.cpp", 223 "$os_type/init/src/if_softbus_server.cpp", 224 "$os_type/init/src/softbus_server.cpp", 225 "$os_type/init/src/softbus_server_death_recipient.cpp", 226 "$os_type/init/src/softbus_server_stub.cpp", 227 "common/src/softbus_server_frame.c", 228 ] 229 deps = dsoftbus_server_common_deps 230 deps += [ 231 ":softbus_permission_json", 232 ":softbus_server.rc", 233 "$dsoftbus_root_path/adapter:softbus_adapter", 234 "$dsoftbus_root_path/core/common:softbus_utils", 235 "$dsoftbus_root_path/core/common/dfx/hidumper_adapter:softbus_dfx_dump", 236 "//third_party/cJSON:cjson", 237 ] 238 public_deps = [ "$dsoftbus_root_path/core/common/dfx/log:softbus_dfx_log" ] 239 dsoftbus_server_common_external_deps = 240 bus_center_server_external_deps + disc_server_external_deps + 241 softbus_permission_external_deps + trans_session_external_deps + 242 conn_manager_external_deps 243 if (is_standard_system) { 244 external_deps = dsoftbus_server_common_external_deps 245 external_deps += [ 246 "access_token:libaccesstoken_sdk", 247 "access_token:libprivacy_sdk", 248 "device_auth:deviceauth_sdk", 249 "hilog:libhilog", 250 "ipc:ipc_core", 251 "safwk:system_ability_fwk", 252 "samgr:samgr_proxy", 253 ] 254 if (!defined(global_parts_info) || 255 defined(global_parts_info.deviceprofile_device_info_manager)) { 256 external_deps += [ 257 "device_info_manager:distributed_device_profile_common", 258 "device_info_manager:distributed_device_profile_sdk", 259 ] 260 } 261 if (!defined(global_parts_info) || 262 defined(global_parts_info.bundlemanager_bundle_framework)) { 263 external_deps += [ "bundle_framework:appexecfwk_core" ] 264 cflags = [ "-DSUPPORT_BUNDLENAME" ] 265 } 266 } 267 268 part_name = "dsoftbus" 269 subsystem_name = "communication" 270 } 271} 272