diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/libwebsockets | |
Diffstat (limited to 'vcpkg/ports/libwebsockets')
| -rw-r--r-- | vcpkg/ports/libwebsockets/export-include-path.patch | 35 | ||||
| -rw-r--r-- | vcpkg/ports/libwebsockets/fix-build-error.patch | 24 | ||||
| -rw-r--r-- | vcpkg/ports/libwebsockets/fix-dependency-libuv.patch | 13 | ||||
| -rw-r--r-- | vcpkg/ports/libwebsockets/portfile.cmake | 192 | ||||
| -rw-r--r-- | vcpkg/ports/libwebsockets/vcpkg.json | 25 |
5 files changed, 289 insertions, 0 deletions
diff --git a/vcpkg/ports/libwebsockets/export-include-path.patch b/vcpkg/ports/libwebsockets/export-include-path.patch new file mode 100644 index 0000000..530d34f --- /dev/null +++ b/vcpkg/ports/libwebsockets/export-include-path.patch @@ -0,0 +1,35 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt (revision b0a749c8e7a8294b68581ce4feac0e55045eb00b) ++++ b/CMakeLists.txt (date 1669850632899) +@@ -1071,8 +1071,8 @@ + "${LWS_ABSOLUTE_INSTALL_CMAKE_DIR}" + "${LWS_ABSOLUTE_INSTALL_INCLUDE_DIR}") # Calculate the relative directory from the cmake dir. + +-if (DEFINED REL_INCLUDE_DIR) +- set(LWS__INCLUDE_DIRS "\${LWS_CMAKE_DIR}/${REL_INCLUDE_DIR}") ++if (1) ++ set(LWS__INCLUDE_DIRS "\${CMAKE_CURRENT_LIST_DIR}/../include") + endif() + if (DEFINED OPENSSL_INCLUDE_DIRS) + set(LWS__INCLUDE_DIRS "${LWS__INCLUDE_DIRS};${OPENSSL_INCLUDE_DIRS}") +diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt +--- a/lib/CMakeLists.txt (revision b0a749c8e7a8294b68581ce4feac0e55045eb00b) ++++ b/lib/CMakeLists.txt (date 1669850782017) +@@ -174,7 +174,7 @@ + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include> + $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../include> + ) +- target_include_directories(websockets PRIVATE ${LWS_LIB_BUILD_INC_PATHS}) ++ target_include_directories(websockets PRIVATE $<BUILD_INTERFACE:${LWS_LIB_BUILD_INC_PATHS}> PUBLIC $<INSTALL_INTERFACE:include>) + target_compile_definitions(websockets PRIVATE LWS_BUILDING_STATIC) + target_include_directories(websockets PUBLIC ${LWS_PUBLIC_INCLUDES}) + set(LWS_PUBLIC_INCLUDES ${LWS_PUBLIC_INCLUDES} PARENT_SCOPE) +@@ -202,7 +202,7 @@ + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include> + $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../include> + ) +- target_include_directories(websockets_shared PRIVATE ${LWS_LIB_BUILD_INC_PATHS}) ++ target_include_directories(websockets_shared PRIVATE $<BUILD_INTERFACE:${LWS_LIB_BUILD_INC_PATHS}> PUBLIC $<INSTALL_INTERFACE:include>) + target_compile_definitions(websockets_shared PRIVATE LWS_BUILDING_SHARED) + target_include_directories(websockets_shared PUBLIC ${LWS_PUBLIC_INCLUDES}) + set(LWS_PUBLIC_INCLUDES ${LWS_PUBLIC_INCLUDES} PARENT_SCOPE) diff --git a/vcpkg/ports/libwebsockets/fix-build-error.patch b/vcpkg/ports/libwebsockets/fix-build-error.patch new file mode 100644 index 0000000..204d496 --- /dev/null +++ b/vcpkg/ports/libwebsockets/fix-build-error.patch @@ -0,0 +1,24 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt (revision b0a749c8e7a8294b68581ce4feac0e55045eb00b) ++++ b/CMakeLists.txt (date 1669850509296) +@@ -494,6 +494,11 @@ + set(LWS_EXT_PTHREAD_INCLUDE_DIR CACHE PATH "Path to an external pthreads include directory") + set(LWS_EXT_PTHREAD_LIBRARIES CACHE PATH "Path to an external pthreads library") + ++if(WIN32) ++ find_package(pthreads_windows REQUIRED) ++ set(LWS_EXT_PTHREAD_INCLUDE_DIR ${PThreads4W_INCLUDE_DIR}) ++ set(LWS_EXT_PTHREAD_LIBRARIES ${PThreads4W_LIBRARY}) ++endif() + + if (LWS_WITH_HTTP_STREAM_COMPRESSION) + set(LWS_WITH_ZLIB 1) +@@ -850,7 +855,7 @@ + # Turn off pointless microsoft security warnings. + add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE) + # Fail the build if any warnings +- add_compile_options(/W3 /WX) ++ add_compile_options(/W3 /WX /wd4142 /wd4267 /wd4996) + # Unbreak MSVC broken preprocessor __VA_ARGS__ behaviour + if (MSVC_VERSION GREATER 1925) + add_compile_options(/Zc:preprocessor /wd5105) diff --git a/vcpkg/ports/libwebsockets/fix-dependency-libuv.patch b/vcpkg/ports/libwebsockets/fix-dependency-libuv.patch new file mode 100644 index 0000000..1c63d25 --- /dev/null +++ b/vcpkg/ports/libwebsockets/fix-dependency-libuv.patch @@ -0,0 +1,13 @@ +diff --git a/lib/event-libs/libuv/CMakeLists.txt b/lib/event-libs/libuv/CMakeLists.txt +index fb810a8..2258ade 100644 +--- a/lib/event-libs/libuv/CMakeLists.txt ++++ b/lib/event-libs/libuv/CMakeLists.txt +@@ -36,7 +36,7 @@ set(LWS_LIBUV_INCLUDE_DIRS CACHE PATH "Path to the libuv include directory") + if ("${LWS_LIBUV_LIBRARIES}" STREQUAL "" OR "${LWS_LIBUV_INCLUDE_DIRS}" STREQUAL "") + if (NOT LIBUV_FOUND) + find_path(LIBUV_INCLUDE_DIRS NAMES uv.h) +- find_library(LIBUV_LIBRARIES NAMES uv) ++ find_library(LIBUV_LIBRARIES NAMES uv libuv) + endif() + else() + set(LIBUV_LIBRARIES ${LWS_LIBUV_LIBRARIES}) diff --git a/vcpkg/ports/libwebsockets/portfile.cmake b/vcpkg/ports/libwebsockets/portfile.cmake new file mode 100644 index 0000000..9348f6f --- /dev/null +++ b/vcpkg/ports/libwebsockets/portfile.cmake @@ -0,0 +1,192 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO warmcat/libwebsockets + REF "v${VERSION}" + SHA512 86f85066ce0e9f7f29af5b7c7be803bd19f1a7e6afd8bcdd7c3afc1a66735324317852d7b19bbe9a5af69e759ec532dd28bebffa256f3e1c30ade7ead41a4275 + HEAD_REF master + PATCHES + fix-dependency-libuv.patch + fix-build-error.patch + export-include-path.patch +) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" LWS_WITH_STATIC) +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" LWS_WITH_SHARED) +string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "static" STATIC_CRT) + +## All LWS options could be possible features: +# # +# # Major individual features +# # +# option(LWS_WITH_NETWORK "Compile with network-related code" ON) +# option(LWS_ROLE_H1 "Compile with support for http/1 (needed for ws)" ON) +# option(LWS_ROLE_WS "Compile with support for websockets" ON) +# option(LWS_ROLE_DBUS "Compile with support for DBUS" OFF) +# option(LWS_ROLE_RAW_PROXY "Raw packet proxy" OFF) +# option(LWS_WITH_HTTP2 "Compile with server support for HTTP/2" ON) +# option(LWS_WITH_LWSWS "Libwebsockets Webserver" OFF) +# option(LWS_WITH_CGI "Include CGI (spawn process with network-connected stdin/out/err) APIs" OFF) +# option(LWS_IPV6 "Compile with support for ipv6" OFF) +# option(LWS_UNIX_SOCK "Compile with support for UNIX domain socket" OFF) +# option(LWS_WITH_PLUGINS "Support plugins for protocols and extensions" OFF) +# option(LWS_WITH_HTTP_PROXY "Support for HTTP proxying" OFF) +# option(LWS_WITH_ZIP_FOPS "Support serving pre-zipped files" OFF) +# option(LWS_WITH_SOCKS5 "Allow use of SOCKS5 proxy on client connections" OFF) +# option(LWS_WITH_GENERIC_SESSIONS "With the Generic Sessions plugin" OFF) +# option(LWS_WITH_PEER_LIMITS "Track peers and restrict resources a single peer can allocate" OFF) +# option(LWS_WITH_ACCESS_LOG "Support generating Apache-compatible access logs" OFF) +# option(LWS_WITH_RANGES "Support http ranges (RFC7233)" OFF) +# option(LWS_WITH_SERVER_STATUS "Support json + jscript server monitoring" OFF) +# option(LWS_WITH_THREADPOOL "Managed worker thread pool support (relies on pthreads)" OFF) +# option(LWS_WITH_HTTP_STREAM_COMPRESSION "Support HTTP stream compression" OFF) +# option(LWS_WITH_HTTP_BROTLI "Also offer brotli http stream compression (requires LWS_WITH_HTTP_STREAM_COMPRESSION)" OFF) +# option(LWS_WITH_ACME "Enable support for ACME automatic cert acquisition + maintenance (letsencrypt etc)" OFF) +# option(LWS_WITH_HUBBUB "Enable libhubbub rewriting support" OFF) +# option(LWS_WITH_FTS "Full Text Search support" OFF) +# # +# # TLS library options... all except mbedTLS are basically OpenSSL variants. +# # +# option(LWS_WITH_SSL "Include SSL support (defaults to OpenSSL or similar, mbedTLS if LWS_WITH_MBEDTLS is set)" ON) +# option(LWS_WITH_MBEDTLS "Use mbedTLS (>=2.0) replacement for OpenSSL. When setting this, you also may need to specify LWS_MBEDTLS_LIBRARIES and LWS_MBEDTLS_INCLUDE_DIRS" OFF) +# option(LWS_WITH_BORINGSSL "Use BoringSSL replacement for OpenSSL" OFF) +# option(LWS_WITH_CYASSL "Use CyaSSL replacement for OpenSSL. When setting this, you also need to specify LWS_CYASSL_LIBRARIES and LWS_CYASSL_INCLUDE_DIRS" OFF) +# option(LWS_WITH_WOLFSSL "Use wolfSSL replacement for OpenSSL. When setting this, you also need to specify LWS_WOLFSSL_LIBRARIES and LWS_WOLFSSL_INCLUDE_DIRS" OFF) +# option(LWS_SSL_CLIENT_USE_OS_CA_CERTS "SSL support should make use of the OS-installed CA root certs" ON) +# # +# # Event library options (may select multiple, or none for default poll() +# # +# option(LWS_WITH_LIBEV "Compile with support for libev" OFF) +# option(LWS_WITH_LIBUV "Compile with support for libuv" OFF) +# option(LWS_WITH_LIBEVENT "Compile with support for libevent" OFF) +# # +# # Static / Dynamic build options +# # +# option(LWS_WITH_STATIC "Build the static version of the library" ON) +# option(LWS_WITH_SHARED "Build the shared version of the library" ON) +# option(LWS_LINK_TESTAPPS_DYNAMIC "Link the test apps to the shared version of the library. Default is to link statically" OFF) +# option(LWS_STATIC_PIC "Build the static version of the library with position-independent code" OFF) +# # +# # Specific platforms +# # +# option(LWS_WITH_ESP32 "Build for ESP32" OFF) +# option(LWS_WITH_ESP32_HELPER "Build ESP32 helper" OFF) +# option(LWS_PLAT_OPTEE "Build for OPTEE" OFF) +# # +# # Client / Server / Test Apps build control +# # +# option(LWS_WITHOUT_CLIENT "Don't build the client part of the library" OFF) +# option(LWS_WITHOUT_SERVER "Don't build the server part of the library" OFF) +# option(LWS_WITHOUT_TESTAPPS "Don't build the libwebsocket-test-apps" OFF) +# option(LWS_WITHOUT_TEST_SERVER "Don't build the test server" OFF) +# option(LWS_WITHOUT_TEST_SERVER_EXTPOLL "Don't build the test server version that uses external poll" OFF) +# option(LWS_WITHOUT_TEST_PING "Don't build the ping test application" OFF) +# option(LWS_WITHOUT_TEST_CLIENT "Don't build the client test application" OFF) +# # +# # Extensions (permessage-deflate) +# # +# option(LWS_WITHOUT_EXTENSIONS "Don't compile with extensions" ON) +# # +# # Helpers + misc +# # +# option(LWS_WITHOUT_BUILTIN_GETIFADDRS "Don't use the BSD getifaddrs implementation from libwebsockets if it is missing (this will result in a compilation error) ... The default is to assume that your libc provides it. On some systems such as uclibc it doesn't exist." OFF) +# option(LWS_FALLBACK_GETHOSTBYNAME "Also try to do dns resolution using gethostbyname if getaddrinfo fails" OFF) +# option(LWS_WITHOUT_BUILTIN_SHA1 "Don't build the lws sha-1 (eg, because openssl will provide it" OFF) +# option(LWS_WITH_LATENCY "Build latency measuring code into the library" OFF) +# option(LWS_WITHOUT_DAEMONIZE "Don't build the daemonization api" ON) +# option(LWS_SSL_SERVER_WITH_ECDH_CERT "Include SSL server use ECDH certificate" OFF) +# option(LWS_WITH_LEJP "With the Lightweight JSON Parser" ON) +# option(LWS_WITH_SQLITE3 "Require SQLITE3 support" OFF) +# option(LWS_WITH_STRUCT_JSON "Generic struct serialization to and from JSON" ON) +# option(LWS_WITH_STRUCT_SQLITE3 "Generic struct serialization to and from SQLITE3" OFF) +# option(LWS_WITH_SMTP "Provide SMTP support" OFF) +# if (WIN32 OR LWS_WITH_ESP32) +# option(LWS_WITH_DIR "Directory scanning api support" OFF) +# option(LWS_WITH_LEJP_CONF "With LEJP configuration parser as used by lwsws" OFF) +# else() +# option(LWS_WITH_DIR "Directory scanning api support" ON) +# option(LWS_WITH_LEJP_CONF "With LEJP configuration parser as used by lwsws" ON) +# endif() +# option(LWS_WITH_NO_LOGS "Disable all logging from being compiled in" OFF) +# option(LWS_AVOID_SIGPIPE_IGN "Android 7+ reportedly needs this" OFF) +# option(LWS_WITH_STATS "Keep statistics of lws internal operations" OFF) +# option(LWS_WITH_JOSE "JSON Web Signature / Encryption / Keys (RFC7515/6/) API" OFF) +# option(LWS_WITH_GENCRYPTO "Enable support for Generic Crypto apis independent of TLS backend" OFF) +# option(LWS_WITH_SELFTESTS "Selftests run at context creation" OFF) +# option(LWS_WITH_GCOV "Build with gcc gcov coverage instrumentation" OFF) +# option(LWS_WITH_EXPORT_LWSTARGETS "Export libwebsockets CMake targets. Disable if they conflict with an outer cmake project." ON) +# option(LWS_REPRODUCIBLE "Build libwebsockets reproducible. It removes the build user and hostname from the build" ON) +# option(LWS_WITH_MINIMAL_EXAMPLES "Also build the normally standalone minimal examples, for QA" OFF) +# option(LWS_WITH_LWSAC "lwsac Chunk Allocation api" ON) +# option(LWS_WITH_CUSTOM_HEADERS "Store and allow querying custom HTTP headers (H1 only)" ON) +# option(LWS_WITH_DISKCACHE "Hashed cache directory with lazy LRU deletion to size limit" OFF) +# option(LWS_WITH_ASAN "Build with gcc runtime sanitizer options enabled (needs libasan)" OFF) +# option(LWS_WITH_DIR "Directory scanning api support" OFF) +# option(LWS_WITH_LEJP_CONF "With LEJP configuration parser as used by lwsws" OFF) +# option(LWS_WITH_ZLIB "Include zlib support (required for extensions)" OFF) +# option(LWS_WITH_BUNDLED_ZLIB "Use bundled zlib version (Windows only)" ${LWS_WITH_BUNDLED_ZLIB_DEFAULT}) +# option(LWS_WITH_MINIZ "Use miniz instead of zlib" OFF) +# option(LWS_WITH_DEPRECATED_LWS_DLL "Migrate to lws_dll2 instead ASAP" OFF) +# option(LWS_WITH_SEQUENCER "lws_seq_t support" ON) +# option(LWS_WITH_EXTERNAL_POLL "Support external POLL integration using callback messages (not recommended)" OFF) +# option(LWS_WITH_LWS_DSH "Support lws_dsh_t Disordered Shared Heap" OFF) +## + +set(EXTRA_ARGS) +if(NOT VCPKG_TARGET_ARCHITECTURE STREQUAL "wasm32") + set(EXTRA_ARGS "-DLWS_WITH_LIBUV=ON") +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${EXTRA_ARGS} + -DLWS_WITH_STATIC=${LWS_WITH_STATIC} + -DLWS_WITH_SHARED=${LWS_WITH_SHARED} + -DLWS_MSVC_STATIC_RUNTIME=${STATIC_CRT} + -DLWS_WITH_GENCRYPTO=ON + -DLWS_WITH_TLS=ON + -DLWS_WITH_BUNDLED_ZLIB=OFF + -DLWS_WITHOUT_TESTAPPS=ON + -DLWS_IPV6=ON + -DLWS_WITH_HTTP2=ON + -DLWS_WITH_HTTP_STREAM_COMPRESSION=ON # Since zlib is already a dependency + -DLWS_WITH_EXTERNAL_POLL=ON + # OPTIONS_RELEASE -DOPTIMIZE=1 + # OPTIONS_DEBUG -DDEBUGGABLE=1 +) + +vcpkg_cmake_install() + +if (VCPKG_TARGET_IS_WINDOWS) + vcpkg_cmake_config_fixup(CONFIG_PATH cmake) +else() + vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/libwebsockets) +endif() + +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/libwebsockets-config.cmake" LIBWEBSOCKETSCONFIG_CMAKE) +string(REPLACE "/../include" "/../../include" LIBWEBSOCKETSCONFIG_CMAKE "${LIBWEBSOCKETSCONFIG_CMAKE}") +file(WRITE "${CURRENT_PACKAGES_DIR}/share/libwebsockets/libwebsockets-config.cmake" "${LIBWEBSOCKETSCONFIG_CMAKE}") + +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + vcpkg_replace_string( "${CURRENT_PACKAGES_DIR}/share/libwebsockets/LibwebsocketsTargets-debug.cmake" "websockets_static.lib" "websockets.lib" IGNORE_UNCHANGED) +endif() + +if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + vcpkg_replace_string( "${CURRENT_PACKAGES_DIR}/share/libwebsockets/LibwebsocketsTargets-release.cmake" "websockets_static.lib" "websockets.lib" IGNORE_UNCHANGED) +endif() + +if (VCPKG_LIBRARY_LINKAGE STREQUAL static) + if (VCPKG_TARGET_IS_WINDOWS) + 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() +endif () + +vcpkg_copy_pdbs() +vcpkg_fixup_pkgconfig() +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/lws_config.h" "${CURRENT_PACKAGES_DIR}" "") + +file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/vcpkg/ports/libwebsockets/vcpkg.json b/vcpkg/ports/libwebsockets/vcpkg.json new file mode 100644 index 0000000..12f54b1 --- /dev/null +++ b/vcpkg/ports/libwebsockets/vcpkg.json @@ -0,0 +1,25 @@ +{ + "name": "libwebsockets", + "version-semver": "4.4.1", + "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.", + "homepage": "https://libwebsockets.org/", + "license": "MIT", + "supports": "!uwp", + "dependencies": [ + { + "name": "libuv", + "platform": "!emscripten" + }, + "openssl", + "pthreads", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "zlib" + ] +} |