From 4189bd286b2cbe247a6d1a048618f80488dedfe8 Mon Sep 17 00:00:00 2001 From: maxfx Date: Tue, 18 Oct 2022 22:05:56 +0200 Subject: [PATCH] max-scale: new port --- maxscale/Makefile | 8 +++++-- ...include_maxscale_protocol_mariadb_mysql.hh | 16 +++++++++++++ .../files/patch-maxutils_maxbase_src_log.cc | 11 +++++++++ .../patch-maxutils_maxbase_src_stacktrace.cc | 23 ++++++++++++++----- ...uery__classifier_qc__sqlite_CMakeLists.txt | 11 +++++++++ 5 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 maxscale/files/patch-include_maxscale_protocol_mariadb_mysql.hh create mode 100644 maxscale/files/patch-maxutils_maxbase_src_log.cc create mode 100644 maxscale/files/patch-query__classifier_qc__sqlite_CMakeLists.txt diff --git a/maxscale/Makefile b/maxscale/Makefile index 5e3e8cc5..b8ed587d 100644 --- a/maxscale/Makefile +++ b/maxscale/Makefile @@ -17,17 +17,21 @@ BUILD_DEPENDS= libepoll-shim>0:devel/libepoll-shim LIB_DEPENDS= libepoll-shim.so:devel/libepoll-shim USES= compiler:c++11-lang cmake:noninja gmake +USE_GCC= yes USE_GITHUB= yes GH_ACCOUNT= mariadb-corporation GH_PROJECT= MaxScale MAKE_ENV+= CPATH="${LOCALBASE}/include/libepoll-shim" +CFLAGS+= -I${LOCALBASE}/include/libepoll-shim +LDFLAGS+= -L${LOCALBASE}/lib -lepoll-shim +CMAKE_ARGS+= SS_DEBUG=0 #REINPLACE_ARGS= -i '' post-patch: - ${REINPLACE_CMD} -e "s|program_invocation_short_name|getprogname()|g" ${WRKSRC}/maxutils/maxbase/src/log.cc - ${REINPLACE_CMD} -e "s|program_invocation_short_name|getprogname()|g" ${WRKSRC}/maxutils/maxbase/src/logger.cc +# ${REINPLACE_CMD} -e "s|program_invocation_short_name|getprogname()|g" ${WRKSRC}/maxutils/maxbase/src/log.cc +# ${REINPLACE_CMD} -e "s|program_invocation_short_name|getprogname()|g" ${WRKSRC}/maxutils/maxbase/src/logger.cc .include diff --git a/maxscale/files/patch-include_maxscale_protocol_mariadb_mysql.hh b/maxscale/files/patch-include_maxscale_protocol_mariadb_mysql.hh new file mode 100644 index 00000000..8380db78 --- /dev/null +++ b/maxscale/files/patch-include_maxscale_protocol_mariadb_mysql.hh @@ -0,0 +1,16 @@ +--- include/maxscale/protocol/mariadb/mysql.hh.orig 2022-10-18 19:45:58 UTC ++++ include/maxscale/protocol/mariadb/mysql.hh +@@ -13,9 +13,12 @@ + #pragma once + + #include +- + #include + #include ++ ++#ifdef __FreeBSD__ ++#include ++#endif + + #define MYSQL_HEADER_LEN 4 + #define MYSQL_CHECKSUM_LEN 4 diff --git a/maxscale/files/patch-maxutils_maxbase_src_log.cc b/maxscale/files/patch-maxutils_maxbase_src_log.cc new file mode 100644 index 00000000..4aa88aa6 --- /dev/null +++ b/maxscale/files/patch-maxutils_maxbase_src_log.cc @@ -0,0 +1,11 @@ +--- maxutils/maxbase/src/log.cc.orig 2022-10-18 19:57:28 UTC ++++ maxutils/maxbase/src/log.cc +@@ -487,7 +487,7 @@ bool mxb_log_init(const char* ident, + if (!filename) + { + #ifdef __GNUC__ +- suffix = program_invocation_short_name; ++ suffix = getprogname(); + #else + suffix = "messages"; + #endif diff --git a/maxscale/files/patch-maxutils_maxbase_src_stacktrace.cc b/maxscale/files/patch-maxutils_maxbase_src_stacktrace.cc index 08e0e16e..c5a872ef 100644 --- a/maxscale/files/patch-maxutils_maxbase_src_stacktrace.cc +++ b/maxscale/files/patch-maxutils_maxbase_src_stacktrace.cc @@ -1,33 +1,44 @@ --- maxutils/maxbase/src/stacktrace.cc.orig 2022-09-12 06:23:56 UTC +++ maxutils/maxbase/src/stacktrace.cc -@@ -18,8 +18,11 @@ - #include +@@ -19,7 +19,13 @@ #include #include -+#include ++#ifdef __FreeBSD__ ++#include /* For WIF.. */ ++#endif ++ +#ifdef __linux__ #include +#endif #ifdef HAVE_GLIBC #include -@@ -236,6 +239,7 @@ void emergency_stacktrace(void (* handler)(const char* +@@ -234,8 +240,16 @@ void emergency_stacktrace(void (* handler)(const char* + // We can't dump stacktraces on non-GLIBC systems + } ++void emergency_stacktrace() ++{ ++/* void* addrs[128]; ++ int count = backtrace(addrs, 128); ++ backtrace_symbols_fd(addrs, count, STDOUT_FILENO); */ ++} ++ #endif +#ifdef __linux__ void dump_gdb_stacktrace(void (* handler)(const char*)) { prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY); -@@ -245,6 +249,12 @@ void dump_gdb_stacktrace(void (* handler)(const char*) +@@ -245,6 +259,12 @@ void dump_gdb_stacktrace(void (* handler)(const char*) getpid()); prctl(PR_SET_PTRACER, 0); } +#else +void dump_gdb_stacktrace(void (* handler)(const char*)) +{ -+ // we can not use prctl on FreeBSD ++ +} +#endif diff --git a/maxscale/files/patch-query__classifier_qc__sqlite_CMakeLists.txt b/maxscale/files/patch-query__classifier_qc__sqlite_CMakeLists.txt new file mode 100644 index 00000000..fe9b5422 --- /dev/null +++ b/maxscale/files/patch-query__classifier_qc__sqlite_CMakeLists.txt @@ -0,0 +1,11 @@ +--- query_classifier/qc_sqlite/CMakeLists.txt.orig 2022-10-18 19:53:16 UTC ++++ query_classifier/qc_sqlite/CMakeLists.txt +@@ -4,7 +4,7 @@ ExternalProject_Add(maxscale_sqlite + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/sqlite-src-3110100 + BINARY_DIR ${CMAKE_BINARY_DIR}/sqlite-bld-3110100 + CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/sqlite-src-3110100/configure --with-pic --enable-maxscale +- BUILD_COMMAND make sqlite3.c ++ BUILD_COMMAND gmake sqlite3.c + INSTALL_COMMAND "" + LOG_DOWNLOAD 1 + LOG_UPDATE 1