diff options
author | Vladislav Vaintroub <wlad@montyprogram.com> | 2011-11-26 23:07:53 +0100 |
---|---|---|
committer | Vladislav Vaintroub <wlad@montyprogram.com> | 2011-11-26 23:07:53 +0100 |
commit | 64e308e28d2b0fb4cd005e23189e3639912bcd60 (patch) | |
tree | 07aa8c5d623328ff0288dba79634ec3e2a9ed5e3 | |
parent | 6be24a771a27a077d58d21a4a1f8db3fbd14cac4 (diff) | |
download | mariadb-git-64e308e28d2b0fb4cd005e23189e3639912bcd60.tar.gz |
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
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | client/CMakeLists.txt | 2 | ||||
-rw-r--r-- | cmake/os/Windows.cmake | 2 | ||||
-rw-r--r-- | cmake/os/WindowsCache.cmake | 4 | ||||
-rw-r--r-- | extra/CMakeLists.txt | 4 | ||||
-rw-r--r-- | plugin/feedback/CMakeLists.txt | 2 | ||||
-rw-r--r-- | plugin/feedback/feedback.cc | 2 | ||||
-rw-r--r-- | scripts/CMakeLists.txt | 10 | ||||
-rw-r--r-- | sql/CMakeLists.txt | 40 | ||||
-rw-r--r-- | sql/sql_profile.cc | 4 | ||||
-rw-r--r-- | sql/winservice.c | 2 | ||||
-rw-r--r-- | storage/sphinx/CMakeLists.txt | 2 | ||||
-rw-r--r-- | win/packaging/CPackWixConfig.cmake | 2 | ||||
-rw-r--r-- | win/packaging/ca/CustomAction.cpp | 4 | ||||
-rw-r--r-- | win/packaging/create_msi.cmake.in | 2 |
15 files changed, 71 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 83145c72f43..d6cfd7fc288 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -318,6 +318,11 @@ ENDIF() INCLUDE(cmake/abi_check.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/config.h) CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/include/mysql_version.h.in @@ -349,7 +354,7 @@ IF(WIN32) ELSE() SET(CPACK_GENERATOR "TGZ") ENDIF() -ADD_SUBDIRECTORY(packaging/WiX) + # Create a single package with "make package" # (see http://public.kitware.com/Bug/view.php?id=11452) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 25ae9370829..5ddaff67692 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -70,7 +70,7 @@ TARGET_LINK_LIBRARIES(mysqlslap mysqlclient) # "WIN32" also covers 64 bit. "echo" is used in some files below "mysql-test/". IF(WIN32) - MYSQL_ADD_EXECUTABLE(echo echo.c) + MYSQL_ADD_EXECUTABLE(echo echo.c COMPONENT Junk) ENDIF(WIN32) SET_TARGET_PROPERTIES (mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysqlslap mysql_plugin diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index 0ccdc3cb6a4..42ddb12bf37 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -89,6 +89,8 @@ IF(MSVC) FOREACH(type EXE SHARED MODULE) 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}") + SET(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF /release") ENDFOREACH() # Mark 32 bit executables large address aware so they can diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index 897012896c8..b6a2c8b22fe 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -58,6 +58,7 @@ SET(HAVE_FCNTL_NONBLOCK CACHE INTERNAL "") SET(HAVE_FCONVERT CACHE INTERNAL "") SET(HAVE_FDATASYNC CACHE INTERNAL "") SET(HAVE_DECL_FDATASYNC CACHE INTERNAL "") +SET(HAVE_FEDISABLEEXCEPT CACHE INTERNAL "") SET(HAVE_FENV_H CACHE INTERNAL "") SET(HAVE_FESETROUND CACHE INTERNAL "") SET(HAVE_FGETLN CACHE INTERNAL "") @@ -126,6 +127,7 @@ SET(HAVE_MLOCK CACHE INTERNAL "") SET(HAVE_MLOCKALL CACHE INTERNAL "") SET(HAVE_MMAP CACHE INTERNAL "") SET(HAVE_MMAP64 CACHE INTERNAL "") +SET(HAVE_NETDB_H CACHE INTERNAL "") SET(HAVE_NETINET_IN6_H CACHE INTERNAL "") SET(HAVE_NETINET_IN_H 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_SELECT_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_STAT_H 1 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_NAMLEN CACHE INTERNAL "") SET(TIME_WITH_SYS_TIME CACHE INTERNAL "") +SET(TIME_T_UNSIGNED 1 CACHE INTERNAL "") SET(TIOCSTAT_IN_SYS_IOCTL CACHE INTERNAL "") SET(HAVE_S_IROTH CACHE INTERNAL "") SET(HAVE_S_IFIFO CACHE INTERNAL "") diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt index a079287f6b2..d7e6cf61983 100644 --- a/extra/CMakeLists.txt +++ b/extra/CMakeLists.txt @@ -61,6 +61,7 @@ MYSQL_ADD_EXECUTABLE(perror perror.c) ADD_DEPENDENCIES(perror GenError) TARGET_LINK_LIBRARIES(perror mysys) +IF(UNIX) MYSQL_ADD_EXECUTABLE(resolveip resolveip.c) TARGET_LINK_LIBRARIES(resolveip mysys) 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) TARGET_LINK_LIBRARIES(resolveip ${SOLARIS_NSL}) ENDIF() +ENDIF() -MYSQL_ADD_EXECUTABLE(replace replace.c) +MYSQL_ADD_EXECUTABLE(replace replace.c COMPONENT Junk) TARGET_LINK_LIBRARIES(replace mysys) IF(UNIX) MYSQL_ADD_EXECUTABLE(innochecksum innochecksum.c) diff --git a/plugin/feedback/CMakeLists.txt b/plugin/feedback/CMakeLists.txt index 7407cc65637..627e4d643fb 100644 --- a/plugin/feedback/CMakeLists.txt +++ b/plugin/feedback/CMakeLists.txt @@ -12,7 +12,7 @@ ENDIF(HAVE_NETDB_H) IF(WIN32) #SET(FEEDBACK_LIBS Ws2_32) - MYSQL_ADD_PLUGIN(FEEDBACK ${FEEDBACK_SOURCES} STATIC_ONLY) + MYSQL_ADD_PLUGIN(FEEDBACK ${FEEDBACK_SOURCES} STATIC_ONLY DEFAULT) ELSE(WIN32) MYSQL_ADD_PLUGIN(FEEDBACK ${FEEDBACK_SOURCES}) ENDIF(WIN32) diff --git a/plugin/feedback/feedback.cc b/plugin/feedback/feedback.cc index 975aaef7d38..d7342eaa109 100644 --- a/plugin/feedback/feedback.cc +++ b/plugin/feedback/feedback.cc @@ -231,7 +231,7 @@ static int init(void *p) i_s_feedback->idx_field1 = 0; ///< virtual index on the 1st col #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(cond); diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 424d92e31e1..a454313d966 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -203,18 +203,12 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.sh ${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db ESCAPE_QUOTES @ONLY) SET(DEST ${INSTALL_SCRIPTDIR}) 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( - "${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db${EXT}" + "${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db" DESTINATION ${DEST} COMPONENT Server ) +ENDIF() SET(prefix "${CMAKE_INSTALL_PREFIX}") diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 6d7b73ffcee..3f6d6a08397 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -302,6 +302,46 @@ ELSE() 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 COMMAND ${CMAKE_COMMAND} -E echo "${CPACK_PACKAGE_FILE_NAME}" ) diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index aee42af8b71..fe593dbae88 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -36,6 +36,10 @@ #include "sql_show.h" // schema_table_store_record #include "sql_class.h" // THD +#ifdef _WIN32 +#pragma comment(lib,"psapi.lib") +#endif + #define TIME_FLOAT_DIGITS 9 /** two vals encoded: (len*100)+dec */ #define TIME_I_S_DECIMAL_SIZE (TIME_FLOAT_DIGITS*100)+(TIME_FLOAT_DIGITS-3) diff --git a/sql/winservice.c b/sql/winservice.c index 562f047fa79..51a5a07a820 100644 --- a/sql/winservice.c +++ b/sql/winservice.c @@ -8,7 +8,7 @@ #include <string.h> #include <stdlib.h> #include <stdio.h> - +#include <shellapi.h> /* Get version from an executable file diff --git a/storage/sphinx/CMakeLists.txt b/storage/sphinx/CMakeLists.txt index 136c49336a3..d9320d10cf7 100644 --- a/storage/sphinx/CMakeLists.txt +++ b/storage/sphinx/CMakeLists.txt @@ -1,5 +1,5 @@ ADD_DEFINITIONS(-DMYSQL_SERVER) IF(MSVC) - TARGET_LINK_LIBRARIES(ws2_32) + LINK_LIBRARIES(ws2_32) ENDIF(MSVC) MYSQL_ADD_PLUGIN(sphinx ha_sphinx.cc STORAGE_ENGINE) diff --git a/win/packaging/CPackWixConfig.cmake b/win/packaging/CPackWixConfig.cmake index 34f661b393e..0722ecbbccb 100644 --- a/win/packaging/CPackWixConfig.cmake +++ b/win/packaging/CPackWixConfig.cmake @@ -9,7 +9,7 @@ IF(ESSENTIALS) ENDIF()
ELSE()
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()
SET( WIX_FEATURE_MySQLServer_EXTRA_FEATURES "DBInstance;SharedClientServerComponents")
diff --git a/win/packaging/ca/CustomAction.cpp b/win/packaging/ca/CustomAction.cpp index 81c9f7eea92..ed26dd45a94 100644 --- a/win/packaging/ca/CustomAction.cpp +++ b/win/packaging/ca/CustomAction.cpp @@ -17,6 +17,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #define UNICODE #endif +#include <winsock2.h> #include <windows.h> #include <winreg.h> #include <msi.h> @@ -26,7 +27,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <string.h> #include <strsafe.h> #include <assert.h> - +#include <shellapi.h> +#include <stdlib.h> #include <winservice.h> #define ONE_MB 1048576 diff --git a/win/packaging/create_msi.cmake.in b/win/packaging/create_msi.cmake.in index d291d06161c..d02791d3b9f 100644 --- a/win/packaging/create_msi.cmake.in +++ b/win/packaging/create_msi.cmake.in @@ -7,7 +7,7 @@ SET(CMAKE_CFG_INTDIR "@CMAKE_CFG_INTDIR@") SET(VERSION "@VERSION@") SET(MAJOR_VERSION "@MAJOR_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(MANUFACTURER "@MANUFACTURER@") SET(WIXCA_LOCATION "@WIXCA_LOCATION@") |