From ae11e6dda4c41a2b30500703176028588e44c53c Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 14:44:57 +0800 Subject: [PATCH 1/3] =?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 | 3 ++- bundle.json | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 62c0477f..410446dd 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -19,7 +19,8 @@ ohos_static_library("websockets") { 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/conmon.c", + "//third_party/libwebsocke + ts/lib/core-net/client/conmon.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", diff --git a/bundle.json b/bundle.json index 4df4850c..07e65701 100644 --- a/bundle.json +++ b/bundle.json @@ -15,7 +15,8 @@ "subsystem": "thirdparty", "syscap": [], "features": [], - "adapted_system_type": [ "standard" ], + " + adapted_system_type": [ "standard" ], "rom": "319KB", "ram": "13865KB", "deps": { -- Gitee From 630b87eed81196cc12ea82215a5df6f4bcf85c63 Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 06:50:10 +0000 Subject: [PATCH 2/3] update BUILD.gn. Signed-off-by: cy --- BUILD.gn | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 410446dd..d3309d55 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -15,12 +15,16 @@ 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", "//third_party/libwebsockets/lib/core-net/client/client.c", - "//third_party/libwebsocke - ts/lib/core-net/client/conmon.c", + "//third_party/libwebsockets/lib/core-net/client/conmon.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", @@ -31,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", @@ -79,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", @@ -105,6 +106,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 +217,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,8 +247,8 @@ ohos_static_library("websockets") { deps = [ "//third_party/openssl:libcrypto_shared", "//third_party/openssl:libssl_shared", + "//third_party/zlib:libz", ] - external_deps = [ "zlib:libz" ] } config("websocket_config") { @@ -287,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" ] @@ -360,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 From ac2d2ed36fa6c6e382eefeb144f2c6043b3eba58 Mon Sep 17 00:00:00 2001 From: cy Date: Mon, 6 Jan 2025 06:51:00 +0000 Subject: [PATCH 3/3] 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 07e65701..ec52483f 100644 --- a/bundle.json +++ b/bundle.json @@ -15,14 +15,14 @@ "subsystem": "thirdparty", "syscap": [], "features": [], - " - adapted_system_type": [ "standard" ], + "adapted_system_type": [ "standard" ], "rom": "319KB", "ram": "13865KB", "deps": { - "components": [ "zlib" ], + "components": [], "third_party": [ - "openssl" + "openssl", + "zlib" ] }, "build": { -- Gitee