• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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("//build/ohos.gni")
15
16FLASHD_PATH = "//base/update/updater/services/flashd"
17HDC_PATH = "//developtools/hdc_standard/src"
18
19common_sources = [
20  "${HDC_PATH}/common/async_cmd.cpp",
21  "${HDC_PATH}/common/auth.cpp",
22  "${HDC_PATH}/common/base.cpp",
23  "${HDC_PATH}/common/channel.cpp",
24  "${HDC_PATH}/common/debug.cpp",
25  "${HDC_PATH}/common/file.cpp",
26  "${HDC_PATH}/common/file_descriptor.cpp",
27  "${HDC_PATH}/common/forward.cpp",
28  "${HDC_PATH}/common/session.cpp",
29  "${HDC_PATH}/common/task.cpp",
30  "${HDC_PATH}/common/tcp.cpp",
31  "${HDC_PATH}/common/transfer.cpp",
32  "${HDC_PATH}/common/usb.cpp",
33]
34
35config("flashd_hdc_config") {
36  include_dirs = [ "${FLASHD_PATH}/common" ]
37  cflags_cc = [ "-std=c++17" ]
38}
39
40ohos_source_set("flashd_deamon") {
41  sources = [
42    "${FLASHD_PATH}/daemon/daemon.cpp",
43    "${FLASHD_PATH}/daemon/daemon_unity.cpp",
44    "${HDC_PATH}/daemon/daemon_app.cpp",
45    "${HDC_PATH}/daemon/daemon_forward.cpp",
46    "${HDC_PATH}/daemon/daemon_tcp.cpp",
47    "${HDC_PATH}/daemon/daemon_usb.cpp",
48    "${HDC_PATH}/daemon/jdwp.cpp",
49    "${HDC_PATH}/daemon/shell.cpp",
50  ]
51
52  sources += common_sources
53
54  defines = [
55    "HARMONY_PROJECT",
56    "HDC_SUPPORT_FLASHD",
57  ]
58
59  configs = [ ":flashd_hdc_config" ]
60
61  deps = [
62    "//third_party/libuv:uv_static",
63    "//third_party/lz4:liblz4_static",
64    "//third_party/openssl:libcrypto_static",
65    "//utils/native/base:utils",
66  ]
67
68  if (use_musl) {
69    external_deps = [
70      "init:libbegetutil",
71      "startup_l2:syspara",
72    ]
73  }
74
75  include_dirs = [
76    "${HDC_PATH}/daemon",
77    "${HDC_PATH}/common",
78    "//base/update/updater/services/flashd",
79    "//base/update/updater/services/flashd/daemon",
80    "//base/update/updater/services/flashd/common",
81    "//base/update/updater/services/flashd/host",
82    "//utils/native/base/include",
83    "//third_party/lz4/lib",
84    "//third_party/openssl/include",
85    "//third_party/libuv",
86  ]
87}
88
89ohos_static_library("libflashd") {
90  sources = [
91    "//base/update/updater/services/flashd/blockdevice.cpp",
92    "//base/update/updater/services/flashd/daemon/daemon_updater.cpp",
93    "//base/update/updater/services/flashd/daemon/flashd_main.cpp",
94    "//base/update/updater/services/flashd/flash_service.cpp",
95    "//base/update/updater/services/flashd/partition.cpp",
96    "//base/update/updater/services/updater_binary/update_image_block.cpp",
97    "//base/update/updater/services/updater_binary/update_partitions.cpp",
98    "//base/update/updater/services/updater_binary/update_processor.cpp",
99  ]
100
101  defines = [
102    "HDC_SUPPORT_FLASHD",
103    "HARMONY_PROJECT",
104  ]
105
106  deps = [
107    ":flashd_deamon",
108    "//base/update/updater/interfaces/kits/misc_info:libmiscinfo",
109    "//base/update/updater/services/applypatch:libapplypatch",
110    "//base/update/updater/services/diffpatch/patch:libpatch",
111    "//base/update/updater/services/fs_manager:libfsmanager",
112    "//base/update/updater/services/log:libupdaterlog",
113    "//base/update/updater/services/package:libupdaterpackage",
114    "//base/update/updater/services/script:libupdaterscript",
115    "//base/update/updater/utils:libutils",
116    "//third_party/bzip2:libbz2",
117    "//third_party/cJSON:cjson_static",
118    "//third_party/libuv:uv_static",
119    "//third_party/lz4:liblz4_static",
120    "//third_party/openssl:libcrypto_static",
121    "//third_party/zlib:libz",
122    "//utils/native/base:utils",
123  ]
124
125  include_dirs = [
126    "${HDC_PATH}/daemon",
127    "${HDC_PATH}/common",
128    "//base/update/updater/services",
129    "//base/update/updater/services/flashd",
130    "//base/update/updater/services/flashd/daemon",
131    "//base/update/updater/services/flashd/common",
132    "//base/update/updater/interfaces/kits/include",
133    "//base/update/updater/services/include/package",
134    "//base/update/updater/services/include/script",
135    "//base/update/updater/services/include/log",
136    "//base/update/updater/services/include",
137    "//base/update/updater/utils/include",
138    "//third_party/bounds_checking_function/include",
139    "//third_party/cJSON",
140    "//third_party/openssl/include",
141    "//utils/native/base/include",
142    "//third_party/lz4/lib",
143    "//third_party/libuv",
144  ]
145
146  external_deps = [ "init:libbegetutil" ]
147
148  part_name = "updater"
149}
150
151ohos_executable("ohflash") {
152  libs = []
153  configs = [ ":flashd_hdc_config" ]
154  defines = [
155    "HDC_HOST",
156    "HARMONY_PROJECT",
157  ]
158  if (is_mac) {
159    defines += [ "HOST_MAC" ]
160  }
161  cflags_cc = [
162    "-Wno-error",
163    "-Wno-error=unused-variable",
164    "-Wno-unused-variable",
165  ]
166  sources = [
167    "${FLASHD_PATH}/host/client.cpp",
168    "${FLASHD_PATH}/host/host_updater.cpp",
169    "${FLASHD_PATH}/host/main.cpp",
170    "${FLASHD_PATH}/host/server.cpp",
171    "${FLASHD_PATH}/host/server_for_client.cpp",
172    "${FLASHD_PATH}/host/translate.cpp",
173    "${HDC_PATH}/host/host_app.cpp",
174    "${HDC_PATH}/host/host_forward.cpp",
175    "${HDC_PATH}/host/host_tcp.cpp",
176    "${HDC_PATH}/host/host_unity.cpp",
177    "${HDC_PATH}/host/host_usb.cpp",
178  ]
179  sources += common_sources
180
181  deps = [
182    "//third_party/libusb:libusb",
183    "//third_party/libuv:uv_static",
184    "//third_party/lz4:liblz4_static",
185    "//third_party/openssl:libcrypto_static",
186    "//utils/native/base:utilsecurec",
187  ]
188
189  deps += [ "//third_party/libusb:libusb" ]
190
191  include_dirs = [
192    "${FLASHD_PATH}/host",
193    "${HDC_PATH}/host",
194    "${FLASHD_PATH}/common",
195    "${HDC_PATH}/common",
196    "//utils/native/base/include",
197    "//third_party/lz4/lib",
198    "//third_party/openssl/include",
199    "//third_party/libuv",
200  ]
201
202  if (is_mingw) {
203    static_link = true
204    defines += [ "_WIN32" ]
205    defines += [ "WIN32_LEAN_AND_MEAN" ]
206    libs += [ "setupapi" ]
207  }
208
209  if (is_linux) {
210    static_link = true
211    deps += [ "//third_party/openssl:libcrypto_static" ]
212  }
213
214  subsystem_name = "updater"
215  part_name = "updater"
216}
217
218group("flashhost_target_standard") {
219  deps = [ ":ohflash" ]
220}
221
222group("flashhost_target_standard_linux") {
223  deps = [ ":ohflash(//build/toolchain/linux:clang_x64)" ]
224}
225
226group("flashhost_target_standard_mingw") {
227  deps = [ ":ohflash(//build/toolchain/mingw:mingw_x86_64)" ]
228}
229
230group("flashhost_target_standard_all") {
231  deps = [
232    ":flashhost_target_standard_linux",
233    ":flashhost_target_standard_mingw",
234  ]
235}
236
237group("updater_flashd") {
238  deps = [ ":libflashd" ]
239}
240