From 10f0efefbbbf34f761d85a53ee513f1c3731a606 Mon Sep 17 00:00:00 2001
From: Kazuhiko SHIOZAKI <kazuhiko@nexedi.com>
Date: Tue, 14 Nov 2023 13:02:45 +0000
Subject: [PATCH] component/mariadb: version up MariaDB 10.4.31 and add MariaDB
 10.5.22, 10.6.15 and 10.11.5.

also copy libperfschema.a in lib directory to build mroonga with MariaDB >= 10.5.
---
 component/mariadb/buildout.cfg | 45 ++++++++++++++++++++++++++--------
 1 file changed, 35 insertions(+), 10 deletions(-)

diff --git a/component/mariadb/buildout.cfg b/component/mariadb/buildout.cfg
index 298d39497..1b8e3d089 100644
--- a/component/mariadb/buildout.cfg
+++ b/component/mariadb/buildout.cfg
@@ -16,6 +16,7 @@ extends =
   ../openssl/buildout.cfg
   ../patch/buildout.cfg
   ../pcre/buildout.cfg
+  ../pcre2/buildout.cfg
   ../pkgconfig/buildout.cfg
   ../snappy/buildout.cfg
   ../xz-utils/buildout.cfg
@@ -26,12 +27,11 @@ extends =
 parts =
   mariadb
 
-[mariadb]
+[mariadb-common]
 recipe = slapos.recipe.cmmi
 shared = true
 url = https://archive.mariadb.org//mariadb-${:version}/source/mariadb-${:version}.tar.gz
-version = 10.4.28
-md5sum = d098e9af77a26260a6a6c21a7ed0daf6
+pcre-location = ${pcre2:location}
 pre-configure =
   set '\bSET(PLUGIN_AUTH_PAM YES CACHE BOOL "")' cmake/build_configurations/mysql_release.cmake
   grep -q "$@"
@@ -73,17 +73,14 @@ configure-options =
 #  https://lore.kernel.org/linux-btrfs/ed3642c2-682e-08a1-f18d-2d63409b7631@nexedi.com/T/
   -DWITH_FALLOCATE=NO
 ##
-CMAKE_CFLAGS = -I${bzip2:location}/include -I${jemalloc:location}/include -I${libaio:location}/include -I${libxml2:location}/include -I${ncurses:location}/include -I${openssl:location}/include -I${pcre:location}/include -I${libedit:location}/include -I${xz-utils:location}/include -I${zlib:location}/include -I${unixodbc:location}/include -I${lz4:location}/include -I${snappy:location}/include -I${zstd:location}/include
-CMAKE_LIBRARY_PATH = ${bzip2:location}/lib:${jemalloc:location}/lib:${libaio:location}/lib:${libxml2:location}/lib:${ncurses:location}/lib:${openssl:location}/lib:${pcre:location}/lib:${libedit:location}/lib:${xz-utils:location}/lib:${zlib:location}/lib:${unixodbc:location}/lib:${lz4:location}/lib:${snappy:location}/lib:${zstd:location}/lib
+CMAKE_CFLAGS = -I${bzip2:location}/include -I${jemalloc:location}/include -I${libaio:location}/include -I${libxml2:location}/include -I${ncurses:location}/include -I${openssl:location}/include -I${:pcre-location}/include -I${libedit:location}/include -I${xz-utils:location}/include -I${zlib:location}/include -I${unixodbc:location}/include -I${lz4:location}/include -I${snappy:location}/include -I${zstd:location}/include
+CMAKE_LIBRARY_PATH = ${bzip2:location}/lib:${jemalloc:location}/lib:${libaio:location}/lib:${libxml2:location}/lib:${ncurses:location}/lib:${openssl:location}/lib:${:pcre-location}/lib:${libedit:location}/lib:${xz-utils:location}/lib:${zlib:location}/lib:${unixodbc:location}/lib:${lz4:location}/lib:${snappy:location}/lib:${zstd:location}/lib
 environment =
   CMAKE_PROGRAM_PATH=${cmake:location}/bin
-  CMAKE_INCLUDE_PATH=${bzip2:location}/include:${libaio:location}/include:${libaio:location}/include:${libxml2:location}/include:${ncurses:location}/include:${openssl:location}/include:${pcre:location}/include:${libedit:location}/include:${xz-utils:location}/include:${zlib:location}/include:${unixodbc:location}/include:${lz4:location}/include:${snappy:location}/include:${zstd:location}/include
+  CMAKE_INCLUDE_PATH=${bzip2:location}/include:${libaio:location}/include:${libaio:location}/include:${libxml2:location}/include:${ncurses:location}/include:${openssl:location}/include:${:pcre-location}/include:${libedit:location}/include:${xz-utils:location}/include:${zlib:location}/include:${unixodbc:location}/include:${lz4:location}/include:${snappy:location}/include:${zstd:location}/include
   CMAKE_LIBRARY_PATH=${:CMAKE_LIBRARY_PATH}
-  LDFLAGS=-L${bzip2:location}/lib -L${jemalloc:location}/lib -L${libaio:location}/lib -L${pcre:location}/lib -L${xz-utils:location}/lib -L${zlib:location}/lib -L${unixodbc:location}/lib -L${lz4:location}/lib -L${snappy:location}/lib -L${zstd:location}/lib
+  LDFLAGS=-L${bzip2:location}/lib -L${jemalloc:location}/lib -L${libaio:location}/lib -L${:pcre-location}/lib -L${xz-utils:location}/lib -L${zlib:location}/lib -L${unixodbc:location}/lib -L${lz4:location}/lib -L${snappy:location}/lib -L${zstd:location}/lib
   PATH=${patch:location}/bin:%(PATH)s
-patch-options = -p1
-patches =
-  https://sources.debian.org/data/main/m/mariadb-10.3/1:10.3.34-0+deb10u1/debian/patches/0024-Revert-to-using-system-pcre-library.patch#1c6a0f2634f5a56122299674b77b1131
 post-install =
   ldd=`ldd %(location)s/lib/plugin/ha_rocksdb.so`
   for x in ${lz4:location} ${snappy:location} ${zstd:location}
@@ -92,6 +89,34 @@ post-install =
   set -- wsrep-lib/wsrep-API/*/wsrep_api.h
   install -DpT $1 %(location)s/$1
   cp -a wsrep-lib/include %(location)s/wsrep-lib
+  cp -a storage/perfschema/libperfschema.a %(location)s/lib
+
+[mariadb-10.4]
+<= mariadb-common
+version = 10.4.31
+md5sum = 7de92260770736c84d8f94e31c105233
+pcre-location = ${pcre:location}
+patch-options = -p1
+patches =
+  https://sources.debian.org/data/main/m/mariadb-10.3/1:10.3.34-0+deb10u1/debian/patches/0024-Revert-to-using-system-pcre-library.patch#1c6a0f2634f5a56122299674b77b1131
+
+[mariadb-10.5]
+<= mariadb-common
+version = 10.5.22
+md5sum = a492aa334f1111513b049e89b15b40d8
+
+[mariadb-10.6]
+<= mariadb-common
+version = 10.6.15
+md5sum = 6b34c051000ecd352a59f8094c84c5c2
+
+[mariadb-10.11]
+<= mariadb-common
+version = 10.11.5
+md5sum = 9a4396dea3a7d3009db6ea962cac0eb6
+
+[mariadb]
+<= mariadb-10.4
 
 [mroonga-mariadb]
 # mroonga - a storage engine for MySQL. It provides fast fulltext search feature to all MySQL users.
-- 
2.30.9