Fix build and packaging on Windows:

- build executables we have in 5.3 (mysql_install_db.exe, mysq_upgrade_service.exe, upgrade wizard), and MSI

- add some missing headers to windows specific source files. 
This needs to be done since 5.5 is using WIN32_LEAN_AND_MEAN preprocessor constant thus windows.h 
no more includes whiole Windows

- do not deliver perl scripts  (mysql_install_db.pl & friends)  -they do not work, are not documented, and we 
have native executables for this functionality. do not pack echo.exe, replace.exe  into MSI, they 
are not needed. Do not build resolveip on Windows, it is not used.

- precache results of  of system checks in cmake/os/WindowsCache.cmake (like it is alreay done for  majority of tests
to speed up cmake run with VS)

- make feedback plugin DEFAULT on Windows (so MSI works if user enables plugin), 
fix null pointer access in PSI_register
This commit is contained in:
Vladislav Vaintroub 2011-11-26 23:07:53 +01:00
parent 6be24a771a
commit 64e308e28d
15 changed files with 71 additions and 18 deletions

View file

@ -318,6 +318,11 @@ ENDIF()
INCLUDE(cmake/abi_check.cmake) INCLUDE(cmake/abi_check.cmake)
INCLUDE(cmake/tags.cmake) INCLUDE(cmake/tags.cmake)
IF(WIN32)
ADD_SUBDIRECTORY(win/packaging)
ADD_SUBDIRECTORY(win/upgrade_wizard)
ENDIF()
CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/my_config.h) CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/my_config.h)
CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/config.h) CONFIGURE_FILE(config.h.cmake ${CMAKE_BINARY_DIR}/include/config.h)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in
@ -349,7 +354,7 @@ IF(WIN32)
ELSE() ELSE()
SET(CPACK_GENERATOR "TGZ") SET(CPACK_GENERATOR "TGZ")
ENDIF() ENDIF()
ADD_SUBDIRECTORY(packaging/WiX)
# Create a single package with "make package" # Create a single package with "make package"
# (see http://public.kitware.com/Bug/view.php?id=11452) # (see http://public.kitware.com/Bug/view.php?id=11452)

View file

