about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/sql/mariadb
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/servers/sql/mariadb')
-rw-r--r--nixpkgs/pkgs/servers/sql/mariadb/connector-c/3_1.nix6
-rw-r--r--nixpkgs/pkgs/servers/sql/mariadb/connector-c/3_2.nix6
-rw-r--r--nixpkgs/pkgs/servers/sql/mariadb/connector-c/3_3.nix6
-rw-r--r--nixpkgs/pkgs/servers/sql/mariadb/connector-c/default.nix76
-rw-r--r--nixpkgs/pkgs/servers/sql/mariadb/default.nix277
-rw-r--r--nixpkgs/pkgs/servers/sql/mariadb/galera/default.nix46
-rw-r--r--nixpkgs/pkgs/servers/sql/mariadb/patch/0001-Fix-build-with-libxml2-2.12.patch167
-rw-r--r--nixpkgs/pkgs/servers/sql/mariadb/patch/cmake-includedir.patch11
-rw-r--r--nixpkgs/pkgs/servers/sql/mariadb/patch/cmake-plugin-includedir.patch16
-rw-r--r--nixpkgs/pkgs/servers/sql/mariadb/patch/macos-MDEV-26769-regression-fix.patch12
10 files changed, 623 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/servers/sql/mariadb/connector-c/3_1.nix b/nixpkgs/pkgs/servers/sql/mariadb/connector-c/3_1.nix
new file mode 100644
index 000000000000..a51fc1d104b1
--- /dev/null
+++ b/nixpkgs/pkgs/servers/sql/mariadb/connector-c/3_1.nix
@@ -0,0 +1,6 @@
+{ callPackage, ... } @ args:
+
+callPackage ./. (args // {
+  version = "3.1.21";
+  hash = "sha256-guN3Rcsb/EV4rxPE3yhJRSsT1+z44zUetg7ZBA4WjIc=";
+})
diff --git a/nixpkgs/pkgs/servers/sql/mariadb/connector-c/3_2.nix b/nixpkgs/pkgs/servers/sql/mariadb/connector-c/3_2.nix
new file mode 100644
index 000000000000..6619e261650c
--- /dev/null
+++ b/nixpkgs/pkgs/servers/sql/mariadb/connector-c/3_2.nix
@@ -0,0 +1,6 @@
+{ callPackage, ... } @ args:
+
+callPackage ./. (args // {
+  version = "3.2.7";
+  hash = "sha256-F7s9fcbJiz6lsWrvlTpY+ZET8MPwlyWPKJZOvHEwBvo=";
+})
diff --git a/nixpkgs/pkgs/servers/sql/mariadb/connector-c/3_3.nix b/nixpkgs/pkgs/servers/sql/mariadb/connector-c/3_3.nix
new file mode 100644
index 000000000000..9f750fe8108b
--- /dev/null
+++ b/nixpkgs/pkgs/servers/sql/mariadb/connector-c/3_3.nix
@@ -0,0 +1,6 @@
+{ callPackage, ... } @ args:
+
+callPackage ./. (args // {
+  version = "3.3.5";
+  hash = "sha256-RLHx8PyfbfIDr6X6ky5/w0XsGMFd+v5PgmQHvYOaf+k=";
+})
diff --git a/nixpkgs/pkgs/servers/sql/mariadb/connector-c/default.nix b/nixpkgs/pkgs/servers/sql/mariadb/connector-c/default.nix
new file mode 100644
index 000000000000..be4af113c1d9
--- /dev/null
+++ b/nixpkgs/pkgs/servers/sql/mariadb/connector-c/default.nix
@@ -0,0 +1,76 @@
+{ lib, stdenv, fetchFromGitHub, cmake
+, curl, openssl, zlib, zstd
+, libiconv
+, version, hash, ...
+}:
+
+with lib;
+
+let
+  isVer33 = versionAtLeast version "3.3";
+
+in stdenv.mkDerivation {
+  pname = "mariadb-connector-c";
+  inherit version;
+
+  src = fetchFromGitHub {
+    owner = "mariadb-corporation";
+    repo = "mariadb-connector-c";
+    rev = "v${version}";
+    inherit hash;
+  };
+
+  outputs = [ "out" "dev" ];
+
+  cmakeFlags = [
+    "-DMARIADB_UNIX_ADDR=/run/mysqld/mysqld.sock"
+    "-DWITH_CURL=ON"
+    "-DWITH_EXTERNAL_ZLIB=ON"
+    "-DWITH_MYSQLCOMPAT=ON"
+  ];
+
+  postPatch = ''
+    substituteInPlace mariadb_config/mariadb_config.c.in \
+      --replace '#define INCLUDE "-I%s/@INSTALL_INCLUDEDIR@ -I%s/@INSTALL_INCLUDEDIR@/mysql"' "#define INCLUDE \"-I$dev/include -I$dev/include/mysql\"" \
+      --replace '#define LIBS    "-L%s/@INSTALL_LIBDIR@/ -lmariadb"' "#define LIBS    \"-L$out/lib/mariadb -lmariadb\"" \
+      --replace '#define PKG_LIBDIR "%s/@INSTALL_LIBDIR@"' "#define PKG_LIBDIR \"$out/lib/mariadb\"" \
+      --replace '#define PLUGIN_DIR "%s/@INSTALL_PLUGINDIR@"' "#define PLUGIN_DIR \"$out/lib/mariadb/plugin\"" \
+      --replace '#define PKG_PLUGINDIR "%s/@INSTALL_PLUGINDIR@"' "#define PKG_PLUGINDIR \"$out/lib/mariadb/plugin\""
+  '' + lib.optionalString stdenv.hostPlatform.isStatic ''
+    # Disables all dynamic plugins
+    substituteInPlace cmake/plugins.cmake \
+      --replace 'if(''${CC_PLUGIN_DEFAULT} STREQUAL "DYNAMIC")' 'if(''${CC_PLUGIN_DEFAULT} STREQUAL "INVALID")'
+    # Force building static libraries
+    substituteInPlace libmariadb/CMakeLists.txt \
+      --replace 'libmariadb SHARED' 'libmariadb STATIC'
+  '';
+
+  # The cmake setup-hook uses $out/lib by default, this is not the case here.
+  preConfigure = optionalString stdenv.isDarwin ''
+    cmakeFlagsArray+=("-DCMAKE_INSTALL_NAME_DIR=$out/lib/mariadb")
+  '';
+
+  nativeBuildInputs = [ cmake ];
+  propagatedBuildInputs = [ curl openssl zlib ] ++ optional isVer33 zstd;
+  buildInputs = [ libiconv ];
+
+  postInstall = ''
+    moveToOutput bin/mariadb_config "$dev"
+  '';
+
+  postFixup = ''
+    ln -sv mariadb_config $dev/bin/mysql_config
+    ln -sv mariadb $out/lib/mysql
+    ln -sv mariadb $dev/include/mysql
+    ln -sv mariadb_version.h $dev/include/mariadb/mysql_version.h
+    ln -sv libmariadb.pc $dev/lib/pkgconfig/mysqlclient.pc
+    install -Dm644 include/ma_config.h $dev/include/mariadb/my_config.h
+  '';
+
+  meta = {
+    description = "Client library that can be used to connect to MySQL or MariaDB";
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ globin ];
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/servers/sql/mariadb/default.nix b/nixpkgs/pkgs/servers/sql/mariadb/default.nix
new file mode 100644
index 000000000000..3ff31ba1d3ab
--- /dev/null
+++ b/nixpkgs/pkgs/servers/sql/mariadb/default.nix
@@ -0,0 +1,277 @@
+let
+  # shared across all versions
+  generic =
+    { version, hash
+    , lib, stdenv, fetchurl, nixosTests, buildPackages
+    # Native buildInputs components
+    , bison, boost, cmake, fixDarwinDylibNames, flex, makeWrapper, pkg-config
+    # Common components
+    , curl, libiconv, ncurses, openssl, pcre2
+    , libkrb5, libaio, liburing, systemd
+    , CoreServices, cctools, perl
+    , jemalloc, less, libedit
+    # Server components
+    , bzip2, lz4, lzo, snappy, xz, zlib, zstd
+    , cracklib, judy, libevent, libxml2
+    , linux-pam, numactl
+    , fmt_8
+    , withStorageMroonga ? true, kytea, libsodium, msgpack, zeromq
+    , withStorageRocks ? true
+    , withEmbedded ? false
+    , withNuma ? false
+    }:
+
+  let
+    isCross = stdenv.buildPlatform != stdenv.hostPlatform;
+
+    libExt = stdenv.hostPlatform.extensions.sharedLibrary;
+
+    mytopEnv = buildPackages.perl.withPackages (p: with p; [ DBDmysql DBI TermReadKey ]);
+
+    common = rec { # attributes common to both builds
+      inherit version;
+
+      src = fetchurl {
+        url = "https://downloads.mariadb.com/MariaDB/mariadb-${version}/source/mariadb-${version}.tar.gz";
+        inherit hash;
+      };
+
+      outputs = [ "out" "man" ];
+
+      nativeBuildInputs = [ cmake pkg-config ]
+        ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames
+        ++ lib.optional (!stdenv.hostPlatform.isDarwin) makeWrapper;
+
+      buildInputs = [
+        libiconv ncurses zlib
+        pcre2
+        openssl
+        curl
+      ] ++ lib.optionals stdenv.hostPlatform.isLinux ([ libkrb5 systemd ]
+        ++ (if (lib.versionOlder version "10.6") then [ libaio ] else [ liburing ]))
+        ++ lib.optionals stdenv.hostPlatform.isDarwin [ CoreServices cctools perl libedit ]
+        ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ jemalloc ];
+
+      prePatch = ''
+        sed -i 's,[^"]*/var/log,/var/log,g' storage/mroonga/vendor/groonga/CMakeLists.txt
+      '';
+
+      patches = [
+        ./patch/cmake-includedir.patch
+
+        # Fix build with libxml 2.12 and Clang 16.
+        # https://github.com/MariaDB/server/pull/2983
+        ./patch/0001-Fix-build-with-libxml2-2.12.patch
+      ]
+        # Fixes a build issue as documented on
+        # https://jira.mariadb.org/browse/MDEV-26769?focusedCommentId=206073&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-206073
+        ++ lib.optional (!stdenv.hostPlatform.isLinux && lib.versionAtLeast version "10.6") ./patch/macos-MDEV-26769-regression-fix.patch;
+
+      cmakeFlags = [
+        "-DBUILD_CONFIG=mysql_release"
+        "-DMANUFACTURER=nixos.org"
+        "-DDEFAULT_CHARSET=utf8mb4"
+        "-DDEFAULT_COLLATION=utf8mb4_unicode_ci"
+        "-DSECURITY_HARDENED=ON"
+
+        "-DINSTALL_UNIX_ADDRDIR=/run/mysqld/mysqld.sock"
+        "-DINSTALL_BINDIR=bin"
+        "-DINSTALL_DOCDIR=share/doc/mysql"
+        "-DINSTALL_DOCREADMEDIR=share/doc/mysql"
+        "-DINSTALL_INCLUDEDIR=include/mysql"
+        "-DINSTALL_LIBDIR=lib"
+        "-DINSTALL_PLUGINDIR=lib/mysql/plugin"
+        "-DINSTALL_INFODIR=share/mysql/docs"
+        "-DINSTALL_MANDIR=share/man"
+        "-DINSTALL_MYSQLSHAREDIR=share/mysql"
+        "-DINSTALL_SCRIPTDIR=bin"
+        "-DINSTALL_SUPPORTFILESDIR=share/doc/mysql"
+        "-DINSTALL_MYSQLTESTDIR=OFF"
+        "-DINSTALL_SQLBENCHDIR=OFF"
+        "-DINSTALL_PAMDIR=share/pam/lib/security"
+        "-DINSTALL_PAMDATADIR=share/pam/etc/security"
+
+        "-DWITH_ZLIB=system"
+        "-DWITH_SSL=system"
+        "-DWITH_PCRE=system"
+        "-DWITH_SAFEMALLOC=OFF"
+        "-DWITH_UNIT_TESTS=OFF"
+        "-DEMBEDDED_LIBRARY=OFF"
+      ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
+        # On Darwin without sandbox, CMake will find the system java and attempt to build with java support, but
+        # then it will fail during the actual build. Let's just disable the flag explicitly until someone decides
+        # to pass in java explicitly.
+        "-DCONNECT_WITH_JDBC=OFF"
+        "-DCURSES_LIBRARY=${ncurses.out}/lib/libncurses.dylib"
+      ] ++ lib.optionals (stdenv.hostPlatform.isDarwin && lib.versionAtLeast version "10.6") [
+        # workaround for https://jira.mariadb.org/browse/MDEV-29925
+        "-Dhave_C__Wl___as_needed="
+      ] ++ lib.optionals isCross [
+        # revisit this if nixpkgs supports any architecture whose stack grows upwards
+        "-DSTACK_DIRECTION=-1"
+        "-DCMAKE_CROSSCOMPILING_EMULATOR=${stdenv.hostPlatform.emulator buildPackages}"
+      ];
+
+      postInstall = lib.optionalString (!withEmbedded) ''
+        # Remove Development components. Need to use libmysqlclient.
+        rm "$out"/lib/mysql/plugin/daemon_example.ini
+        rm "$out"/lib/{libmariadb.a,libmariadbclient.a,libmysqlclient.a,libmysqlclient_r.a,libmysqlservices.a}
+        rm -f "$out"/bin/{mariadb-config,mariadb_config,mysql_config}
+        rm -r $out/include
+        rm -r $out/lib/pkgconfig
+      '';
+
+      # perlPackages.DBDmysql is broken on darwin
+      postFixup = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
+        wrapProgram $out/bin/mytop --set PATH ${lib.makeBinPath [ less ncurses ]}
+      '';
+
+      passthru.tests = let
+        testVersion = "mariadb_${builtins.replaceStrings ["."] [""] (lib.versions.majorMinor version)}";
+      in {
+        mariadb-galera-rsync = nixosTests.mariadb-galera.${testVersion};
+        mysql = nixosTests.mysql.${testVersion};
+        mysql-autobackup = nixosTests.mysql-autobackup.${testVersion};
+        mysql-backup = nixosTests.mysql-backup.${testVersion};
+        mysql-replication = nixosTests.mysql-replication.${testVersion};
+      };
+
+      meta = with lib; {
+        description = "An enhanced, drop-in replacement for MySQL";
+        homepage    = "https://mariadb.org/";
+        license     = licenses.gpl2;
+        maintainers = with maintainers; [ thoughtpolice ] ++ teams.helsinki-systems.members;
+        platforms   = platforms.all;
+      };
+    };
+
+    client = stdenv.mkDerivation (common // {
+      pname = "mariadb-client";
+
+      patches = common.patches ++ [
+        ./patch/cmake-plugin-includedir.patch
+      ];
+
+      buildInputs = common.buildInputs
+        ++ lib.optionals (lib.versionAtLeast common.version "10.7") [ fmt_8 ];
+
+      cmakeFlags = common.cmakeFlags ++ [
+        "-DPLUGIN_AUTH_PAM=NO"
+        "-DWITHOUT_SERVER=ON"
+        "-DWITH_WSREP=OFF"
+        "-DINSTALL_MYSQLSHAREDIR=share/mysql-client"
+      ];
+
+      postInstall = common.postInstall + ''
+        rm "$out"/bin/{mariadb-test,mysqltest}
+        libmysqlclient_path=$(readlink -f $out/lib/libmysqlclient${libExt})
+        rm "$out"/lib/{libmariadb${libExt},libmysqlclient${libExt},libmysqlclient_r${libExt}}
+        mv "$libmysqlclient_path" "$out"/lib/libmysqlclient${libExt}
+        ln -sv libmysqlclient${libExt} "$out"/lib/libmysqlclient_r${libExt}
+      '';
+    });
+
+    server = stdenv.mkDerivation (common // {
+      pname = "mariadb-server";
+
+      nativeBuildInputs = common.nativeBuildInputs ++ [ bison boost.dev flex ];
+
+      buildInputs = common.buildInputs ++ [
+        bzip2 lz4 lzo snappy xz zstd
+        cracklib judy libevent libxml2
+      ] ++ lib.optional withNuma numactl
+        ++ lib.optionals stdenv.hostPlatform.isLinux [ linux-pam ]
+        ++ lib.optional (!stdenv.hostPlatform.isDarwin) mytopEnv
+        ++ lib.optionals withStorageMroonga [ kytea libsodium msgpack zeromq ]
+        ++ lib.optionals (lib.versionAtLeast common.version "10.7") [ fmt_8 ];
+
+      propagatedBuildInputs = lib.optional withNuma numactl;
+
+      postPatch = ''
+        substituteInPlace scripts/galera_new_cluster.sh \
+          --replace ":-mariadb" ":-mysql"
+      '';
+
+      cmakeFlags = common.cmakeFlags ++ [
+        "-DMYSQL_DATADIR=/var/lib/mysql"
+        "-DENABLED_LOCAL_INFILE=OFF"
+        "-DWITH_READLINE=ON"
+        "-DWITH_EXTRA_CHARSETS=all"
+        "-DWITH_EMBEDDED_SERVER=${if withEmbedded then "ON" else "OFF"}"
+        "-DWITH_UNIT_TESTS=OFF"
+        "-DWITH_WSREP=ON"
+        "-DWITH_INNODB_DISALLOW_WRITES=ON"
+        "-DWITHOUT_EXAMPLE=1"
+        "-DWITHOUT_FEDERATED=1"
+        "-DWITHOUT_TOKUDB=1"
+      ] ++ lib.optionals withNuma [
+        "-DWITH_NUMA=ON"
+      ] ++ lib.optionals (!withStorageMroonga) [
+        "-DWITHOUT_MROONGA=1"
+      ] ++ lib.optionals (!withStorageRocks) [
+        "-DWITHOUT_ROCKSDB=1"
+      ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin && withStorageRocks) [
+        "-DWITH_ROCKSDB_JEMALLOC=ON"
+      ] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
+        "-DWITH_JEMALLOC=yes"
+      ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
+        "-DPLUGIN_AUTH_PAM=NO"
+        "-DPLUGIN_AUTH_PAM_V1=NO"
+        "-DWITHOUT_OQGRAPH=1"
+        "-DWITHOUT_PLUGIN_S3=1"
+      ];
+
+      preConfigure = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
+        patchShebangs scripts/mytop.sh
+      '';
+
+      postInstall = common.postInstall + ''
+        rm -r "$out"/share/aclocal
+        chmod +x "$out"/bin/wsrep_sst_common
+        rm -f "$out"/bin/{mariadb-client-test,mariadb-test,mysql_client_test,mysqltest}
+      '' + lib.optionalString withStorageMroonga ''
+        mv "$out"/share/{groonga,groonga-normalizer-mysql} "$out"/share/doc/mysql
+      '' + lib.optionalString (!stdenv.hostPlatform.isDarwin && lib.versionAtLeast common.version "10.4") ''
+        mv "$out"/OFF/suite/plugins/pam/pam_mariadb_mtr.so "$out"/share/pam/lib/security
+        mv "$out"/OFF/suite/plugins/pam/mariadb_mtr "$out"/share/pam/etc/security
+        rm -r "$out"/OFF
+      '';
+
+      CXXFLAGS = lib.optionalString stdenv.hostPlatform.isi686 "-fpermissive";
+    });
+  in
+    server // {
+      inherit client server;
+    };
+in
+  self: {
+    # see https://mariadb.org/about/#maintenance-policy for EOLs
+    mariadb_105 = self.callPackage generic {
+      # Supported until 2025-06-24
+      version = "10.5.23";
+      hash = "sha256-P3wzsgjLeZ2wFKh09WcY6t/yLulXgfo2Cqa8aWEJrP4=";
+      inherit (self.darwin) cctools;
+      inherit (self.darwin.apple_sdk.frameworks) CoreServices;
+    };
+    mariadb_106 = self.callPackage generic {
+      # Supported until 2026-07-06
+      version = "10.6.16";
+      hash = "sha256-Xvg4Q+eW3Nqa6keyRpDd9thI9D9D4R+dmgzCHHj7uc8=";
+      inherit (self.darwin) cctools;
+      inherit (self.darwin.apple_sdk.frameworks) CoreServices;
+    };
+    mariadb_1011 = self.callPackage generic {
+      # Supported until 2028-02-16
+      version = "10.11.6";
+      hash = "sha256-HAFjRj6Y1x9HgHQWEaQJge7ivETTkmAcpJu/lI0E3Wc=";
+      inherit (self.darwin) cctools;
+      inherit (self.darwin.apple_sdk.frameworks) CoreServices;
+    };
+    mariadb_110 = self.callPackage generic {
+      # Supported until 2024-06-07
+      version = "11.0.4";
+      hash = "sha256-J2ls3zEVnyJUEOtchmW4VkWhxZmBzlr2vP9sll/u3ms=";
+      inherit (self.darwin) cctools;
+      inherit (self.darwin.apple_sdk.frameworks) CoreServices;
+    };
+  }
diff --git a/nixpkgs/pkgs/servers/sql/mariadb/galera/default.nix b/nixpkgs/pkgs/servers/sql/mariadb/galera/default.nix
new file mode 100644
index 000000000000..0898c6a3bfc4
--- /dev/null
+++ b/nixpkgs/pkgs/servers/sql/mariadb/galera/default.nix
@@ -0,0 +1,46 @@
+{ lib, stdenv, fetchFromGitHub, buildEnv
+, asio, boost, check, openssl, cmake
+, nixosTests
+}:
+
+stdenv.mkDerivation rec {
+  pname = "mariadb-galera";
+  version = "26.4.17";
+
+  src = fetchFromGitHub {
+    owner = "codership";
+    repo = "galera";
+    rev = "release_${version}";
+    hash = "sha256-XcaHg0mqCGqP7VYb4jLSxuNxmBXJv2ivA/1spMyT4Tg=";
+    fetchSubmodules = true;
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ asio boost.dev check openssl ];
+
+  preConfigure = ''
+    # make sure bundled asio cannot be used, but leave behind license, because it gets installed
+    rm -r asio/{asio,asio.hpp}
+  '';
+
+  postInstall = ''
+    # for backwards compatibility
+    mkdir $out/lib/galera
+    ln -s $out/lib/libgalera_smm.so $out/lib/galera/libgalera_smm.so
+  '';
+
+  passthru.tests = {
+    inherit (nixosTests) mariadb-galera;
+  };
+
+  meta = with lib; {
+    description = "Galera 3 wsrep provider library";
+    mainProgram = "garbd";
+    homepage = "https://galeracluster.com/";
+    license = licenses.lgpl2Only;
+    maintainers = with maintainers; [ izorkin ] ++ teams.helsinki-systems.members;
+    platforms = platforms.all;
+    broken = stdenv.isDarwin;
+  };
+}
diff --git a/nixpkgs/pkgs/servers/sql/mariadb/patch/0001-Fix-build-with-libxml2-2.12.patch b/nixpkgs/pkgs/servers/sql/mariadb/patch/0001-Fix-build-with-libxml2-2.12.patch
new file mode 100644
index 000000000000..a12dfb73d09d
--- /dev/null
+++ b/nixpkgs/pkgs/servers/sql/mariadb/patch/0001-Fix-build-with-libxml2-2.12.patch
@@ -0,0 +1,167 @@
+From 1f1ee5d3776af7ef56ffa3f4dcd22532c2c86c74 Mon Sep 17 00:00:00 2001
+From: Jan Tojnar <jtojnar@gmail.com>
+Date: Sun, 7 Jan 2024 10:19:54 +0100
+Subject: [PATCH] Fix build with libxml2 2.12
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+libxml2 2.12.0 made `xmlGetLastError()` return `const` pointer:
+
+https://gitlab.gnome.org/GNOME/libxml2/-/commit/61034116d0a3c8b295c6137956adc3ae55720711
+
+Clang 16 does not like this:
+
+    error: assigning to 'xmlErrorPtr' (aka '_xmlError *') from 'const xmlError *' (aka 'const _xmlError *') discards qualifiers
+    error: cannot initialize a variable of type 'xmlErrorPtr' (aka '_xmlError *') with an rvalue of type 'const xmlError *' (aka 'const _xmlError *')
+
+Let’s update the variables to `const`.
+For older versions, it will be automatically converted.
+
+But then `xmlResetError(xmlError*)` will not like the `const` pointer:
+
+    error: no matching function for call to 'xmlResetError'
+    note: candidate function not viable: 1st argument ('const xmlError *' (aka 'const _xmlError *')) would lose const qualifier
+
+Let’s replace it with `xmlResetLastError()`.
+
+ALso remove `LIBXMLDOC::Xerr` protected member property.
+It was introduced in 65b0e5455b547a3d574fa77b34cce23ae3bea0a0
+along with the `xmlResetError` calls.
+It does not appear to be used for anything.
+---
+ storage/connect/libdoc.cpp | 39 +++++++++++++++++++-------------------
+ 1 file changed, 19 insertions(+), 20 deletions(-)
+
+diff --git a/storage/connect/libdoc.cpp b/storage/connect/libdoc.cpp
+index e414aa88355..10edcbc3ffa 100644
+--- a/storage/connect/libdoc.cpp
++++ b/storage/connect/libdoc.cpp
+@@ -93,7 +93,6 @@ class LIBXMLDOC : public XMLDOCUMENT {
+   xmlXPathContextPtr Ctxp;
+   xmlXPathObjectPtr  Xop;
+   xmlXPathObjectPtr  NlXop;
+-  xmlErrorPtr        Xerr;
+   char              *Buf;                  // Temporary
+   bool               Nofreelist;
+ }; // end of class LIBXMLDOC
+@@ -327,7 +326,6 @@ LIBXMLDOC::LIBXMLDOC(char *nsl, char *nsdf, char *enc, PFBLOCK fp)
+   Ctxp = NULL;
+   Xop = NULL;
+   NlXop = NULL;
+-  Xerr = NULL;
+   Buf = NULL;
+   Nofreelist = false;
+   } // end of LIBXMLDOC constructor
+@@ -365,8 +363,8 @@ bool LIBXMLDOC::ParseFile(PGLOBAL g, char *fn)
+       Encoding = (char*)Docp->encoding;
+ 
+     return false;
+-  } else if ((Xerr = xmlGetLastError()))
+-    xmlResetError(Xerr);
++  } else if (xmlGetLastError())
++    xmlResetLastError();
+ 
+   return true;
+   } // end of ParseFile
+@@ -505,9 +503,9 @@ int LIBXMLDOC::DumpDoc(PGLOBAL g, char *ofn)
+ #if 1
+   // This function does not crash (
+   if (xmlSaveFormatFileEnc((const char *)ofn, Docp, Encoding, 0) < 0) {
+-    xmlErrorPtr err = xmlGetLastError();
++    const xmlError *err = xmlGetLastError();
+     strcpy(g->Message, (err) ? err->message : "Error saving XML doc");
+-    xmlResetError(Xerr);
++    xmlResetLastError();
+     rc = -1;
+     } // endif Save
+ //  rc = xmlDocDump(of, Docp);
+@@ -546,8 +544,8 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
+     if (Nlist) {
+       xmlXPathFreeNodeSet(Nlist);
+ 
+-      if ((Xerr = xmlGetLastError()))
+-        xmlResetError(Xerr);
++      if (xmlGetLastError())
++        xmlResetLastError();
+ 
+       Nlist = NULL;
+       } // endif Nlist
+@@ -555,8 +553,8 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
+     if (Xop) {
+       xmlXPathFreeObject(Xop);
+ 
+-      if ((Xerr = xmlGetLastError()))
+-        xmlResetError(Xerr);
++      if (xmlGetLastError())
++        xmlResetLastError();
+ 
+       Xop = NULL;
+       } // endif Xop
+@@ -564,8 +562,8 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
+     if (NlXop) {
+       xmlXPathFreeObject(NlXop);
+ 
+-      if ((Xerr = xmlGetLastError()))
+-        xmlResetError(Xerr);
++      if (xmlGetLastError())
++        xmlResetLastError();
+ 
+       NlXop = NULL;
+       } // endif NlXop
+@@ -573,8 +571,8 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
+     if (Ctxp) {
+       xmlXPathFreeContext(Ctxp);
+ 
+-      if ((Xerr = xmlGetLastError()))
+-        xmlResetError(Xerr);
++      if (xmlGetLastError())
++        xmlResetLastError();
+ 
+       Ctxp = NULL;
+       } // endif Ctxp
+@@ -590,6 +588,7 @@ void LIBXMLDOC::CloseDoc(PGLOBAL g, PFBLOCK xp)
+ /******************************************************************/
+ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp)
+   {
++  const xmlError *xerr;
+   xmlNodeSetPtr nl;
+ 
+   if (trace(1))
+@@ -649,11 +648,11 @@ xmlNodeSetPtr LIBXMLDOC::GetNodeList(PGLOBAL g, xmlNodePtr np, char *xp)
+     } else
+       xmlXPathFreeObject(Xop);            // Caused node not found
+ 
+-    if ((Xerr = xmlGetLastError())) {
+-      strcpy(g->Message, Xerr->message);
+-      xmlResetError(Xerr);
++    if ((xerr = xmlGetLastError())) {
++      strcpy(g->Message, xerr->message);
++      xmlResetLastError();
+       return NULL;
+-      } // endif Xerr
++      } // endif xerr
+ 
+     } // endif Xop
+ 
+@@ -1079,7 +1078,7 @@ void XML2NODE::AddText(PGLOBAL g, PCSZ txtp)
+ /******************************************************************/
+ void XML2NODE::DeleteChild(PGLOBAL g, PXNODE dnp)
+   {
+-  xmlErrorPtr xerr;
++  const xmlError *xerr;
+ 
+   if (trace(1))
+     htrc("DeleteChild: node=%p\n", dnp);
+@@ -1122,7 +1121,7 @@ void XML2NODE::DeleteChild(PGLOBAL g, PXNODE dnp)
+   if (trace(1))
+     htrc("DeleteChild: errmsg=%-.256s\n", xerr->message);
+ 
+-  xmlResetError(xerr);
++  xmlResetLastError();
+   } // end of DeleteChild
+ 
+ /* -------------------- class XML2NODELIST ---------------------- */
+-- 
+2.42.0
+
diff --git a/nixpkgs/pkgs/servers/sql/mariadb/patch/cmake-includedir.patch b/nixpkgs/pkgs/servers/sql/mariadb/patch/cmake-includedir.patch
new file mode 100644
index 000000000000..0c4fe7d321e2
--- /dev/null
+++ b/nixpkgs/pkgs/servers/sql/mariadb/patch/cmake-includedir.patch
@@ -0,0 +1,11 @@
+--- a/include/CMakeLists.txt	2017-12-25 05:59:07.204144374 +0100
++++ b/include/CMakeLists.txt	2017-12-25 05:59:26.339552817 +0100
+@@ -94,7 +94,7 @@
+ ENDIF()
+ 
+ MACRO(INSTALL_COMPAT_HEADER file footer)
+-  INSTALL(CODE "FILE(WRITE \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDEDIR}/${file}
++  INSTALL(CODE "FILE(WRITE ${INSTALL_INCLUDEDIR}/${file}
+ \"/* Do not edit this file directly, it was auto-generated by cmake */
+ 
+ #warning This file should not be included by clients, include only <mysql.h>
diff --git a/nixpkgs/pkgs/servers/sql/mariadb/patch/cmake-plugin-includedir.patch b/nixpkgs/pkgs/servers/sql/mariadb/patch/cmake-plugin-includedir.patch
new file mode 100644
index 000000000000..d2a4535f7ba9
--- /dev/null
+++ b/nixpkgs/pkgs/servers/sql/mariadb/patch/cmake-plugin-includedir.patch
@@ -0,0 +1,16 @@
+diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
+index 31291d26..fad52814 100644
+--- a/cmake/plugin.cmake
++++ b/cmake/plugin.cmake
+@@ -34,6 +34,11 @@ MACRO(MYSQL_ADD_PLUGIN)
+     "LINK_LIBRARIES;DEPENDENCIES"
+     ${ARGN}
+   )
++
++  IF(WITHOUT_SERVER OR ARG_CLIENT)
++  INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
++  ENDIF()
++
+   IF(NOT WITHOUT_SERVER OR ARG_CLIENT)
+
+   # Add common include directories
diff --git a/nixpkgs/pkgs/servers/sql/mariadb/patch/macos-MDEV-26769-regression-fix.patch b/nixpkgs/pkgs/servers/sql/mariadb/patch/macos-MDEV-26769-regression-fix.patch
new file mode 100644
index 000000000000..8c0e6f78e287
--- /dev/null
+++ b/nixpkgs/pkgs/servers/sql/mariadb/patch/macos-MDEV-26769-regression-fix.patch
@@ -0,0 +1,12 @@
+diff -ru a/storage/innobase/include/buf0types.h b/storage/innobase/include/buf0types.h
+--- a/storage/innobase/include/buf0types.h	2021-11-17 02:37:32.000000000 -0500
++++ b/storage/innobase/include/buf0types.h	2021-11-17 02:38:50.000000000 -0500
+@@ -179,7 +179,7 @@
+ #include "sux_lock.h"
+ 
+ #ifdef SUX_LOCK_GENERIC
+-class page_hash_latch : private rw_lock
++class page_hash_latch : public rw_lock
+ {
+   /** Wait for a shared lock */
+   void read_lock_wait();