From c8509588232f6d7f3358610b57d188f24a97882a Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 10:27:10 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=E4=B8=80=E8=87=B4=E6=80=A7=E6=95=B4?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: cy --- BUILD.gn | 1 + bundle.json | 1 + include/lws_config.h | 1 + include/lws_config_private.h | 3 ++- 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/BUILD.gn b/BUILD.gn index 62c0477f..2db68419 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -5,6 +5,7 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # + # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/bundle.json b/bundle.json index 4df4850c..b338efe3 100644 --- a/bundle.json +++ b/bundle.json @@ -5,6 +5,7 @@ "license": "Apache V2.0", "publishAs": "code-segment", "segment": { + "destPath": "third_party/libwebsockets" }, "dirs": {}, diff --git a/include/lws_config.h b/include/lws_config.h index cf9bdd02..7cb1c1f0 100644 --- a/include/lws_config.h +++ b/include/lws_config.h @@ -13,6 +13,7 @@ * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE diff --git a/include/lws_config_private.h b/include/lws_config_private.h index 24897944..aab8c2bd 100644 --- a/include/lws_config_private.h +++ b/include/lws_config_private.h @@ -7,7 +7,8 @@ * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is + * sell copies of the + * Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in -- Gitee From 82942f98c1c63e659ba2a162f9beecbe73b794bb Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 02:44:55 +0000 Subject: [PATCH 02/15] update BUILD.gn. Signed-off-by: cy --- BUILD.gn | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/BUILD.gn b/BUILD.gn index 2db68419..5c2b75cc 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -5,7 +5,6 @@ # # http://www.apache.org/licenses/LICENSE-2.0 # - # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -16,6 +15,11 @@ import("//build/ohos.gni") platform = "${current_os}_${current_cpu}" +if (target_os == "ios") { + libwebsockets_path = rebase_path("//third_party/libwebsockets") + exec_script("for_ios.sh", [ "$libwebsockets_path" ]) +} + ohos_static_library("websockets") { sources = [ "//third_party/libwebsockets/lib/core-net/adopt.c", @@ -105,6 +109,13 @@ ohos_static_library("websockets") { part_name = "libwebsockets" subsystem_name = "thirdparty" + if (target_os != "ios") { + sources += [ + "//third_party/libwebsockets/lib/core-net/route.c", + "//third_party/libwebsockets/lib/roles/netlink/ops-netlink.c", + ] + } + include_dirs = [ "//third_party/libwebsockets/include", "//third_party/libwebsockets/include/libwebsockets", @@ -209,10 +220,20 @@ ohos_static_library("websockets") { "//third_party/glib", ] + if (target_os == "ios") { + sources += [ "//third_party/libwebsockets/lib/core-net/vhost_ios.c" ] + } else { + sources += [ "//third_party/libwebsockets/lib/core-net/vhost.c" ] + } + defines = [ "OHOS_LIBWEBSOCKETS=1", "OPENSSL_SUPPRESS_DEPRECATED", ] + if (target_os == "ios") { + defines += [ "LWS_DETECTED_PLAT_IOS=1" ] + defines += [ "CROSS_PLATFORM_IOS_LIBWEBSOCKETS=1" ] + } cflags = [ "-fPIC", @@ -229,6 +250,7 @@ ohos_static_library("websockets") { deps = [ "//third_party/openssl:libcrypto_shared", "//third_party/openssl:libssl_shared", + "//third_party/zlib:libz", ] external_deps = [ "zlib:libz" ] } -- Gitee From 9e342981db0cce359919cdd366ab1c9b1be2a05d Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 02:45:54 +0000 Subject: [PATCH 03/15] update include/lws_config_private.h. Signed-off-by: cy --- include/lws_config_private.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/include/lws_config_private.h b/include/lws_config_private.h index aab8c2bd..5ce4caae 100644 --- a/include/lws_config_private.h +++ b/include/lws_config_private.h @@ -7,8 +7,7 @@ * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the - * Software, and to permit persons to whom the Software is + * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in @@ -72,10 +71,8 @@ /* Define to 1 if you have the header file. */ #define LWS_HAVE_STRING_H -#if !defined (CROSS_PLATFORM_IOS_LIBWEBSOCKETS) /* Define to 1 if you have the header file. */ #define LWS_HAVE_SYS_PRCTL_H -#endif /* Define to 1 if you have the header file. */ #define LWS_HAVE_SYS_RESOURCE_H -- Gitee From 223466ef7ebaa2e30e3fcf53b20834613a90dcbe Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 02:46:19 +0000 Subject: [PATCH 04/15] update include/lws_config_private.h. Signed-off-by: cy --- include/lws_config_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/lws_config_private.h b/include/lws_config_private.h index 5ce4caae..1005421b 100644 --- a/include/lws_config_private.h +++ b/include/lws_config_private.h @@ -7,7 +7,7 @@ * of this software and associated documentation files (the "Software"), to * deal in the Software without restriction, including without limitation the * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is + * sell copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in -- Gitee From 1c1e4dfba0586447a66cf0a839261f9c5f1554d3 Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 02:47:04 +0000 Subject: [PATCH 05/15] update include/lws_config.h. Signed-off-by: cy --- include/lws_config.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/lws_config.h b/include/lws_config.h index 7cb1c1f0..7f6b4674 100644 --- a/include/lws_config.h +++ b/include/lws_config.h @@ -13,7 +13,6 @@ * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -90,9 +89,7 @@ #define LWS_HAVE_HMAC_CTX_new #define LWS_HAVE_MALLOC_H #define LWS_HAVE_MALLOC_TRIM -#if !defined (CROSS_PLATFORM_IOS_LIBWEBSOCKETS) #define LWS_HAVE_MALLOC_USABLE_SIZE -#endif /* #undef LWS_HAVE_mbedtls_md_setup */ /* #undef LWS_HAVE_mbedtls_net_init */ /* #undef LWS_HAVE_mbedtls_rsa_complete */ @@ -110,10 +107,8 @@ /* #undef LWS_HAVE_NEW_UV_VERSION_H */ #define LWS_HAVE_OPENSSL_ECDH_H #define LWS_HAVE_OPENSSL_STACK -#if !defined (CROSS_PLATFORM_IOS_LIBWEBSOCKETS) #define LWS_HAVE_PIPE2 #define LWS_HAVE_EVENTFD -#endif #define LWS_HAVE_PTHREAD_H #define LWS_HAVE_RSA_SET0_KEY /* #undef LWS_HAVE_RSA_verify_pss_mgf1 */ -- Gitee From dfb595b58e394344fa85722f0e3eb6063afd57bb Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 02:47:41 +0000 Subject: [PATCH 06/15] update bundle.json. Signed-off-by: cy --- bundle.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bundle.json b/bundle.json index b338efe3..7d873382 100644 --- a/bundle.json +++ b/bundle.json @@ -4,8 +4,7 @@ "version": "v4.3.3", "license": "Apache V2.0", "publishAs": "code-segment", - "segment": { - + "segment": { "destPath": "third_party/libwebsockets" }, "dirs": {}, @@ -20,9 +19,10 @@ "rom": "319KB", "ram": "13865KB", "deps": { - "components": [ "zlib" ], + "components": [], "third_party": [ - "openssl" + "openssl", + "zlib" ] }, "build": { -- Gitee From 9324310d654e7eda2a0f42ee0af8211a983c9ccf Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 02:48:15 +0000 Subject: [PATCH 07/15] update BUILD.gn. Signed-off-by: cy --- BUILD.gn | 1 - 1 file changed, 1 deletion(-) diff --git a/BUILD.gn b/BUILD.gn index 5c2b75cc..f8adba2d 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -252,7 +252,6 @@ ohos_static_library("websockets") { "//third_party/openssl:libssl_shared", "//third_party/zlib:libz", ] - external_deps = [ "zlib:libz" ] } config("websocket_config") { -- Gitee From 8411a0edc9a45b6484681326bcfc99a37c38578c Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 03:09:51 +0000 Subject: [PATCH 08/15] update bundle.json. Signed-off-by: cy --- bundle.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bundle.json b/bundle.json index 7d873382..1de247d0 100644 --- a/bundle.json +++ b/bundle.json @@ -19,10 +19,9 @@ "rom": "319KB", "ram": "13865KB", "deps": { - "components": [], + "components": ["zlib"], "third_party": [ - "openssl", - "zlib" + "openssl" ] }, "build": { -- Gitee From 22a031d4f065f172b8bf2100c9b8a7d40fea4f9c Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 03:10:29 +0000 Subject: [PATCH 09/15] update bundle.json. Signed-off-by: cy --- bundle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundle.json b/bundle.json index 1de247d0..51c84d64 100644 --- a/bundle.json +++ b/bundle.json @@ -19,7 +19,7 @@ "rom": "319KB", "ram": "13865KB", "deps": { - "components": ["zlib"], + "components": [ "zlib" ], "third_party": [ "openssl" ] -- Gitee From 7f2cf6e1d451d4a2227e1d40bb64e0d8d38c7947 Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 03:12:52 +0000 Subject: [PATCH 10/15] update BUILD.gn. Signed-off-by: cy --- BUILD.gn | 3 --- 1 file changed, 3 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index f8adba2d..5e56f7c5 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -35,11 +35,9 @@ ohos_static_library("websockets") { "//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/route.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", @@ -83,7 +81,6 @@ ohos_static_library("websockets") { "//third_party/libwebsockets/lib/roles/http/server/lws-spa.c", "//third_party/libwebsockets/lib/roles/http/server/server.c", "//third_party/libwebsockets/lib/roles/listen/ops-listen.c", - "//third_party/libwebsockets/lib/roles/netlink/ops-netlink.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", -- Gitee From 50697f149df449e2aefde4d4a5918ff8f488952a Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 03:46:07 +0000 Subject: [PATCH 11/15] update include/lws_config_private.h. Signed-off-by: cy --- include/lws_config_private.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/lws_config_private.h b/include/lws_config_private.h index 1005421b..24897944 100644 --- a/include/lws_config_private.h +++ b/include/lws_config_private.h @@ -71,8 +71,10 @@ /* Define to 1 if you have the header file. */ #define LWS_HAVE_STRING_H +#if !defined (CROSS_PLATFORM_IOS_LIBWEBSOCKETS) /* Define to 1 if you have the header file. */ #define LWS_HAVE_SYS_PRCTL_H +#endif /* Define to 1 if you have the header file. */ #define LWS_HAVE_SYS_RESOURCE_H -- Gitee From 4b587e523c9165d52bb8cb9a3eee9721f413599d Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 03:47:31 +0000 Subject: [PATCH 12/15] update include/lws_config.h. Signed-off-by: cy --- include/lws_config.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/lws_config.h b/include/lws_config.h index 7f6b4674..ccb3f1ac 100644 --- a/include/lws_config.h +++ b/include/lws_config.h @@ -89,7 +89,9 @@ #define LWS_HAVE_HMAC_CTX_new #define LWS_HAVE_MALLOC_H #define LWS_HAVE_MALLOC_TRIM +#if !defined (CROSS_PLATFORM_IOS_LIBWEBSOCKETS) #define LWS_HAVE_MALLOC_USABLE_SIZE +#endif /* #undef LWS_HAVE_mbedtls_md_setup */ /* #undef LWS_HAVE_mbedtls_net_init */ /* #undef LWS_HAVE_mbedtls_rsa_complete */ -- Gitee From 6fbd8a9bdd19e25dccd3e9da2f0526bb50167af0 Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 03:48:09 +0000 Subject: [PATCH 13/15] update include/lws_config.h. Signed-off-by: cy --- include/lws_config.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/lws_config.h b/include/lws_config.h index ccb3f1ac..cf9bdd02 100644 --- a/include/lws_config.h +++ b/include/lws_config.h @@ -109,8 +109,10 @@ /* #undef LWS_HAVE_NEW_UV_VERSION_H */ #define LWS_HAVE_OPENSSL_ECDH_H #define LWS_HAVE_OPENSSL_STACK +#if !defined (CROSS_PLATFORM_IOS_LIBWEBSOCKETS) #define LWS_HAVE_PIPE2 #define LWS_HAVE_EVENTFD +#endif #define LWS_HAVE_PTHREAD_H #define LWS_HAVE_RSA_SET0_KEY /* #undef LWS_HAVE_RSA_verify_pss_mgf1 */ -- Gitee From e0638abe9cb5a5a7ceaaa93d7933c7257ef5bb93 Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 04:01:06 +0000 Subject: [PATCH 14/15] update bundle.json. Signed-off-by: cy --- bundle.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundle.json b/bundle.json index 51c84d64..4df4850c 100644 --- a/bundle.json +++ b/bundle.json @@ -4,7 +4,7 @@ "version": "v4.3.3", "license": "Apache V2.0", "publishAs": "code-segment", - "segment": { + "segment": { "destPath": "third_party/libwebsockets" }, "dirs": {}, -- Gitee From ad9ae78bbebef834e4448ec97716f8bce2ab930c Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 04:02:46 +0000 Subject: [PATCH 15/15] update BUILD.gn. Signed-off-by: cy --- BUILD.gn | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 5e56f7c5..d3309d55 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -305,7 +305,7 @@ config("websockets_public_config") { if (platform == "mingw_x86_64") { include_dirs += [ "//third_party/libwebsockets/lib/plat/windows" ] } else if (platform == "mac_arm64" || platform == "mac_x64" || - platform == "linux_x64") { + platform == "linux_x64" || platform == "linux_arm64") { include_dirs += [ "//third_party/libwebsockets/lib/plat/unix" ] } cflags = [ "-Wno-error=#warnings" ] @@ -378,7 +378,7 @@ ohos_static_library("websockets_static") { "//third_party/libwebsockets/lib/plat/windows/windows-sockets.c", ] } else if (platform == "mac_arm64" || platform == "mac_x64" || - platform == "linux_x64") { + platform == "linux_x64" || platform == "linux_arm64") { defines = [ "LWS_HAVE_SYS_RESOURCE_H" ] sources += [ "//third_party/libwebsockets/lib/plat/unix/unix-caps.c", -- Gitee