@ -70,7 +70,7 @@ TARGET_LINK_LIBRARIES(mysqlslap mysqlclient)
# "WIN32" also covers 64 bit. "echo" is used in some files below "mysql-test/". # "WIN32" also covers 64 bit. "echo" is used in some files below "mysql-test/".
IF(WIN32) IF(WIN32)
MYSQL_ADD_EXECUTABLE(echo echo.c) MYSQL_ADD_EXECUTABLE(echo echo.c COMPONENT Junk)
ENDIF(WIN32) ENDIF(WIN32)
SET_TARGET_PROPERTIES (mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysqlslap mysql_plugin SET_TARGET_PROPERTIES (mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysqlslap mysql_plugin

View file

@ -89,6 +89,8 @@ IF(MSVC)
FOREACH(type EXE SHARED MODULE) FOREACH(type EXE SHARED MODULE)
STRING(REGEX REPLACE "/STACK:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS}") STRING(REGEX REPLACE "/STACK:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS}")
STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}") STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}")
STRING(REGEX REPLACE "/INCREMENTAL$" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}")
SET(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF /release")
ENDFOREACH() ENDFOREACH()
# Mark 32 bit executables large address aware so they can # Mark 32 bit executables large address aware so they can

View file

@ -58,6 +58,7 @@ SET(HAVE_FCNTL_NONBLOCK CACHE INTERNAL "")
SET(HAVE_FCONVERT CACHE INTERNAL "") SET(HAVE_FCONVERT CACHE INTERNAL "")
SET(HAVE_FDATASYNC CACHE INTERNAL "") SET(HAVE_FDATASYNC CACHE INTERNAL "")
SET(HAVE_DECL_FDATASYNC CACHE INTERNAL "") SET(HAVE_DECL_FDATASYNC CACHE INTERNAL "")
SET(HAVE_FEDISABLEEXCEPT CACHE INTERNAL "")
SET(HAVE_FENV_H CACHE INTERNAL "") SET(HAVE_FENV_H CACHE INTERNAL "")
SET(HAVE_FESETROUND CACHE INTERNAL "") SET(HAVE_FESETROUND CACHE INTERNAL "")
SET(HAVE_FGETLN CACHE INTERNAL "") SET(HAVE_FGETLN CACHE INTERNAL "")
@ -126,6 +127,7 @@ SET(HAVE_MLOCK CACHE INTERNAL "")
SET(HAVE_MLOCKALL CACHE INTERNAL "") SET(HAVE_MLOCKALL CACHE INTERNAL "")
SET(HAVE_MMAP CACHE INTERNAL "") SET(HAVE_MMAP CACHE INTERNAL "")
SET(HAVE_MMAP64 CACHE INTERNAL "") SET(HAVE_MMAP64 CACHE INTERNAL "")
SET(HAVE_NETDB_H CACHE INTERNAL "")
SET(HAVE_NETINET_IN6_H CACHE INTERNAL "") SET(HAVE_NETINET_IN6_H CACHE INTERNAL "")
SET(HAVE_NETINET_IN_H CACHE INTERNAL "") SET(HAVE_NETINET_IN_H CACHE INTERNAL "")
SET(HAVE_NL_LANGINFO CACHE INTERNAL "") SET(HAVE_NL_LANGINFO CACHE INTERNAL "")
@ -276,6 +278,7 @@ SET(HAVE_SYS_PTE_H CACHE INTERNAL "")
SET(HAVE_SYS_RESOURCE_H CACHE INTERNAL "") SET(HAVE_SYS_RESOURCE_H CACHE INTERNAL "")
SET(HAVE_SYS_SELECT_H CACHE INTERNAL "") SET(HAVE_SYS_SELECT_H CACHE INTERNAL "")
SET(HAVE_SYS_SHM_H CACHE INTERNAL "") SET(HAVE_SYS_SHM_H CACHE INTERNAL "")
SET(HAVE_SYS_SOCKIO_H CACHE INTERNAL "")
SET(HAVE_SYS_SOCKET_H CACHE INTERNAL "") SET(HAVE_SYS_SOCKET_H CACHE INTERNAL "")
SET(HAVE_SYS_STAT_H 1 CACHE INTERNAL "") SET(HAVE_SYS_STAT_H 1 CACHE INTERNAL "")
SET(HAVE_SYS_STREAM_H CACHE INTERNAL "") SET(HAVE_SYS_STREAM_H CACHE INTERNAL "")
@ -333,6 +336,7 @@ SET(STRUCT_DIRENT_HAS_D_INO CACHE INTERNAL "")
SET(STRUCT_DIRENT_HAS_D_INO CACHE INTERNAL "") SET(STRUCT_DIRENT_HAS_D_INO CACHE INTERNAL "")
SET(STRUCT_DIRENT_HAS_D_NAMLEN CACHE INTERNAL "") SET(STRUCT_DIRENT_HAS_D_NAMLEN CACHE INTERNAL "")
SET(TIME_WITH_SYS_TIME CACHE INTERNAL "") SET(TIME_WITH_SYS_TIME CACHE INTERNAL "")
SET(TIME_T_UNSIGNED 1 CACHE INTERNAL "")
SET(TIOCSTAT_IN_SYS_IOCTL CACHE INTERNAL "") SET(TIOCSTAT_IN_SYS_IOCTL CACHE INTERNAL "")
SET(HAVE_S_IROTH CACHE INTERNAL "") SET(HAVE_S_IROTH CACHE INTERNAL "")
SET(HAVE_S_IFIFO CACHE INTERNAL "") SET(HAVE_S_IFIFO CACHE INTERNAL "")

View file

@ -61,6 +61,7 @@ MYSQL_ADD_EXECUTABLE(perror perror.c)
ADD_DEPENDENCIES(perror GenError) ADD_DEPENDENCIES(perror GenError)
TARGET_LINK_LIBRARIES(perror mysys) TARGET_LINK_LIBRARIES(perror mysys)
IF(UNIX)
MYSQL_ADD_EXECUTABLE(resolveip resolveip.c) MYSQL_ADD_EXECUTABLE(resolveip resolveip.c)
TARGET_LINK_LIBRARIES(resolveip mysys) TARGET_LINK_LIBRARIES(resolveip mysys)
IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
@ -69,8 +70,9 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
MY_SEARCH_LIBS(inet_aton "nsl;socket;resolv" SOLARIS_NSL) MY_SEARCH_LIBS(inet_aton "nsl;socket;resolv" SOLARIS_NSL)
TARGET_LINK_LIBRARIES(resolveip ${SOLARIS_NSL}) TARGET_LINK_LIBRARIES(resolveip ${SOLARIS_NSL})
ENDIF() ENDIF()
ENDIF()
MYSQL_ADD_EXECUTABLE(replace replace.c) MYSQL_ADD_EXECUTABLE(replace replace.c COMPONENT Junk)
TARGET_LINK_LIBRARIES(replace mysys) TARGET_LINK_LIBRARIES(replace mysys)
IF(UNIX) IF(UNIX)
MYSQL_ADD_EXECUTABLE(innochecksum innochecksum.c) MYSQL_ADD_EXECUTABLE(innochecksum innochecksum.c)

View file

@ -12,7 +12,7 @@ ENDIF(HAVE_NETDB_H)
IF(WIN32) IF(WIN32)
#SET(FEEDBACK_LIBS Ws2_32) #SET(FEEDBACK_LIBS Ws2_32)
MYSQL_ADD_PLUGIN(FEEDBACK ${FEEDBACK_SOURCES} STATIC_ONLY) MYSQL_ADD_PLUGIN(FEEDBACK ${FEEDBACK_SOURCES} STATIC_ONLY DEFAULT)
ELSE(WIN32) ELSE(WIN32)
MYSQL_ADD_PLUGIN(FEEDBACK ${FEEDBACK_SOURCES}) MYSQL_ADD_PLUGIN(FEEDBACK ${FEEDBACK_SOURCES})
ENDIF(WIN32) ENDIF(WIN32)

View file

@ -231,7 +231,7 @@ static int init(void *p)
i_s_feedback->idx_field1 = 0; ///< virtual index on the 1st col i_s_feedback->idx_field1 = 0; ///< virtual index on the 1st col
#define PSI_register(X) \ #define PSI_register(X) \
PSI_server->register_ ## X("feedback", X ## _list, array_elements(X ## _list)) if(PSI_server) PSI_server->register_ ## X("feedback", X ## _list, array_elements(X ## _list))
PSI_register(mutex); PSI_register(mutex);
PSI_register(cond); PSI_register(cond);

View file

@ -203,18 +203,12 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.sh
${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db ESCAPE_QUOTES @ONLY) ${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db ESCAPE_QUOTES @ONLY)
SET(DEST ${INSTALL_SCRIPTDIR}) SET(DEST ${INSTALL_SCRIPTDIR})
SET(EXT) SET(EXT)
ELSE()
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.pl.in
${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db.pl ESCAPE_QUOTES @ONLY)
SET(DEST ${INSTALL_SCRIPTDIR})
SET(EXT ".pl")
ENDIF()
INSTALL_SCRIPT( INSTALL_SCRIPT(
"${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db${EXT}" "${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db"
DESTINATION ${DEST} DESTINATION ${DEST}
COMPONENT Server COMPONENT Server
) )
ENDIF()
SET(prefix "${CMAKE_INSTALL_PREFIX}") SET(prefix "${CMAKE_INSTALL_PREFIX}")

View file

@ -302,6 +302,46 @@ ELSE()
ENDIF() ENDIF()
ENDIF() ENDIF()
IF(WIN32)
SET(my_bootstrap_sql ${CMAKE_CURRENT_BINARY_DIR}/my_bootstrap.sql)
FILE(TO_NATIVE_PATH ${my_bootstrap_sql} native_outfile)
# Create bootstrapper SQL script
ADD_CUSTOM_COMMAND(OUTPUT
${my_bootstrap_sql}
COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_SOURCE_DIR}/scripts
cmd /c copy mysql_system_tables.sql+mysql_system_tables_data.sql+fill_help_tables.sql ${native_outfile}
DEPENDS
${CMAKE_SOURCE_DIR}/scripts/mysql_system_tables.sql
${CMAKE_SOURCE_DIR}/scripts/mysql_system_tables_data.sql
${CMAKE_SOURCE_DIR}/scripts/fill_help_tables.sql
)
ADD_CUSTOM_COMMAND(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mysql_bootstrap_sql.c
COMMAND comp_sql
mysql_bootstrap_sql
${CMAKE_CURRENT_BINARY_DIR}/my_bootstrap.sql
mysql_bootstrap_sql.c
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS comp_sql ${my_bootstrap_sql}
)
MYSQL_ADD_EXECUTABLE(mysql_install_db
mysql_install_db.cc
${CMAKE_CURRENT_BINARY_DIR}/mysql_bootstrap_sql.c
COMPONENT Server
)
TARGET_LINK_LIBRARIES(mysql_install_db mysys)
ADD_LIBRARY(winservice STATIC winservice.c)
TARGET_LINK_LIBRARIES(winservice shell32)
MYSQL_ADD_EXECUTABLE(mysql_upgrade_service
mysql_upgrade_service.cc
COMPONENT Server)
TARGET_LINK_LIBRARIES(mysql_upgrade_service mysys winservice)
ENDIF()
ADD_CUSTOM_TARGET(show-dist-name ADD_CUSTOM_TARGET(show-dist-name
COMMAND ${CMAKE_COMMAND} -E echo "${CPACK_PACKAGE_FILE_NAME}" COMMAND ${CMAKE_COMMAND} -E echo "${CPACK_PACKAGE_FILE_NAME}"
) )

