From 7a9a32ed1ce80768905cc16c93cd6b772eb87c5c Mon Sep 17 00:00:00 2001 From: fupengfei001 Date: Mon, 17 Apr 2023 18:41:12 +0800 Subject: [PATCH 1/3] fupengfei6@huawei.com Signed-off-by: fupengfei001 --- BUILD.gn | 146 +++++++++++++++++++++++++++ include/lws_config.h | 184 +++++++++++++++++++++++++++++++++++ include/lws_config_private.h | 130 +++++++++++++++++++++++++ 3 files changed, 460 insertions(+) diff --git a/BUILD.gn b/BUILD.gn index d7217316..fa1dda5c 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -13,6 +13,8 @@ import("//build/ohos.gni") +platform = "${current_os}_${current_cpu}" + ohos_static_library("websockets") { sources = [ "//third_party/libwebsockets/lib/core-net/adopt.c", @@ -203,6 +205,8 @@ ohos_static_library("websockets") { "//third_party/glib", ] + defines = [ "OHOS_LIBWEBSOCKETS=1" ] + cflags = [ "-fPIC", "-Os", @@ -221,3 +225,145 @@ ohos_static_library("websockets") { "//third_party/zlib:libz", ] } + +config("websocket_config") { + cflags = [ + "-Wall", + "-Wsign-compqre", + "-Wstrict-aliasing", + "-Wuninitialized", + "-fvisibility=hidden", + "-Wtype-limits", + "-Wignored-qualifiers", + "-Wno-deprecated-declarations", + "-pthread", + "-Wno-unused-command-line-argument", + "-Wno-unused-parameter", + "-Wno-implicit-function-declaration", + ] +} + +config("websockets_public_config") { + include_dirs = [ + "//third_party/libwebsockets/plugins", + "//third_party/libwebsockets/lib/core", + "//third_party/libwebsockets/lib/core-net", + "//third_party/libwebsockets/lib/event-libs", + "//third_party/libwebsockets/lib/abstract", + "//third_party/libwebsockets/lib/tls", + "//third_party/libwebsockets/lib/roles", + "//third_party/libwebsockets/lib/event-libs/libuv", + "//third_party/libwebsockets/lib/event-libs/poll", + "//third_party/libwebsockets/lib/event-libs/libevent", + "//third_party/libwebsockets/lib/event-libs/glib", + "//third_party/libwebsockets/lib/event-libs/libev", + "//third_party/libwebsockets/lib/jose/jwe", + "//third_party/libwebsockets/lib/jose/jws", + "//third_party/libwebsockets/lib/jose", + "//third_party/libwebsockets/lib/misc", + "//third_party/libwebsockets/lib/roles/http", + "//third_party/libwebsockets/lib/roles/http/compression", + "//third_party/libwebsockets/lib/roles/h1", + "//third_party/libwebsockets/lib/roles/h2", + "//third_party/libwebsockets/lib/roles/ws", + "//third_party/libwebsockets/lib/roles/cgi", + "//third_party/libwebsockets/lib/roles/dbus", + "//third_party/libwebsockets/lib/roles/raw-proxy", + "//third_party/libwebsockets/lib/abstract", + "//third_party/libwebsockets/lib/system/async-dns", + "//third_party/libwebsockets/lib/roles/mqtt", + "//third_party/libwebsockets/lib/system/metrics", + "//third_party/libwebsockets/lib", + "//third_party/libwebsockets/win32port/win32helpers", + "//third_party/libwebsockets/include", + ] + if(platform == "mingw_x86_64") { + include_dirs += ["//third_party/libwebsockets/lib/plat/windows"] + } else if(platform == "mac_arm64" || platform == "mac_x64" || platform == "linux_x64") { + include_dirs += ["//third_party/libwebsockets/lib/plat/unix"] + } + cflags = ["-Wno-error=warnings"] +} + +ohos_static_library("websocket_static") { + sources = [ + "//third_party/libwebsockets/lib/core-net/adopt.c", + "//third_party/libwebsockets/lib/core-net/client/client.c", + "//third_party/libwebsockets/lib/core-net/client/connect.c", + "//third_party/libwebsockets/lib/core-net/client/connect2.c", + "//third_party/libwebsockets/lib/core-net/client/connect3.c", + "//third_party/libwebsockets/lib/core-net/client/connect4.c", + "//third_party/libwebsockets/lib/core-net/client/sort-dns.c", + "//third_party/libwebsockets/lib/core-net/close.c", + "//third_party/libwebsockets/lib/core-net/dummy-callback.c", + "//third_party/libwebsockets/lib/core-net/network.c", + "//third_party/libwebsockets/lib/core-net/output.c", + "//third_party/libwebsockets/lib/core-net/pollfd.c", + "//third_party/libwebsockets/lib/core-net/sequencer.c", + "//third_party/libwebsockets/lib/core-net/service.c", + "//third_party/libwebsockets/lib/core-net/sorted-usec-list.c", + "//third_party/libwebsockets/lib/core-net/state.c", + "//third_party/libwebsockets/lib/core-net/vhost.c", + "//third_party/libwebsockets/lib/core-net/wsi-timeout.c", + "//third_party/libwebsockets/lib/core-net/wsi.c", + "//third_party/libwebsockets/lib/core/alloc.c", + "//third_party/libwebsockets/lib/core/buflist.c", + "//third_party/libwebsockets/lib/core/context.c", + "//third_party/libwebsockets/lib/core/libwebsockets.c", + "//third_party/libwebsockets/lib/core/logs.c", + "//third_party/libwebsockets/lib/core/lws_dll2.c", + "//third_party/libwebsockets/lib/core/vfs.c", + "//third_party/libwebsockets/lib/event-libs/poll/poll.c", + "//third_party/libwebsockets/lib/misc/base64-decode.c", + "//third_party/libwebsockets/lib/misc/lejp.c", + "//third_party/libwebsockets/lib/misc/lws-ring.c", + "//third_party/libwebsockets/lib/misc/lwsac/cached-file.c", + "//third_party/libwebsockets/lib/misc/lwsac/lwsac.c", + "//third_party/libwebsockets/lib/misc/peer-limits.c", + "//third_party/libwebsockets/lib/misc/sha-1.c", + "//third_party/libwebsockets/lib/roles/h1/ops-h1.c", + "//third_party/libwebsockets/lib/roles/h2/hpack.c", + "//third_party/libwebsockets/lib/roles/h2/http2.c", + "//third_party/libwebsockets/lib/roles/h2/ops-h2.c", + "//third_party/libwebsockets/lib/roles/http/client/client-http.c", + "//third_party/libwebsockets/lib/roles/http/header.c", + "//third_party/libwebsockets/lib/roles/http/parsers.c", + "//third_party/libwebsockets/lib/roles/http/date.c", + "//third_party/libwebsockets/lib/roles/http/server/server.c", + "//third_party/libwebsockets/lib/roles/listen/ops-listen.c", + "//third_party/libwebsockets/lib/roles/pipe/ops-pipe.c", + "//third_party/libwebsockets/lib/roles/raw-file/ops-raw-file.c", + "//third_party/libwebsockets/lib/roles/raw-skt/ops-raw-skt.c", + "//third_party/libwebsockets/lib/roles/ws/client-parser-ws.c", + "//third_party/libwebsockets/lib/roles/ws/client-ws.c", + "//third_party/libwebsockets/lib/roles/ws/ops-ws.c", + "//third_party/libwebsockets/lib/roles/ws/server-ws.c", + "//third_party/libwebsockets/lib/system/system.c", + ] + if(platform == "mingw_x86_64") { + sources += [ + "//third_party/libwebsockets/lib/plat/windows/windows-fds.c", + "//third_party/libwebsockets/lib/plat/windows/windows-file.c", + "//third_party/libwebsockets/lib/plat/windows/windows-init.c", + "//third_party/libwebsockets/lib/plat/windows/windows-misc.c", + "//third_party/libwebsockets/lib/plat/windows/windows-pipe.c", + "//third_party/libwebsockets/lib/plat/windows/windows-plugins.c", + "//third_party/libwebsockets/lib/plat/windows/windows-service.c", + "//third_party/libwebsockets/lib/plat/windows/windows-socket.c", + ] + } else if(platform == platform == "mac_arm64" || platform == "mac_x64" || platform == "linux_x64") { + defines = ["LWS_HAVE_SYS_RESOURCE_H"] + sources += [ + "//third_party/libwebsockets/lib/plat/unix/unix-caps.c", + "//third_party/libwebsockets/lib/plat/unix/unix-fds.c", + "//third_party/libwebsockets/lib/plat/unix/unix-file.c", + "//third_party/libwebsockets/lib/plat/unix/unix-init.c", + "//third_party/libwebsockets/lib/plat/unix/unix-misc.c", + "//third_party/libwebsockets/lib/plat/unix/unix-pipe.c", + "//third_party/libwebsockets/lib/plat/unix/unix-service.c", + "//third_party/libwebsockets/lib/plat/unix/unix-sockets.c", + ] + } + config = [":websocket_config"] + public_config = [":websockets_public_config"] +} diff --git a/include/lws_config.h b/include/lws_config.h index 0b063d12..18254f2b 100644 --- a/include/lws_config.h +++ b/include/lws_config.h @@ -22,6 +22,8 @@ * IN THE SOFTWARE. */ +#if OHOS_LIBWEBSOCKETS + /* lws_config.h Generated from lws_config.h.in */ #ifndef NDEBUG @@ -260,3 +262,185 @@ /* #undef LWS_WITH_LIBUV_INTERNAL */ /* #undef LWS_WITH_PLUGINS_API */ #define LWS_HAVE_RTA_PREF + +#else + +/* lws_config.h Generated from lws_config.h.in */ + +#ifndef NDEBUG + #ifndef _DEBUG + #define _DEBUG + #endif +#endif + +#define LWS_INSTALL_DATADIR "/usr/local/share" +#define LWS_LIBRARY_VERSION_MAJOR 4 +#define LWS_LIBRARY_VERSION_MINOR 0 +#define LWS_LIBRARY_VERSION_PATCH 1 +/* LWS_LIBRARY_VERSION_NUMBER looks like 1005001 for e.g. version 1.5.1 */ +#define LWS_LIBRARY_VERSION_NUMBER (LWS_LIBRARY_VERSION_MAJOR * 1000000) + \ + (LWS_LIBRARY_VERSION_MINOR * 1000) + \ + LWS_LIBRARY_VERSION_PATCH +#define LWS_MAX_SMP 1 + +/* #undef LWS_LIBRARY_VERSION_NUMBER */ + +/* #undef LWS_AVOID_SIGPIPE_IGN */ +/* #undef LWS_BUILD_HASH */ +/* #undef LWS_BUILTIN_GETIFADDRS */ +#define LWS_CLIENT_HTTP_PROXYING +/* #undef LWS_FALLBACK_GETHOSTBYNAME */ +#define LWS_HAS_INTPTR_T +#define LWS_HAS_GETOPT_LONG +/* #undef LWS_HAVE__ATOI64 */ +#define LWS_HAVE_ATOLL +#define LWS_HAVE_BN_bn2binpad +#define LWS_HAVE_CLOCK_GETTIME +/* #undef LWS_HAVE_EC_POINT_get_affine_coordinates*/ +#define LWS_HAVE_ECDSA_SIG_set0 +#define LWS_HAVE_EVP_MD_CTX_free +/* #undef LWS_HAVE_EVP_aes_128_wrap */ +/* #undef LWS_HAVE_EVP_aes_128_cfb8 */ +/* #undef LWS_HAVE_EVP_aes_128_cfb128 */ +/* #undef LWS_HAVE_EVP_aes_192_cfb8 */ +/* #undef LWS_HAVE_EVP_aes_192_cfb128 */ +/* #undef LWS_HAVE_EVP_aes_256_cfb8 */ +/* #undef LWS_HAVE_EVP_aes_256_cfb128 */ +/* #undef LWS_HAVE_EVP_aes_128_xts */ +#define LWS_HAVE_EXECVPE + +/* #if !define(WIN32) && !define(_WIN32) */ +/* #define LWS_HAVE_LIBCAP */ +/* #define LWS_HAVE_EVENTFD */ +/* #define LWS_HAVE_SYS_CAPABILITY_H */ +/* #define LWS_HAVE_MALLOC_USABLE_SIZE */ +/* #define LWS_WITH_TLS */ +/* #endif */ + +#define LWS_HAVE_HMAC_CTX_new +#define LWS_HAVE_MALLOC_H +#define LWS_HAVE_MALLOC_TRIM +/* #undef LWS_HAVE_mbedtls_net_init */ +/* #undef LWS_HAVE_mbedtls_ssl_conf_alpn_protocols */ +/* #undef LWS_HAVE_mbedtls_ssl_get_alpn_protocol */ +/* #undef LWS_HAVE_mbedtls_ssl_conf_sni */ +/* #undef LWS_HAVE_mbedtls_ssl_set_hs_ca_chain */ +/* #undef LWS_HAVE_mbedtls_ssl_set_hs_own_cert */ +/* #undef LWS_HAVE_mbedtls_ssl_set_hs_authmode */ +/* #undef LWS_HAVE_MBEDTLS_NET_SOCKETS */ +/* #undef LWS_HAVE_NEW_UV_VERSION_H */ +#define LWS_HAVE_OPENSSL_ECDH_H +/* #define LWS_HAVE_PIPE2 */ +#define LWS_HAVE_PTHREAD_H +#define LWS_HAVE_RSA_SET0_KEY +#define LWS_HAVE_RSA_verify_pss_mgf1 +/* #undef LWS_HAVE_SSL_CTX_get0_certificate */ +/* #undef LWS_HAVE_SSL_CTX_set1_param */ +/* #undef LWS_HAVE_SSL_CTX_set_ciphersuites */ +/* #undef LWS_HAVE_SSL_EXTRA_CHAIN_CERTS */ +/* #undef LWS_HAVE_SSL_get0_alpn_selected */ +#define LWS_HAVE_SSL_CTX_EVP_PKEY_new_raw_private_key +/* #undef LWS_HAVE_SSL_set_alpn_protos */ +/* #undef LWS_HAVE_SSL_SET_INFO_CALLBACK */ +/* #undef LWS_HAVE__STAT32I64 */ +#define LWS_HAVE_STDINT_H +/* #undef LWS_HAVE_TLS_CLIENT_METHOD */ +/* #undef LWS_HAVE_TLSV1_2_CLIENT_METHOD */ +/* #undef LWS_HAVE_UV_VERSION_H */ +#define LWS_HAVE_VFORK +#define LWS_HAVE_X509_get_key_usage +#define LWS_HAVE_X509_VERIFY_PARAM_set1_host +#define LWS_LIBRARY_VERSION "4.0.1" +/* #undef LWS_MINGW_SUPPORT */ +/* #undef LWS_NO_CLIENT */ +#define LWS_NO_DAEMONIZE +#define LWS_OPENSSL_CLIENT_CERTS "../share" +#define LWS_OPENSSL_SUPPORT +/* #undef LWS_PLAT_OPTEE */ +#define LWS_PLAT_UNIX +/* #undef LWS_PLAT_FREERTOS */ +/* #undef LWS_ROLE_CGI */ +/* #undef LWS_ROLE_DBUS */ +#define LWS_ROLE_H1 +#define LWS_ROLE_H2 +#define LWS_ROLE_RAW +#define LWS_ROLE_RAW_FILE +/* #undef LWS_ROLE_RAW_PROXY */ +#define LWS_ROLE_WS +/* #undef LWS_ROLE_MQTT */ +/* #undef LWS_SHA1_USE_OPENSSL_NAME */ +#define LWS_SSL_CLIENT_USE_OS_CA_CERTS +/* #undef LWS_SSL_SERVER_WITH_ECDH_CERT */ +/* #undef LWS_WITH_ABSTRACT */ +/* #undef LWS_WITH_ACCESS_LOG */ +/* #undef LWS_WITH_ACME */ +/* #undef LWS_WITH_ALSA */ +/* #undef LWS_WITH_SYS_ASYNC_DNS */ +#define LWS_WITH_BORINGSSL +/* #undef LWS_WITH_CGI */ +#define LWS_WITH_CUSTOM_HEADERS +/* #undef LWS_WITH_DEPRECATED_LWS_DLL */ +/* #undef LWS_WITH_DETAILED_LATENCY */ +#define LWS_WITH_DIR +/* #undef LWS_WITH_ESP32 */ +/* #undef LWS_HAVE_EVBACKEND_LINUXAIO */ +/* #undef LWS_HAVE_EVBACKEND_IOURING */ +/* #undef LWS_WITH_EXTERNAL_POLL */ +#define LWS_WITH_FILE_OPS +/* #undef LWS_WITH_FSMOUNT */ +/* #undef LWS_WITH_FTS */ +/* #undef LWS_WITH_GENCRYPTO */ +/* #undef LWS_WITH_GENERIC_SESSIONS */ +/* #undef LWS_WITH_GLIB */ +/* #undef LWS_WITH_GTK */ +#define LWS_WITH_HTTP2 +#define LWS_WITH_HTTP_BASIC_AUTH +/* #undef LWS_WITH_HTTP_BROTLI */ +/* #undef LWS_WITH_HTTP_PROXY */ +/* #undef LWS_WITH_HTTP_STREAM_COMPRESSION */ +#define LWS_WITH_HTTP_UNCOMMON_HEADERS +/* #undef LWS_WITH_IPV6 */ +/* #undef LWS_WITH_JOSE */ +#define LWS_WITH_LEJP +/* #undef LWS_WITH_LIBEV */ +/* #undef LWS_WITH_LIBEVENT */ +/* #undef LWS_WITH_LIBUV */ +#define LWS_WITH_LWSAC +#define LWS_LOGS_TIMESTAMP +/* #undef LWS_WITH_MBEDTLS */ +/* #undef LWS_WITH_MINIZ */ +#define LWS_WITH_NETWORK +/* #undef LWS_WITH_NO_LOGS */ +#define LWS_WITH_CLIENT +#define LWS_WITHOUT_EXTENSIONS +#define LWS_WITH_SERVER +/* #undef LWS_WITH_SPAWN */ +#define LWS_WITH_PEER_LIMITS +/* #undef LWS_WITH_PLUGINS */ +/* #undef LWS_WITH_POLARSSL */ +#define LWS_WITH_POLL +/* #undef LWS_WITH_RANGES */ +/* #undef LWS_WITH_SECURE_STREAMS */ +/* #undef LWS_WITH_SECURE_STREAMS_SYS_AUTH_API_AMAZON_COM */ +/* #undef LWS_WITH_SECURE_STREAMS_PROXY_API */ +/* #undef LWS_WITH_SELFTESTS */ +#define LWS_WITH_SEQUENCER +/* #undef LWS_WITH_SERVER_STATUS */ +/* #undef LWS_WITH_SMTP */ +/* #undef LWS_WITH_SOCKS5 */ +/* #undef LWS_WITH_STATEFUL_URLDECODE */ +/* #undef LWS_WITH_STATS */ +/* #undef LWS_WITH_STRUCT_SQLITE3 */ +/* #undef LWS_WITH_STRUCT_JSON */ +/* #undef LWS_WITH_SQLITE3 */ +/* #undef LWS_WITH_SYS_NTPCLIENT */ +/* #undef LWS_WITH_SYS_DHCP_CLIENT */ +/* #undef LWS_WITH_THREADPOOL */ +#define LWS_WITH_UDP +/* #undef LWS_WITH_UNIX_SOCK */ +/* #undef LWS_WITH_ZIP_FOPS */ +/* #undef USE_OLD_CYASSL */ +/* #undef USE_WOLFSSL */ +#define LWS_WITH_SYS_STATE + +#endif \ No newline at end of file diff --git a/include/lws_config_private.h b/include/lws_config_private.h index fc270721..1005421b 100644 --- a/include/lws_config_private.h +++ b/include/lws_config_private.h @@ -22,6 +22,8 @@ * IN THE SOFTWARE. */ +#if OHOS_LIBWEBSOCKETS + /* lws_config_private.h.in. Private compilation options. */ #ifndef NDEBUG @@ -133,3 +135,131 @@ /* Defined if you have the header file. */ #define LWS_HAVE_INTTYPES_H + +#else + +/* lws_config_private.h.in. Private compilation options. */ + +#ifndef NDEBUG + #ifndef _DEBUG + #define _DEBUG + #endif +#endif + +/* Define to 1 to use CyaSSL as a replacement for OpenSSL. + * LWS_OPENSSL_SUPPORT needs to be set also for this to work. */ +/* #undef USE_CYASSL */ + +/* Define to 1 if you have the header file. */ +#define LWS_HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#define LWS_HAVE_FCNTL_H + +/* Define to 1 if you have the `fork' function. */ +#define LWS_HAVE_FORK + +/* Define to 1 if you have the `getenv' function. */ +#define LWS_HAVE_GETENV + +/* Define to 1 if you have the header file. */ +/* #undef LWS_HAVE_IN6ADDR_H */ + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#define LWS_HAVE_MALLOC + +/* Define to 1 if you have the header file. */ +#define LWS_HAVE_MEMORY_H + +/* Define to 1 if you have the `memset' function. */ +#define LWS_HAVE_MEMSET + +/* Define to 1 if you have the header file. */ +#define LWS_HAVE_NETINET_IN_H + +/* Define to 1 if your system has a GNU libc compatible `realloc' function, and + to 0 otherwise. */ +#define LWS_HAVE_REALLOC + +/* Define to 1 if you have the `socket' function. */ +#define LWS_HAVE_SOCKET + +/* Define to 1 if you have the header file. */ +#define LWS_HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#define LWS_HAVE_STDLIB_H + +/* Define to 1 if you have the `strerror' function. */ +#define LWS_HAVE_STRERROR + +/* Define to 1 if you have the header file. */ +#define LWS_HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#define LWS_HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +/* #define LWS_HAVE_SYS_PRCTL_H */ + +/* Define to 1 if you have the header file. */ +#define LWS_HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +/* #undef LWS_HAVE_SYS_SOCKIO_H */ + +/* Define to 1 if you have the header file. */ +#define LWS_HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#define LWS_HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#define LWS_HAVE_UNISTD_H + +#define LWS_HAVE_TCP_USER_TIMEOUT + +/* Define to 1 if you have the `vfork' function. */ +#define LWS_HAVE_VFORK + +/* Define to 1 if you have the header file. */ +/* #undef LWS_HAVE_VFORK_H */ + +/* Define to 1 if `fork' works. */ +#define LWS_HAVE_WORKING_FORK + +/* Define to 1 if `vfork' works. */ +#define LWS_HAVE_WORKING_VFORK + +/* Define to 1 if execvpe() exists */ +#define LWS_HAVE_EXECVPE + +/* Define to 1 if you have the header file. */ +/* #undef LWS_HAVE_ZLIB_H */ + +#define LWS_HAVE_GETLOADAVG + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR // We're not using libtool + +/* Define to rpl_malloc if the replacement function should be used. */ +/* #undef malloc */ + +/* Define to rpl_realloc if the replacement function should be used. */ +/* #undef realloc */ + +/* Define to 1 if we have getifaddrs */ +#define LWS_HAVE_GETIFADDRS + +/* Define if the inline keyword doesn't exist. */ +/* #undef inline */ + +/* #undef LWS_WITH_ZLIB */ +#define LWS_HAS_PTHREAD_SETNAME_NP + +/* Defined if you have the header file. */ +#define LWS_HAVE_INTTYPES_H + +#endif \ No newline at end of file -- Gitee From 5a4a92fadcfa7bd4521dd106765c8ab96344f19d Mon Sep 17 00:00:00 2001 From: fupengfei001 Date: Mon, 17 Apr 2023 20:23:59 +0800 Subject: [PATCH 2/3] fupengfei6@huawei.com Signed-off-by: fupengfei001 --- BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILD.gn b/BUILD.gn index fa1dda5c..e48a2bd8 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -285,7 +285,7 @@ config("websockets_public_config") { cflags = ["-Wno-error=warnings"] } -ohos_static_library("websocket_static") { +ohos_static_library("websockets_static") { sources = [ "//third_party/libwebsockets/lib/core-net/adopt.c", "//third_party/libwebsockets/lib/core-net/client/client.c", -- Gitee From 96d9855c22fafea548c232d5b513063f76e11aef Mon Sep 17 00:00:00 2001 From: fupengfei001 Date: Mon, 17 Apr 2023 21:04:22 +0800 Subject: [PATCH 3/3] fupengfei6@huawei.com Signed-off-by: fupengfei001 --- BUILD.gn | 62 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index e48a2bd8..f94449a7 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -229,7 +229,7 @@ ohos_static_library("websockets") { config("websocket_config") { cflags = [ "-Wall", - "-Wsign-compqre", + "-Wsign-compare", "-Wstrict-aliasing", "-Wuninitialized", "-fvisibility=hidden", @@ -277,12 +277,13 @@ config("websockets_public_config") { "//third_party/libwebsockets/win32port/win32helpers", "//third_party/libwebsockets/include", ] - if(platform == "mingw_x86_64") { - include_dirs += ["//third_party/libwebsockets/lib/plat/windows"] - } else if(platform == "mac_arm64" || platform == "mac_x64" || platform == "linux_x64") { - include_dirs += ["//third_party/libwebsockets/lib/plat/unix"] + if (platform == "mingw_x86_64") { + include_dirs += [ "//third_party/libwebsockets/lib/plat/windows" ] + } else if (platform == "mac_arm64" || platform == "mac_x64" || + platform == "linux_x64") { + include_dirs += [ "//third_party/libwebsockets/lib/plat/unix" ] } - cflags = ["-Wno-error=warnings"] + cflags = [ "-Wno-error=#warnings" ] } ohos_static_library("websockets_static") { @@ -311,14 +312,14 @@ ohos_static_library("websockets_static") { "//third_party/libwebsockets/lib/core/context.c", "//third_party/libwebsockets/lib/core/libwebsockets.c", "//third_party/libwebsockets/lib/core/logs.c", - "//third_party/libwebsockets/lib/core/lws_dll2.c", + "//third_party/libwebsockets/lib/core/lws_dll2.c", "//third_party/libwebsockets/lib/core/vfs.c", "//third_party/libwebsockets/lib/event-libs/poll/poll.c", "//third_party/libwebsockets/lib/misc/base64-decode.c", "//third_party/libwebsockets/lib/misc/lejp.c", "//third_party/libwebsockets/lib/misc/lws-ring.c", "//third_party/libwebsockets/lib/misc/lwsac/cached-file.c", - "//third_party/libwebsockets/lib/misc/lwsac/lwsac.c", + "//third_party/libwebsockets/lib/misc/lwsac/lwsac.c", "//third_party/libwebsockets/lib/misc/peer-limits.c", "//third_party/libwebsockets/lib/misc/sha-1.c", "//third_party/libwebsockets/lib/roles/h1/ops-h1.c", @@ -326,9 +327,9 @@ ohos_static_library("websockets_static") { "//third_party/libwebsockets/lib/roles/h2/http2.c", "//third_party/libwebsockets/lib/roles/h2/ops-h2.c", "//third_party/libwebsockets/lib/roles/http/client/client-http.c", + "//third_party/libwebsockets/lib/roles/http/date.c", "//third_party/libwebsockets/lib/roles/http/header.c", "//third_party/libwebsockets/lib/roles/http/parsers.c", - "//third_party/libwebsockets/lib/roles/http/date.c", "//third_party/libwebsockets/lib/roles/http/server/server.c", "//third_party/libwebsockets/lib/roles/listen/ops-listen.c", "//third_party/libwebsockets/lib/roles/pipe/ops-pipe.c", @@ -340,30 +341,31 @@ ohos_static_library("websockets_static") { "//third_party/libwebsockets/lib/roles/ws/server-ws.c", "//third_party/libwebsockets/lib/system/system.c", ] - if(platform == "mingw_x86_64") { + if (platform == "mingw_x86_64") { sources += [ - "//third_party/libwebsockets/lib/plat/windows/windows-fds.c", - "//third_party/libwebsockets/lib/plat/windows/windows-file.c", - "//third_party/libwebsockets/lib/plat/windows/windows-init.c", - "//third_party/libwebsockets/lib/plat/windows/windows-misc.c", - "//third_party/libwebsockets/lib/plat/windows/windows-pipe.c", - "//third_party/libwebsockets/lib/plat/windows/windows-plugins.c", - "//third_party/libwebsockets/lib/plat/windows/windows-service.c", - "//third_party/libwebsockets/lib/plat/windows/windows-socket.c", + "//third_party/libwebsockets/lib/plat/windows/windows-fds.c", + "//third_party/libwebsockets/lib/plat/windows/windows-file.c", + "//third_party/libwebsockets/lib/plat/windows/windows-init.c", + "//third_party/libwebsockets/lib/plat/windows/windows-misc.c", + "//third_party/libwebsockets/lib/plat/windows/windows-pipe.c", + "//third_party/libwebsockets/lib/plat/windows/windows-plugins.c", + "//third_party/libwebsockets/lib/plat/windows/windows-service.c", + "//third_party/libwebsockets/lib/plat/windows/windows-sockets.c", ] - } else if(platform == platform == "mac_arm64" || platform == "mac_x64" || platform == "linux_x64") { - defines = ["LWS_HAVE_SYS_RESOURCE_H"] + } else if (platform == "mac_arm64" || platform == "mac_x64" || + platform == "linux_x64") { + defines = [ "LWS_HAVE_SYS_RESOURCE_H" ] sources += [ - "//third_party/libwebsockets/lib/plat/unix/unix-caps.c", - "//third_party/libwebsockets/lib/plat/unix/unix-fds.c", - "//third_party/libwebsockets/lib/plat/unix/unix-file.c", - "//third_party/libwebsockets/lib/plat/unix/unix-init.c", - "//third_party/libwebsockets/lib/plat/unix/unix-misc.c", - "//third_party/libwebsockets/lib/plat/unix/unix-pipe.c", - "//third_party/libwebsockets/lib/plat/unix/unix-service.c", - "//third_party/libwebsockets/lib/plat/unix/unix-sockets.c", + "//third_party/libwebsockets/lib/plat/unix/unix-caps.c", + "//third_party/libwebsockets/lib/plat/unix/unix-fds.c", + "//third_party/libwebsockets/lib/plat/unix/unix-file.c", + "//third_party/libwebsockets/lib/plat/unix/unix-init.c", + "//third_party/libwebsockets/lib/plat/unix/unix-misc.c", + "//third_party/libwebsockets/lib/plat/unix/unix-pipe.c", + "//third_party/libwebsockets/lib/plat/unix/unix-service.c", + "//third_party/libwebsockets/lib/plat/unix/unix-sockets.c", ] } - config = [":websocket_config"] - public_config = [":websockets_public_config"] + configs = [ ":websocket_config" ] + public_configs = [ ":websockets_public_config" ] } -- Gitee