This file is part of MXE. See LICENSE.md for licensing information.

Contains ad hoc patches for cross building.

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Thu, 10 Apr 2025 20:57:03 +0200
Subject: [PATCH 1/4] build pc file for mingw


diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1111111..2222222 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -449,9 +449,7 @@ ENDIF()
 INCLUDE(${CC_SOURCE_DIR}/plugins/CMakeLists.txt)
 ADD_SUBDIRECTORY(include)
 ADD_SUBDIRECTORY(libmariadb)
-IF((NOT WIN32) OR CYGWIN)
-  ADD_SUBDIRECTORY(mariadb_config)
-ENDIF()
+ADD_SUBDIRECTORY(mariadb_config)
 
 IF(IS_DIRECTORY ${CC_SOURCE_DIR}/unittest)
   IF(WITH_UNIT_TESTS)

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Thu, 10 Apr 2025 21:35:56 +0200
Subject: [PATCH 2/4] options to suppress install of static and shared


diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt
index 1111111..2222222 100644
--- a/libmariadb/CMakeLists.txt
+++ b/libmariadb/CMakeLists.txt
@@ -500,9 +500,13 @@ IF(NOT WIN32)
   SET_TARGET_PROPERTIES(mariadbclient PROPERTIES OUTPUT_NAME "${LIBMARIADB_STATIC_NAME}")
 ENDIF()
 
+IF(NOT DISABLE_STATIC)
 INSTALL(TARGETS mariadbclient
           COMPONENT Development
           DESTINATION ${INSTALL_LIBDIR})
+ENDIF()
+
+IF(NOT DISABLE_SHARED)
 IF(WIN32)
 INSTALL(TARGETS libmariadb
         COMPONENT SharedLibraries
@@ -524,3 +528,4 @@ IF(MSVC)
            CONFIGURATIONS Debug RelWithDebInfo
            COMPONENT Development)
 ENDIF()
+ENDIF()

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Thu, 10 Apr 2025 23:39:02 +0200
Subject: [PATCH 3/4] add -lz to Libs.private


diff --git a/mariadb_config/libmariadb.pc.in b/mariadb_config/libmariadb.pc.in
index 1111111..2222222 100644
--- a/mariadb_config/libmariadb.pc.in
+++ b/mariadb_config/libmariadb.pc.in
@@ -15,6 +15,6 @@ Version: @CPACK_PACKAGE_VERSION@
 Description: MariaDB Connector/C dynamic library
 Cflags: -I${includedir}
 Libs: -L${libdir} -lmariadb
-Libs.private: @extra_dynamic_LDFLAGS@
+Libs.private: @extra_dynamic_LDFLAGS@ -lz
 
 

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Sun, 20 Apr 2025 13:20:50 +0200
Subject: [PATCH 4/4] fix MINGW 32-bit build error

The error was:

ma_client_plugin.c: At top level:
ma_client_plugin.c:488:1: error: conflicting types for 'mysql_load_plugin'; have 'struct st_mysql_client_plugin *(MYSQL *, const char *, int,  int, ...)' {aka 'struct st_mysql_client_plugin *(struct st_mysql *, const char *, int,  int, ...)'}
  488 | mysql_load_plugin(MYSQL *mysql, const char *name, int type, int argc, ...)
      | ^~~~~~~~~~~~~~~~~
In file included from ../../mariadb-connector-c-3.4.5/include/ma_common.h:24,
                 from ma_client_plugin.c:38:
../../mariadb-connector-c-3.4.5/include/mysql/client_plugin.h:199:1: note: previous declaration of 'mysql_load_plugin' with type 'struct st_mysql_client_plugin *(struct st_mysql *, const char *, int,  int, ...)'
  199 | mysql_load_plugin(struct st_mysql *mysql, const char *name, int type,

The definition of st_mysql_client_plugin in ma_client_plugin.c.in had
STDCALL, unlike both the declaration in mysql/client_plugin.h and the
declaration in mysql.h. Removing this apparently stray STDCALL
from the definition allows the build to complete.

diff --git a/libmariadb/ma_client_plugin.c.in b/libmariadb/ma_client_plugin.c.in
index 1111111..2222222 100644
--- a/libmariadb/ma_client_plugin.c.in
+++ b/libmariadb/ma_client_plugin.c.in
@@ -478,7 +478,7 @@ err:
 
 
 /* see <mysql/client_plugin.h> for a full description */
-struct st_mysql_client_plugin * STDCALL
+struct st_mysql_client_plugin *
 mysql_load_plugin(MYSQL *mysql, const char *name, int type, int argc, ...)
 {
   struct st_mysql_client_plugin *p;
