Improve macOS build system OpenSSL detection and documentation

- Support OPENSSL_ROOT_DIR environment variable for better Homebrew integration
- Fix OpenSSL library path on Darwin (use lib instead of lib64)
- Improve OpenSSL version extraction using grep/sed for better compatibility
- Add TAP test build instructions to BUILD-MACOS.md
pull/5308/head
René Cannaò 3 months ago
parent bd16436ea3
commit 62bc15fd88

@ -10,6 +10,14 @@ endif
# Use pkg-config to get the compiler and linker flags for OpenSSL if CUSTOM_OPENSSL_PATH is not set
ifeq ($(CUSTOM_OPENSSL_PATH),)
ifeq ($(UNAME_S),Darwin)
ifneq ($(OPENSSL_ROOT_DIR),)
CUSTOM_OPENSSL_PATH := $(OPENSSL_ROOT_DIR)
endif
endif
endif
ifeq ($(CUSTOM_OPENSSL_PATH),)
ifeq ($(OPENSSL_PACKAGE),openssl3)
ifeq ($(UNAME_S),Darwin)
@ -49,7 +57,11 @@ endif
endif
else
SSL_IDIR := $(CUSTOM_OPENSSL_PATH)/include
ifeq ($(UNAME_S),Darwin)
SSL_LDIR := $(CUSTOM_OPENSSL_PATH)/lib
else
SSL_LDIR := $(CUSTOM_OPENSSL_PATH)/lib64
endif
ifeq ($(UNAME_S),Darwin)
LIB_SSL_PATH := $(shell find $(SSL_LDIR) -name "libssl.dylib" 2>/dev/null | head -n 1)
ifeq ($(LIB_SSL_PATH),)

@ -10,7 +10,7 @@ ifeq ($(UNAME_S),Darwin)
echo "OpenSSL header file not found at $$header_path"; \
exit 1; \
fi; \
version_number=$$(awk '/# define OPENSSL_VERSION_STR/ {print $$3}' $$header_path | tr -d '"'); \
version_number=$$(grep "# *define OPENSSL_VERSION_STR" $$header_path | sed -E 's/.*"([^"]+)".*/\1/'); \
if [ -z "$$version_number" ]; then \
echo "Failed to extract OPENSSL_VERSION_STR from $$header_path"; \
exit 1; \
@ -49,7 +49,7 @@ else
echo "OpenSSL header file not found at $$header_path"; \
exit 1; \
fi; \
version_number=$$(awk '/# define OPENSSL_VERSION_STR/ {print $$3}' $$header_path | tr -d '"'); \
version_number=$$(grep "# *define OPENSSL_VERSION_STR" $$header_path | sed -E 's/.*"([^"]+)".*/\1/'); \
if [ -z "$$version_number" ]; then \
echo "Failed to extract OPENSSL_VERSION_STR from $$header_path"; \
exit 1; \

@ -47,3 +47,17 @@ If the linker fails to find `libssl` or `libcrypto`, ensure that `OPENSSL_ROOT_D
### Missing ICU Headers
The build system is configured to find `icu4c` via Homebrew. If you encounter errors related to ICU, ensure `icu4c` is installed and the Homebrew prefix is correct.
### Building TAP Tests (Optional)
If you wish to run the TAP tests, you need to build the test dependencies first:
```bash
export OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)
make build_tap_test_debug
```
This will automatically:
1. Build the main ProxySQL debug binary.
2. Download and build MariaDB and MySQL connectors (patched for macOS compatibility).
3. Build the TAP test framework.

Loading…
Cancel
Save