mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-28 03:10:57 +08:00
[libwebsockets] update to 2.4.1
This commit is contained in:
parent
e44c1b292d
commit
933c46267b
@ -1,91 +1,99 @@
|
||||
diff --git a/lib/lws-plat-win.c b/lib/lws-plat-win.c
|
||||
diff --git a/lib/plat/lws-plat-win.c b/lib/plat/lws-plat-win.c
|
||||
index dd3e95a..eb1690a 100644
|
||||
--- a/lib/lws-plat-win.c
|
||||
+++ b/lib/lws-plat-win.c
|
||||
@@ -155,7 +155,7 @@ lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
|
||||
--- a/lib/plat/lws-plat-win.c
|
||||
+++ b/lib/plat/lws-plat-win.c
|
||||
@@ -157,7 +157,7 @@ _lws_plat_service_tsi(struct lws_context *context, int timeout_ms, int tsi)
|
||||
{
|
||||
struct lws_context_per_thread *pt = &context->pt[tsi];
|
||||
struct lws_context_per_thread *pt;
|
||||
WSANETWORKEVENTS networkevents;
|
||||
- struct lws_pollfd *pfd;
|
||||
+ struct lws_pollfd *pfd = NULL;
|
||||
struct lws *wsi;
|
||||
unsigned int i;
|
||||
DWORD ev;
|
||||
@@ -493,6 +493,7 @@ lws_plat_inet_ntop(int af, const void *src, char *dst, int cnt)
|
||||
return ok ? dst : NULL;
|
||||
@@ -591,6 +591,7 @@ lws_plat_inet_pton(int af, const char *src, void *dst)
|
||||
return ok ? 1 : -1;
|
||||
}
|
||||
|
||||
+#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP)
|
||||
static lws_filefd_type
|
||||
_lws_plat_file_open(struct lws *wsi, const char *filename,
|
||||
unsigned long *filelen, int flags)
|
||||
@@ -516,6 +517,35 @@ _lws_plat_file_open(struct lws *wsi, const char *filename,
|
||||
|
||||
return ret;
|
||||
LWS_VISIBLE lws_fop_fd_t
|
||||
_lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
|
||||
const char *vpath, lws_fop_flags_t *flags)
|
||||
@@ -631,6 +632,49 @@ _lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
|
||||
bail:
|
||||
return NULL;
|
||||
}
|
||||
+#else
|
||||
+static lws_filefd_type
|
||||
+_lws_plat_file_open(struct lws *wsi, const char *filename,
|
||||
+ unsigned long *filelen, int flags)
|
||||
+LWS_VISIBLE lws_fop_fd_t
|
||||
+_lws_plat_file_open(const struct lws_plat_file_ops *fops, const char *filename,
|
||||
+ const char *vpath, lws_fop_flags_t *flags)
|
||||
+{
|
||||
+ HANDLE ret;
|
||||
+ WCHAR buf[MAX_PATH];
|
||||
+ HANDLE ret;
|
||||
+ WCHAR buf[MAX_PATH];
|
||||
+ lws_fop_fd_t fop_fd;
|
||||
+ LARGE_INTEGER llFileSize = {0};
|
||||
+
|
||||
+ (void)wsi;
|
||||
+ MultiByteToWideChar(CP_UTF8, 0, filename, -1, buf, ARRAY_SIZE(buf));
|
||||
+ if ((flags & 7) == _O_RDONLY) {
|
||||
+ ret = CreateFile2(buf, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, NULL);
|
||||
+ }
|
||||
+ else {
|
||||
+ lwsl_err("%s: open for write not implemented\n", __func__);
|
||||
+ *filelen = 0;
|
||||
+ return LWS_INVALID_FILE;
|
||||
+ }
|
||||
+ MultiByteToWideChar(CP_UTF8, 0, filename, -1, buf, ARRAY_SIZE(buf));
|
||||
+ if (((*flags) & 7) == _O_RDONLY) {
|
||||
+ ret = CreateFile2(buf, GENERIC_READ, FILE_SHARE_READ,
|
||||
+ OPEN_EXISTING, NULL);
|
||||
+ } else {
|
||||
+ lwsl_err("%s: open for write not implemented\n", __func__);
|
||||
+ *filelen = 0;
|
||||
+ ret = LWS_INVALID_FILE;
|
||||
+ }
|
||||
+
|
||||
+ if (ret != LWS_INVALID_FILE)
|
||||
+ {
|
||||
+ struct stat info;
|
||||
+ int result = stat(filename, &info);
|
||||
+ *filelen = result != 0 ? -1 : (long)(info.st_size);
|
||||
+ }
|
||||
+ if (ret == LWS_INVALID_FILE)
|
||||
+ goto bail;
|
||||
+
|
||||
+ return ret;
|
||||
+ fop_fd = malloc(sizeof(*fop_fd));
|
||||
+ if (!fop_fd)
|
||||
+ goto bail;
|
||||
+
|
||||
+ fop_fd->fops = fops;
|
||||
+ fop_fd->fd = ret;
|
||||
+ fop_fd->filesystem_priv = NULL; /* we don't use it */
|
||||
+ fop_fd->flags = *flags;
|
||||
+ fop_fd->len = GetFileSize(ret, NULL);
|
||||
+ if(GetFileSizeEx(ret, &llFileSize))
|
||||
+ fop_fd->len = llFileSize.QuadPart;
|
||||
+
|
||||
+ fop_fd->pos = 0;
|
||||
+
|
||||
+ return fop_fd;
|
||||
+
|
||||
+bail:
|
||||
+ return NULL;
|
||||
+}
|
||||
+#endif
|
||||
|
||||
static int
|
||||
_lws_plat_file_close(struct lws *wsi, lws_filefd_type fd)
|
||||
LWS_VISIBLE int
|
||||
_lws_plat_file_close(lws_fop_fd_t *fop_fd)
|
||||
diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h
|
||||
index 23f8f4d..bc32aef 100644
|
||||
--- a/lib/private-libwebsockets.h
|
||||
+++ b/lib/private-libwebsockets.h
|
||||
@@ -48,12 +48,25 @@
|
||||
@@ -111,12 +111,23 @@
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
+
|
||||
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
|
||||
+ #ifndef WINVER
|
||||
+ #define WINVER 0x0602
|
||||
+ #define _WIN32_WINNT WINVER
|
||||
+ #endif
|
||||
+#ifndef WINVER
|
||||
+#define WINVER 0x0602
|
||||
+#define _WIN32_WINNT WINVER
|
||||
+#endif
|
||||
+
|
||||
+ #define getenv(x) NULL
|
||||
+ #define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
+#define getenv(x) NULL
|
||||
+#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
+#else
|
||||
+
|
||||
#if (WINVER < 0x0501)
|
||||
-#undef WINVER
|
||||
-#undef _WIN32_WINNT
|
||||
-#define WINVER 0x0501
|
||||
-#define _WIN32_WINNT WINVER
|
||||
+ #undef WINVER
|
||||
+ #undef _WIN32_WINNT
|
||||
+ #define WINVER 0x0501
|
||||
+ #define _WIN32_WINNT WINVER
|
||||
+ #endif
|
||||
#undef WINVER
|
||||
#undef _WIN32_WINNT
|
||||
#define WINVER 0x0501
|
||||
#define _WIN32_WINNT WINVER
|
||||
#endif
|
||||
+
|
||||
+#endif
|
||||
#define LWS_NO_DAEMONIZE
|
||||
#define LWS_ERRNO WSAGetLastError()
|
||||
#define LWS_EAGAIN WSAEWOULDBLOCK
|
||||
|
@ -1,4 +1,4 @@
|
||||
Source: libwebsockets
|
||||
Version: 2.0.0-4
|
||||
Version: 2.4.1
|
||||
Build-Depends: zlib, openssl
|
||||
Description: Libwebsockets is a lightweight pure C library built to use minimal CPU and memory resources, and provide fast throughput in both directions as client or server.
|
||||
|
@ -3,8 +3,8 @@ include(vcpkg_common_functions)
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO warmcat/libwebsockets
|
||||
REF v2.0.0
|
||||
SHA512 26bc09877c1595b80b08e788e4ae3908af86b67e19f4b9f7ac48d90783cf5c563d4d03e5586d18f6bb8e67d15a03d000f31f67f3a327d898844f77e5d22f7c9d
|
||||
REF v2.4.1
|
||||
SHA512 a5f6a3388517d6f46183dfd1e625475ac1d4d509690e431a581d6ca927078fa50ac9a0787b4305fe088c694af1809335020bfc083a4d4d98585143f13ff61c75
|
||||
HEAD_REF master
|
||||
)
|
||||
|
||||
@ -35,7 +35,21 @@ vcpkg_install_cmake()
|
||||
vcpkg_fixup_cmake_targets(CONFIG_PATH "cmake")
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/libwebsockets-test-server)
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/share/libwebsockets/LibwebsocketsConfig.cmake LIBWEBSOCKETSCONFIG_CMAKE)
|
||||
string(REPLACE "/../include" "/../../include" LIBWEBSOCKETSCONFIG_CMAKE "${LIBWEBSOCKETSCONFIG_CMAKE}")
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/share/libwebsockets/LibwebsocketsConfig.cmake "${LIBWEBSOCKETSCONFIG_CMAKE}")
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/share/libwebsockets/LibwebsocketsTargets-debug.cmake LIBWEBSOCKETSTARGETSDEBUG_CMAKE)
|
||||
string(REPLACE "websockets_static.lib" "websockets.lib" LIBWEBSOCKETSTARGETSDEBUG_CMAKE "${LIBWEBSOCKETSTARGETSDEBUG_CMAKE}")
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/share/libwebsockets/LibwebsocketsTargets-debug.cmake "${LIBWEBSOCKETSTARGETSDEBUG_CMAKE}")
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/share/libwebsockets/LibwebsocketsTargets-release.cmake LIBWEBSOCKETSTARGETSRELEASE_CMAKE)
|
||||
string(REPLACE "websockets_static.lib" "websockets.lib" LIBWEBSOCKETSTARGETSRELEASE_CMAKE "${LIBWEBSOCKETSTARGETSRELEASE_CMAKE}")
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/share/libwebsockets/LibwebsocketsTargets-release.cmake "${LIBWEBSOCKETSTARGETSRELEASE_CMAKE}")
|
||||
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libwebsockets)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libwebsockets/LICENSE ${CURRENT_PACKAGES_DIR}/share/libwebsockets/copyright)
|
||||
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/debug/lib/websockets_static.lib ${CURRENT_PACKAGES_DIR}/debug/lib/websockets.lib)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/lib/websockets_static.lib ${CURRENT_PACKAGES_DIR}/lib/websockets.lib)
|
||||
endif ()
|
||||
vcpkg_copy_pdbs()
|
||||
|
Loading…
x
Reference in New Issue
Block a user