From 136b5879d7d1a382e8b9e61ebc8c1a22082fdef5 Mon Sep 17 00:00:00 2001 From: Patrick Perry Date: Fri, 5 Jun 2026 14:37:54 -0700 Subject: [PATCH] Linux: gate WSC source files and zlib system deps on HC_NOWEBSOCKETS/HC_NOZLIB After #965, websocketpp_websocket.cpp was added to LINUX_SOURCE_FILES unconditionally and install_dependencies.bash installed zlib1g/zlib1g-dev unconditionally. Consumers opting out via HC_NOWEBSOCKETS or HC_NOZLIB still paid the build/dep cost. - CMakeLists.txt: gate websocketpp_websocket.{cpp,h} + x509_cert_utilities.hpp on NOT DEFINED HC_NOWEBSOCKETS (matches existing HC_NOZLIB gating pattern at line 89). - install_dependencies.bash: skip zlib1g/zlib1g-dev when HC_NOZLIB=true or HC_NOWEBSOCKETS=true (compression cannot run without zlib, and websockets are the only consumer of compression). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Build/libHttpClient.Linux/CMakeLists.txt | 11 ++++++++--- Build/libHttpClient.Linux/install_dependencies.bash | 9 ++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Build/libHttpClient.Linux/CMakeLists.txt b/Build/libHttpClient.Linux/CMakeLists.txt index 87622d76..7d298ecb 100644 --- a/Build/libHttpClient.Linux/CMakeLists.txt +++ b/Build/libHttpClient.Linux/CMakeLists.txt @@ -81,11 +81,16 @@ set(LINUX_SOURCE_FILES "${PATH_TO_ROOT}/Source/Platform/Linux/PlatformComponents_Linux.cpp" "${PATH_TO_ROOT}/Source/Task/ThreadPool_stl.cpp" "${PATH_TO_ROOT}/Source/Task/WaitTimer_stl.cpp" - "${PATH_TO_ROOT}/Source/WebSocket/Websocketpp/websocketpp_websocket.cpp" - "${PATH_TO_ROOT}/Source/WebSocket/Websocketpp/websocketpp_websocket.h" - "${PATH_TO_ROOT}/Source/WebSocket/Websocketpp/x509_cert_utilities.hpp" ) +if (NOT DEFINED HC_NOWEBSOCKETS) + list(APPEND LINUX_SOURCE_FILES + "${PATH_TO_ROOT}/Source/WebSocket/Websocketpp/websocketpp_websocket.cpp" + "${PATH_TO_ROOT}/Source/WebSocket/Websocketpp/websocketpp_websocket.h" + "${PATH_TO_ROOT}/Source/WebSocket/Websocketpp/x509_cert_utilities.hpp" + ) +endif() + if (NOT DEFINED HC_NOZLIB) set(ZLIB_SOURCE_FILES "${PATH_TO_ROOT}/External/zlib/adler32.c" diff --git a/Build/libHttpClient.Linux/install_dependencies.bash b/Build/libHttpClient.Linux/install_dependencies.bash index 1b85ec62..377ed5f8 100755 --- a/Build/libHttpClient.Linux/install_dependencies.bash +++ b/Build/libHttpClient.Linux/install_dependencies.bash @@ -26,7 +26,14 @@ done set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters build_dependencies=(clang make autoconf automake libtool) -library_dependencies=(zlib1g zlib1g-dev) +library_dependencies=() + +# zlib is only needed when zlib support is enabled (default on) AND websockets are enabled, +# since WebSocket Compression (HC_ENABLE_WEBSOCKET_COMPRESSION, default ON) depends on zlib. +# Consumers that opt out via HC_NOZLIB=true or HC_NOWEBSOCKETS=true do not need zlib system packages. +if [ "${HC_NOZLIB}" != "true" ] && [ "${HC_NOWEBSOCKETS}" != "true" ]; then + library_dependencies+=(zlib1g zlib1g-dev) +fi if [ "$DO_INSTALL" = false ]; then