View file

@ -36,6 +36,10 @@
#include "sql_show.h" // schema_table_store_record #include "sql_show.h" // schema_table_store_record
#include "sql_class.h" // THD #include "sql_class.h" // THD
#ifdef _WIN32
#pragma comment(lib,"psapi.lib")
#endif
#define TIME_FLOAT_DIGITS 9 #define TIME_FLOAT_DIGITS 9
/** two vals encoded: (len*100)+dec */ /** two vals encoded: (len*100)+dec */
#define TIME_I_S_DECIMAL_SIZE (TIME_FLOAT_DIGITS*100)+(TIME_FLOAT_DIGITS-3) #define TIME_I_S_DECIMAL_SIZE (TIME_FLOAT_DIGITS*100)+(TIME_FLOAT_DIGITS-3)

View file

@ -8,7 +8,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <shellapi.h>
/* /*
Get version from an executable file Get version from an executable file

View file

@ -1,5 +1,5 @@
ADD_DEFINITIONS(-DMYSQL_SERVER) ADD_DEFINITIONS(-DMYSQL_SERVER)
IF(MSVC) IF(MSVC)
TARGET_LINK_LIBRARIES(ws2_32) LINK_LIBRARIES(ws2_32)
ENDIF(MSVC) ENDIF(MSVC)
MYSQL_ADD_PLUGIN(sphinx ha_sphinx.cc STORAGE_ENGINE) MYSQL_ADD_PLUGIN(sphinx ha_sphinx.cc STORAGE_ENGINE)

View file

@ -9,7 +9,7 @@ IF(ESSENTIALS)
ENDIF() ENDIF()
ELSE() ELSE()
SET(CPACK_COMPONENTS_USED SET(CPACK_COMPONENTS_USED
"Server;Client;Development;SharedLibraries;Embedded;Debuginfo;Documentation;IniFiles;Readme;Server_Scripts;scripts;DebugBinaries") "Server;Client;Development;SharedLibraries;Embedded;Documentation;IniFiles;Readme;Debuginfo")
ENDIF() ENDIF()
SET( WIX_FEATURE_MySQLServer_EXTRA_FEATURES "DBInstance;SharedClientServerComponents") SET( WIX_FEATURE_MySQLServer_EXTRA_FEATURES "DBInstance;SharedClientServerComponents")

View file

@ -17,6 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#define UNICODE #define UNICODE
#endif #endif
#include <winsock2.h>
#include <windows.h> #include <windows.h>
#include <winreg.h> #include <winreg.h>
#include <msi.h> #include <msi.h>
@ -26,7 +27,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <string.h> #include <string.h>
#include <strsafe.h> #include <strsafe.h>
#include <assert.h> #include <assert.h>
#include <shellapi.h>
#include <stdlib.h>
#include <winservice.h> #include <winservice.h>
#define ONE_MB 1048576 #define ONE_MB 1048576

View file

@ -7,7 +7,7 @@ SET(CMAKE_CFG_INTDIR "@CMAKE_CFG_INTDIR@")
SET(VERSION "@VERSION@") SET(VERSION "@VERSION@")
SET(MAJOR_VERSION "@MAJOR_VERSION@") SET(MAJOR_VERSION "@MAJOR_VERSION@")
SET(MINOR_VERSION "@MINOR_VERSION@") SET(MINOR_VERSION "@MINOR_VERSION@")
SET(PATCH_VERSION "@PATCH@") SET(PATCH_VERSION "@PATCH_VERSION@")
SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@) SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@)
SET(MANUFACTURER "@MANUFACTURER@") SET(MANUFACTURER "@MANUFACTURER@")
SET(WIXCA_LOCATION "@WIXCA_LOCATION@") SET(WIXCA_LOCATION "@WIXCA_LOCATION@")