xref: /aosp_15_r20/external/libwebsockets/Android.bp (revision 1c60b9aca93fdbc9b5f19b2d2194c91294b22281)
1// Copyright (C) 2020 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Common variables.
16package {
17    default_applicable_licenses: ["external_libwebsockets_license"],
18}
19
20// Added automatically by a large-scale-change that took the approach of
21// 'apply every license found to every target'. While this makes sure we respect
22// every license restriction, it may not be entirely correct.
23//
24// e.g. GPL in an MIT project might only apply to the contrib/ directory.
25//
26// Please consider splitting the single license below into multiple licenses,
27// taking care not to lose any license_kind information, and overriding the
28// default license using the 'licenses: [...]' property on targets as needed.
29//
30// For unused files, consider creating a 'fileGroup' with "//visibility:private"
31// to attach the license to, and including a comment whether the files may be
32// used in the current project.
33// See: http://go/android-license-faq
34license {
35    name: "external_libwebsockets_license",
36    visibility: [":__subpackages__"],
37    license_kinds: [
38        "SPDX-license-identifier-Apache-2.0",
39        "SPDX-license-identifier-BSD",
40        "SPDX-license-identifier-Beerware",
41        "SPDX-license-identifier-CC0-1.0",
42        "SPDX-license-identifier-GPL",
43        "SPDX-license-identifier-LGPL",
44        "SPDX-license-identifier-MIT",
45        "SPDX-license-identifier-Zlib",
46        "legacy_permissive",
47        "legacy_unencumbered",
48    ],
49    license_text: [
50        "LICENSE",
51    ],
52}
53
54libwebsocketsSrcFiles = [
55    "lib/core-net/adopt.c",
56    "lib/core-net/client/client.c",
57    "lib/core-net/client/conmon.c",
58    "lib/core-net/client/connect.c",
59    "lib/core-net/client/connect2.c",
60    "lib/core-net/client/connect3.c",
61    "lib/core-net/client/connect4.c",
62    "lib/core-net/client/sort-dns.c",
63    "lib/core-net/close.c",
64    "lib/core-net/dummy-callback.c",
65    "lib/core-net/network.c",
66    "lib/core-net/output.c",
67    "lib/core-net/pollfd.c",
68    "lib/core-net/service.c",
69    "lib/core-net/sorted-usec-list.c",
70    "lib/core-net/state.c",
71    "lib/core-net/vhost.c",
72    "lib/core-net/wsi-timeout.c",
73    "lib/core-net/wsi.c",
74    "lib/core/alloc.c",
75    "lib/core/buflist.c",
76    "lib/core/context.c",
77    "lib/core/libwebsockets.c",
78    "lib/core/logs.c",
79    "lib/core/lws_dll2.c",
80    "lib/core/lws_map.c",
81    "lib/core/vfs.c",
82    "lib/event-libs/poll/poll.c",
83    "lib/misc/base64-decode.c",
84    "lib/misc/cache-ttl/file.c",
85    "lib/misc/cache-ttl/heap.c",
86    "lib/misc/cache-ttl/lws-cache-ttl.c",
87    "lib/misc/dir.c",
88    "lib/misc/lejp.c",
89    "lib/misc/lws-ring.c",
90    "lib/misc/lwsac/cached-file.c",
91    "lib/misc/lwsac/lwsac.c",
92    "lib/misc/prng.c",
93    "lib/misc/sha-1.c",
94    "lib/plat/unix/unix-caps.c",
95    "lib/plat/unix/unix-fds.c",
96    "lib/plat/unix/unix-file.c",
97    "lib/plat/unix/unix-init.c",
98    "lib/plat/unix/unix-misc.c",
99    "lib/plat/unix/unix-pipe.c",
100    "lib/plat/unix/unix-service.c",
101    "lib/plat/unix/unix-sockets.c",
102    "lib/roles/h1/ops-h1.c",
103    "lib/roles/h2/hpack.c",
104    "lib/roles/h2/http2.c",
105    "lib/roles/h2/ops-h2.c",
106    "lib/roles/http/client/client-http.c",
107    "lib/roles/http/cookie.c",
108    "lib/roles/http/date.c",
109    "lib/roles/http/header.c",
110    "lib/roles/http/parsers.c",
111    "lib/roles/http/server/lejp-conf.c",
112    "lib/roles/http/server/lws-spa.c",
113    "lib/roles/http/server/server.c",
114    "lib/roles/listen/ops-listen.c",
115    "lib/roles/pipe/ops-pipe.c",
116    "lib/roles/raw-file/ops-raw-file.c",
117    "lib/roles/raw-skt/ops-raw-skt.c",
118    "lib/roles/ws/client-parser-ws.c",
119    "lib/roles/ws/client-ws.c",
120    "lib/roles/ws/ops-ws.c",
121    "lib/roles/ws/server-ws.c",
122    "lib/system/smd/smd.c",
123    "lib/system/system.c",
124    "lib/tls/openssl/openssl-client.c",
125    "lib/tls/openssl/openssl-server.c",
126    "lib/tls/openssl/openssl-session.c",
127    "lib/tls/openssl/openssl-ssl.c",
128    "lib/tls/openssl/openssl-tls.c",
129    "lib/tls/openssl/openssl-x509.c",
130    "lib/tls/tls-client.c",
131    "lib/tls/tls-network.c",
132    "lib/tls/tls-server.c",
133    "lib/tls/tls-sessions.c",
134    "lib/tls/tls.c",
135]
136
137libwebsocketsIncludePath = [
138    "plugins",
139    "lib/core",
140    "lib/core-net",
141    "lib/event-libs",
142    "lib/abstract",
143    "lib/tls",
144    "lib/roles",
145    "lib/event-libs/libuv",
146    "lib/event-libs/poll",
147    "lib/event-libs/libevent",
148    "lib/event-libs/glib",
149    "lib/event-libs/libev",
150    "lib/jose/jwe",
151    "lib/jose/jws",
152    "lib/jose",
153    "lib/misc",
154    "lib/roles/http",
155    "lib/roles/http/compression",
156    "lib/roles/h1",
157    "lib/roles/h2",
158    "lib/roles/ws",
159    "lib/roles/cgi",
160    "lib/roles/dbus",
161    "lib/roles/raw-proxy",
162    "lib/abstract",
163    "lib/system/async-dns",
164    "lib/system/smd",
165    "lib/system/metrics",
166    "lib/roles/mqtt",
167    "lib/plat/unix",
168    "lib",
169]
170
171cc_library_static {
172    name: "libwebsockets",
173    srcs: libwebsocketsSrcFiles,
174    local_include_dirs: libwebsocketsIncludePath,
175    export_include_dirs: ["include"],
176    static_libs: [
177        "libssl",
178        "libcap",
179    ],
180    host_supported: true,
181    product_variables: {
182        debuggable: {
183            cflags: [
184                "-UNDEBUG",
185            ],
186        },
187    },
188    target: {
189        darwin: {
190            enabled: false,
191        },
192        android: {
193            shared_libs: [
194                "libcrypto",
195            ],
196            cflags: [
197                "-Wno-unused-parameter",
198                "-Wno-missing-field-initializers",
199            ],
200        },
201        host: {
202            static_libs: [
203                "libcrypto",
204            ],
205            cflags: [
206                "-UNDEBUG",
207                "-Wall",
208                "-Wsign-compare",
209                "-Wstrict-aliasing",
210                "-Wuninitialized",
211                "-Werror",
212                "-fvisibility=hidden",
213                "-Wundef",
214                "-Wtype-limits",
215                "-Wignored-qualifiers",
216                "-Wno-deprecated-declarations",
217                "-pthread",
218                "-Wno-unused-command-line-argument",
219                "-Wno-unused-parameter",
220            ],
221        },
222    },
223}
224