From 66e409e58533daecb413042abc5e04dcdc7337f8 Mon Sep 17 00:00:00 2001 From: purplerain Date: Mon, 12 Aug 2024 20:52:36 +0000 Subject: [PATCH] UPDATE: backport fix for newer fmt --- databases/mariadb/Makefile | 4 +- .../mariadb/patches/patch-BUILD_check-cpu | 12 ++++++ .../mariadb/patches/patch-include_my_global_h | 12 ++++++ .../mariadb/patches/patch-sql_item_strfunc_cc | 26 +++++++++++-- .../patch-storage_rocksdb_CMakeLists_txt | 18 +++++++++ .../patch-storage_rocksdb_build_rocksdb_cmake | 12 ++++++ ...tch-storage_rocksdb_rocksdb_CMakeLists_txt | 12 ++++++ ..._rocksdb_build_tools_build_detect_platform | 19 +++++++++ ...ch-storage_rocksdb_rocksdb_env_fs_posix_cc | 39 +++++++++++++++++++ ...-storage_rocksdb_rocksdb_port_port_posix_h | 31 +++++++++++++++ databases/mariadb/pkg/PLIST-server | 2 +- databases/mariadb/pkg/PLIST-tests | 2 +- 12 files changed, 181 insertions(+), 8 deletions(-) create mode 100644 databases/mariadb/patches/patch-BUILD_check-cpu create mode 100644 databases/mariadb/patches/patch-include_my_global_h create mode 100644 databases/mariadb/patches/patch-storage_rocksdb_build_rocksdb_cmake create mode 100644 databases/mariadb/patches/patch-storage_rocksdb_rocksdb_CMakeLists_txt create mode 100644 databases/mariadb/patches/patch-storage_rocksdb_rocksdb_build_tools_build_detect_platform create mode 100644 databases/mariadb/patches/patch-storage_rocksdb_rocksdb_env_fs_posix_cc create mode 100644 databases/mariadb/patches/patch-storage_rocksdb_rocksdb_port_port_posix_h diff --git a/databases/mariadb/Makefile b/databases/mariadb/Makefile index 67a351f96..31e7b526d 100644 --- a/databases/mariadb/Makefile +++ b/databases/mariadb/Makefile @@ -5,7 +5,7 @@ COMMENT-tests= multithreaded SQL database (regression test suite/benchmark) VERSION= 10.9.8 DISTNAME= mariadb-${VERSION} PKGNAME-main= mariadb-client-${VERSION} -REVISION-server= 0 +REVISION-server= 1 EPOCH= 1 CATEGORIES= databases SITES= https://downloads.mariadb.com/MariaDB/${DISTNAME}/source/ \ @@ -75,7 +75,7 @@ CONFIGURE_ARGS+=-DCMAKE_INSTALL_PREFIX="${PREFIX}" \ -DINSTALL_SQLBENCHDIR="share/mysql-bench" \ -DINSTALL_SUPPORTFILESDIR="share/examples/mysql" \ -DMYSQL_UNIX_ADDR="${SOCKET_DIR}/mysql.sock" \ - -DCOMPILATION_COMMENT='OpenBSD port: ${FULLPKGNAME-server}' \ + -DCOMPILATION_COMMENT='SecBSD port: ${FULLPKGNAME-server}' \ -DPLUGIN_OQGRAPH=NO \ -DWITH_EXTERNAL_ZLIB=On \ -DWITH_PCRE=system \ diff --git a/databases/mariadb/patches/patch-BUILD_check-cpu b/databases/mariadb/patches/patch-BUILD_check-cpu new file mode 100644 index 000000000..cc127e75b --- /dev/null +++ b/databases/mariadb/patches/patch-BUILD_check-cpu @@ -0,0 +1,12 @@ +Index: BUILD/check-cpu +--- BUILD/check-cpu.orig ++++ BUILD/check-cpu +@@ -140,7 +140,7 @@ check_cpu () { + # Fallback when there is no /proc/cpuinfo + CPUINFO=" " + case "`uname -s`" in +- FreeBSD|OpenBSD) ++ FreeBSD|OpenBSD|SecBSD) + cpu_family=`uname -m`; + model_name=`sysctl -n hw.model` + ;; diff --git a/databases/mariadb/patches/patch-include_my_global_h b/databases/mariadb/patches/patch-include_my_global_h new file mode 100644 index 000000000..d9163bf8b --- /dev/null +++ b/databases/mariadb/patches/patch-include_my_global_h @@ -0,0 +1,12 @@ +Index: include/my_global.h +--- include/my_global.h.orig ++++ include/my_global.h +@@ -62,7 +62,7 @@ + #define _POSIX_THREAD_CPUTIME + #endif /* __CYGWIN__ */ + +-#if defined(__OpenBSD__) && (OpenBSD >= 200411) ++#if defined(__SecBSD__) && (SecBSD >= 202404) + #define HAVE_ERRNO_AS_DEFINE + #endif + diff --git a/databases/mariadb/patches/patch-sql_item_strfunc_cc b/databases/mariadb/patches/patch-sql_item_strfunc_cc index d1740f11e..e26509feb 100644 --- a/databases/mariadb/patches/patch-sql_item_strfunc_cc +++ b/databases/mariadb/patches/patch-sql_item_strfunc_cc @@ -1,13 +1,31 @@ -[PATCH] MDEV-31963 Fix libfmt usage in SFORMAT +- [PATCH] MDEV-31963 Fix libfmt usage in SFORMAT -`fmt::detail::make_arg` does not accept temporaries. Make it happy by -storing the format arg values in a temporary array first. + `fmt::detail::make_arg` does not accept temporaries. Make it happy by + storing the format arg values in a temporary array first. -cd5808eb8da13c5626d4bdeb452cef6ada29cb1d + cd5808eb8da13c5626d4bdeb452cef6ada29cb1d + +- MDEV-34206 compile failure: fmt use incompatible with libfmt-10.2.[2]+ + + Upstream libfmt commit fmtlib/fmt@d707292 + now requires the format function to be const. + + Adjust the function prototype so it is const and can compile. + + 4375245d5d9f01cabb6e3fd6c637535e724eae38 Index: sql/item_strfunc.cc --- sql/item_strfunc.cc.orig +++ sql/item_strfunc.cc +@@ -1367,7 +1367,7 @@ bool Item_func_sformat::fix_length_and_dec(THD *thd) + namespace fmt { + template <> struct formatter: formatter { + template +- auto format(String c, FormatContext& ctx) -> decltype(ctx.out()) { ++ auto format(String c, FormatContext& ctx) const -> decltype(ctx.out()) { + string_view name = { c.ptr(), c.length() }; + return formatter::format(name, ctx); + }; @@ -1382,11 +1382,24 @@ namespace fmt { */ String *Item_func_sformat::val_str(String *res) diff --git a/databases/mariadb/patches/patch-storage_rocksdb_CMakeLists_txt b/databases/mariadb/patches/patch-storage_rocksdb_CMakeLists_txt index 275eb8cf0..5e45e4de0 100644 --- a/databases/mariadb/patches/patch-storage_rocksdb_CMakeLists_txt +++ b/databases/mariadb/patches/patch-storage_rocksdb_CMakeLists_txt @@ -17,3 +17,21 @@ Index: storage/rocksdb/CMakeLists.txt # This plugin needs recent C++ compilers (it is using C++11 features) # Skip build for the old compilers SET(CXX11_FLAGS) +@@ -198,7 +189,7 @@ ADD_DEPENDENCIES(rocksdb_aux_lib GenError) + + # MARIAROCKS-TODO: how to properly depend on -lrt ? + TARGET_LINK_LIBRARIES(rocksdb_aux_lib rocksdblib ${ZLIB_LIBRARY}) +-if (UNIX AND NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") ++if (UNIX AND NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "SecBSD") + TARGET_LINK_LIBRARIES(rocksdb_aux_lib -lrt) + endif() + TARGET_LINK_LIBRARIES(rocksdb_aux_lib ${ATOMIC_EXTRA_LIBS}) +@@ -249,7 +240,7 @@ ENDIF() + # ADD_SUBDIRECTORY(unittest) + #ENDIF() + +-if (UNIX AND NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") ++if (UNIX AND NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "SecBSD") + SET(rocksdb_static_libs ${rocksdb_static_libs} "-lrt") + endif() + diff --git a/databases/mariadb/patches/patch-storage_rocksdb_build_rocksdb_cmake b/databases/mariadb/patches/patch-storage_rocksdb_build_rocksdb_cmake new file mode 100644 index 000000000..a5acc53c8 --- /dev/null +++ b/databases/mariadb/patches/patch-storage_rocksdb_build_rocksdb_cmake @@ -0,0 +1,12 @@ +Index: storage/rocksdb/build_rocksdb.cmake +--- storage/rocksdb/build_rocksdb.cmake.orig ++++ storage/rocksdb/build_rocksdb.cmake +@@ -96,6 +96,8 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD") + add_definitions(-DOS_NETBSD) + elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") + add_definitions(-DOS_OPENBSD) ++elseif(CMAKE_SYSTEM_NAME MATCHES "SecBSD") ++ add_definitions(-DOS_SECBSD) + elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly") + add_definitions(-DOS_DRAGONFLYBSD) + elseif(CMAKE_SYSTEM_NAME MATCHES "Android") diff --git a/databases/mariadb/patches/patch-storage_rocksdb_rocksdb_CMakeLists_txt b/databases/mariadb/patches/patch-storage_rocksdb_rocksdb_CMakeLists_txt new file mode 100644 index 000000000..b6d85b71d --- /dev/null +++ b/databases/mariadb/patches/patch-storage_rocksdb_rocksdb_CMakeLists_txt @@ -0,0 +1,12 @@ +Index: storage/rocksdb/rocksdb/CMakeLists.txt +--- storage/rocksdb/rocksdb/CMakeLists.txt.orig ++++ storage/rocksdb/rocksdb/CMakeLists.txt +@@ -419,6 +419,8 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD") + add_definitions(-DOS_NETBSD) + elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD") + add_definitions(-DOS_OPENBSD) ++elseif(CMAKE_SYSTEM_NAME MATCHES "SecBSD") ++ add_definitions(-DOS_SECBSD) + elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly") + add_definitions(-DOS_DRAGONFLYBSD) + elseif(CMAKE_SYSTEM_NAME MATCHES "Android") diff --git a/databases/mariadb/patches/patch-storage_rocksdb_rocksdb_build_tools_build_detect_platform b/databases/mariadb/patches/patch-storage_rocksdb_rocksdb_build_tools_build_detect_platform new file mode 100644 index 000000000..11efb9b4a --- /dev/null +++ b/databases/mariadb/patches/patch-storage_rocksdb_rocksdb_build_tools_build_detect_platform @@ -0,0 +1,19 @@ +Index: storage/rocksdb/rocksdb/build_tools/build_detect_platform +--- storage/rocksdb/rocksdb/build_tools/build_detect_platform.orig ++++ storage/rocksdb/rocksdb/build_tools/build_detect_platform +@@ -205,6 +205,15 @@ EOF + FIND=gfind + WATCH=gnuwatch + ;; ++ SecBSD) ++ PLATFORM=OS_SECBSD ++ CXX=clang++ ++ COMMON_FLAGS="$COMMON_FLAGS -fno-builtin-memcmp -D_REENTRANT -DOS_SECBSD" ++ PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -pthread" ++ # PORT_FILES=port/secbsd/secbsd_specific.cc ++ FIND=gfind ++ WATCH=gnuwatch ++ ;; + DragonFly) + PLATFORM=OS_DRAGONFLYBSD + COMMON_FLAGS="$COMMON_FLAGS -fno-builtin-memcmp -D_REENTRANT -DOS_DRAGONFLYBSD" diff --git a/databases/mariadb/patches/patch-storage_rocksdb_rocksdb_env_fs_posix_cc b/databases/mariadb/patches/patch-storage_rocksdb_rocksdb_env_fs_posix_cc new file mode 100644 index 000000000..a77e63e24 --- /dev/null +++ b/databases/mariadb/patches/patch-storage_rocksdb_rocksdb_env_fs_posix_cc @@ -0,0 +1,39 @@ +Index: storage/rocksdb/rocksdb/env/fs_posix.cc +--- storage/rocksdb/rocksdb/env/fs_posix.cc.orig ++++ storage/rocksdb/rocksdb/env/fs_posix.cc +@@ -144,7 +144,7 @@ class PosixFileSystem : public FileSystem { + return IOStatus::IOError(fname, + "Direct I/O not supported in RocksDB lite"); + #endif // !ROCKSDB_LITE +-#if !defined(OS_MACOSX) && !defined(OS_OPENBSD) && !defined(OS_SOLARIS) ++#if !defined(OS_MACOSX) && !defined(OS_OPENBSD) && !defined(OS_SECBSD) && !defined(OS_SOLARIS) + flags |= O_DIRECT; + #endif + } +@@ -196,7 +196,7 @@ class PosixFileSystem : public FileSystem { + return IOStatus::IOError(fname, + "Direct I/O not supported in RocksDB lite"); + #endif // !ROCKSDB_LITE +-#if !defined(OS_MACOSX) && !defined(OS_OPENBSD) && !defined(OS_SOLARIS) ++#if !defined(OS_MACOSX) && !defined(OS_OPENBSD) && !defined(OS_SECBSD) && !defined(OS_SOLARIS) + flags |= O_DIRECT; + TEST_SYNC_POINT_CALLBACK("NewRandomAccessFile:O_DIRECT", &flags); + #endif +@@ -270,7 +270,7 @@ class PosixFileSystem : public FileSystem { + "Direct I/O not supported in RocksDB lite"); + #endif // ROCKSDB_LITE + flags |= O_WRONLY; +-#if !defined(OS_MACOSX) && !defined(OS_OPENBSD) && !defined(OS_SOLARIS) ++#if !defined(OS_MACOSX) && !defined(OS_OPENBSD) && !defined(OS_SECBSD) && !defined(OS_SOLARIS) + flags |= O_DIRECT; + #endif + TEST_SYNC_POINT_CALLBACK("NewWritableFile:O_DIRECT", &flags); +@@ -363,7 +363,7 @@ class PosixFileSystem : public FileSystem { + "Direct I/O not supported in RocksDB lite"); + #endif // !ROCKSDB_LITE + flags |= O_WRONLY; +-#if !defined(OS_MACOSX) && !defined(OS_OPENBSD) && !defined(OS_SOLARIS) ++#if !defined(OS_MACOSX) && !defined(OS_OPENBSD) && !defined(OS_SECBSD) && !defined(OS_SOLARIS) + flags |= O_DIRECT; + #endif + TEST_SYNC_POINT_CALLBACK("NewWritableFile:O_DIRECT", &flags); diff --git a/databases/mariadb/patches/patch-storage_rocksdb_rocksdb_port_port_posix_h b/databases/mariadb/patches/patch-storage_rocksdb_rocksdb_port_port_posix_h new file mode 100644 index 000000000..9b533e98a --- /dev/null +++ b/databases/mariadb/patches/patch-storage_rocksdb_rocksdb_port_port_posix_h @@ -0,0 +1,31 @@ +Index: storage/rocksdb/rocksdb/port/port_posix.h +--- storage/rocksdb/rocksdb/port/port_posix.h.orig ++++ storage/rocksdb/rocksdb/port/port_posix.h +@@ -45,7 +45,7 @@ + #define PLATFORM_IS_LITTLE_ENDIAN (BYTE_ORDER == LITTLE_ENDIAN) + #include + #elif defined(OS_FREEBSD) || defined(OS_OPENBSD) || defined(OS_NETBSD) || \ +- defined(OS_DRAGONFLYBSD) || defined(OS_ANDROID) ++ defined(OS_SECBSD) || defined(OS_DRAGONFLYBSD) || defined(OS_ANDROID) + #include + #include + #define PLATFORM_IS_LITTLE_ENDIAN (_BYTE_ORDER == _LITTLE_ENDIAN) +@@ -65,7 +65,7 @@ + + #if defined(OS_MACOSX) || defined(OS_SOLARIS) || defined(OS_FREEBSD) ||\ + defined(OS_NETBSD) || defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD) ||\ +- defined(OS_ANDROID) || defined(CYGWIN) || defined(OS_AIX) ++ defined(OS_SECBSD) || defined(OS_ANDROID) || defined(CYGWIN) || defined(OS_AIX) + // Use fread/fwrite/fflush on platforms without _unlocked variants + #define fread_unlocked fread + #define fwrite_unlocked fwrite +@@ -73,7 +73,8 @@ + #endif + + #if defined(OS_MACOSX) || defined(OS_FREEBSD) ||\ +- defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD) ++ defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD) ||\ ++ defined(OS_SECBSD) + // Use fsync() on platforms without fdatasync() + #define fdatasync fsync + #endif diff --git a/databases/mariadb/pkg/PLIST-server b/databases/mariadb/pkg/PLIST-server index 0fee059cb..cd09c25ba 100644 --- a/databases/mariadb/pkg/PLIST-server +++ b/databases/mariadb/pkg/PLIST-server @@ -677,6 +677,7 @@ share/mysql/korean/ share/mysql/korean/errmsg.sys share/mysql/maria_add_gis_sp.sql share/mysql/maria_add_gis_sp_bootstrap.sql +%%rocksdb%% share/mysql/mysql_performance_tables.sql share/mysql/mysql_sys_schema.sql share/mysql/mysql_system_tables.sql @@ -706,4 +707,3 @@ share/mysql/swedish/errmsg.sys share/mysql/ukrainian/ share/mysql/ukrainian/errmsg.sys %%le%% -%%rocksdb%% diff --git a/databases/mariadb/pkg/PLIST-tests b/databases/mariadb/pkg/PLIST-tests index 4dbc6e655..cc0db1031 100644 --- a/databases/mariadb/pkg/PLIST-tests +++ b/databases/mariadb/pkg/PLIST-tests @@ -3764,6 +3764,7 @@ share/mysql-test/plugin/metadata_lock_info/metadata_lock_info/t/ share/mysql-test/plugin/metadata_lock_info/metadata_lock_info/t/global_read_lock.test share/mysql-test/plugin/metadata_lock_info/metadata_lock_info/t/table_metadata_lock.test share/mysql-test/plugin/metadata_lock_info/metadata_lock_info/t/user_lock.test +%%rocksdb%% share/mysql-test/plugin/myisam/ share/mysql-test/plugin/myisam/mtr2/ share/mysql-test/plugin/myisam/mtr2/README @@ -17174,4 +17175,3 @@ share/mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.cnf share/mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.test share/mysql-test/valgrind.supp %%le%% -%%rocksdb%%