Skip to content
Open
6 changes: 3 additions & 3 deletions common_mk/openssl_flags.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -44,4 +44,4 @@ else
endif
else
$(error Warning: OpenSSL headers (SSL_IDIR) not found. Exiting. Please install OpenSSL version 3.)
endif
endif
4 changes: 2 additions & 2 deletions common_mk/openssl_version_check.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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; \
Expand Down Expand Up @@ -41,4 +41,4 @@ check_openssl_version:
echo "OpenSSL version must be >= $(REQUIRED_OPENSSL_VERSION). Detected: $$openssl_version"; \
exit 1; \
fi; \
fi
fi
4 changes: 2 additions & 2 deletions deps/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion include/PgSQL_Thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 5 additions & 0 deletions lib/PgSQL_Monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
#include <vector>
#include <list>

#ifdef __FreeBSD__
#include <sys/limits.h>
#define ULONG_LONG_MAX ULLONG_MAX
#endif

using std::function;
using std::unique_ptr;
using std::vector;
Expand Down
3 changes: 3 additions & 0 deletions lib/proxy_protocol_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#include <stdio.h>
#include <assert.h>
#include <iostream>
#ifdef __FreeBSD__
#include <sys/socket.h>
#endif

static bool DEBUG_ProxyProtocolInfo = false;

Expand Down