Skip to content

Commit

Permalink
max-scale: new port
Browse files Browse the repository at this point in the history
  • Loading branch information
Martinfx committed Oct 18, 2022
1 parent 651302f commit 4189bd2
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 8 deletions.
8 changes: 6 additions & 2 deletions maxscale/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 <bsd.port.mk>

16 changes: 16 additions & 0 deletions maxscale/files/patch-include_maxscale_protocol_mariadb_mysql.hh
Original file line number Diff line number Diff line change
@@ -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 <maxscale/ccdefs.hh>
-
#include <maxscale/buffer.hh>
#include <maxscale/protocol/mariadb/common_constants.hh>
+
+#ifdef __FreeBSD__
+#include <sys/endian.h>
+#endif

#define MYSQL_HEADER_LEN 4
#define MYSQL_CHECKSUM_LEN 4
11 changes: 11 additions & 0 deletions maxscale/files/patch-maxutils_maxbase_src_log.cc
Original file line number Diff line number Diff line change
@@ -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
23 changes: 17 additions & 6 deletions maxscale/files/patch-maxutils_maxbase_src_stacktrace.cc
Original file line number Diff line number Diff line change
@@ -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 <functional>
@@ -19,7 +19,13 @@
#include <cstdarg>
#include <climits>
+#include <sys/wait.h>

+#ifdef __FreeBSD__
+#include <sys/wait.h> /* For WIF.. */
+#endif
+
+#ifdef __linux__
#include <sys/prctl.h>
+#endif

#ifdef HAVE_GLIBC
#include <execinfo.h>
@@ -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

Expand Down
11 changes: 11 additions & 0 deletions maxscale/files/patch-query__classifier_qc__sqlite_CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 4189bd2

Please sign in to comment.