diff --git a/common_mk/openssl_flags.mk b/common_mk/openssl_flags.mk index 4b709e7aa9..97d2764eaa 100644 --- a/common_mk/openssl_flags.mk +++ b/common_mk/openssl_flags.mk @@ -14,12 +14,12 @@ $(info OPENSSL_PACKAGE: $(OPENSSL_PACKAGE)) ifeq ($(CUSTOM_OPENSSL_PATH),) $(info No custom path specified.) ifeq ($(OPENSSL_PACKAGE),openssl3) - SSL_IDIR := $(shell pkg-config --cflags $(OPENSSL_PACKAGE) | grep -oP "(?<=-I)[^ ]+") + SSL_IDIR := $(shell pkg-config --cflags $(OPENSSL_PACKAGE) | sed -n 's/.*-I\([^ ]*\).*/\1/p') SSL_LDIR := $(shell pkg-config --variable=libdir $(OPENSSL_PACKAGE)) LIB_SSL_PATH := $(shell find $(SSL_LDIR) -name "libssl.so.3" 2>/dev/null | head -n 1) LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -name "libcrypto.so.3" 2>/dev/null | head -n 1) else - SSL_IDIR := $(shell export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1; export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1; pkg-config --cflags $(OPENSSL_PACKAGE) | grep -oP "(?<=-I)[^ ]+") + SSL_IDIR := $(shell export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1; export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1; pkg-config --cflags $(OPENSSL_PACKAGE) | sed -n 's/.*-I\([^ ]*\).*/\1/p') SSL_LDIR := $(shell pkg-config --variable=libdir $(OPENSSL_PACKAGE)) LIB_SSL_PATH := $(shell find $(SSL_LDIR) -name "libssl.so" 2>/dev/null | head -n 1) LIB_CRYPTO_PATH := $(shell find $(SSL_LDIR) -name "libcrypto.so" 2>/dev/null | head -n 1) @@ -44,4 +44,4 @@ else endif else $(error Warning: OpenSSL headers (SSL_IDIR) not found. Exiting. Please install OpenSSL version 3.) -endif \ No newline at end of file +endif diff --git a/common_mk/openssl_version_check.mk b/common_mk/openssl_version_check.mk index fceccbca1a..f15d312e63 100644 --- a/common_mk/openssl_version_check.mk +++ b/common_mk/openssl_version_check.mk @@ -11,7 +11,7 @@ check_openssl_version: echo "OpenSSL header file not found at $$header_path"; \ exit 1; \ fi; \ - version_number=$$(grep -oP '# define OPENSSL_VERSION_STR "\K[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?' $$header_path | tr -d '[:space:]'); \ + version_number=$$(grep OPENSSL_VERSION_STR $$header_path | sed -n 's/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/p'); \ if [ -z "$$version_number" ]; then \ echo "Failed to extract OPENSSL_VERSION_STR from $$header_path"; \ exit 1; \ @@ -41,4 +41,4 @@ check_openssl_version: echo "OpenSSL version must be >= $(REQUIRED_OPENSSL_VERSION). Detected: $$openssl_version"; \ exit 1; \ fi; \ - fi \ No newline at end of file + fi diff --git a/deps/Makefile b/deps/Makefile index 59440ec1f2..15e8674056 100644 --- a/deps/Makefile +++ b/deps/Makefile @@ -302,12 +302,12 @@ pcre: pcre/pcre/.libs/libpcre.a postgresql/postgresql/src/interfaces/libpq/libpq.a: cd postgresql && rm -rf postgresql-*/ || true cd postgresql && tar -zxf postgresql-*.tar.gz - cd postgresql/postgresql && patch -p0 < ../get_result_from_pgconn.patch + cd postgresql/postgresql && patch -p0 -l < ../get_result_from_pgconn.patch cd postgresql/postgresql && patch -p0 < ../handle_row_data.patch cd postgresql/postgresql && patch -p0 < ../fmt_err_msg.patch cd postgresql/postgresql && patch -p0 < ../bind_fmt_text.patch #cd postgresql/postgresql && LD_LIBRARY_PATH="$(shell pwd)/libssl/openssl" ./configure --with-ssl=openssl --with-includes="$(shell pwd)/libssl/openssl/include/" --with-libraries="$(shell pwd)/libssl/openssl/" --without-readline --enable-debug CFLAGS="-ggdb -O0 -fno-omit-frame-pointer" CPPFLAGS="-g -O0" - cd postgresql/postgresql && LD_LIBRARY_PATH="$(SSL_LDIR)" ./configure --with-ssl=openssl --with-includes="$(SSL_IDIR)" --with-libraries="$(SSL_LDIR)" --without-readline + cd postgresql/postgresql && LD_LIBRARY_PATH="$(SSL_LDIR)" ./configure --with-ssl=openssl --with-includes="$(SSL_IDIR)" --with-libraries="$(SSL_LDIR)" --without-readline --without-icu cd postgresql/postgresql/src/interfaces/libpq && CC=${CC} CXX=${CXX} ${MAKE} MAKELEVEL=0 #cd postgresql/postgresql && CC=${CC} CXX=${CXX} ${MAKE} -f src/interfaces/libpq/Makefile all diff --git a/include/PgSQL_Thread.h b/include/PgSQL_Thread.h index 35657449a5..da08e70f42 100644 --- a/include/PgSQL_Thread.h +++ b/include/PgSQL_Thread.h @@ -226,10 +226,10 @@ class __attribute__((aligned(64))) PgSQL_Thread : public Base_Thread //PtrArray* mysql_sessions; PtrArray* mirror_queue_mysql_sessions; PtrArray* mirror_queue_mysql_sessions_cache; + CopyCmdMatcher *copy_cmd_matcher; #ifdef IDLE_THREADS PtrArray* idle_mysql_sessions; PtrArray* resume_mysql_sessions; - CopyCmdMatcher *copy_cmd_matcher; pgsql_conn_exchange_t myexchange; #endif // IDLE_THREADS diff --git a/lib/Makefile b/lib/Makefile index 8653118f00..37ef2bb079 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -51,7 +51,7 @@ endif # for 'Darwin'. This is required when compiling 'libhttpserver' for avoiding # internal use of 'SELECT' in favor of 'EPOLL'. See #3591. ENABLE_EPOLL := -DENABLE_EPOLL -ifeq ($(UNAME_S),Darwin) +ifneq (,$(findstring $(UNAME_S),Darwin FreeBSD)) ENABLE_EPOLL := endif diff --git a/lib/PgSQL_Monitor.cpp b/lib/PgSQL_Monitor.cpp index 4db02cf77a..fce3c62ce0 100644 --- a/lib/PgSQL_Monitor.cpp +++ b/lib/PgSQL_Monitor.cpp @@ -17,6 +17,11 @@ #include #include +#ifdef __FreeBSD__ +#include +#define ULONG_LONG_MAX ULLONG_MAX +#endif + using std::function; using std::unique_ptr; using std::vector; diff --git a/lib/proxy_protocol_info.cpp b/lib/proxy_protocol_info.cpp index 522463f643..2e84235283 100644 --- a/lib/proxy_protocol_info.cpp +++ b/lib/proxy_protocol_info.cpp @@ -3,6 +3,9 @@ #include #include #include +#ifdef __FreeBSD__ +#include +#endif static bool DEBUG_ProxyProtocolInfo = false;