mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-28888 : Embedded MariaDB does not build on Windows
Add limited support for building embedded library (DLL only).
This commit is contained in:
@@ -154,7 +154,11 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
|
||||
# (can be a static or shared lib)
|
||||
IF(LIB_TYPE STREQUAL "STATIC_LIBRARY")
|
||||
SET(STATIC_TGTS ${STATIC_TGTS} ${LIB})
|
||||
SET(STATIC_LIBS ${STATIC_LIBS} $<TARGET_FILE:${LIB}>)
|
||||
IF(MSVC)
|
||||
TARGET_LINK_LIBRARIES(${TARGET} PRIVATE ${LIB})
|
||||
ELSE()
|
||||
SET(STATIC_LIBS ${STATIC_LIBS} $<TARGET_FILE:${LIB}>)
|
||||
ENDIF()
|
||||
ADD_DEPENDENCIES(${TARGET} ${LIB})
|
||||
# Extract dependent OS libraries
|
||||
GET_DEPENDEND_OS_LIBS(${LIB} LIB_OSLIBS)
|
||||
|
@@ -148,6 +148,7 @@ ADD_DEPENDENCIES(sql_embedded GenError GenServerSource)
|
||||
IF(TARGET pcre2)
|
||||
ADD_DEPENDENCIES(sql_embedded pcre2)
|
||||
ENDIF()
|
||||
TARGET_LINK_LIBRARIES(sql_embedded LINK_PRIVATE tpool ${CRC32_LIBRARY})
|
||||
|
||||
# On Windows, static embedded server library is called mysqlserver.lib
|
||||
# On Unix, it is libmysqld.a
|
||||
|
@@ -485,7 +485,7 @@ MYSQL_METHODS embedded_methods=
|
||||
|
||||
char **copy_arguments(int argc, char **argv)
|
||||
{
|
||||
uint length= 0;
|
||||
size_t length= 0;
|
||||
char **from, **res, **end= argv+argc;
|
||||
|
||||
for (from=argv ; from != end ; from++)
|
||||
@@ -1100,11 +1100,11 @@ bool Protocol_text::store_field_metadata(const THD * thd,
|
||||
client_field->flags= (uint16) server_field.flags;
|
||||
client_field->decimals= server_field.decimals;
|
||||
|
||||
client_field->db_length= strlen(client_field->db);
|
||||
client_field->table_length= strlen(client_field->table);
|
||||
client_field->name_length= strlen(client_field->name);
|
||||
client_field->org_name_length= strlen(client_field->org_name);
|
||||
client_field->org_table_length= strlen(client_field->org_table);
|
||||
client_field->db_length= (uint)strlen(client_field->db);
|
||||
client_field->table_length= (uint)strlen(client_field->table);
|
||||
client_field->name_length= (uint)strlen(client_field->name);
|
||||
client_field->org_name_length= (uint)strlen(client_field->org_name);
|
||||
client_field->org_table_length= (uint)strlen(client_field->org_table);
|
||||
|
||||
client_field->catalog= dup_str_aux(field_alloc, "def", 3, cs, thd_cs);
|
||||
client_field->catalog_length= 3;
|
||||
@@ -1378,12 +1378,12 @@ bool Protocol::net_store_data(const uchar *from, size_t length)
|
||||
|
||||
if (!(field_buf= (char*) alloc_root(alloc, length + sizeof(uint) + 1)))
|
||||
return TRUE;
|
||||
*(uint *)field_buf= length;
|
||||
*(uint *)field_buf= (uint)length;
|
||||
*next_field= field_buf + sizeof(uint);
|
||||
memcpy((uchar*) *next_field, from, length);
|
||||
(*next_field)[length]= 0;
|
||||
if (next_mysql_field->max_length < length)
|
||||
next_mysql_field->max_length=length;
|
||||
next_mysql_field->max_length=(ulong)length;
|
||||
++next_field;
|
||||
++next_mysql_field;
|
||||
return FALSE;
|
||||
@@ -1393,7 +1393,7 @@ bool Protocol::net_store_data(const uchar *from, size_t length)
|
||||
bool Protocol::net_store_data_cs(const uchar *from, size_t length,
|
||||
CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
|
||||
{
|
||||
uint conv_length= to_cs->mbmaxlen * length / from_cs->mbminlen;
|
||||
size_t conv_length= length * to_cs->mbmaxlen / from_cs->mbminlen;
|
||||
uint dummy_error;
|
||||
char *field_buf;
|
||||
if (!thd->mysql) // bootstrap file handling
|
||||
@@ -1404,10 +1404,10 @@ bool Protocol::net_store_data_cs(const uchar *from, size_t length,
|
||||
*next_field= field_buf + sizeof(uint);
|
||||
length= copy_and_convert(*next_field, conv_length, to_cs,
|
||||
(const char*) from, length, from_cs, &dummy_error);
|
||||
*(uint *) field_buf= length;
|
||||
*(uint *) field_buf= (uint)length;
|
||||
(*next_field)[length]= 0;
|
||||
if (next_mysql_field->max_length < length)
|
||||
next_mysql_field->max_length= length;
|
||||
next_mysql_field->max_length= (ulong)length;
|
||||
++next_field;
|
||||
++next_mysql_field;
|
||||
return false;
|
||||
|
@@ -1827,6 +1827,13 @@ extern "C" sig_handler print_signal_warning(int sig)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef void (*report_svc_status_t)(DWORD current_state, DWORD win32_exit_code,
|
||||
DWORD wait_hint);
|
||||
static void dummy_svc_status(DWORD, DWORD, DWORD) {}
|
||||
static report_svc_status_t my_report_svc_status= dummy_svc_status;
|
||||
#endif
|
||||
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
extern "C" void unireg_abort(int exit_code)
|
||||
{
|
||||
@@ -1872,13 +1879,6 @@ extern "C" void unireg_abort(int exit_code)
|
||||
mysqld_exit(exit_code);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
typedef void (*report_svc_status_t)(DWORD current_state, DWORD win32_exit_code,
|
||||
DWORD wait_hint);
|
||||
static void dummy_svc_status(DWORD, DWORD, DWORD) {}
|
||||
static report_svc_status_t my_report_svc_status= dummy_svc_status;
|
||||
#endif
|
||||
|
||||
static void mysqld_exit(int exit_code)
|
||||
{
|
||||
DBUG_ENTER("mysqld_exit");
|
||||
@@ -4564,6 +4564,7 @@ void ssl_acceptor_stats_update(int sslaccept_ret)
|
||||
|
||||
static void init_ssl()
|
||||
{
|
||||
#if !defined(EMBEDDED_LIBRARY)
|
||||
/*
|
||||
Not need to check require_secure_transport on the Linux,
|
||||
because it always has Unix domain sockets that are secure:
|
||||
@@ -4579,7 +4580,7 @@ static void init_ssl()
|
||||
unireg_abort(1);
|
||||
}
|
||||
#endif
|
||||
#if defined(HAVE_OPENSSL) && !defined(EMBEDDED_LIBRARY)
|
||||
#if defined(HAVE_OPENSSL)
|
||||
if (opt_use_ssl)
|
||||
{
|
||||
enum enum_ssl_init_error error= SSL_INITERR_NOERROR;
|
||||
@@ -4620,7 +4621,8 @@ static void init_ssl()
|
||||
}
|
||||
if (des_key_file)
|
||||
load_des_key_file(des_key_file);
|
||||
#endif /* HAVE_OPENSSL && ! EMBEDDED_LIBRARY */
|
||||
#endif /* HAVE_OPENSSL */
|
||||
#endif /* !EMBEDDED_LIBRARY */
|
||||
}
|
||||
|
||||
/* Reinitialize SSL (FLUSH SSL) */
|
||||
|
Reference in New Issue
Block a user