From df97ae9009ca85029c66bddca4a580902e6fd356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Fri, 20 Mar 2026 20:50:57 +0100 Subject: [PATCH] Add documentation for zstd static linking - Add README.md to deps/zstd documenting source and usage - Add comments in deps/Makefile for zstd build rule - Add comments in include/makefiles_paths.mk for ZSTD paths - Update INSTALL.md to note zstd is bundled and statically linked Related: #5462 --- INSTALL.md | 2 ++ deps/Makefile | 3 +++ deps/zstd/README.md | 31 +++++++++++++++++++++++++++++++ deps/zstd/zstd | 1 + include/makefiles_paths.mk | 1 + 5 files changed, 38 insertions(+) create mode 100644 deps/zstd/README.md create mode 120000 deps/zstd/zstd diff --git a/INSTALL.md b/INSTALL.md index 33e727340..8d461933a 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -191,6 +191,8 @@ zypper install -y automake bzip2 cmake make gcc-c++ gcc git openssl openssl-deve brew install automake bzip2 cmake make git gpatch gnutls openssl@3 icu4c pkg-config libiconv zlib ``` +Note: zstd compression library is bundled with ProxySQL and statically linked, so it doesn't need to be installed separately. + To compile on macOS, you must set the following environment variables to ensure the build system can find OpenSSL and Homebrew dependencies: ```bash diff --git a/deps/Makefile b/deps/Makefile index 7c451eb29..724e26aa2 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -175,6 +175,9 @@ lz4/lz4/lib/liblz4.a: lz4: lz4/lz4/lib/liblz4.a +# zstd - Zstandard compression library +# Used for compressed protocol support in MySQL/PostgreSQL connections +# Source: https://github.com/facebook/zstd zstd/zstd/lib/libzstd.a: cd zstd && rm -rf zstd-*/ || true cd zstd && tar -zxf zstd-*.tar.gz diff --git a/deps/zstd/README.md b/deps/zstd/README.md new file mode 100644 index 000000000..9cdd3f0e0 --- /dev/null +++ b/deps/zstd/README.md @@ -0,0 +1,31 @@ +# zstd - Zstandard Compression Library + +This directory contains the zstd compression library used by ProxySQL for +compressed protocol support in MySQL and PostgreSQL connections. + +## Source + +- **Project**: https://github.com/facebook/zstd +- **Version**: 1.5.7 +- **License**: BSD-3-Clause / GPL-2.0-only (dual licensed) + +## Build + +The library is built automatically by the ProxySQL build system: + +```bash +cd deps/zstd && tar -zxf zstd-1.5.7.tar.gz +cd zstd/zstd/lib && make libzstd.a +``` + +## Static Linking + +zstd is statically linked into ProxySQL to eliminate runtime dependencies +on system libraries. This ensures consistent behavior across different +platforms (Linux, macOS, FreeBSD). + +## Usage in ProxySQL + +- MySQL compressed protocol (`mysql_compression`) +- PostgreSQL compressed protocol support +- Used by `mysql_data_stream.cpp` and `MySQL_Protocol.cpp` diff --git a/deps/zstd/zstd b/deps/zstd/zstd new file mode 120000 index 000000000..f71c52150 --- /dev/null +++ b/deps/zstd/zstd @@ -0,0 +1 @@ +zstd-1.5.7 \ No newline at end of file diff --git a/include/makefiles_paths.mk b/include/makefiles_paths.mk index 147f5c2fe..11ac00c1f 100644 --- a/include/makefiles_paths.mk +++ b/include/makefiles_paths.mk @@ -54,6 +54,7 @@ CITYHASH_LDIR := $(CITYHASH_PATH)/src/.libs LZ4_PATH := $(DEPS_PATH)/lz4/lz4 LZ4_LDIR := $(LZ4_PATH)/lib +# Zstandard compression library for protocol compression support ZSTD_PATH := $(DEPS_PATH)/zstd/zstd ZSTD_IDIR := $(ZSTD_PATH)/lib ZSTD_LDIR := $(ZSTD_PATH)/lib