File mingw-w64.patch of Package mingw64-mysql-connector-c
--- mysql-connector-c-6.1.11-src/cmake/install_macros.cmake 2017-07-13 08:55:32.000000000 +0200
+++ mysql-connector-c-6.1.11-src/cmake/install_macros.cmake 2021-06-30 19:08:07.562364469 +0200
@@ -362,8 +362,9 @@
CONFIGURATIONS Release RelWithDebInfo
COMPONENT ${ARG_COMPONENT}
OPTIONAL)
- ENDIF()
ENDFOREACH()
+ ENDIF()
+
ENDFUNCTION()
--- mysql-connector-c-6.1.11-src/extra/yassl/src/yassl_int.cpp 2017-07-13 08:55:32.000000000 +0200
+++ mysql-connector-c-6.1.11-src/extra/yassl/src/yassl_int.cpp 2021-06-30 19:06:55.702266472 +0200
@@ -20,7 +20,8 @@
// First include (the generated) my_config.h, to get correct platform defines.
#include "my_config.h"
#ifdef _WIN32
-#include<Windows.h>
+#include <winsock2.h>
+#include <windows.h>
#else
#include <pthread.h>
#endif
--- mysql-connector-c-6.1.11-src/include/my_atomic.h 2017-07-13 08:55:32.000000000 +0200
+++ mysql-connector-c-6.1.11-src/include/my_atomic.h 2021-06-30 19:06:55.702266472 +0200
@@ -58,7 +58,7 @@
# include "atomic/solaris.h"
#elif defined(HAVE_GCC_SYNC_BUILTINS) /* Use old __sync by default */
# include "atomic/gcc_sync.h"
-#elif defined(HAVE_GCC_ATOMIC_BUILTINS) /* Use __atomic on e.g. powerpc */
+#elif defined(HAVE_GCC_ATOMIC_BUILTINS) || defined(__MINGW32__)/* Use __atomic on e.g. powerpc */
# include "atomic/gcc_atomic.h"
#else
# error Native atomics support not found!
--- mysql-connector-c-6.1.11-src/include/my_dir.h 2017-07-13 08:55:32.000000000 +0200
+++ mysql-connector-c-6.1.11-src/include/my_dir.h 2021-06-30 19:06:55.702266472 +0200
@@ -27,9 +27,11 @@
/* Defines for my_dir and my_stat */
#ifdef _WIN32
+#ifndef __MINGW32__
#define S_IROTH _S_IREAD
#define S_IFIFO _S_IFIFO
#endif
+#endif
#define MY_S_IFMT S_IFMT /* type of file */
#define MY_S_IFDIR S_IFDIR /* directory */
--- mysql-connector-c-6.1.11-src/include/my_global.h 2017-07-13 08:55:32.000000000 +0200
+++ mysql-connector-c-6.1.11-src/include/my_global.h 2021-06-30 19:06:55.702266472 +0200
@@ -217,8 +217,10 @@
#ifdef _WIN32
typedef int socket_len_t;
typedef int sigset_t;
+#ifndef __MINGW32__
typedef int mode_t;
typedef SSIZE_T ssize_t;
+#endif
#else
typedef socklen_t socket_len_t;
#endif
@@ -644,7 +646,7 @@
};
-#ifdef _WIN32
+#if defined(_WIN32) && !defined(__MINGW32__)
/****************************************************************************
** Replacements for localtime_r and gmtime_r
****************************************************************************/
@@ -660,7 +662,7 @@
gmtime_s(res, clock);
return res;
}
-#endif /* _WIN32 */
+#endif
#ifndef HAVE_STRUCT_TIMESPEC /* Windows before VS2015 */
/*
--- mysql-connector-c-6.1.11-src/include/mysql/psi/mysql_socket.h 2017-07-13 08:55:32.000000000 +0200
+++ mysql-connector-c-6.1.11-src/include/mysql/psi/mysql_socket.h 2021-06-30 19:06:55.702266472 +0200
@@ -29,7 +29,7 @@
#ifdef _WIN32
#include <ws2def.h>
#include <winsock2.h>
- #include <MSWSock.h>
+ #include <mswsock.h>
#define SOCKBUF_T char
#else
#include <netinet/in.h>
--- mysql-connector-c-6.1.11-src/include/mysql.h 2017-07-13 08:55:32.000000000 +0200
+++ mysql-connector-c-6.1.11-src/include/mysql.h 2021-06-30 19:06:55.706266476 +0200
@@ -35,7 +35,7 @@
#include <sys/types.h>
#endif
typedef char my_bool;
-#if !defined(_WIN32)
+#if !defined(_WIN32) || defined(__MINGW32__)
#define STDCALL
#else
#define STDCALL __stdcall
--- mysql-connector-c-6.1.11-src/libmysql/authentication_win/CMakeLists.txt 2017-07-13 08:55:32.000000000 +0200
+++ mysql-connector-c-6.1.11-src/libmysql/authentication_win/CMakeLists.txt 2021-06-30 19:06:55.702266472 +0200
@@ -26,7 +26,7 @@
SET(PLUGIN_SOURCES plugin_client.cc handshake_client.cc log_client.cc common.cc handshake.cc)
ADD_CONVENIENCE_LIBRARY(auth_win_client ${PLUGIN_SOURCES} ${HEADERS})
-TARGET_LINK_LIBRARIES(auth_win_client Secur32)
+TARGET_LINK_LIBRARIES(auth_win_client secur32)
# In IDE, group headers in a separate folder.
--- mysql-connector-c-6.1.11-src/libmysql/authentication_win/handshake.h 2017-07-13 08:55:32.000000000 +0200
+++ mysql-connector-c-6.1.11-src/libmysql/authentication_win/handshake.h 2021-06-30 19:06:55.702266472 +0200
@@ -100,7 +100,7 @@
Handshake(const char *ssp, side_t side);
virtual ~Handshake();
- int Handshake::packet_processing_loop();
+ int packet_processing_loop();
bool virtual is_complete() const
{
--- mysql-connector-c-6.1.11-src/libmysql/CMakeLists.txt 2017-07-13 08:55:32.000000000 +0200
+++ mysql-connector-c-6.1.11-src/libmysql/CMakeLists.txt 2021-06-30 19:06:55.706266476 +0200
@@ -256,13 +256,20 @@
SET(${out_name} ${name})
ENDMACRO()
-IF(UNIX)
+IF(UNIX OR MINGW)
MACRO(GET_VERSIONED_LIBNAME LIBNAME EXTENSION VERSION OUTNAME)
+ IF(MINGW)
+ SET(DOT_VERSION "-${VERSION}")
+ IF(DOT_VERSION STREQUAL "-")
+ SET(DOT_VERSION "")
+ ENDIF()
+ ELSE()
SET(DOT_VERSION ".${VERSION}")
IF(DOT_VERSION STREQUAL ".")
SET(DOT_VERSION "")
ENDIF()
- IF(APPLE)
+ ENDIF()
+ IF(APPLE OR MINGW)
SET(${OUTNAME} ${LIBNAME}${DOT_VERSION}${EXTENSION})
ELSE()
SET(${OUTNAME} ${LIBNAME}${EXTENSION}${DOT_VERSION})
@@ -285,9 +292,9 @@
MERGE_LIBRARIES(libmysql SHARED ${LIBS}
EXPORTS ${CLIENT_API_FUNCTIONS} ${CLIENT_API_FUNCTIONS_UNDOCUMENTED}
COMPONENT SharedLibraries)
- IF(UNIX)
+ IF(UNIX OR MINGW)
# libtool compatability
- IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE)
+ IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE OR MINGW)
SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}")
ELSE()
SET(OS_SHARED_LIB_VERSION
@@ -298,6 +305,12 @@
OUTPUT_NAME mysqlclient
VERSION "${OS_SHARED_LIB_VERSION}"
SOVERSION "${SHARED_LIB_MAJOR_VERSION}")
+ IF(MINGW)
+ # cmake is too dumb to handle mingw. Do the basics (append -MAJOR)
+ # and then do the rest in .spec
+ SET_TARGET_PROPERTIES(libmysql PROPERTIES
+ OUTPUT_NAME "mysqlclient-${OS_SHARED_LIB_VERSION}")
+ ENDIF()
CONFIGURE_FILE(libmysql.ver.in ${CMAKE_CURRENT_BINARY_DIR}/libmysql.ver)
IF(APPLE)
@@ -378,5 +391,5 @@
IF(DISABLE_SHARED)
TARGET_LINK_LIBRARIES(libmysql_api_test ${LIBS})
ELSE()
- TARGET_LINK_LIBRARIES(libmysql_api_test libmysql)
+ TARGET_LINK_LIBRARIES(libmysql_api_test mysqlclient)
ENDIF()
Only in mysql-connector-c-6.1.11-src/libmysql: CMakeLists.txt.orig
--- mysql-connector-c-6.1.11-src/mysys/my_thr_init.c 2017-07-13 08:55:32.000000000 +0200
+++ mysql-connector-c-6.1.11-src/mysys/my_thr_init.c 2021-06-30 19:06:55.702266472 +0200
@@ -452,7 +452,9 @@
static void install_sigabrt_handler()
{
/*abort() should not override our exception filter*/
+#if !defined(__MINGW32__)
_set_abort_behavior(0,_CALL_REPORTFAULT);
+#endif
signal(SIGABRT,my_sigabrt_handler);
}
#endif