diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/packaging/CMakeLists.txt | 80 | ||||
-rw-r--r-- | win/packaging/CPackWixConfig.cmake | 2 | ||||
-rw-r--r-- | win/packaging/CPackZIPConfig.cmake | 11 | ||||
-rw-r--r-- | win/packaging/CPackZIPDebugInfoConfig.cmake | 6 | ||||
-rw-r--r-- | win/packaging/ca/CMakeLists.txt | 7 | ||||
-rw-r--r-- | win/packaging/create_msi.cmake | 11 | ||||
-rw-r--r-- | win/packaging/extra.wxs.in | 12 | ||||
-rw-r--r-- | win/packaging/mysql_server.wxs.in | 2 | ||||
-rw-r--r-- | win/upgrade_wizard/CMakeLists.txt | 18 | ||||
-rw-r--r-- | win/upgrade_wizard/upgradeDlg.cpp | 27 |
10 files changed, 119 insertions, 57 deletions
diff --git a/win/packaging/CMakeLists.txt b/win/packaging/CMakeLists.txt index 61bfe9e5568..465b4529fac 100644 --- a/win/packaging/CMakeLists.txt +++ b/win/packaging/CMakeLists.txt @@ -178,6 +178,39 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio") SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_CFG_INTDIR}") ENDIF() +IF(MSVC_CRT_TYPE MATCHES "/MD") + # Find out CRT merge module path, we're going to use it in installer + # The path and name depends on VS version + IF(MSVC_VERSION LESS 1900) + # VS2015 + SET(VCREDIST_MSM_FILENAME Microsoft_VC140_CRT_${WIX_ARCH_SUFFIX}.msm) + SET(ProgramFilesX86 "ProgramFiles(x86)") + FIND_FILE(${VCREDIST_MSM_FILENAME} + NO_DEFAULT_PATH + PATHS + "$ENV{${ProgramFilesX86}}/Common Files/Merge Modules" + "$ENV{ProgramFiles}/Common Files/Merge Modules" + ) + ELSEIF(MSVC_VERSION LESS 2000) + # VS2017 + SET(VCREDIST_MSM_FILENAME Microsoft_VC141_CRT_${WIX_ARCH_SUFFIX}.msm) + FILE(GLOB MSM_LIST "C:/Program Files*/Microsoft Visual Studio/2017/*/VC/Redist/MSVC/*/MergeModules/${VCREDIST_MSM_FILENAME}") + LIST(LENGTH MSM_LIST LEN) + IF(LEN GREATER 0) + LIST(GET MSM_LIST 0 VCRedist_MSM) + ENDIF() + ELSE() + # Post-VS2017. Needs to be ported when new VS is out + MESSAGE(WARNING + "Name of redistributable merge module not known for this version of MSVC") + ENDIF() + IF (NOT VCRedist_MSM) + MESSAGE(WARNING "Can't find merge module ${VCREDIST_MSM_FILENAME}") + ELSE() + FILE(TO_NATIVE_PATH ${VCRedist_MSM} VCRedist_MSM) + # MESSAGE("VCRedist_MSM=${VCRedist_MSM}") + ENDIF() +ENDIF() ADD_CUSTOM_TARGET( MSI @@ -209,41 +242,26 @@ ADD_CUSTOM_TARGET( -DVERSION="${VERSION}" -DWITH_THIRD_PARTY="${WITH_THIRD_PARTY}" -DWIXCA_LOCATION="$<TARGET_FILE:wixca>" + -DMSVC_CRT_TYPE="${MSVC_CRT_TYPE}" + -DVCRedist_MSM="${VCRedist_MSM}" -P ${CMAKE_CURRENT_SOURCE_DIR}/create_msi.cmake ) ADD_DEPENDENCIES(MSI wixca) + +IF(CMAKE_GENERATOR MATCHES "Visual Studio") + SET(CPACK_CONFIG_PARAM -C $(Configuration)) +ENDIF() + +IF(SIGNCODE) + SET(SIGN_COMMAND COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/sign.cmake) +ENDIF() + ADD_CUSTOM_TARGET( - MSI_ESSENTIALS - COMMAND ${CMAKE_COMMAND} ${CONFIG_PARAM} -DESSENTIALS=1 - -DCANDLE_EXECUTABLE="${CANDLE_EXECUTABLE}" - -DCMAKE_CFG_INTDIR="${CMAKE_CFG_INTDIR}" - -DCMAKE_FULL_VER="${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" - -DCMAKE_SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P} - -DCOPYING_RTF="${COPYING_RTF}" - -DCPACK_WIX_CONFIG="${CPACK_WIX_CONFIG}" - -DCPACK_WIX_INCLUDE="${CPACK_WIX_INCLUDE}" - -DCPACK_WIX_PACKAGE_BASE_NAME="${CPACK_WIX_PACKAGE_BASE_NAME}" - -DCPACK_WIX_PACKAGE_NAME="${CPACK_WIX_PACKAGE_NAME}" - -DCPACK_WIX_UPGRADE_CODE="${CPACK_WIX_UPGRADE_CODE}" - -DEXTRA_WIX_PREPROCESSOR_FLAGS="${EXTRA_WIX_PREPROCESSOR_FLAGS}" - -DLIGHT_EXECUTABLE="${LIGHT_EXECUTABLE}" - -DMAJOR_VERSION="${MAJOR_VERSION}" - -DMANUFACTURER="${MANUFACTURER}" - -DMINOR_VERSION="${MINOR_VERSION}" - -DPATCH_VERSION="${PATCH_VERSION}" - -DSIGNCODE="${SIGNCODE}" - -DSIGNTOOL_EXECUTABLE="${SIGNTOOL_EXECUTABLE}" - -DSIGNTOOL_PARAMETERS="${SIGNTOOL_PARAMETERS}" - -DSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}" - -DTHIRD_PARTY_DOWNLOAD_LOCATION="${THIRD_PARTY_DOWNLOAD_LOCATION}" - -DTHIRD_PARTY_FEATURE_CONDITION="${THIRD_PARTY_FEATURE_CONDITION}" - -DTINY_VERSION="${TINY_VERSION}" - -DTOP_BINDIR="${CMAKE_BINARY_DIR}" - -DVERSION="${VERSION}" - -DWITH_THIRD_PARTY="${WITH_THIRD_PARTY}" - -DWIXCA_LOCATION="$<TARGET_FILE:wixca>" - -P ${CMAKE_CURRENT_SOURCE_DIR}/create_msi.cmake + win_package + ${SIGN_COMMAND} + COMMAND cpack ${CPACK_CONFIG_PARAM} --config ${CMAKE_CURRENT_SOURCE_DIR}/CPackZipConfig.cmake + COMMAND cpack ${CPACK_CONFIG_PARAM} --config ${CMAKE_CURRENT_SOURCE_DIR}/CPackZipDebugInfoConfig.cmake + WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) -ADD_DEPENDENCIES(MSI_ESSENTIALS wixca) diff --git a/win/packaging/CPackWixConfig.cmake b/win/packaging/CPackWixConfig.cmake index 581f4925d41..74329e79247 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;Documentation;Readme;Debuginfo;Common;VCCRT;connect-engine;ClientPlugins;gssapi-server;gssapi-client;aws-key-management;rocksdb-engine;backup") + "Server;Client;Development;SharedLibraries;Documentation;Readme;Common;connect-engine;ClientPlugins;gssapi-server;gssapi-client;aws-key-management;rocksdb-engine;backup") ENDIF() SET( WIX_FEATURE_MySQLServer_EXTRA_FEATURES "DBInstance;SharedClientServerComponents") diff --git a/win/packaging/CPackZIPConfig.cmake b/win/packaging/CPackZIPConfig.cmake new file mode 100644 index 00000000000..5afbffbf0fe --- /dev/null +++ b/win/packaging/CPackZIPConfig.cmake @@ -0,0 +1,11 @@ +INCLUDE(CPackConfig.cmake) +SET(CPACK_GENERATOR ZIP) +set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) +set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE) +SET(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY ON) +FOREACH(it DebugBinaries Debuginfo IniFiles Junk Test SqlBench) + list(FIND CPACK_COMPONENTS_ALL "${it}" index) + IF(index GREATER 0) + LIST(REMOVE_AT CPACK_COMPONENTS_ALL ${index}) + ENDIF() +ENDFOREACH() diff --git a/win/packaging/CPackZIPDebugInfoConfig.cmake b/win/packaging/CPackZIPDebugInfoConfig.cmake new file mode 100644 index 00000000000..674c1675399 --- /dev/null +++ b/win/packaging/CPackZIPDebugInfoConfig.cmake @@ -0,0 +1,6 @@ +INCLUDE(CPackConfig.cmake) +set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}-debugsymbols") +set(CPACK_ARCHIVE_COMPONENT_INSTALL ON) +set(CPACK_COMPONENTS_GROUPING ALL_COMPONENTS_IN_ONE) +SET(CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY ON) +SET(CPACK_COMPONENTS_ALL Debuginfo) diff --git a/win/packaging/ca/CMakeLists.txt b/win/packaging/ca/CMakeLists.txt index 04d5408b9c9..79e8ee4c5a7 100644 --- a/win/packaging/ca/CMakeLists.txt +++ b/win/packaging/ca/CMakeLists.txt @@ -18,7 +18,8 @@ SET(WIXCA_SOURCES CustomAction.cpp CustomAction.def) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql) +# Custom action should not depend on C runtime, since we do not know if CRT is installed. +FORCE_STATIC_CRT() ADD_VERSION_INFO(wixca SHARED WIXCA_SOURCES) -ADD_LIBRARY(wixca SHARED EXCLUDE_FROM_ALL ${WIXCA_SOURCES}) -TARGET_LINK_LIBRARIES(wixca ${WIX_WCAUTIL_LIBRARY} ${WIX_DUTIL_LIBRARY} - msi version winservice) +ADD_LIBRARY(wixca SHARED EXCLUDE_FROM_ALL ${WIXCA_SOURCES} ${CMAKE_SOURCE_DIR}/sql/winservice.c) +TARGET_LINK_LIBRARIES(wixca ${WIX_WCAUTIL_LIBRARY} ${WIX_DUTIL_LIBRARY} msi version) diff --git a/win/packaging/create_msi.cmake b/win/packaging/create_msi.cmake index 795baa32c8f..01bb6505b3f 100644 --- a/win/packaging/create_msi.cmake +++ b/win/packaging/create_msi.cmake @@ -59,6 +59,11 @@ IF(CMAKE_INSTALL_CONFIG_NAME) SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_INSTALL_CONFIG_NAME}") ENDIF() +IF((MSVC_CRT_TYPE MATCHES "/MD") AND (NOT VCRedist_MSM)) + # Something was wrong, we package VC runtime merge modules + # when compiled with dynamic C runtime. + MESSAGE(FATAL_ERROR "Redistributable merge module was not found") +ENDIF() SET(COMPONENTS_ALL "${CPACK_COMPONENTS_ALL}") FOREACH(comp ${COMPONENTS_ALL}) @@ -381,9 +386,13 @@ EXECUTE_PROCESS( ${EXTRA_CANDLE_ARGS} ) +IF(VCRedist_MSM) + SET(SILENCE_VCREDIST_MSM_WARNINGS -sice:ICE82 -sice:ICE03) +ENDIF() + EXECUTE_PROCESS( COMMAND ${LIGHT_EXECUTABLE} -v -ext WixUIExtension -ext WixUtilExtension - -ext WixFirewallExtension -sice:ICE61 + -ext WixFirewallExtension -sice:ICE61 ${SILENCE_VCREDIST_MSM_WARNINGS} mysql_server.wixobj extra.wixobj -out ${CPACK_PACKAGE_FILE_NAME}.msi ${EXTRA_LIGHT_ARGS} ) diff --git a/win/packaging/extra.wxs.in b/win/packaging/extra.wxs.in index a71ef982896..7a9168d394a 100644 --- a/win/packaging/extra.wxs.in +++ b/win/packaging/extra.wxs.in @@ -650,7 +650,17 @@ </Feature> <?endif ?> - + + <?if "@VCRedist_MSM@" != "" ?> + <!-- VC runtime merge module --> + <DirectoryRef Id="TARGETDIR"> + <Merge Id="VCRedist" SourceFile="@VCRedist_MSM@" DiskId="1" Language="0"/> + </DirectoryRef> + <Feature Id="VCRedist" Title="Visual C++ Runtime" AllowAdvertise="no" Display="hidden" Level="1"> + <MergeRef Id="VCRedist"/> + </Feature> + <?endif?> + <!-- Custom action, call mysql_install_db --> <SetProperty Sequence='execute' Before='CreateDatabaseCommand' Id="SKIPNETWORKING" Value="--skip-networking" >SKIPNETWORKING</SetProperty> <SetProperty Sequence='execute' Before='CreateDatabaseCommand' Id="ALLOWREMOTEROOTACCESS" Value="--allow-remote-root-access">ALLOWREMOTEROOTACCESS</SetProperty> diff --git a/win/packaging/mysql_server.wxs.in b/win/packaging/mysql_server.wxs.in index c10116830e7..80dcc365e56 100644 --- a/win/packaging/mysql_server.wxs.in +++ b/win/packaging/mysql_server.wxs.in @@ -12,7 +12,7 @@ Keywords='Installer' Description='MariaDB Server' Manufacturer='@MANUFACTURER@' - InstallerVersion='200' + InstallerVersion='301' Languages='1033' Compressed='yes' SummaryCodepage='1252' diff --git a/win/upgrade_wizard/CMakeLists.txt b/win/upgrade_wizard/CMakeLists.txt index f4148ee98d2..7d0e774b968 100644 --- a/win/upgrade_wizard/CMakeLists.txt +++ b/win/upgrade_wizard/CMakeLists.txt @@ -23,21 +23,27 @@ IF(NOT MFC_FOUND) ENDIF() RETURN() ENDIF() + IF(MSVC_CRT_TYPE MATCHES "/MD") - # MFC should be dynamically linked - SET(CMAKE_MFC_FLAG 2) + # FORCE static CRT and MFC for upgrade wizard, + # so we do not have to redistribute MFC. + FORCE_STATIC_CRT() + SET(UPGRADE_WIZARD_SOURCES ${CMAKE_SOURCE_DIR}/sql/winservice.c) ELSE() - # MFC should be statically linked - SET(CMAKE_MFC_FLAG 1) + SET(UPGRADE_WIZARD_LINK_LIBRARIES winservice) ENDIF() + +# MFC should be statically linked +SET(CMAKE_MFC_FLAG 1) + # Enable exception handling (avoids warnings) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc -DNO_WARN_MBCS_MFC_DEPRECATION") INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql) MYSQL_ADD_EXECUTABLE(mysql_upgrade_wizard - upgrade.cpp upgradeDlg.cpp upgrade.rc + upgrade.cpp upgradeDlg.cpp upgrade.rc ${UPGRADE_WIZARD_SOURCES} COMPONENT Server) -TARGET_LINK_LIBRARIES(mysql_upgrade_wizard winservice) +TARGET_LINK_LIBRARIES(mysql_upgrade_wizard ${UPGRADE_WIZARD_LINK_LIBRARIES}) # upgrade_wizard is Windows executable, set WIN32_EXECUTABLE so it does not # create a console. SET_TARGET_PROPERTIES(mysql_upgrade_wizard PROPERTIES WIN32_EXECUTABLE 1) diff --git a/win/upgrade_wizard/upgradeDlg.cpp b/win/upgrade_wizard/upgradeDlg.cpp index d996c0ebe5d..793e89886d6 100644 --- a/win/upgrade_wizard/upgradeDlg.cpp +++ b/win/upgrade_wizard/upgradeDlg.cpp @@ -422,21 +422,22 @@ void CUpgradeDlg::UpgradeOneService(const string& servicename) { allMessages[lines%MAX_MESSAGES] = output_line; m_DataDir.SetWindowText(allMessages[lines%MAX_MESSAGES].c_str()); - output_line.clear(); lines++; - /* - Updating progress dialog.There are currently 9 messages from - mysql_upgrade_service (actually it also writes Phase N/M but - we do not parse the output right now). - */ -#define EXPRECTED_MYSQL_UPGRADE_MESSAGES 9 - - int stepsTotal= m_ProgressTotal*EXPRECTED_MYSQL_UPGRADE_MESSAGES; - int stepsCurrent= m_ProgressCurrent*EXPRECTED_MYSQL_UPGRADE_MESSAGES - + lines; - int percentDone= stepsCurrent*100/stepsTotal; - m_Progress.SetPos(percentDone); + int curPhase, numPhases; + + // Parse output line to update progress indicator + if (strncmp(output_line.c_str(),"Phase ",6) == 0 && + sscanf(output_line.c_str() +6 ,"%d/%d",&curPhase,&numPhases) == 2 + && numPhases > 0 ) + { + int stepsTotal= m_ProgressTotal*numPhases; + int stepsCurrent= m_ProgressCurrent*numPhases+ curPhase; + int percentDone= stepsCurrent*100/stepsTotal; + m_Progress.SetPos(percentDone); + m_Progress.SetPos(stepsCurrent * 100 / stepsTotal); + } + output_line.clear(); } else { |