• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2022 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
16ohos_static_library("websockets") {
17  sources = [
18    "//third_party/libwebsockets/lib/core/alloc.c",
19    "//third_party/libwebsockets/lib/core/buflist.c",
20    "//third_party/libwebsockets/lib/core/context.c",
21    "//third_party/libwebsockets/lib/core/lws_dll2.c",
22    "//third_party/libwebsockets/lib/core/libwebsockets.c",
23    "//third_party/libwebsockets/lib/core/logs.c",
24    "//third_party/libwebsockets/lib/system/system.c",
25    "//third_party/libwebsockets/lib/misc/base64-decode.c",
26    "//third_party/libwebsockets/lib/misc/lws-ring.c",
27    "//third_party/libwebsockets/lib/core/vfs.c",
28    "//third_party/libwebsockets/lib/core-net/dummy-callback.c",
29    "//third_party/libwebsockets/lib/core-net/output.c",
30    "//third_party/libwebsockets/lib/core-net/close.c",
31    "//third_party/libwebsockets/lib/core-net/network.c",
32    "//third_party/libwebsockets/lib/core-net/vhost.c",
33    "//third_party/libwebsockets/lib/core-net/pollfd.c",
34    "//third_party/libwebsockets/lib/core-net/service.c",
35    "//third_party/libwebsockets/lib/core-net/sorted-usec-list.c",
36    "//third_party/libwebsockets/lib/core-net/state.c",
37    "//third_party/libwebsockets/lib/core-net/stats.c",
38    "//third_party/libwebsockets/lib/core-net/wsi.c",
39    "//third_party/libwebsockets/lib/core-net/wsi-timeout.c",
40    "//third_party/libwebsockets/lib/core-net/adopt.c",
41    "//third_party/libwebsockets/lib/roles/pipe/ops-pipe.c",
42    "//third_party/libwebsockets/lib/core-net/sequencer.c",
43    "//third_party/libwebsockets/lib/misc/dir.c",
44    "//third_party/libwebsockets/lib/roles/http/header.c",
45    "//third_party/libwebsockets/lib/roles/http/parsers.c",
46    "//third_party/libwebsockets/lib/roles/h1/ops-h1.c",
47    "//third_party/libwebsockets/lib/roles/ws/ops-ws.c",
48    "//third_party/libwebsockets/lib/roles/ws/client-ws.c",
49    "//third_party/libwebsockets/lib/roles/ws/client-parser-ws.c",
50    "//third_party/libwebsockets/lib/roles/ws/server-ws.c",
51    "//third_party/libwebsockets/lib/roles/raw-skt/ops-raw-skt.c",
52    "//third_party/libwebsockets/lib/roles/raw-file/ops-raw-file.c",
53    "//third_party/libwebsockets/lib/misc/lwsac/lwsac.c",
54    "//third_party/libwebsockets/lib/misc/lwsac/cached-file.c",
55    "//third_party/libwebsockets/lib/core-net/connect.c",
56    "//third_party/libwebsockets/lib/core-net/client.c",
57    "//third_party/libwebsockets/lib/roles/http/client/client-http.c",
58    "//third_party/libwebsockets/lib/roles/http/client/client-handshake.c",
59    "//third_party/libwebsockets/lib/core-net/server.c",
60    "//third_party/libwebsockets/lib/roles/listen/ops-listen.c",
61    "//third_party/libwebsockets/lib/tls/tls.c",
62    "//third_party/libwebsockets/lib/tls/tls-network.c",
63    "//third_party/libwebsockets/lib/tls/openssl/openssl-tls.c",
64    "//third_party/libwebsockets/lib/tls/openssl/openssl-x509.c",
65    "//third_party/libwebsockets/lib/tls/openssl/openssl-ssl.c",
66    "//third_party/libwebsockets/lib/tls/tls-server.c",
67    "//third_party/libwebsockets/lib/tls/openssl/openssl-server.c",
68    "//third_party/libwebsockets/lib/tls/tls-client.c",
69    "//third_party/libwebsockets/lib/tls/openssl/openssl-client.c",
70    "//third_party/libwebsockets/lib/misc/sha-1.c",
71    "//third_party/libwebsockets/lib/roles/h2/http2.c",
72    "//third_party/libwebsockets/lib/roles/h2/hpack.c",
73    "//third_party/libwebsockets/lib/roles/h2/ops-h2.c",
74    "//third_party/libwebsockets/lib/plat/unix/unix-caps.c",
75    "//third_party/libwebsockets/lib/plat/unix/unix-misc.c",
76    "//third_party/libwebsockets/lib/plat/unix/unix-init.c",
77    "//third_party/libwebsockets/lib/plat/unix/unix-file.c",
78    "//third_party/libwebsockets/lib/plat/unix/unix-pipe.c",
79    "//third_party/libwebsockets/lib/plat/unix/unix-service.c",
80    "//third_party/libwebsockets/lib/plat/unix/unix-sockets.c",
81    "//third_party/libwebsockets/lib/plat/unix/unix-fds.c",
82    "//third_party/libwebsockets/lib/roles/http/server/server.c",
83    "//third_party/libwebsockets/lib/roles/http/server/lws-spa.c",
84    "//third_party/libwebsockets/lib/event-libs/poll/poll.c",
85    "//third_party/libwebsockets/lib/misc/lejp.c",
86    "//third_party/libwebsockets/lib/roles/http/server/lejp-conf.c"
87  ]
88
89  include_dirs = [
90    "//third_party/libwebsockets/include",
91    "//third_party/libwebsockets/include/libwebsockets",
92    "//third_party/libwebsockets/include/libwebsockets/abstract",
93    "//third_party/libwebsockets/include/libwebsockets/abstract/protocols",
94    "//third_party/libwebsockets/lib",
95    "//third_party/libwebsockets/lib/tls",
96    "//third_party/libwebsockets/lib/tls/mbedtls/wrapper/include/internal",
97    "//third_party/libwebsockets/lib/tls/mbedtls/wrapper/include/platform",
98    "//third_party/libwebsockets/lib/secure-streams",
99    "//third_party/libwebsockets/lib/core-net",
100    "//third_party/libwebsockets/lib/roles",
101    "//third_party/libwebsockets/lib/roles/http",
102    "//third_party/libwebsockets/lib/roles/raw-proxy",
103    "//third_party/libwebsockets/lib/roles/h1",
104    "//third_party/libwebsockets/lib/roles/h2",
105    "//third_party/libwebsockets/lib/roles/ws",
106    "//third_party/libwebsockets/lib/event-libs",
107    "//third_party/libwebsockets/lib/event-libs/poll",
108    "//third_party/libwebsockets/lib/abstract",
109    "//third_party/libwebsockets/lib/abstract/protocols/smtp",
110    "//third_party/libwebsockets/lib/core",
111    "//third_party/libwebsockets/lib/jose",
112    "//third_party/libwebsockets/lib/jose/jwe",
113    "//third_party/libwebsockets/lib/plat/unix",
114    "//third_party/openssl/include/openssl",
115    "//third_party/openssl/crypto/evp",
116    "//third_party/glib/glib",
117    "//third_party/glib"
118  ]
119
120  defines = [ "OHOS_LIBWEBSOCKETS=1" ]
121
122  cflags = [
123    "-fPIC",
124    "-Os",
125    "-g",
126    "-Wall",
127    "-fno-strict-aliasing",
128    "-fvisibility=hidden",
129    "-Wmissing-declarations",
130    "-Waggregate-return",
131    "-pipe",
132   ]
133
134  deps = [
135    "//third_party/openssl:libcrypto_static",
136    "//third_party/openssl:ssl_source",
137    "//third_party/zlib:libz",
138  ]
139}
140
141config("websocket_config") {
142  cflags = [
143    "-Wall",
144    "-Wsign-compare",
145    "-Wstrict-aliasing",
146    "-Wuninitialized",
147    "-fvisibility=hidden",
148    "-Wtype-limits",
149    "-Wignored-qualifiers",
150    "-Wno-deprecated-declarations",
151    "-pthread",
152    "-Wno-unused-command-line-argument",
153    "-Wno-unused-parameter",
154    "-Wno-implicit-function-declaration",
155  ]
156}
157
158config("websockets_public_config") {
159  include_dirs = [
160    "//third_party/libwebsockets/plugins",
161    "//third_party/libwebsockets/lib/core",
162    "//third_party/libwebsockets/lib/core-net",
163    "//third_party/libwebsockets/lib/event-libs",
164    "//third_party/libwebsockets/lib/abstract",
165    "//third_party/libwebsockets/lib/tls",
166    "//third_party/libwebsockets/lib/roles",
167    "//third_party/libwebsockets/lib/event-libs/libuv",
168    "//third_party/libwebsockets/lib/event-libs/poll",
169    "//third_party/libwebsockets/lib/event-libs/libevent",
170    "//third_party/libwebsockets/lib/event-libs/glib",
171    "//third_party/libwebsockets/lib/event-libs/libev",
172    "//third_party/libwebsockets/lib/jose/jwe",
173    "//third_party/libwebsockets/lib/jose/jws",
174    "//third_party/libwebsockets/lib/jose",
175    "//third_party/libwebsockets/lib/misc",
176    "//third_party/libwebsockets/lib/roles/http",
177    "//third_party/libwebsockets/lib/roles/http/compression",
178    "//third_party/libwebsockets/lib/roles/h1",
179    "//third_party/libwebsockets/lib/roles/h2",
180    "//third_party/libwebsockets/lib/roles/ws",
181    "//third_party/libwebsockets/lib/roles/cgi",
182    "//third_party/libwebsockets/lib/roles/dbus",
183    "//third_party/libwebsockets/lib/roles/raw-proxy",
184    "//third_party/libwebsockets/lib/abstract",
185    "//third_party/libwebsockets/lib/system/async-dns",
186    "//third_party/libwebsockets/lib/roles/mqtt",
187    "//third_party/libwebsockets/lib/system/metrics",
188    "//third_party/libwebsockets/lib",
189    "//third_party/libwebsockets/win32port/win32helpers",
190    "//third_party/libwebsockets/include",
191  ]
192  if (host_os == "linux") {
193    include_dirs += [ "//third_party/libwebsockets/lib/plat/windows" ]
194  } else {
195    include_dirs += [ "//third_party/libwebsockets/lib/plat/unix" ]
196  }
197  cflags = [ "-Wno-error=#warnings" ]
198}
199
200ohos_static_library("websockets_static") {
201  sources = [
202    "//third_party/libwebsockets/lib/core-net/adopt.c",
203    "//third_party/libwebsockets/lib/core-net/client.c",
204    "//third_party/libwebsockets/lib/core-net/close.c",
205    "//third_party/libwebsockets/lib/core-net/connect.c",
206    "//third_party/libwebsockets/lib/core-net/dummy-callback.c",
207    "//third_party/libwebsockets/lib/core-net/network.c",
208    "//third_party/libwebsockets/lib/core-net/output.c",
209    "//third_party/libwebsockets/lib/core-net/pollfd.c",
210    "//third_party/libwebsockets/lib/core-net/sequencer.c",
211    "//third_party/libwebsockets/lib/core-net/server.c",
212    "//third_party/libwebsockets/lib/core-net/service.c",
213    "//third_party/libwebsockets/lib/core-net/sorted-usec-list.c",
214    "//third_party/libwebsockets/lib/core-net/state.c",
215    "//third_party/libwebsockets/lib/core-net/stats.c",
216    "//third_party/libwebsockets/lib/core-net/vhost.c",
217    "//third_party/libwebsockets/lib/core-net/wsi-timeout.c",
218    "//third_party/libwebsockets/lib/core-net/wsi.c",
219    "//third_party/libwebsockets/lib/core/alloc.c",
220    "//third_party/libwebsockets/lib/core/buflist.c",
221    "//third_party/libwebsockets/lib/core/context.c",
222    "//third_party/libwebsockets/lib/core/libwebsockets.c",
223    "//third_party/libwebsockets/lib/core/logs.c",
224    "//third_party/libwebsockets/lib/core/lws_dll2.c",
225    "//third_party/libwebsockets/lib/core/vfs.c",
226    "//third_party/libwebsockets/lib/event-libs/poll/poll.c",
227    "//third_party/libwebsockets/lib/misc/base64-decode.c",
228    "//third_party/libwebsockets/lib/misc/lejp.c",
229    "//third_party/libwebsockets/lib/misc/lws-ring.c",
230    "//third_party/libwebsockets/lib/misc/lwsac/cached-file.c",
231    "//third_party/libwebsockets/lib/misc/lwsac/lwsac.c",
232    "//third_party/libwebsockets/lib/misc/peer-limits.c",
233    "//third_party/libwebsockets/lib/misc/sha-1.c",
234    "//third_party/libwebsockets/lib/roles/h1/ops-h1.c",
235    "//third_party/libwebsockets/lib/roles/h2/hpack.c",
236    "//third_party/libwebsockets/lib/roles/h2/http2.c",
237    "//third_party/libwebsockets/lib/roles/h2/ops-h2.c",
238    "//third_party/libwebsockets/lib/roles/http/client/client-handshake.c",
239    "//third_party/libwebsockets/lib/roles/http/client/client-http.c",
240    "//third_party/libwebsockets/lib/roles/http/date.c",
241    "//third_party/libwebsockets/lib/roles/http/header.c",
242    "//third_party/libwebsockets/lib/roles/http/parsers.c",
243    "//third_party/libwebsockets/lib/roles/http/server/server.c",
244    "//third_party/libwebsockets/lib/roles/listen/ops-listen.c",
245    "//third_party/libwebsockets/lib/roles/pipe/ops-pipe.c",
246    "//third_party/libwebsockets/lib/roles/raw-file/ops-raw-file.c",
247    "//third_party/libwebsockets/lib/roles/raw-skt/ops-raw-skt.c",
248    "//third_party/libwebsockets/lib/roles/ws/client-parser-ws.c",
249    "//third_party/libwebsockets/lib/roles/ws/client-ws.c",
250    "//third_party/libwebsockets/lib/roles/ws/ops-ws.c",
251    "//third_party/libwebsockets/lib/roles/ws/server-ws.c",
252    "//third_party/libwebsockets/lib/system/system.c",
253  ]
254  if (host_os == "linux") {
255    sources += [
256      "//third_party/libwebsockets/lib/plat/windows/windows-fds.c",
257      "//third_party/libwebsockets/lib/plat/windows/windows-file.c",
258      "//third_party/libwebsockets/lib/plat/windows/windows-init.c",
259      "//third_party/libwebsockets/lib/plat/windows/windows-misc.c",
260      "//third_party/libwebsockets/lib/plat/windows/windows-pipe.c",
261      "//third_party/libwebsockets/lib/plat/windows/windows-plugins.c",
262      "//third_party/libwebsockets/lib/plat/windows/windows-service.c",
263      "//third_party/libwebsockets/lib/plat/windows/windows-socket.c",
264    ]
265  } else {
266    sources += [
267      "//third_party/libwebsockets/lib/plat/unix/unix-caps.c",
268      "//third_party/libwebsockets/lib/plat/unix/unix-fds.c",
269      "//third_party/libwebsockets/lib/plat/unix/unix-file.c",
270      "//third_party/libwebsockets/lib/plat/unix/unix-init.c",
271      "//third_party/libwebsockets/lib/plat/unix/unix-misc.c",
272      "//third_party/libwebsockets/lib/plat/unix/unix-pipe.c",
273      "//third_party/libwebsockets/lib/plat/unix/unix-service.c",
274      "//third_party/libwebsockets/lib/plat/unix/unix-sockets.c",
275    ]
276  }
277  configs = [ ":websocket_config" ]
278  public_configs = [ ":websockets_public_config" ]
279}