summaryrefslogtreecommitdiff
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/Makefile.am41
-rw-r--r--win/build-vs10.bat2
-rw-r--r--win/build-vs10_x64.bat2
-rw-r--r--win/build_maria_release.bat47
-rw-r--r--win/cmake/cmake_parse_arguments.cmake47
-rw-r--r--win/cmake/cpack_source_ignore_files.cmake40
-rw-r--r--win/cmake/create_initial_db.cmake.in85
-rw-r--r--win/cmake/dummy.in0
-rw-r--r--win/cmake/install_layout.cmake223
-rw-r--r--win/cmake/install_macros.cmake328
-rw-r--r--win/cmake/mysql_add_executable.cmake56
-rw-r--r--win/cmake/mysql_version.cmake144
-rw-r--r--win/cmake/package_name.cmake134
-rw-r--r--win/cmake/versioninfo.rc.in23
-rw-r--r--win/configure-mariadb.bat2
-rw-r--r--win/configure-mariadb.sh17
-rw-r--r--win/configure.js8
-rw-r--r--win/make_mariadb_win_dist7
-rw-r--r--win/packaging/CMakeLists.txt174
-rw-r--r--win/packaging/COPYING.rtf61
-rw-r--r--win/packaging/CPackWixConfig.cmake114
-rw-r--r--win/packaging/WixUIBannerBmp.jpgbin0 -> 3703 bytes
-rw-r--r--win/packaging/WixUIDialogBmp.jpgbin0 -> 12411 bytes
-rw-r--r--win/packaging/ca/CMakeLists.txt63
-rw-r--r--win/packaging/ca/CustomAction.cpp948
-rw-r--r--win/packaging/ca/CustomAction.def10
-rw-r--r--win/packaging/ca/CustomAction.rc18
-rw-r--r--win/packaging/create_msi.cmake.in445
-rw-r--r--win/packaging/custom_ui.wxs183
-rw-r--r--win/packaging/extra.wxs.in888
-rw-r--r--win/packaging/heidisql.cmake23
-rw-r--r--win/packaging/heidisql.wxi.in51
-rw-r--r--win/packaging/heidisql_feature.wxi.in10
-rw-r--r--win/packaging/mysql_server.wxs.in87
-rw-r--r--win/upgrade_wizard/CMakeLists.txt44
-rw-r--r--win/upgrade_wizard/res/upgrade.icobin0 -> 99678 bytes
-rw-r--r--win/upgrade_wizard/res/upgrade.rc213
-rw-r--r--win/upgrade_wizard/resource.h27
-rw-r--r--win/upgrade_wizard/stdafx.h47
-rw-r--r--win/upgrade_wizard/targetver.h8
-rw-r--r--win/upgrade_wizard/upgrade.cpp57
-rw-r--r--win/upgrade_wizard/upgrade.h32
-rw-r--r--win/upgrade_wizard/upgrade.rc148
-rw-r--r--win/upgrade_wizard/upgradeDlg.cpp627
-rw-r--r--win/upgrade_wizard/upgradeDlg.h73
-rw-r--r--win/upgrade_wizard/upgrade_wizard.exe.manifest15
46 files changed, 5359 insertions, 13 deletions
diff --git a/win/Makefile.am b/win/Makefile.am
index e226f0bcbb3..6f2b92fb5bf 100644
--- a/win/Makefile.am
+++ b/win/Makefile.am
@@ -18,4 +18,43 @@
EXTRA_DIST = build-vs71.bat build-vs8.bat build-vs8_x64.bat build-vs9.bat \
build-vs9_x64.bat configure.js README mysql_manifest.cmake \
create_manifest.js create_def_file.js build-nmake.bat \
- build-nmake-x64.bat configure-mariadb.sh make_mariadb_win_dist
+ build-nmake-x64.bat configure-mariadb.sh make_mariadb_win_dist \
+ build-vs10.bat build-vs10_x64.bat \
+ cmake/cmake_parse_arguments.cmake \
+ cmake/cpack_source_ignore_files.cmake \
+ cmake/create_initial_db.cmake.in \
+ cmake/install_layout.cmake \
+ cmake/install_macros.cmake \
+ cmake/mysql_add_executable.cmake \
+ cmake/mysql_version.cmake \
+ cmake/package_name.cmake \
+ cmake/versioninfo.rc.in \
+ cmake/dummy.in \
+ packaging/CMakeLists.txt \
+ packaging/CPackWixConfig.cmake \
+ packaging/create_msi.cmake.in \
+ packaging/custom_ui.wxs \
+ packaging/extra.wxs.in \
+ packaging/COPYING.rtf \
+ packaging/mysql_server.wxs.in \
+ packaging/ca/CMakeLists.txt \
+ packaging/ca/CustomAction.cpp \
+ packaging/ca/CustomAction.def \
+ packaging/ca/CustomAction.rc \
+ packaging/WixUIBannerBmp.jpg \
+ packaging/WixUIDialogBmp.jpg \
+ packaging/heidisql.cmake \
+ packaging/heidisql.wxi.in \
+ packaging/heidisql_feature.wxi.in\
+ upgrade_wizard/resource.h \
+ upgrade_wizard/stdafx.h \
+ upgrade_wizard/targetver.h \
+ upgrade_wizard/upgrade.cpp \
+ upgrade_wizard/upgrade.h \
+ upgrade_wizard/upgrade.rc \
+ upgrade_wizard/upgradeDlg.cpp \
+ upgrade_wizard/upgradeDlg.h \
+ upgrade_wizard/upgrade_wizard.exe.manifest \
+ upgrade_wizard/CMakeLists.txt \
+ upgrade_wizard/res/upgrade.ico \
+ upgrade_wizard/res/upgrade.rc2
diff --git a/win/build-vs10.bat b/win/build-vs10.bat
index adda0651246..b67ac7e9753 100644
--- a/win/build-vs10.bat
+++ b/win/build-vs10.bat
@@ -1,6 +1,6 @@
@echo off
-REM Copyright (c) 2011, Oracle and/or its affiliates
+REM Copyright (C) 2010 Monty Program AB
REM
REM This program is free software; you can redistribute it and/or modify
REM it under the terms of the GNU General Public License as published by
diff --git a/win/build-vs10_x64.bat b/win/build-vs10_x64.bat
index 0d1424930fc..f84e826ac65 100644
--- a/win/build-vs10_x64.bat
+++ b/win/build-vs10_x64.bat
@@ -1,6 +1,6 @@
@echo off
-REM Copyright (c) 2011, Oracle and/or its affiliates
+REM Copyright (C) 2010 Monty Program AB
REM
REM This program is free software; you can redistribute it and/or modify
REM it under the terms of the GNU General Public License as published by
diff --git a/win/build_maria_release.bat b/win/build_maria_release.bat
new file mode 100644
index 00000000000..c5b1bb915c2
--- /dev/null
+++ b/win/build_maria_release.bat
@@ -0,0 +1,47 @@
+set build_64_bit=
+set build_msi=
+set generator=
+set scriptdir=%~dp0
+
+:: Process all the arguments from the command line
+::
+:process_arguments
+ if "%~1"=="" goto :do_work
+ if "%~1"=="-h" goto :help
+ if "%~1"=="-msi" set build_msi=1
+ if "%~1"=="-G" set generator=-G "%~2"
+ shift
+ goto :process_arguments
+
+:help
+ echo "build_maria_release [-h] [-msi] [-G <Generator>]"
+
+:die
+ echo error occured.
+ popd
+ exit /b 1
+
+:do_work
+:: We're doing out-of-source build to ensure nobody has broken it:)
+
+ pushd %scriptdir%
+ cd ..
+ rd /s /q xxx
+ mkdir xxx
+ cd xxx
+
+ cmake .. -DWITH_EMBEDDED_SERVER=1 %generator%
+ if %ERRORLEVEL% NEQ 0 goto :die
+ cmake --build . --config Debug
+ if %ERRORLEVEL% NEQ 0 goto :die
+ cmake --build . --config RelWithDebInfo --target package
+ if %ERRORLEVEL% NEQ 0 goto :die
+
+
+ if "%build_msi%"=="1" (
+ cmake --build . --config RelWithDebInfo --target win\packaging\msi
+ if %ERRORLEVEL% NEQ 0 goto :die
+ )
+ xcopy /y *.zip ..
+ xcopy /y *.msi ..
+ popd \ No newline at end of file
diff --git a/win/cmake/cmake_parse_arguments.cmake b/win/cmake/cmake_parse_arguments.cmake
new file mode 100644
index 00000000000..db540ae9020
--- /dev/null
+++ b/win/cmake/cmake_parse_arguments.cmake
@@ -0,0 +1,47 @@
+
+# Copyright (C) 2007 MySQL AB, 2009 Sun Microsystems,Inc
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Handy macro to parse macro arguments
+MACRO(MYSQL_PARSE_ARGUMENTS prefix arg_names option_names)
+ SET(DEFAULT_ARGS)
+ FOREACH(arg_name ${arg_names})
+ SET(${prefix}_${arg_name})
+ ENDFOREACH(arg_name)
+ FOREACH(option ${option_names})
+ SET(${prefix}_${option} FALSE)
+ ENDFOREACH(option)
+
+ SET(current_arg_name DEFAULT_ARGS)
+ SET(current_arg_list)
+ FOREACH(arg ${ARGN})
+ SET(larg_names ${arg_names})
+ LIST(FIND larg_names "${arg}" is_arg_name)
+ IF (is_arg_name GREATER -1)
+ SET(${prefix}_${current_arg_name} ${current_arg_list})
+ SET(current_arg_name ${arg})
+ SET(current_arg_list)
+ ELSE (is_arg_name GREATER -1)
+ SET(loption_names ${option_names})
+ LIST(FIND loption_names "${arg}" is_option)
+ IF (is_option GREATER -1)
+ SET(${prefix}_${arg} TRUE)
+ ELSE (is_option GREATER -1)
+ SET(current_arg_list ${current_arg_list} ${arg})
+ ENDIF (is_option GREATER -1)
+ ENDIF (is_arg_name GREATER -1)
+ ENDFOREACH(arg)
+ SET(${prefix}_${current_arg_name} ${current_arg_list})
+ENDMACRO() \ No newline at end of file
diff --git a/win/cmake/cpack_source_ignore_files.cmake b/win/cmake/cpack_source_ignore_files.cmake
new file mode 100644
index 00000000000..5eef20dccc6
--- /dev/null
+++ b/win/cmake/cpack_source_ignore_files.cmake
@@ -0,0 +1,40 @@
+SET(CPACK_SOURCE_IGNORE_FILES
+\\\\.bzr/
+\\\\.bzr-mysql
+\\\\.bzrignore
+CMakeCache\\\\.txt
+cmake_dist\\\\.cmake
+CPackSourceConfig\\\\.cmake
+CPackConfig.cmake
+/cmake_install\\\\.cmake
+/CTestTestfile\\\\.cmake
+/CMakeFiles/
+/version_resources/
+/_CPack_Packages/
+$\\\\.gz
+$\\\\.zip
+/CMakeFiles/
+/version_resources/
+/_CPack_Packages/
+scripts/make_binary_distribution$
+scripts/msql2mysql$
+scripts/mysql_config$
+scripts/mysql_convert_table_format$
+scripts/mysql_find_rows$
+scripts/mysql_fix_extensions$
+scripts/mysql_install_db$
+scripts/mysql_secure_installation$
+scripts/mysql_setpermission$
+scripts/mysql_zap$
+scripts/mysqlaccess$
+scripts/mysqld_multi$
+scripts/mysqld_safe$
+scripts/mysqldumpslow$
+scripts/mysqlhotcopy$
+Makefile$
+include/config\\\\.h$
+include/my_config\\\\.h$
+/autom4te\\\\.cache/
+errmsg\\\\.sys$
+#
+)
diff --git a/win/cmake/create_initial_db.cmake.in b/win/cmake/create_initial_db.cmake.in
new file mode 100644
index 00000000000..d4721b7bac4
--- /dev/null
+++ b/win/cmake/create_initial_db.cmake.in
@@ -0,0 +1,85 @@
+# Copyright (C) 2009 Sun Microsystems, Inc
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# This script creates initial database for packaging on Windows
+SET(CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@")
+SET(CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@")
+SET(MYSQLD_EXECUTABLE "@MYSQLD_EXECUTABLE@")
+SET(CMAKE_CFG_INTDIR "@CMAKE_CFG_INTDIR@")
+SET(WIN32 "@WIN32@")
+# Force Visual Studio to output to stdout
+IF(ENV{VS_UNICODE_OUTPUT})
+ SET ($ENV{VS_UNICODE_OUTPUT})
+ENDIF()
+IF(CMAKE_CFG_INTDIR AND CONFIG)
+ #Resolve build configuration variables
+ STRING(REPLACE "${CMAKE_CFG_INTDIR}" ${CONFIG} MYSQLD_EXECUTABLE
+ "${MYSQLD_EXECUTABLE}")
+ENDIF()
+
+# Create bootstrapper SQL script
+FILE(WRITE bootstrap.sql "use mysql;\n" )
+FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql)
+ FILE(STRINGS ${CMAKE_SOURCE_DIR}/scripts/${FILENAME} CONTENTS)
+ FOREACH(STR ${CONTENTS})
+ IF(NOT STR MATCHES "@current_hostname")
+ FILE(APPEND bootstrap.sql "${STR}\n")
+ ENDIF()
+ ENDFOREACH()
+ENDFOREACH()
+FILE(READ ${CMAKE_SOURCE_DIR}/scripts/fill_help_tables.sql CONTENTS)
+FILE(APPEND bootstrap.sql ${CONTENTS})
+
+
+FILE(REMOVE_RECURSE mysql)
+MAKE_DIRECTORY(mysql)
+IF(WIN32)
+ SET(CONSOLE --console)
+ENDIF()
+
+SET(BOOTSTRAP_COMMAND
+ ${MYSQLD_EXECUTABLE}
+ --no-defaults
+ ${CONSOLE}
+ --bootstrap
+ --language=${CMAKE_CURRENT_BINARY_DIR}/share/english
+ --basedir=.
+ --datadir=.
+ --tmpdir=.
+ --default-storage-engine=MyISAM
+ --loose-skip-innodb
+ --loose-skip-pbxt
+ --loose-skip-ndbcluster
+ --max_allowed_packet=8M
+ --net_buffer_length=16K
+)
+
+GET_FILENAME_COMPONENT(CWD . ABSOLUTE)
+EXECUTE_PROCESS(
+ COMMAND "@CMAKE_COMMAND@" -E echo Executing ${BOOTSTRAP_COMMAND}
+)
+EXECUTE_PROCESS (
+ COMMAND "@CMAKE_COMMAND@" -E echo input file bootstrap.sql, current directory ${CWD}
+)
+EXECUTE_PROCESS (
+ COMMAND ${BOOTSTRAP_COMMAND} INPUT_FILE bootstrap.sql OUTPUT_VARIABLE OUT
+ ERROR_VARIABLE ERR
+ RESULT_VARIABLE RESULT
+ )
+
+IF(NOT RESULT EQUAL 0)
+ MESSAGE(FATAL_ERROR "Could not create initial database \n ${OUT} \n ${ERR}")
+ENDIF()
+
diff --git a/win/cmake/dummy.in b/win/cmake/dummy.in
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/win/cmake/dummy.in
diff --git a/win/cmake/install_layout.cmake b/win/cmake/install_layout.cmake
new file mode 100644
index 00000000000..601e208d96d
--- /dev/null
+++ b/win/cmake/install_layout.cmake
@@ -0,0 +1,223 @@
+# Copyright (C) 2010 Sun Microsystems, Inc
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# The purpose of this file is to set the default installation layout.
+#
+# The current choices of installation layout are:
+#
+# STANDALONE
+# Build with prefix=/usr/local/mysql, create tarball with install prefix="."
+# and relative links. Windows zip uses the same tarball layout but without
+# the build prefix.
+#
+# RPM
+# Build as per default RPM layout, with prefix=/usr
+#
+# DEB
+# Build as per STANDALONE, prefix=/opt/mysql/server-$major.$minor
+#
+# SVR4
+# Solaris package layout suitable for pkg* tools, prefix=/opt/mysql/mysql
+#
+# To force a directory layout, use -DINSTALL_LAYOUT=<layout>.
+#
+# The default is STANDALONE.
+#
+# There is the possibility to further fine-tune installation directories.
+# Several variables can be overwritten:
+#
+# - INSTALL_BINDIR (directory with client executables and scripts)
+# - INSTALL_SBINDIR (directory with mysqld)
+# - INSTALL_SCRIPTDIR (several scripts, rarely used)
+#
+# - INSTALL_LIBDIR (directory with client end embedded libraries)
+# - INSTALL_PLUGINDIR (directory for plugins)
+#
+# - INSTALL_INCLUDEDIR (directory for MySQL headers)
+#
+# - INSTALL_DOCDIR (documentation)
+# - INSTALL_DOCREADMEDIR (readme and similar)
+# - INSTALL_MANDIR (man pages)
+# - INSTALL_INFODIR (info pages)
+#
+# - INSTALL_SHAREDIR (location of aclocal/mysql.m4)
+# - INSTALL_MYSQLSHAREDIR (MySQL character sets and localized error messages)
+# - INSTALL_MYSQLTESTDIR (mysql-test)
+# - INSTALL_SQLBENCHDIR (sql-bench)
+# - INSTALL_SUPPORTFILESDIR (various extra support files)
+#
+# - INSTALL_MYSQLDATADIR (data directory)
+#
+# When changing this page, _please_ do not forget to update public Wiki
+# http://forge.mysql.com/wiki/CMake#Fine-tuning_installation_paths
+
+IF(NOT INSTALL_LAYOUT)
+ SET(DEFAULT_INSTALL_LAYOUT "STANDALONE")
+ENDIF()
+
+SET(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}"
+CACHE STRING "Installation directory layout. Options are: STANDALONE (as in zip or tar.gz installer), RPM, DEB, SVR4")
+
+IF(UNIX)
+ IF(INSTALL_LAYOUT MATCHES "RPM")
+ SET(default_prefix "/usr")
+ ELSEIF(INSTALL_LAYOUT MATCHES "DEB")
+ SET(default_prefix "/opt/mysql/server-${MYSQL_BASE_VERSION}")
+ # This is required to avoid "cpack -GDEB" default of prefix=/usr
+ SET(CPACK_SET_DESTDIR ON)
+ ELSEIF(INSTALL_LAYOUT MATCHES "SVR4")
+ SET(default_prefix "/opt/mysql/mysql")
+ ELSE()
+ SET(default_prefix "/usr/local/mysql")
+ ENDIF()
+ IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ SET(CMAKE_INSTALL_PREFIX ${default_prefix}
+ CACHE PATH "install prefix" FORCE)
+ ENDIF()
+ SET(VALID_INSTALL_LAYOUTS "RPM" "STANDALONE" "DEB" "SVR4")
+ LIST(FIND VALID_INSTALL_LAYOUTS "${INSTALL_LAYOUT}" ind)
+ IF(ind EQUAL -1)
+ MESSAGE(FATAL_ERROR "Invalid INSTALL_LAYOUT parameter:${INSTALL_LAYOUT}."
+ " Choose between ${VALID_INSTALL_LAYOUTS}" )
+ ENDIF()
+
+ SET(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc"
+ CACHE PATH "config directory (for my.cnf)")
+ MARK_AS_ADVANCED(SYSCONFDIR)
+ENDIF()
+
+#
+# STANDALONE layout
+#
+SET(INSTALL_BINDIR_STANDALONE "bin")
+SET(INSTALL_SBINDIR_STANDALONE "bin")
+SET(INSTALL_SCRIPTDIR_STANDALONE "scripts")
+#
+SET(INSTALL_LIBDIR_STANDALONE "lib")
+SET(INSTALL_PLUGINDIR_STANDALONE "lib/plugin")
+#
+SET(INSTALL_INCLUDEDIR_STANDALONE "include")
+#
+SET(INSTALL_DOCDIR_STANDALONE "docs")
+SET(INSTALL_DOCREADMEDIR_STANDALONE ".")
+SET(INSTALL_MANDIR_STANDALONE "man")
+SET(INSTALL_INFODIR_STANDALONE "docs")
+#
+SET(INSTALL_SHAREDIR_STANDALONE "share")
+SET(INSTALL_MYSQLSHAREDIR_STANDALONE "share")
+SET(INSTALL_MYSQLTESTDIR_STANDALONE "mysql-test")
+SET(INSTALL_SQLBENCHDIR_STANDALONE ".")
+SET(INSTALL_SUPPORTFILESDIR_STANDALONE "support-files")
+#
+SET(INSTALL_MYSQLDATADIR_STANDALONE "data")
+
+#
+# RPM layout
+#
+SET(INSTALL_BINDIR_RPM "bin")
+SET(INSTALL_SBINDIR_RPM "sbin")
+SET(INSTALL_SCRIPTDIR_RPM "bin")
+#
+IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+ SET(INSTALL_LIBDIR_RPM "lib64")
+ SET(INSTALL_PLUGINDIR_RPM "lib64/mysql/plugin")
+ELSE()
+ SET(INSTALL_LIBDIR_RPM "lib")
+ SET(INSTALL_PLUGINDIR_RPM "lib/mysql/plugin")
+ENDIF()
+#
+SET(INSTALL_INCLUDEDIR_RPM "include/mysql")
+#
+#SET(INSTALL_DOCDIR_RPM unset - installed directly by RPM)
+#SET(INSTALL_DOCREADMEDIR_RPM unset - installed directly by RPM)
+SET(INSTALL_INFODIR_RPM "share/info")
+SET(INSTALL_MANDIR_RPM "share/man")
+#
+SET(INSTALL_SHAREDIR_RPM "share")
+SET(INSTALL_MYSQLSHAREDIR_RPM "share/mysql")
+SET(INSTALL_MYSQLTESTDIR_RPM "share/mysql-test")
+SET(INSTALL_SQLBENCHDIR_RPM "")
+SET(INSTALL_SUPPORTFILESDIR_RPM "share/mysql")
+#
+SET(INSTALL_MYSQLDATADIR_RPM "/var/lib/mysql")
+
+#
+# DEB layout
+#
+SET(INSTALL_BINDIR_DEB "bin")
+SET(INSTALL_SBINDIR_DEB "bin")
+SET(INSTALL_SCRIPTDIR_DEB "scripts")
+#
+SET(INSTALL_LIBDIR_DEB "lib")
+SET(INSTALL_PLUGINDIR_DEB "lib/plugin")
+#
+SET(INSTALL_INCLUDEDIR_DEB "include")
+#
+SET(INSTALL_DOCDIR_DEB "docs")
+SET(INSTALL_DOCREADMEDIR_DEB ".")
+SET(INSTALL_MANDIR_DEB "man")
+SET(INSTALL_INFODIR_DEB "docs")
+#
+SET(INSTALL_SHAREDIR_DEB "share")
+SET(INSTALL_MYSQLSHAREDIR_DEB "share")
+SET(INSTALL_MYSQLTESTDIR_DEB "mysql-test")
+SET(INSTALL_SQLBENCHDIR_DEB ".")
+SET(INSTALL_SUPPORTFILESDIR_DEB "support-files")
+#
+SET(INSTALL_MYSQLDATADIR_DEB "data")
+
+#
+# SVR4 layout
+#
+SET(INSTALL_BINDIR_SVR4 "bin")
+SET(INSTALL_SBINDIR_SVR4 "bin")
+SET(INSTALL_SCRIPTDIR_SVR4 "scripts")
+#
+SET(INSTALL_LIBDIR_SVR4 "lib")
+SET(INSTALL_PLUGINDIR_SVR4 "lib/plugin")
+#
+SET(INSTALL_INCLUDEDIR_SVR4 "include")
+#
+SET(INSTALL_DOCDIR_SVR4 "docs")
+SET(INSTALL_DOCREADMEDIR_SVR4 ".")
+SET(INSTALL_MANDIR_SVR4 "man")
+SET(INSTALL_INFODIR_SVR4 "docs")
+#
+SET(INSTALL_SHAREDIR_SVR4 "share")
+SET(INSTALL_MYSQLSHAREDIR_SVR4 "share")
+SET(INSTALL_MYSQLTESTDIR_SVR4 "mysql-test")
+SET(INSTALL_SQLBENCHDIR_SVR4 ".")
+SET(INSTALL_SUPPORTFILESDIR_SVR4 "support-files")
+#
+SET(INSTALL_MYSQLDATADIR_SVR4 "/var/lib/mysql")
+
+
+# Clear cached variables if install layout was changed
+IF(OLD_INSTALL_LAYOUT)
+ IF(NOT OLD_INSTALL_LAYOUT STREQUAL INSTALL_LAYOUT)
+ SET(FORCE FORCE)
+ ENDIF()
+ENDIF()
+SET(OLD_INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE INTERNAL "")
+
+# Set INSTALL_FOODIR variables for chosen layout (for example, INSTALL_BINDIR
+# will be defined as ${INSTALL_BINDIR_STANDALONE} by default if STANDALONE
+# layout is chosen)
+FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN
+ INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA)
+ SET(INSTALL_${var}DIR ${INSTALL_${var}DIR_${INSTALL_LAYOUT}}
+ CACHE STRING "${var} installation directory" ${FORCE})
+ MARK_AS_ADVANCED(INSTALL_${var}DIR)
+ENDFOREACH()
diff --git a/win/cmake/install_macros.cmake b/win/cmake/install_macros.cmake
new file mode 100644
index 00000000000..a5357204950
--- /dev/null
+++ b/win/cmake/install_macros.cmake
@@ -0,0 +1,328 @@
+# Copyright (C) 2009 Sun Microsystems, Inc
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
+INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)
+MACRO (INSTALL_DEBUG_SYMBOLS targets)
+ IF(MSVC)
+ FOREACH(target ${targets})
+ GET_TARGET_PROPERTY(location ${target} LOCATION)
+ GET_TARGET_PROPERTY(type ${target} TYPE)
+ IF(NOT INSTALL_LOCATION)
+ IF(type MATCHES "STATIC_LIBRARY" OR type MATCHES "MODULE_LIBRARY" OR type MATCHES "SHARED_LIBRARY")
+ SET(INSTALL_LOCATION "lib")
+ ELSEIF(type MATCHES "EXECUTABLE")
+ SET(INSTALL_LOCATION "bin")
+ ELSE()
+ MESSAGE(FATAL_ERROR "cannot determine type of ${target}. Don't now where to install")
+ ENDIF()
+ ENDIF()
+ STRING(REPLACE ".exe" ".pdb" pdb_location ${location})
+ STRING(REPLACE ".dll" ".pdb" pdb_location ${pdb_location})
+ STRING(REPLACE ".lib" ".pdb" pdb_location ${pdb_location})
+ IF(CMAKE_GENERATOR MATCHES "Visual Studio")
+ STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" pdb_location ${pdb_location})
+ ENDIF()
+ IF(target STREQUAL "mysqld")
+ SET(comp Server)
+ ELSEIF(pdb_location MATCHES "mysql-test")
+ SET(comp Tests)
+ ELSE()
+ SET(comp Debuginfo)
+ ENDIF()
+ INSTALL(FILES ${pdb_location} DESTINATION ${INSTALL_LOCATION} COMPONENT ${comp})
+ ENDFOREACH()
+ ENDIF()
+ENDMACRO()
+
+# Installs manpage for given file (either script or executable)
+#
+FUNCTION(INSTALL_MANPAGE file)
+ IF(NOT UNIX)
+ RETURN()
+ ENDIF()
+ GET_FILENAME_COMPONENT(file_name "${file}" NAME)
+ SET(GLOB_EXPR
+ ${CMAKE_SOURCE_DIR}/man/*${file}man.1*
+ ${CMAKE_SOURCE_DIR}/man/*${file}man.8*
+ ${CMAKE_BINARY_DIR}/man/*${file}man.1*
+ ${CMAKE_BINARY_DIR}/man/*${file}man.8*
+ )
+ IF(MYSQL_DOC_DIR)
+ SET(GLOB_EXPR
+ ${MYSQL_DOC_DIR}/man/*${file}man.1*
+ ${MYSQL_DOC_DIR}/man/*${file}man.8*
+ ${MYSQL_DOC_DIR}/man/*${file}.1*
+ ${MYSQL_DOC_DIR}/man/*${file}.8*
+ ${GLOB_EXPR}
+ )
+ ENDIF()
+
+ FILE(GLOB_RECURSE MANPAGES ${GLOB_EXPR})
+ IF(MANPAGES)
+ LIST(GET MANPAGES 0 MANPAGE)
+ STRING(REPLACE "${file}man.1" "${file}.1" MANPAGE "${MANPAGE}")
+ STRING(REPLACE "${file}man.8" "${file}.8" MANPAGE "${MANPAGE}")
+ IF(MANPAGE MATCHES "${file}.1")
+ SET(SECTION man1)
+ ELSE()
+ SET(SECTION man8)
+ ENDIF()
+ INSTALL(FILES "${MANPAGE}" DESTINATION "${INSTALL_MANDIR}/${SECTION}"
+ COMPONENT ManPages)
+ ENDIF()
+ENDFUNCTION()
+
+FUNCTION(INSTALL_SCRIPT)
+ MYSQL_PARSE_ARGUMENTS(ARG
+ "DESTINATION;COMPONENT"
+ ""
+ ${ARGN}
+ )
+
+ SET(script ${ARG_DEFAULT_ARGS})
+ IF(NOT ARG_DESTINATION)
+ SET(ARG_DESTINATION ${INSTALL_BINDIR})
+ ENDIF()
+ IF(ARG_COMPONENT)
+ SET(COMP COMPONENT ${ARG_COMPONENT})
+ ELSE()
+ SET(COMP)
+ ENDIF()
+
+ INSTALL(FILES
+ ${script}
+ DESTINATION ${ARG_DESTINATION}
+ PERMISSIONS OWNER_READ OWNER_WRITE
+ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE ${COMP}
+ )
+ INSTALL_MANPAGE(${script})
+ENDFUNCTION()
+
+# Install symbolic link to CMake target.
+# the link is created in the same directory as target
+# and extension will be the same as for target file.
+MACRO(INSTALL_SYMLINK linkname target destination component)
+IF(UNIX)
+ GET_TARGET_PROPERTY(location ${target} LOCATION)
+ GET_FILENAME_COMPONENT(path ${location} PATH)
+ GET_FILENAME_COMPONENT(name ${location} NAME)
+ SET(output ${path}/${linkname})
+ ADD_CUSTOM_COMMAND(
+ OUTPUT ${output}
+ COMMAND ${CMAKE_COMMAND} ARGS -E remove -f ${output}
+ COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink
+ ${name}
+ ${linkname}
+ WORKING_DIRECTORY ${path}
+ DEPENDS ${target}
+ )
+
+ ADD_CUSTOM_TARGET(symlink_${linkname}
+ ALL
+ DEPENDS ${output})
+ SET_TARGET_PROPERTIES(symlink_${linkname} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
+ IF(CMAKE_GENERATOR MATCHES "Xcode")
+ # For Xcode, replace project config with install config
+ STRING(REPLACE "${CMAKE_CFG_INTDIR}"
+ "\${CMAKE_INSTALL_CONFIG_NAME}" output ${output})
+ ENDIF()
+ INSTALL(FILES ${output} DESTINATION ${destination} COMPONENT ${component})
+ENDIF()
+ENDMACRO()
+
+IF(WIN32)
+ OPTION(SIGNCODE "Sign executables and dlls with digital certificate" OFF)
+ MARK_AS_ADVANCED(SIGNCODE)
+ IF(SIGNCODE)
+ SET(SIGNTOOL_PARAMETERS
+ /a /t http://timestamp.verisign.com/scripts/timstamp.dll
+ CACHE STRING "parameters for signtool (list)")
+ FIND_PROGRAM(SIGNTOOL_EXECUTABLE signtool
+ PATHS "$ENV{ProgramFiles}/Microsoft SDKs/Windows/v7.0A/bin"
+ "$ENV{ProgramFiles}/Windows Kits/8.0/bin/x86"
+ )
+ IF(NOT SIGNTOOL_EXECUTABLE)
+ MESSAGE(FATAL_ERROR
+ "signtool is not found. Signing executables not possible")
+ ENDIF()
+ MARK_AS_ADVANCED(SIGNTOOL_EXECUTABLE SIGNTOOL_PARAMETERS)
+ ENDIF()
+ENDIF()
+
+MACRO(SIGN_TARGET)
+ MYSQL_PARSE_ARGUMENTS(ARG "COMPONENT" "" ${ARGN})
+ SET(target ${ARG_DEFAULT_ARGS})
+ IF(ARG_COMPONENT)
+ SET(comp COMPONENT ${ARG_COMPONENT})
+ ELSE()
+ SET(comp)
+ ENDIF()
+ GET_TARGET_PROPERTY(target_type ${target} TYPE)
+ IF(target_type AND NOT target_type MATCHES "STATIC")
+ GET_TARGET_PROPERTY(target_location ${target} LOCATION)
+ IF(CMAKE_GENERATOR MATCHES "Visual Studio")
+ STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}"
+ target_location ${target_location})
+ ENDIF()
+ INSTALL(CODE
+ "EXECUTE_PROCESS(COMMAND
+ \"${SIGNTOOL_EXECUTABLE}\" verify /pa /q \"${target_location}\"
+ RESULT_VARIABLE ERR)
+ IF(NOT \${ERR} EQUAL 0)
+ EXECUTE_PROCESS(COMMAND
+ \"${SIGNTOOL_EXECUTABLE}\" sign ${SIGNTOOL_PARAMETERS} \"${target_location}\"
+ RESULT_VARIABLE ERR)
+ ENDIF()
+ IF(NOT \${ERR} EQUAL 0)
+ MESSAGE(FATAL_ERROR \"Error signing '${target_location}'\")
+ ENDIF()
+ " ${comp})
+ ENDIF()
+ENDMACRO()
+
+
+# Installs targets, also installs pdbs on Windows.
+#
+#
+
+FUNCTION(MYSQL_INSTALL_TARGETS)
+ MYSQL_PARSE_ARGUMENTS(ARG
+ "DESTINATION;COMPONENT"
+ ""
+ ${ARGN}
+ )
+ IF(ARG_COMPONENT)
+ SET(COMP COMPONENT ${ARG_COMPONENT})
+ ENDIF()
+
+ SET(TARGETS ${ARG_DEFAULT_ARGS})
+ IF(NOT TARGETS)
+ MESSAGE(FATAL_ERROR "Need target list for MYSQL_INSTALL_TARGETS")
+ ENDIF()
+ IF(NOT ARG_DESTINATION)
+ MESSAGE(FATAL_ERROR "Need DESTINATION parameter for MYSQL_INSTALL_TARGETS")
+ ENDIF()
+
+ FOREACH(target ${TARGETS})
+ # If signing is required, sign executables before installing
+ IF(SIGNCODE)
+ SIGN_TARGET(${target} ${COMP})
+ ENDIF()
+ # Install man pages on Unix
+ IF(UNIX)
+ GET_TARGET_PROPERTY(target_location ${target} LOCATION)
+ INSTALL_MANPAGE(${target_location})
+ ENDIF()
+ ENDFOREACH()
+
+ INSTALL(TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION} ${COMP})
+ SET(INSTALL_LOCATION ${ARG_DESTINATION} )
+ INSTALL_DEBUG_SYMBOLS("${TARGETS}")
+ SET(INSTALL_LOCATION)
+ENDFUNCTION()
+
+# Optionally install mysqld/client/embedded from debug build run. outside of the current build dir
+# (unless multi-config generator is used like Visual Studio or Xcode).
+# For Makefile generators we default Debug build directory to ${buildroot}/../debug.
+GET_FILENAME_COMPONENT(BINARY_PARENTDIR ${CMAKE_BINARY_DIR} PATH)
+SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug build")
+
+
+FUNCTION(INSTALL_DEBUG_TARGET target)
+ MYSQL_PARSE_ARGUMENTS(ARG
+ "DESTINATION;RENAME;PDB_DESTINATION;COMPONENT"
+ ""
+ ${ARGN}
+ )
+ GET_TARGET_PROPERTY(target_type ${target} TYPE)
+ IF(ARG_RENAME)
+ SET(RENAME_PARAM RENAME ${ARG_RENAME}${CMAKE_${target_type}_SUFFIX})
+ ELSE()
+ SET(RENAME_PARAM)
+ ENDIF()
+ IF(NOT ARG_DESTINATION)
+ MESSAGE(FATAL_ERROR "Need DESTINATION parameter for INSTALL_DEBUG_TARGET")
+ ENDIF()
+ GET_TARGET_PROPERTY(target_location ${target} LOCATION)
+ IF(CMAKE_GENERATOR MATCHES "Makefiles")
+ STRING(REPLACE "${CMAKE_BINARY_DIR}" "${DEBUGBUILDDIR}" debug_target_location "${target_location}")
+ ELSE()
+ STRING(REPLACE "${CMAKE_CFG_INTDIR}" "Debug" debug_target_location "${target_location}" )
+ ENDIF()
+ IF(NOT ARG_COMPONENT)
+ SET(ARG_COMPONENT DebugBinaries)
+ ENDIF()
+
+ # Define permissions
+ # For executable files
+ SET(PERMISSIONS_EXECUTABLE
+ PERMISSIONS
+ OWNER_READ OWNER_WRITE OWNER_EXECUTE
+ GROUP_READ GROUP_EXECUTE
+ WORLD_READ WORLD_EXECUTE)
+
+ # Permissions for shared library (honors CMAKE_INSTALL_NO_EXE which is
+ # typically set on Debian)
+ IF(CMAKE_INSTALL_SO_NO_EXE)
+ SET(PERMISSIONS_SHARED_LIBRARY
+ PERMISSIONS
+ OWNER_READ OWNER_WRITE
+ GROUP_READ
+ WORLD_READ)
+ ELSE()
+ SET(PERMISSIONS_SHARED_LIBRARY ${PERMISSIONS_EXECUTABLE})
+ ENDIF()
+
+ # Shared modules get the same permissions as shared libraries
+ SET(PERMISSIONS_MODULE_LIBRARY ${PERMISSIONS_SHARED_LIBRARY})
+
+ # Define permissions for static library
+ SET(PERMISSIONS_STATIC_LIBRARY
+ PERMISSIONS
+ OWNER_READ OWNER_WRITE
+ GROUP_READ
+ WORLD_READ)
+
+ INSTALL(FILES ${debug_target_location}
+ DESTINATION ${ARG_DESTINATION}
+ ${RENAME_PARAM}
+ ${PERMISSIONS_${target_type}}
+ CONFIGURATIONS Release RelWithDebInfo
+ COMPONENT ${ARG_COMPONENT}
+ OPTIONAL)
+
+ IF(MSVC)
+ GET_FILENAME_COMPONENT(ext ${debug_target_location} EXT)
+ STRING(REPLACE "${ext}" ".pdb" debug_pdb_target_location "${debug_target_location}" )
+ IF (RENAME_PARAM)
+ IF(NOT ARG_PDB_DESTINATION)
+ STRING(REPLACE "${ext}" ".pdb" "${ARG_RENAME}" pdb_rename)
+ SET(PDB_RENAME_PARAM RENAME "${pdb_rename}")
+ ENDIF()
+ ENDIF()
+ IF(NOT ARG_PDB_DESTINATION)
+ SET(ARG_PDB_DESTINATION "${ARG_DESTINATION}")
+ ENDIF()
+ INSTALL(FILES ${debug_pdb_target_location}
+ DESTINATION ${ARG_PDB_DESTINATION}
+ ${PDB_RENAME_PARAM}
+ CONFIGURATIONS Release RelWithDebInfo
+ COMPONENT ${ARG_COMPONENT}
+ OPTIONAL)
+ ENDIF()
+ENDFUNCTION()
+
diff --git a/win/cmake/mysql_add_executable.cmake b/win/cmake/mysql_add_executable.cmake
new file mode 100644
index 00000000000..ac812fbcdfd
--- /dev/null
+++ b/win/cmake/mysql_add_executable.cmake
@@ -0,0 +1,56 @@
+# Copyright (C) 2009 Sun Microsystems, Inc
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Add executable plus some additional MySQL specific stuff
+# Usage (same as for standard CMake's ADD_EXECUTABLE)
+#
+# MYSQL_ADD_EXECUTABLE(target source1...sourceN)
+#
+# MySQL specifics:
+# - instruct CPack to install executable under ${CMAKE_INSTALL_PREFIX}/bin directory
+# On Windows :
+# - add version resource
+# - instruct CPack to do autenticode signing if SIGNCODE is set
+
+INCLUDE(cmake_parse_arguments)
+
+FUNCTION (MYSQL_ADD_EXECUTABLE)
+ # Pass-through arguments for ADD_EXECUTABLE
+ MYSQL_PARSE_ARGUMENTS(ARG
+ "WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL;DESTINATION;COMPONENT"
+ ""
+ ${ARGN}
+ )
+ LIST(GET ARG_DEFAULT_ARGS 0 target)
+ LIST(REMOVE_AT ARG_DEFAULT_ARGS 0)
+
+ SET(sources ${ARG_DEFAULT_ARGS})
+ ADD_VERSION_INFO(${target} EXECUTABLE sources)
+ ADD_EXECUTABLE(${target} ${ARG_WIN32} ${ARG_MACOSX_BUNDLE} ${ARG_EXCLUDE_FROM_ALL} ${sources})
+ # tell CPack where to install
+ IF(NOT ARG_EXCLUDE_FROM_ALL)
+ IF(NOT ARG_DESTINATION)
+ SET(ARG_DESTINATION ${INSTALL_BINDIR})
+ ENDIF()
+ IF(ARG_COMPONENT)
+ SET(COMP COMPONENT ${ARG_COMPONENT})
+ ELSEIF(MYSQL_INSTALL_COMPONENT)
+ SET(COMP COMPONENT ${MYSQL_INSTALL_COMPONENT})
+ ELSE()
+ SET(COMP COMPONENT Client)
+ ENDIF()
+ MYSQL_INSTALL_TARGETS(${target} DESTINATION ${ARG_DESTINATION} ${COMP})
+ ENDIF()
+ENDFUNCTION()
diff --git a/win/cmake/mysql_version.cmake b/win/cmake/mysql_version.cmake
new file mode 100644
index 00000000000..e6b64d3003e
--- /dev/null
+++ b/win/cmake/mysql_version.cmake
@@ -0,0 +1,144 @@
+
+MACRO(MYSQL_GET_CONFIG_VALUE keyword var)
+ IF(NOT ${var})
+ IF (EXISTS ${CMAKE_SOURCE_DIR}/configure.in)
+ FILE (STRINGS ${CMAKE_SOURCE_DIR}/configure.in str REGEX "^[ ]*${keyword}=")
+ IF(str)
+ STRING(REPLACE "${keyword}=" "" str ${str})
+ STRING(REGEX REPLACE "[ ].*" "" str ${str})
+ SET(${var} ${str} CACHE INTERNAL "Config variable")
+ ENDIF()
+ ENDIF()
+ ENDIF()
+ENDMACRO()
+
+
+# Read mysql version for configure script
+
+MACRO(GET_MYSQL_VERSION)
+
+ IF(NOT VERSION_STRING)
+ IF(EXISTS ${CMAKE_SOURCE_DIR}/configure.in)
+ FILE(STRINGS ${CMAKE_SOURCE_DIR}/configure.in str REGEX "AM_INIT_AUTOMAKE")
+ STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][^ \\)]+" VERSION_STRING "${str}")
+ IF(NOT VERSION_STRING)
+ STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION_STRING "${str}")
+ IF(NOT VERSION_STRING)
+ FILE(STRINGS configure.in str REGEX "AC_INIT\\(")
+ STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[-][a-zA-Z0-9]+" VERSION_STRING "${str}")
+ IF(NOT VERSION_STRING)
+ STRING(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" VERSION_STRING "${str}")
+ ENDIF()
+ ENDIF()
+ ENDIF()
+ ENDIF()
+ ENDIF()
+
+ IF(NOT VERSION_STRING)
+ MESSAGE(FATAL_ERROR
+ "VERSION_STRING cannot be parsed, please specify -DVERSION_STRING=major.minor.patch-extra"
+ "when calling cmake")
+ ENDIF()
+
+ SET(VERSION ${VERSION_STRING})
+ STRING(REPLACE "-" "_" MYSQL_U_SCORE_VERSION "${VERSION_STRING}")
+
+ # Remove trailing (non-numeric) part of the version string
+ STRING(REGEX REPLACE "[^\\.0-9].*" "" VERSION_STRING ${VERSION_STRING})
+
+ STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" MAJOR_VERSION "${VERSION_STRING}")
+ STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" MINOR_VERSION "${VERSION_STRING}")
+ STRING(REGEX REPLACE "[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" PATCH "${VERSION_STRING}")
+ SET(MYSQL_BASE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version")
+ SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH}")
+ MATH(EXPR MYSQL_VERSION_ID "10000*${MAJOR_VERSION} + 100*${MINOR_VERSION} + ${PATCH}")
+ MARK_AS_ADVANCED(VERSION MYSQL_VERSION_ID MYSQL_BASE_VERSION)
+ SET(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION})
+ SET(CPACK_PACKAGE_VERSION_MINOR ${MINOR_VERSION})
+ SET(CPACK_PACKAGE_VERSION_PATCH ${PATCH})
+ENDMACRO()
+
+# Get mysql version and other interesting variables
+GET_MYSQL_VERSION()
+
+MYSQL_GET_CONFIG_VALUE("PROTOCOL_VERSION" PROTOCOL_VERSION)
+MYSQL_GET_CONFIG_VALUE("DOT_FRM_VERSION" DOT_FRM_VERSION)
+MYSQL_GET_CONFIG_VALUE("MYSQL_TCP_PORT_DEFAULT" MYSQL_TCP_PORT_DEFAULT)
+MYSQL_GET_CONFIG_VALUE("MYSQL_UNIX_ADDR_DEFAULT" MYSQL_UNIX_ADDR_DEFAULT)
+MYSQL_GET_CONFIG_VALUE("SHARED_LIB_MAJOR_VERSION" SHARED_LIB_MAJOR_VERSION)
+IF(NOT MYSQL_TCP_PORT_DEFAULT)
+ SET(MYSQL_TCP_PORT_DEFAULT "3306")
+ENDIF()
+IF(NOT MYSQL_TCP_PORT)
+ SET(MYSQL_TCP_PORT ${MYSQL_TCP_PORT_DEFAULT})
+ SET(MYSQL_TCP_PORT_DEFAULT "0")
+ELSEIF(MYSQL_TCP_PORT EQUAL MYSQL_TCP_PORT_DEFAULT)
+ SET(MYSQL_TCP_PORT_DEFAULT "0")
+ENDIF()
+
+
+IF(NOT MYSQL_UNIX_ADDR)
+ SET(MYSQL_UNIX_ADDR "/tmp/mysql.sock")
+ENDIF()
+IF(NOT COMPILATION_COMMENT)
+ SET(COMPILATION_COMMENT "mariadb.org binary distribution")
+ENDIF()
+
+
+INCLUDE(package_name)
+IF(NOT CPACK_PACKAGE_FILE_NAME)
+ GET_PACKAGE_FILE_NAME(CPACK_PACKAGE_FILE_NAME)
+ENDIF()
+
+IF(NOT CPACK_SOURCE_PACKAGE_FILE_NAME)
+ SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mariadb-${VERSION}")
+ENDIF()
+SET(CPACK_PACKAGE_CONTACT "MariaDB team <build@mysql.com>")
+SET(CPACK_PACKAGE_VENDOR "Monty Program AB")
+SET(CPACK_SOURCE_GENERATOR "TGZ")
+INCLUDE(cpack_source_ignore_files)
+
+# Defintions for windows version resources
+SET(PRODUCTNAME "MariaDB Server")
+SET(COMPANYNAME ${CPACK_PACKAGE_VENDOR})
+
+# Windows 'date' command has unpredictable output, so cannot rely on it to
+# set MYSQL_COPYRIGHT_YEAR - if someone finds a portable way to do so then
+# it might be useful
+#IF (WIN32)
+# EXECUTE_PROCESS(COMMAND "date" "/T" OUTPUT_VARIABLE TMP_DATE)
+# STRING(REGEX REPLACE "(..)/(..)/..(..).*" "\\3\\2\\1" MYSQL_COPYRIGHT_YEAR ${TMP_DATE})
+IF(UNIX)
+ EXECUTE_PROCESS(COMMAND "date" "+%Y" OUTPUT_VARIABLE MYSQL_COPYRIGHT_YEAR OUTPUT_STRIP_TRAILING_WHITESPACE)
+ENDIF()
+
+# Add version information to the exe and dll files
+# Refer to http://msdn.microsoft.com/en-us/library/aa381058(VS.85).aspx
+# for more info.
+IF(MSVC)
+ # Tiny version is used to identify the build, it can be set with cmake -DTINY_VERSION=<number>
+ # to bzr revno for example (in the CI builds)
+ SET(TINY_VERSION "0" CACHE INTERNAL "")
+
+ GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
+
+ SET(FILETYPE VFT_APP)
+ CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in
+ ${CMAKE_BINARY_DIR}/versioninfo_exe.rc)
+
+ SET(FILETYPE VFT_DLL)
+ CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in
+ ${CMAKE_BINARY_DIR}/versioninfo_dll.rc)
+
+ FUNCTION(ADD_VERSION_INFO target target_type sources_var)
+ IF("${target_type}" MATCHES "SHARED" OR "${target_type}" MATCHES "MODULE")
+ SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_dll.rc)
+ ELSEIF("${target_type}" MATCHES "EXE")
+ SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_exe.rc)
+ ENDIF()
+ SET(${sources_var} ${${sources_var}} ${rcfile} PARENT_SCOPE)
+ ENDFUNCTION()
+ELSE()
+ FUNCTION(ADD_VERSION_INFO)
+ ENDFUNCTION()
+ENDIF()
diff --git a/win/cmake/package_name.cmake b/win/cmake/package_name.cmake
new file mode 100644
index 00000000000..1bbe68a0336
--- /dev/null
+++ b/win/cmake/package_name.cmake
@@ -0,0 +1,134 @@
+# Copyright (C) 2010 Sun Microsystems, Inc
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Produce meaningful package name for the binary package
+# The logic is rather involved with special cases for different OSes
+INCLUDE(CheckTypeSize)
+CHECK_TYPE_SIZE("void *" SIZEOF_VOIDP)
+MACRO(GET_PACKAGE_FILE_NAME Var)
+IF(NOT VERSION)
+ MESSAGE(FATAL_ERROR
+ "Variable VERSION needs to be set prior to calling GET_PACKAGE_FILE_NAME")
+ ENDIF()
+ IF(NOT SYSTEM_NAME_AND_PROCESSOR)
+ SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 1)
+ SET(DEFAULT_PLATFORM ${CMAKE_SYSTEM_NAME})
+ SET(DEFAULT_MACHINE ${CMAKE_SYSTEM_PROCESSOR})
+ IF(SIZEOF_VOIDP EQUAL 8)
+ SET(64BIT 1)
+ ENDIF()
+
+ IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
+ SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 0)
+ SET(DEFAULT_PLATFORM "win")
+ IF(64BIT)
+ SET(DEFAULT_MACHINE "x64")
+ ELSE()
+ SET(DEFAULT_MACHINE "32")
+ ENDIF()
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ IF(NOT 64BIT AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
+ SET(DEFAULT_MACHINE "i686")
+ ENDIF()
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ # SunOS 5.10=> solaris10
+ STRING(REPLACE "5." "" VER "${CMAKE_SYSTEM_VERSION}")
+ SET(DEFAULT_PLATFORM "solaris${VER}")
+ IF(64BIT)
+ IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
+ SET(DEFAULT_MACHINE "x86_64")
+ ELSE()
+ SET(DEFAULT_MACHINE "${CMAKE_SYSTEM_PROCESSOR}-64bit")
+ ENDIF()
+ ENDIF()
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
+ STRING(REPLACE "B." "" VER "${CMAKE_SYSTEM_VERSION}")
+ SET(DEFAULT_PLATFORM "hpux${VER}")
+ IF(64BIT)
+ SET(DEFAULT_MACHINE "${CMAKE_SYSTEM_PROCESSOR}-64bit")
+ ENDIF()
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "AIX")
+ SET(DEFAULT_PLATFORM "${CMAKE_SYSTEM_NAME}5.${CMAKE_SYSTEM_VERSION}")
+ IF(64BIT)
+ SET(DEFAULT_MACHINE "${CMAKE_SYSTEM_PROCESSOR}-64bit")
+ ENDIF()
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ STRING(REGEX MATCH "[0-9]+\\.[0-9]+" VER "${CMAKE_SYSTEM_VERSION}")
+ SET(DEFAULT_PLATFORM "${CMAKE_SYSTEM_NAME}${VER}")
+ IF(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64")
+ SET(DEFAULT_MACHINE "x86_64")
+ IF(NOT 64BIT)
+ SET(DEFAULT_MACHINE "i386")
+ ENDIF()
+ ENDIF()
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ IF(CMAKE_OSX_DEPLOYMENT_TARGET)
+ SET(DEFAULT_PLATFORM "osx${CMAKE_OSX_DEPLOYMENT_TARGET}")
+ ELSE()
+ SET(VER "${CMAKE_SYSTEM_VERSION}")
+ STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" VER "${VER}")
+ # Subtract 4 from Darwin version to get correct osx10.X
+ MATH(EXPR VER "${VER} -4")
+ SET(DEFAULT_PLATFORM "osx10.${VER}")
+ ENDIF()
+ LIST(LENGTH CMAKE_OSX_ARCHITECTURES LEN)
+ IF(LEN GREATER 1)
+ SET(DEFAULT_MACHINE "universal")
+ ELSE()
+ SET(DEFAULT_MACHINE "${CMAKE_OSX_ARCHITECTURES}")
+ IF(NOT DEFAULT_MACHINE)
+ IF(CMAKE_SIZEOF_VOIPD EQUAL 4)
+ SET(DEFAULT_MACHINE "i386")
+ ELSE()
+ SET(DEFAULT_MACHINE "x86_64")
+ ENDIF()
+ ENDIF()
+ ENDIF()
+ IF(DEFAULT_MACHINE MATCHES "i386")
+ SET(DEFAULT_MACHINE "x86")
+ ENDIF()
+ ENDIF()
+
+ IF(NOT PLATFORM)
+ SET(PLATFORM ${DEFAULT_PLATFORM})
+ ENDIF()
+ IF(NOT MACHINE)
+ SET(MACHINE ${DEFAULT_MACHINE})
+ ENDIF()
+
+ IF(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE)
+ SET(SYSTEM_NAME_AND_PROCESSOR "${PLATFORM}-${MACHINE}")
+ ELSE()
+ SET(SYSTEM_NAME_AND_PROCESSOR "${PLATFORM}${MACHINE}")
+ ENDIF()
+ ENDIF()
+
+ IF(SHORT_PRODUCT_TAG)
+ SET(PRODUCT_TAG "-${SHORT_PRODUCT_TAG}")
+ ELSEIF(MYSQL_SERVER_SUFFIX)
+ SET(PRODUCT_TAG "${MYSQL_SERVER_SUFFIX}") # Already has a leading dash
+ ELSE()
+ SET(PRODUCT_TAG)
+ ENDIF()
+
+ SET(package_name "mariadb${PRODUCT_TAG}-${MYSQL_NO_DASH_VERSION}-${SYSTEM_NAME_AND_PROCESSOR}")
+
+ # Sometimes package suffix is added (something like "-icc-glibc23")
+ IF(PACKAGE_SUFFIX)
+ SET(package_name "${package_name}${PACKAGE_SUFFIX}")
+ ENDIF()
+ STRING(TOLOWER ${package_name} package_name)
+ SET(${Var} ${package_name})
+ENDMACRO()
diff --git a/win/cmake/versioninfo.rc.in b/win/cmake/versioninfo.rc.in
new file mode 100644
index 00000000000..b570eb2f8e0
--- /dev/null
+++ b/win/cmake/versioninfo.rc.in
@@ -0,0 +1,23 @@
+#include <windows.h>
+VS_VERSION_INFO VERSIONINFO
+FILEVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH@,@TINY_VERSION@
+PRODUCTVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH@,@TINY_VERSION@
+FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+FILEFLAGS 0
+FILEOS VOS__WINDOWS32
+FILETYPE @FILETYPE@
+FILESUBTYPE VFT2_UNKNOWN
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904E4"
+ BEGIN
+ VALUE "FileVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@.@TINY_VERSION@\0"
+ VALUE "ProductVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@.@TINY_VERSION@\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1252
+ END
+END
diff --git a/win/configure-mariadb.bat b/win/configure-mariadb.bat
index 158d22c9aca..dc5b59819a3 100644
--- a/win/configure-mariadb.bat
+++ b/win/configure-mariadb.bat
@@ -3,7 +3,7 @@ cscript win\configure.js ^
WITH_FEDERATEDX_STORAGE_ENGINE ^
WITH_MERGE_STORAGE_ENGINE ^
WITH_PARTITION_STORAGE_ENGINE ^
- WITH_MARIA_STORAGE_ENGINE ^
+ WITH_ARIA_STORAGE_ENGINE ^
WITH_PBXT_STORAGE_ENGINE ^
WITH_XTRADB_STORAGE_ENGINE ^
WITH_FEEDBACK_STORAGE_ENGINE
diff --git a/win/configure-mariadb.sh b/win/configure-mariadb.sh
index c6324bfd259..67bfe293639 100644
--- a/win/configure-mariadb.sh
+++ b/win/configure-mariadb.sh
@@ -7,9 +7,16 @@
set -e
-cscript win/configure.js --with-plugin-archive --with-plugin-blackhole \
- --with-plugin-csv --with-plugin-example --with-plugin-federatedx \
- --with-plugin-merge --with-plugin-partition --with-plugin-maria \
- --with-plugin-pbxt --with-plugin-xtradb --with-plugin-feedback \
+cscript win/configure.js \
+ WITH_ARCHIVE_STORAGE_ENGINE \
+ WITH_BLACKHOLE_STORAGE_ENGINE \
+ WITH_CSV_STORAGE_ENGINE \
+ WITH_EXAMPLE_STORAGE_ENGINE \
+ WITH_FEDERATEDX_STORAGE_ENGINE \
+ WITH_MERGE_STORAGE_ENGINE \
+ WITH_PARTITION_STORAGE_ENGINE \
+ WITH_ARIA_STORAGE_ENGINE \
+ WITH_PBXT_STORAGE_ENGINE \
+ WITH_XTRADB_STORAGE_ENGINE \
+ WITH_FEEDBACK_STORAGE_ENGINE \
WITH_EMBEDDED_SERVER
-
diff --git a/win/configure.js b/win/configure.js
index c3e5429a620..7e2cb3cd3d9 100644
--- a/win/configure.js
+++ b/win/configure.js
@@ -44,17 +44,17 @@ try
case "EMBED_MANIFESTS":
case "EXTRA_DEBUG":
case "WITH_EMBEDDED_SERVER":
- case "WITHOUT_MARIA_TEMP_TABLES":
+ case "WITHOUT_ARIA_TEMP_TABLES":
configfile.WriteLine("SET (" + args.Item(i) + " TRUE)");
break;
- case "WITH_MARIA_STORAGE_ENGINE":
+ case "WITH_ARIA_STORAGE_ENGINE":
configfile.WriteLine("SET (" + args.Item(i) + " TRUE)");
if(with_maria_tmp_tables == -1)
{
with_maria_tmp_tables = 1;
}
break;
- case "WITH_MARIA_TMP_TABLES":
+ case "WITH_ARIA_TMP_TABLES":
with_maria_tmp_tables = ( parts.length == 1 ||
parts[1] == "YES" || parts[1] == "TRUE");
break;
@@ -73,7 +73,7 @@ try
}
if (with_maria_tmp_tables == 1)
{
- configfile.WriteLine("SET (WITH_MARIA_TMP_TABLES TRUE)");
+ configfile.WriteLine("SET (WITH_ARIA_TMP_TABLES TRUE)");
}
if (actual_port == 0)
{
diff --git a/win/make_mariadb_win_dist b/win/make_mariadb_win_dist
index a7ca8f2c9df..f6d961ea866 100644
--- a/win/make_mariadb_win_dist
+++ b/win/make_mariadb_win_dist
@@ -19,6 +19,13 @@ The default is to the builds and create 32 bit packages.
EOF
}
+
+if test -f win/build_maria_release.bat
+then
+ cmd /c win\\build_maria_release.bat "$@"
+ exit $?
+fi
+
# The default settings
CMAKE_GENERATOR="Visual Studio 9 2008"
ARCH="win32"
diff --git a/win/packaging/CMakeLists.txt b/win/packaging/CMakeLists.txt
new file mode 100644
index 00000000000..0b5e2f98f16
--- /dev/null
+++ b/win/packaging/CMakeLists.txt
@@ -0,0 +1,174 @@
+# Copyright 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+IF(NOT WIN32)
+ RETURN()
+ENDIF()
+
+SET(MANUFACTURER "Monty Program AB")
+FIND_PATH(WIX_DIR heat.exe
+ $ENV{WIX_DIR}/bin
+ $ENV{ProgramFiles}/wix/bin
+ "$ENV{ProgramFiles}/Windows Installer XML v3/bin"
+ "$ENV{ProgramFiles}/Windows Installer XML v3.5/bin"
+ "$ENV{ProgramFiles}/Windows Installer XML v3.6/bin"
+ "$ENV{WIX}/bin"
+)
+
+SET(CPACK_WIX_PACKAGE_BASE_NAME "MariaDB")
+IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ SET(CPACK_WIX_UPGRADE_CODE "49EB7A6A-1CEF-4A1E-9E89-B9A4993963E3")
+ SET(CPACK_WIX_PACKAGE_NAME "MariaDB @MAJOR_VERSION@.@MINOR_VERSION@")
+ELSE()
+ SET(CPACK_WIX_UPGRADE_CODE "2331E7BD-EE58-431B-9E18-B2B918BCEB1B")
+ SET(CPACK_WIX_PACKAGE_NAME "MariaDB @MAJOR_VERSION@.@MINOR_VERSION@ (x64)")
+ENDIF()
+
+
+IF(NOT WIX_DIR)
+ IF(NOT _WIX_DIR_CHECKED)
+ SET(_WIX_DIR_CHECKED 1 CACHE INTERNAL "")
+ MESSAGE(STATUS "Cannot find wix 3, installer project will not be generated")
+ IF(BUILD_RELEASE)
+ MESSAGE(FATAL_ERROR
+ "Can't find Wix. It is necessary for producing official package"
+ )
+ ENDIF()
+ ENDIF()
+ RETURN()
+ENDIF()
+
+ADD_SUBDIRECTORY(ca)
+
+# extra.wxs.in needs DATADIR_MYSQL_FILES and DATADIR_PERFORMANCE_SCHEMA_FILES, i.e
+# Wix-compatible file lists for ${builddir}\sql\data\{mysql,performance_schema}
+
+FOREACH(dir mysql performance_schema)
+ FILE(GLOB files ${CMAKE_BINARY_DIR}/sql/data/${dir}/*)
+ SET(filelist)
+ FOREACH(f ${files})
+ IF(NOT f MATCHES ".rule")
+ FILE(TO_NATIVE_PATH "${f}" file_native_path)
+ GET_FILENAME_COMPONENT(file_name "${f}" NAME)
+ SET(filelist
+"${filelist}
+<File Id='${file_name}' Source='${file_native_path}'/>")
+ ENDIF()
+ ENDFOREACH()
+ STRING(TOUPPER ${dir} DIR_UPPER)
+ SET(DATADIR_${DIR_UPPER}_FILES "${filelist}")
+ENDFOREACH()
+
+
+FIND_PROGRAM(CANDLE_EXECUTABLE candle ${WIX_DIR})
+FIND_PROGRAM(LIGHT_EXECUTABLE light ${WIX_DIR})
+
+# WiX wants the license text as rtf; if there is no rtf license,
+# we create a fake one from the plain text COPYING file.
+IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.rtf")
+ SET(COPYING_RTF "${CMAKE_CURRENT_SOURCE_DIR}/COPYING.rtf")
+ELSE()
+ IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../LICENSE.mysql")
+ SET(LICENSE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../../LICENSE.mysql")
+ ELSE()
+ SET(LICENSE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../../COPYING")
+ ENDIF()
+ FILE(READ ${LICENSE_FILE} CONTENTS)
+ STRING(REGEX REPLACE "\n" "\\\\par\n" CONTENTS "${CONTENTS}")
+ STRING(REGEX REPLACE "\t" "\\\\tab" CONTENTS "${CONTENTS}")
+ FILE(WRITE "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "{\\rtf1\\ansi\\deff0{\\fonttbl{\\f0\\fnil\\fcharset0 Courier New;}}\\viewkind4\\uc1\\pard\\lang1031\\f0\\fs15")
+ FILE(APPEND "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "${CONTENTS}")
+ FILE(APPEND "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf" "\n}\n")
+ SET(COPYING_RTF "${CMAKE_CURRENT_BINARY_DIR}/COPYING.rtf")
+ENDIF()
+GET_TARGET_PROPERTY(WIXCA_LOCATION wixca LOCATION)
+SET(CPACK_WIX_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/CPackWixConfig.cmake)
+
+GET_TARGET_PROPERTY(upgrade_wizard_location mysql_upgrade_wizard LOCATION)
+IF(NOT upgrade_wizard_location)
+ SET(EXTRA_WIX_PREPROCESSOR_FLAGS "-dHaveUpgradeWizard=0")
+ENDIF()
+IF(WITH_INNOBASE_STORAGE_ENGINE OR WITH_INNODB_STORAGE_ENGINE OR WITH_XTRADB_STORAGE_ENGINE)
+ SET(EXTRA_WIX_PREPROCESSOR_FLAGS ${EXTRA_WIX_PREPROCESSOR_FLAGS} "-dHaveInnodb=1")
+ENDIF()
+
+SET(THIRD_PARTY_FEATURE_CONDITION "")
+
+IF(WITH_THIRD_PARTY)
+ SET(THIRD_PARTY_DOWNLOAD_LOCATION "$ENV{TEMP}")
+ IF(THIRD_PARTY_DOWNLOAD_LOCATION)
+ FILE(TO_CMAKE_PATH "${THIRD_PARTY_DOWNLOAD_LOCATION}" THIRD_PARTY_DOWNLOAD_LOCATION)
+ ELSE()
+ SET(THIRD_PARTY_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}")
+ ENDIF()
+ENDIF()
+
+GET_TARGET_PROPERTY(LIBMYSQL_LOCATION libmysql LOCATION)
+FOREACH(third_party ${WITH_THIRD_PARTY})
+ SET(third_party_install_plugin ${CMAKE_CURRENT_SOURCE_DIR}/${third_party}.cmake)
+ IF(NOT EXISTS ${third_party_install_plugin})
+ MESSAGE(FATAL_ERROR
+"Third party MSI installation plugin ${third_party_install_plugin} does not exist.
+It was expected due to WITH_THIRD_PARTY=${WITH_THIRD_PARTY}"
+)
+ ENDIF()
+ STRING(TOUPPER "${third_party}" upper_third_party)
+ IF(NOT THIRD_PARTY_FEATURE_CONDITION )
+ SET(THIRD_PARTY_FEATURE_CONDITION "<Condition Level='0'>${upper_third_party}INSTALLED")
+ ELSE()
+ SET(THIRD_PARTY_FEATURE_CONDITION "AND ${upper_third_party}INSTALLED")
+ ENDIF()
+ENDFOREACH()
+
+IF(THIRD_PARTY_FEATURE_CONDITION)
+ SET(THIRD_PARTY_FEATURE_CONDITION "${THIRD_PARTY_FEATURE_CONDITION}</Condition>")
+ENDIF()
+
+IF(NOT CPACK_WIX_UI)
+ SET(CPACK_WIX_UI "MyWixUI_Mondo")
+ENDIF()
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/create_msi.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
+ @ONLY)
+
+
+IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ SET(WixWin64 " Win64='yes'")
+ELSE()
+ SET(WixWin64)
+ENDIF()
+
+
+IF(CMAKE_GENERATOR MATCHES "Visual Studio")
+ SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_CFG_INTDIR}")
+ENDIF()
+
+
+ADD_CUSTOM_TARGET(
+ MSI
+ COMMAND ${CMAKE_COMMAND}
+ ${CONFIG_PARAM}
+ -P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
+)
+ADD_DEPENDENCIES(MSI wixca)
+
+ADD_CUSTOM_TARGET(
+ MSI_ESSENTIALS
+ COMMAND ${CMAKE_COMMAND} -DESSENTIALS=1
+ ${CONFIG_PARAM}
+ -P ${CMAKE_CURRENT_BINARY_DIR}/create_msi.cmake
+)
+ADD_DEPENDENCIES(MSI_ESSENTIALS wixca)
+
diff --git a/win/packaging/COPYING.rtf b/win/packaging/COPYING.rtf
new file mode 100644
index 00000000000..de1f0bbefde
--- /dev/null
+++ b/win/packaging/COPYING.rtf
@@ -0,0 +1,61 @@
+{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}{\f1\froman\fprq2\fcharset2 Symbol;}{\f2\fswiss\fcharset0 Arial;}}
+{\stylesheet{ Normal;}{\s1 heading 1;}{\s2 heading 2;}}
+\viewkind4\uc1\pard\s2\sb100\sa100\b\f0\fs24 GNU GENERAL PUBLIC LICENSE\par
+\pard\sb100\sa100\b0\fs20 Version 2, June 1991 \par
+\pard Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.\fs24 \par
+\pard\s2\sb100\sa100\b Preamble\par
+\pard\sb100\sa100\b0\fs20 The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. \par
+When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. \par
+To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. \par
+For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. \par
+We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. \par
+Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. \par
+Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. \par
+The precise terms and conditions for copying, distribution and modification follow.\fs24 \par
+\pard\s2\sb100\sa100\b TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\par
+\pard\sb100\sa100\b0\fs20 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". \par
+Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. \par
+1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. \par
+You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. \par
+2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: \par
+\pard\fi-360\li720\sb100\sa100\tx720\f1\'b7\tab\f0 a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. \par
+\pard\fi-360\li720\sb100\sa100\f1\'b7\tab\f0 b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. \par
+\f1\'b7\tab\f0 c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) \par
+\pard These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. \par
+\pard\sb100\sa100 Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. \par
+In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. \par
+3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: \par
+\pard\fi-360\li720\sb100\sa100\tx720\f1\'b7\tab\f0 a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, \par
+\pard\fi-360\li720\sb100\sa100\f1\'b7\tab\f0 b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, \par
+\f1\'b7\tab\f0 c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) \par
+\pard The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. \par
+\pard\sb100\sa100 If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. \par
+4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. \par
+5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. \par
+6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. \par
+7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. \par
+If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. \par
+It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. \par
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. \par
+8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. \par
+9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. \par
+Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. \par
+10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. \par
+NO WARRANTY \par
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. \par
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. \par
+\pard\s2\sb100\sa100\b\fs24 END OF TERMS AND CONDITIONS \par
+How to Apply These Terms to Your New Programs\fs20\par
+\pard\sb100\sa100\b0 If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. \par
+To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. \par
+\pard one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. \par
+\pard\sb100\sa100 Also add information on how to contact you by electronic and paper mail. \par
+If the program is interactive, make it output a short notice like this when it starts in an interactive mode: \par
+\pard Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. \par
+\pard\sb100\sa100 The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c' ; they could even be mouse-clicks or menu items--whatever suits your program. \par
+You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: \par
+\pard Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. signature of Ty Coon , 1 April 1989 Ty Coon, President of Vice \par
+\pard\sb100\sa100 This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.\par
+\pard\f2\par
+}
+
diff --git a/win/packaging/CPackWixConfig.cmake b/win/packaging/CPackWixConfig.cmake
new file mode 100644
index 00000000000..34f661b393e
--- /dev/null
+++ b/win/packaging/CPackWixConfig.cmake
@@ -0,0 +1,114 @@
+
+IF(ESSENTIALS)
+ SET(CPACK_COMPONENTS_USED "Server;Client")
+ SET(CPACK_WIX_UI "MyWixUI_Mondo")
+ IF(CMAKE_SIZEOF_VOID_P MATCHES 8)
+ SET(CPACK_PACKAGE_FILE_NAME "mariadb-essential-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-winx64")
+ ELSE()
+ SET(CPACK_PACKAGE_FILE_NAME "mariadb-essential-${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}-win32")
+ ENDIF()
+ELSE()
+ SET(CPACK_COMPONENTS_USED
+ "Server;Client;Development;SharedLibraries;Embedded;Debuginfo;Documentation;IniFiles;Readme;Server_Scripts;scripts;DebugBinaries")
+ENDIF()
+
+SET( WIX_FEATURE_MySQLServer_EXTRA_FEATURES "DBInstance;SharedClientServerComponents")
+# Some components like Embedded are optional
+# We will build MSI without embedded if it was not selected for build
+#(need to modify CPACK_COMPONENTS_ALL for that)
+SET(CPACK_ALL)
+FOREACH(comp1 ${CPACK_COMPONENTS_USED})
+ SET(found)
+ FOREACH(comp2 ${CPACK_COMPONENTS_ALL})
+ IF(comp1 STREQUAL comp2)
+ SET(found 1)
+ BREAK()
+ ENDIF()
+ ENDFOREACH()
+ IF(found)
+ SET(CPACK_ALL ${CPACK_ALL} ${comp1})
+ ENDIF()
+ENDFOREACH()
+SET(CPACK_COMPONENTS_ALL ${CPACK_ALL})
+
+# Always install (hidden), includes Readme files
+SET(CPACK_COMPONENT_GROUP_ALWAYSINSTALL_HIDDEN 1)
+SET(CPACK_COMPONENT_README_GROUP "AlwaysInstall")
+
+# Feature MySQL Server
+SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DISPLAY_NAME "MariaDB Server")
+SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_EXPANDED "1")
+SET(CPACK_COMPONENT_GROUP_MYSQLSERVER_DESCRIPTION "Install server")
+ # Subfeature "Server" (hidden)
+ SET(CPACK_COMPONENT_SERVER_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_SERVER_HIDDEN 1)
+ # Subfeature "Client"
+ SET(CPACK_COMPONENT_CLIENT_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_CLIENT_DISPLAY_NAME "Client Programs")
+ SET(CPACK_COMPONENT_CLIENT_DESCRIPTION
+ "Various helpful (commandline) tools including the mysql command line client" )
+ # Subfeature "Debug binaries"
+ SET(CPACK_COMPONENT_DEBUGBINARIES_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_DEBUGBINARIES_DISPLAY_NAME "Debug binaries")
+ SET(CPACK_COMPONENT_DEBUGBINARIES_DESCRIPTION
+ "Debug/trace versions of executables and libraries" )
+ #SET(CPACK_COMPONENT_DEBUGBINARIES_WIX_LEVEL 2)
+
+
+ #Subfeature "Data Files"
+ SET(CPACK_COMPONENT_DATAFILES_GROUP "MySQLServer")
+ SET(CPACK_COMPONENT_DATAFILES_DISPLAY_NAME "Server data files")
+ SET(CPACK_COMPONENT_DATAFILES_DESCRIPTION "Server data files" )
+ SET(CPACK_COMPONENT_DATAFILES_HIDDEN 1)
+
+
+#Feature "Devel"
+SET(CPACK_COMPONENT_GROUP_DEVEL_DISPLAY_NAME "Development Components")
+SET(CPACK_COMPONENT_GROUP_DEVEL_DESCRIPTION "Installs C/C++ header files and libraries")
+ #Subfeature "Development"
+ SET(CPACK_COMPONENT_DEVELOPMENT_GROUP "Devel")
+ SET(CPACK_COMPONENT_DEVELOPMENT_HIDDEN 1)
+
+ #Subfeature "Shared libraries"
+ SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "Devel")
+ SET(CPACK_COMPONENT_SHAREDLIBRARIES_DISPLAY_NAME "Client C API library (shared)")
+ SET(CPACK_COMPONENT_SHAREDLIBRARIES_DESCRIPTION "Installs shared client library")
+
+ #Subfeature "Embedded"
+ SET(CPACK_COMPONENT_EMBEDDED_GROUP "Devel")
+ SET(CPACK_COMPONENT_EMBEDDED_DISPLAY_NAME "Embedded server library")
+ SET(CPACK_COMPONENT_EMBEDDED_DESCRIPTION "Installs embedded server library")
+ SET(CPACK_COMPONENT_EMBEDDED_WIX_LEVEL 2)
+
+#Feature Debug Symbols
+SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DISPLAY_NAME "Debug Symbols")
+SET(CPACK_COMPONENT_GROUP_DEBUGSYMBOLS_DESCRIPTION "Installs Debug Symbols")
+SET(CPACK_COMPONENT_DEBUGSYMBOLS_WIX_LEVEL 2)
+ SET(CPACK_COMPONENT_DEBUGINFO_GROUP "DebugSymbols")
+ SET(CPACK_COMPONENT_DEBUGINFO_HIDDEN 1)
+
+#Feature Documentation
+SET(CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "Documentation")
+SET(CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION "Installs documentation")
+SET(CPACK_COMPONENT_DOCUMENTATION_WIX_LEVEL 2)
+
+#Feature tests
+SET(CPACK_COMPONENT_TEST_DISPLAY_NAME "Tests")
+SET(CPACK_COMPONENT_TEST_DESCRIPTION "Installs unittests (requires Perl to run)")
+SET(CPACK_COMPONENT_TEST_WIX_LEVEL 2)
+
+
+#Feature Misc (hidden, installs only if everything is installed)
+SET(CPACK_COMPONENT_GROUP_MISC_HIDDEN 1)
+SET(CPACK_COMPONENT_GROUP_MISC_WIX_LEVEL 100)
+ SET(CPACK_COMPONENT_INIFILES_GROUP "Misc")
+ SET(CPACK_COMPONENT_SERVER_SCRIPTS_GROUP "Misc")
+
+#Add Firewall exception for mysqld.exe
+SET(bin.mysqld.exe.FILE_EXTRA "
+ <FirewallException Id='firewallexception.mysqld.exe' Name='[ProductName]' Scope='any'
+ IgnoreFailure='yes' xmlns='http://schemas.microsoft.com/wix/FirewallExtension'
+ />
+ "
+)
+
diff --git a/win/packaging/WixUIBannerBmp.jpg b/win/packaging/WixUIBannerBmp.jpg
new file mode 100644
index 00000000000..a04177bed9d
--- /dev/null
+++ b/win/packaging/WixUIBannerBmp.jpg
Binary files differ
diff --git a/win/packaging/WixUIDialogBmp.jpg b/win/packaging/WixUIDialogBmp.jpg
new file mode 100644
index 00000000000..466cdc461c8
--- /dev/null
+++ b/win/packaging/WixUIDialogBmp.jpg
Binary files differ
diff --git a/win/packaging/ca/CMakeLists.txt b/win/packaging/ca/CMakeLists.txt
new file mode 100644
index 00000000000..0da1e5d67b1
--- /dev/null
+++ b/win/packaging/ca/CMakeLists.txt
@@ -0,0 +1,63 @@
+# Copyright 2010, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+INCLUDE_DIRECTORIES(${WIX_DIR}/../SDK/inc)
+LINK_DIRECTORIES(${WIX_DIR}/../SDK/lib)
+
+SET(WIXCA_SOURCES CustomAction.cpp CustomAction.def)
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql)
+
+IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ SET(WIX_ARCH_SUFFIX "_x64")
+ SET(WIX36_ARCH_SUFFIX "x64")
+ELSE()
+ SET(WIX_ARCH_SUFFIX)
+ SET(WIX36_ARCH_SUFFIX "x86")
+ENDIF()
+
+IF(MSVC_VERSION EQUAL 1400)
+ SET(WIX35_MSVC_SUFFIX "_2005")
+ELSEIF(MSVC_VERSION EQUAL 1500)
+ SET(WIX35_MSVC_SUFFIX "_2008")
+ SET(WIX36_MSVC_SUFFIX "VS2008")
+ELSEIF(MSVC_VERSION EQUAL 1600 OR MSVC_VERSION EQUAL 1700 )
+ SET(WIX35_MSVC_SUFFIX "_2010")
+ SET(WIX36_MSVC_SUFFIX "VS2010")
+ELSE()
+ # When next VS is out, add the correct version here
+ MESSAGE(FATAL_ERROR "Unknown VS version")
+ENDIF()
+INCLUDE_DIRECTORIES(${WIX_DIR}/../SDK/${WIX36_MSVC_SUFFIX}/inc)
+
+FIND_LIBRARY(WIX_WCAUTIL_LIBRARY
+ NAMES wcautil${WIX_ARCH_SUFFIX} wcautil${WIX35_MSVC_SUFFIX}${WIX_ARCH_SUFFIX}
+ wcautil
+ PATHS
+ ${WIX_DIR}/../SDK/lib
+ ${WIX_DIR}/../SDK/${WIX36_MSVC_SUFFIX}/lib/${WIX36_ARCH_SUFFIX})
+
+FIND_LIBRARY(WIX_DUTIL_LIBRARY
+ NAMES dutil${WIX_ARCH_SUFFIX} dutil${WIX35_MSVC_SUFFIX}${WIX_ARCH_SUFFIX}
+ dutil
+ PATHS
+ ${WIX_DIR}/../SDK/lib
+ ${WIX_DIR}/../SDK/${WIX36_MSVC_SUFFIX}/lib/${WIX36_ARCH_SUFFIX}
+ )
+
+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)
diff --git a/win/packaging/ca/CustomAction.cpp b/win/packaging/ca/CustomAction.cpp
new file mode 100644
index 00000000000..dbce86804c8
--- /dev/null
+++ b/win/packaging/ca/CustomAction.cpp
@@ -0,0 +1,948 @@
+/* Copyright 2010, Oracle and/or its affiliates. All rights reserved.
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; version 2 of the License.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef UNICODE
+#define UNICODE
+#endif
+
+#include <windows.h>
+#include <winreg.h>
+#include <msi.h>
+#include <msiquery.h>
+#include <wcautil.h>
+#include <strutil.h>
+#include <string.h>
+#include <strsafe.h>
+#include <assert.h>
+
+#include <winservice.h>
+
+#define ONE_MB 1048576
+UINT ExecRemoveDataDirectory(wchar_t *dir)
+{
+ /* Strip stray backslash */
+ DWORD len = (DWORD)wcslen(dir);
+ if(len > 0 && dir[len-1]==L'\\')
+ dir[len-1] = 0;
+
+ SHFILEOPSTRUCTW fileop;
+ fileop.hwnd= NULL; /* no status display */
+ fileop.wFunc= FO_DELETE; /* delete operation */
+ fileop.pFrom= dir; /* source file name as double null terminated string */
+ fileop.pTo= NULL; /* no destination needed */
+ fileop.fFlags= FOF_NOCONFIRMATION|FOF_SILENT; /* do not prompt the user */
+
+ fileop.fAnyOperationsAborted= FALSE;
+ fileop.lpszProgressTitle= NULL;
+ fileop.hNameMappings= NULL;
+
+ return SHFileOperationW(&fileop);
+}
+
+
+extern "C" UINT __stdcall RemoveDataDirectory(MSIHANDLE hInstall)
+{
+ HRESULT hr = S_OK;
+ UINT er = ERROR_SUCCESS;
+
+ hr = WcaInitialize(hInstall, __FUNCTION__);
+ ExitOnFailure(hr, "Failed to initialize");
+ WcaLog(LOGMSG_STANDARD, "Initialized.");
+
+ wchar_t dir[MAX_PATH];
+ DWORD len = MAX_PATH;
+ MsiGetPropertyW(hInstall, L"CustomActionData", dir, &len);
+
+ er= ExecRemoveDataDirectory(dir);
+ WcaLog(LOGMSG_STANDARD, "SHFileOperation returned %d", er);
+LExit:
+ return WcaFinalize(er);
+}
+
+/*
+ Escape command line parameter fpr pass to CreateProcess().
+
+ We assume out has enough space to include encoded string
+ 2*wcslen(in) is enough.
+
+ It is assumed that called will add double quotation marks before and after
+ the string.
+*/
+static void EscapeCommandLine(const wchar_t *in, wchar_t *out, size_t buflen)
+{
+ const wchar_t special_chars[]=L" \t\n\v\"";
+ bool needs_escaping= false;
+ size_t pos;
+
+ for(int i=0; i< sizeof(special_chars) -1; i++)
+ {
+ if (wcschr(in, special_chars[i]))
+ {
+ needs_escaping = true;
+ break;
+ }
+ }
+
+ if(!needs_escaping)
+ {
+ wcscpy_s(out, buflen, in);
+ return;
+ }
+
+ pos= 0;
+ for(int i = 0 ; ; i++)
+ {
+ size_t n_backslashes = 0;
+ wchar_t c;
+ while (in[i] == L'\\')
+ {
+ i++;
+ n_backslashes++;
+ }
+
+ c= in[i];
+ if (c == 0)
+ {
+ /*
+ Escape all backslashes, but let the terminating double quotation mark
+ that caller adds be interpreted as a metacharacter.
+ */
+ for(size_t j= 0; j < 2*n_backslashes;j++)
+ {
+ out[pos++]=L'\\';
+ }
+ break;
+ }
+ else if (c == L'"')
+ {
+ /*
+ Escape all backslashes and the following double quotation mark.
+ */
+ for(size_t j= 0; j < 2*n_backslashes + 1; j++)
+ {
+ out[pos++]=L'\\';
+ }
+ out[pos++]= L'"';
+ }
+ else
+ {
+ /* Backslashes aren't special here. */
+ for (size_t j=0; j < n_backslashes; j++)
+ out[pos++] = L'\\';
+
+ out[pos++]= c;
+ }
+ }
+ out[pos++]= 0;
+}
+/*
+ Check for if directory is empty during install,
+ sets "<PROPERTY>_NOT_EMPTY" otherise
+*/
+extern "C" UINT __stdcall CheckDirectoryEmpty(MSIHANDLE hInstall,
+ const wchar_t *PropertyName)
+{
+ HRESULT hr = S_OK;
+ UINT er = ERROR_SUCCESS;
+ hr = WcaInitialize(hInstall, __FUNCTION__);
+ ExitOnFailure(hr, "Failed to initialize");
+ WcaLog(LOGMSG_STANDARD, "Initialized.");
+
+
+ wchar_t buf[MAX_PATH];
+ DWORD len = MAX_PATH;
+ MsiGetPropertyW(hInstall, PropertyName, buf, &len);
+ wcscat_s(buf, MAX_PATH, L"*.*");
+
+ WcaLog(LOGMSG_STANDARD, "Checking files in %S", buf);
+ WIN32_FIND_DATAW data;
+ HANDLE h;
+ bool empty;
+ h= FindFirstFile(buf, &data);
+ if (h != INVALID_HANDLE_VALUE)
+ {
+ empty= true;
+ for(;;)
+ {
+ if (wcscmp(data.cFileName, L".") || wcscmp(data.cFileName, L".."))
+ {
+ empty= false;
+ break;
+ }
+ if (!FindNextFile(h, &data))
+ break;
+ }
+ FindClose(h);
+ }
+ else
+ {
+ /* Non-existent directory, we handle it as empty */
+ empty = true;
+ }
+
+ if(empty)
+ WcaLog(LOGMSG_STANDARD, "Directory %S is empty or non-existent",
+ PropertyName);
+ else
+ WcaLog(LOGMSG_STANDARD, "Directory %S is NOT empty", PropertyName);
+
+ wcscpy_s(buf, MAX_PATH, PropertyName);
+ wcscat_s(buf, L"NOTEMPTY");
+ WcaSetProperty(buf, empty? L"":L"1");
+
+LExit:
+ return WcaFinalize(er);
+}
+
+extern "C" UINT __stdcall CheckDataDirectoryEmpty(MSIHANDLE hInstall)
+{
+ return CheckDirectoryEmpty(hInstall, L"DATADIR");
+}
+
+bool CheckServiceExists(const wchar_t *name)
+{
+ SC_HANDLE manager =0, service=0;
+ manager = OpenSCManager( NULL, NULL, SC_MANAGER_CONNECT);
+ if (!manager)
+ {
+ return false;
+ }
+
+ service = OpenService(manager, name, SC_MANAGER_CONNECT);
+ if(service)
+ CloseServiceHandle(service);
+ CloseServiceHandle(manager);
+
+ return service?true:false;
+}
+
+/* User in rollback of create database custom action */
+bool ExecRemoveService(const wchar_t *name)
+{
+ SC_HANDLE manager =0, service=0;
+ manager = OpenSCManager( NULL, NULL, SC_MANAGER_ALL_ACCESS);
+ bool ret;
+ if (!manager)
+ {
+ return false;
+ }
+ service = OpenService(manager, name, DELETE);
+ if(service)
+ {
+ ret= DeleteService(service);
+ }
+ else
+ {
+ ret= false;
+ }
+ CloseServiceHandle(manager);
+ return ret;
+}
+
+/*
+ Check if port is free by trying to bind to the port
+*/
+bool IsPortFree(short port)
+{
+ WORD wVersionRequested;
+ WSADATA wsaData;
+
+ wVersionRequested = MAKEWORD(2, 2);
+
+ WSAStartup(wVersionRequested, &wsaData);
+
+ struct sockaddr_in sin;
+ SOCKET sock;
+ sock = socket(AF_INET, SOCK_STREAM, 0);
+ if(sock == -1)
+ {
+ return false;
+ }
+ sin.sin_port = htons(port);
+ sin.sin_addr.s_addr = 0;
+ sin.sin_addr.s_addr = INADDR_ANY;
+ sin.sin_family = AF_INET;
+ if(bind(sock, (struct sockaddr *)&sin,sizeof(struct sockaddr_in) ) == -1)
+ {
+ return false;
+ }
+ closesocket(sock);
+ WSACleanup();
+ return true;
+}
+
+
+/*
+ Helper function used in filename normalization.
+ Removes leading quote and terminates string at the position of the next one
+ (if applicable, does not change string otherwise). Returns modified string
+*/
+wchar_t *strip_quotes(wchar_t *s)
+{
+ if (s && (*s == L'"'))
+ {
+ s++;
+ wchar_t *p = wcschr(s, L'"');
+ if(p)
+ *p = 0;
+ }
+ return s;
+}
+
+
+/*
+ Checks for consistency of service configuration.
+
+ It can happen that SERVICENAME or DATADIR
+ MSI properties are in inconsistent state after somebody upgraded database
+ We catch this case during uninstall. In particular, either service is not
+ removed even if SERVICENAME was set (but this name is reused by someone else)
+ or data directory is not removed (if it is used by someone else). To find out
+ whether service name and datadirectory are in use For every service,
+ configuration is read and checked as follows:
+
+ - look if a service has to do something with mysql
+ - If so, check its name against SERVICENAME. if match, check binary path
+ against INSTALLDIR\bin. If binary path does not match, then service runs
+ under different installation and won't be removed.
+ - Check options file for datadir and look if this is inside this
+ installation's datadir don't remove datadir if this is the case.
+
+ "Don't remove" in this context means that custom action is removing
+ SERVICENAME property or CLEANUPDATA property, which later on in course of
+ installation mean, that either datadir or service is kept.
+*/
+
+void CheckServiceConfig(
+ wchar_t *my_servicename, /* SERVICENAME property in this installation*/
+ wchar_t *datadir, /* DATADIR property in this installation*/
+ wchar_t *bindir, /* INSTALLDIR\bin */
+ wchar_t *other_servicename, /* Service to check against */
+ QUERY_SERVICE_CONFIGW * config /* Other service's config */
+ )
+{
+
+ bool same_bindir = false;
+ wchar_t * commandline= config->lpBinaryPathName;
+ int numargs;
+ wchar_t **argv= CommandLineToArgvW(commandline, &numargs);
+ WcaLog(LOGMSG_VERBOSE, "CommandLine= %S", commandline);
+ if(!argv || !argv[0] || ! wcsstr(argv[0], L"mysqld"))
+ {
+ goto end;
+ }
+
+ WcaLog(LOGMSG_STANDARD, "MySQL service %S found: CommandLine= %S",
+ other_servicename, commandline);
+ if (wcsstr(argv[0], bindir))
+ {
+ WcaLog(LOGMSG_STANDARD, "executable under bin directory");
+ same_bindir = true;
+ }
+
+ bool is_my_service = (_wcsicmp(my_servicename, other_servicename) == 0);
+ if(!is_my_service)
+ {
+ WcaLog(LOGMSG_STANDARD, "service does not match current service");
+ /*
+ TODO probably the best thing possible would be to add temporary
+ row to MSI ServiceConfig table with remove on uninstall
+ */
+ }
+ else if (!same_bindir)
+ {
+ WcaLog(LOGMSG_STANDARD,
+ "Service name matches, but not the executable path directory, mine is %S",
+ bindir);
+ WcaSetProperty(L"SERVICENAME", L"");
+ }
+
+ /* Check if data directory is used */
+ if(!datadir || numargs <= 1 || wcsncmp(argv[1],L"--defaults-file=",16) != 0)
+ {
+ goto end;
+ }
+
+ wchar_t current_datadir_buf[MAX_PATH]={0};
+ wchar_t normalized_current_datadir[MAX_PATH+1];
+ wchar_t *current_datadir= current_datadir_buf;
+ wchar_t *defaults_file= argv[1]+16;
+ defaults_file= strip_quotes(defaults_file);
+
+ WcaLog(LOGMSG_STANDARD, "parsed defaults file is %S", defaults_file);
+
+ if (GetPrivateProfileStringW(L"mysqld", L"datadir", NULL, current_datadir,
+ MAX_PATH, defaults_file) == 0)
+ {
+ WcaLog(LOGMSG_STANDARD,
+ "Cannot find datadir in ini file '%S'", defaults_file);
+ goto end;
+ }
+
+ WcaLog(LOGMSG_STANDARD, "datadir from defaults-file is %S", current_datadir);
+ strip_quotes(current_datadir);
+
+ /* Convert to Windows path */
+ if (GetFullPathNameW(current_datadir, MAX_PATH, normalized_current_datadir,
+ NULL))
+ {
+ /* Add backslash to be compatible with directory formats in MSI */
+ wcsncat(normalized_current_datadir, L"\\", MAX_PATH+1);
+ WcaLog(LOGMSG_STANDARD, "normalized current datadir is '%S'",
+ normalized_current_datadir);
+ }
+
+ if (_wcsicmp(datadir, normalized_current_datadir) == 0 && !same_bindir)
+ {
+ WcaLog(LOGMSG_STANDARD,
+ "database directory from current installation, but different mysqld.exe");
+ WcaSetProperty(L"CLEANUPDATA", L"");
+ }
+
+end:
+ LocalFree((HLOCAL)argv);
+}
+
+/*
+ Checks if database directory or service are modified by user
+ For example, service may point to different mysqld.exe that it was originally
+ installed, or some different service might use this database directory. This
+ would normally mean user has done an upgrade of the database and in this case
+ uninstall should neither delete service nor database directory.
+
+ If this function find that service is modified by user (mysqld.exe used by
+ service does not point to the installation bin directory), MSI public variable
+ SERVICENAME is removed, if DATADIR is used by some other service, variables
+ DATADIR and CLEANUPDATA are removed.
+
+ The effect of variable removal is that service does not get uninstalled and
+ datadir is not touched by uninstallation.
+
+ Note that this function is running without elevation and does not use anything
+ that would require special privileges.
+
+*/
+extern "C" UINT CheckDBInUse(MSIHANDLE hInstall)
+{
+ static BYTE buf[256*1024]; /* largest possible buffer for EnumServices */
+ static char config_buffer[8*1024]; /*largest buffer for QueryServiceConfig */
+ HRESULT hr = S_OK;
+ UINT er = ERROR_SUCCESS;
+ wchar_t *servicename= NULL;
+ wchar_t *datadir= NULL;
+ wchar_t *bindir=NULL;
+
+ SC_HANDLE scm = NULL;
+ ULONG bufsize = sizeof(buf);
+ ULONG bufneed = 0x00;
+ ULONG num_services = 0x00;
+ LPENUM_SERVICE_STATUS_PROCESS info = NULL;
+
+ hr = WcaInitialize(hInstall, __FUNCTION__);
+ ExitOnFailure(hr, "Failed to initialize");
+ WcaLog(LOGMSG_STANDARD, "Initialized.");
+
+ WcaGetProperty(L"SERVICENAME", &servicename);
+ WcaGetProperty(L"DATADIR", &datadir);
+ WcaGetFormattedString(L"[INSTALLDIR]bin\\", &bindir);
+ WcaLog(LOGMSG_STANDARD,"SERVICENAME=%S, DATADIR=%S, bindir=%S",
+ servicename, datadir, bindir);
+
+ scm = OpenSCManager(NULL, NULL,
+ SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_CONNECT);
+ if (scm == NULL)
+ {
+ ExitOnFailure(E_FAIL, "OpenSCManager failed");
+ }
+
+ BOOL ok= EnumServicesStatusExW( scm,
+ SC_ENUM_PROCESS_INFO,
+ SERVICE_WIN32,
+ SERVICE_STATE_ALL,
+ buf,
+ bufsize,
+ &bufneed,
+ &num_services,
+ NULL,
+ NULL);
+ if(!ok)
+ {
+ WcaLog(LOGMSG_STANDARD, "last error %d", GetLastError());
+ ExitOnFailure(E_FAIL, "EnumServicesStatusExW failed");
+ }
+ info = (LPENUM_SERVICE_STATUS_PROCESS)buf;
+ for (ULONG i=0; i < num_services; i++)
+ {
+ SC_HANDLE service= OpenServiceW(scm, info[i].lpServiceName,
+ SERVICE_QUERY_CONFIG);
+ if (!service)
+ continue;
+ WcaLog(LOGMSG_VERBOSE, "Checking Service %S", info[i].lpServiceName);
+ QUERY_SERVICE_CONFIGW *config=
+ (QUERY_SERVICE_CONFIGW *)(void *)config_buffer;
+ DWORD needed;
+ BOOL ok= QueryServiceConfigW(service, config,sizeof(config_buffer),
+ &needed);
+ CloseServiceHandle(service);
+ if (ok)
+ {
+ CheckServiceConfig(servicename, datadir, bindir, info[i].lpServiceName,
+ config);
+ }
+ }
+
+LExit:
+ if(scm)
+ CloseServiceHandle(scm);
+
+ ReleaseStr(servicename);
+ ReleaseStr(datadir);
+ ReleaseStr(bindir);
+ return WcaFinalize(er);
+}
+
+/*
+ Get maximum size of the buffer process can allocate.
+ this is calculated as min(RAM,virtualmemorylimit)
+ For 32bit processes, virtual address memory is 2GB (x86 OS)
+ or 4GB(x64 OS).
+
+ Fragmentation due to loaded modules, heap and stack
+ limit maximum size of continous memory block further,
+ so that limit for 32 bit process is about 1200 on 32 bit OS
+ or 2000 MB on 64 bit OS(found experimentally).
+*/
+unsigned long long GetMaxBufferSize(unsigned long long totalPhys)
+{
+#ifdef _M_IX86
+ BOOL wow64;
+ if (IsWow64Process(GetCurrentProcess(), &wow64))
+ return min(totalPhys, 2000ULL*ONE_MB);
+ else
+ return min(totalPhys, 1200ULL*ONE_MB);
+#else
+ return totalPhys;
+#endif
+}
+
+
+/*
+ Checks SERVICENAME, PORT and BUFFERSIZE parameters
+*/
+extern "C" UINT __stdcall CheckDatabaseProperties (MSIHANDLE hInstall)
+{
+ wchar_t ServiceName[MAX_PATH]={0};
+ wchar_t SkipNetworking[MAX_PATH]={0};
+ wchar_t QuickConfig[MAX_PATH]={0};
+ wchar_t Password[MAX_PATH]={0};
+ wchar_t EscapedPassword[2*MAX_PATH+2];
+ wchar_t Port[6];
+ wchar_t BufferPoolSize[16];
+ DWORD PortLen=6;
+ bool haveInvalidPort=false;
+ const wchar_t *ErrorMsg=0;
+ HRESULT hr= S_OK;
+ UINT er= ERROR_SUCCESS;
+
+
+ hr = WcaInitialize(hInstall, __FUNCTION__);
+ ExitOnFailure(hr, "Failed to initialize");
+ WcaLog(LOGMSG_STANDARD, "Initialized.");
+
+ DWORD ServiceNameLen = MAX_PATH;
+ MsiGetPropertyW (hInstall, L"SERVICENAME", ServiceName, &ServiceNameLen);
+ if(ServiceName[0])
+ {
+ if(ServiceNameLen > 256)
+ {
+ ErrorMsg= L"Invalid service name. The maximum length is 256 characters.";
+ goto LExit;
+ }
+ for(DWORD i=0; i< ServiceNameLen;i++)
+ {
+ if(ServiceName[i] == L'\\' || ServiceName[i] == L'/'
+ || ServiceName[i]=='\'' || ServiceName[i] ==L'"')
+ {
+ ErrorMsg =
+ L"Invalid service name. Forward slash and back slash are forbidden."
+ L"Single and double quotes are also not permitted.";
+ goto LExit;
+ }
+ }
+ if(CheckServiceExists(ServiceName))
+ {
+ ErrorMsg=
+ L"A service with the same name already exists. "
+ L"Please use a different name.";
+ goto LExit;
+ }
+ }
+
+ DWORD PasswordLen= MAX_PATH;
+ MsiGetPropertyW (hInstall, L"PASSWORD", Password, &PasswordLen);
+ EscapeCommandLine(Password, EscapedPassword,
+ sizeof(EscapedPassword)/sizeof(EscapedPassword[0]));
+ MsiSetPropertyW(hInstall,L"ESCAPEDPASSWORD",EscapedPassword);
+
+ DWORD SkipNetworkingLen= MAX_PATH;
+ MsiGetPropertyW(hInstall, L"SKIPNETWORKING", SkipNetworking,
+ &SkipNetworkingLen);
+ MsiGetPropertyW(hInstall, L"PORT", Port, &PortLen);
+
+ if(SkipNetworking[0]==0 && Port[0] != 0)
+ {
+ /* Strip spaces */
+ for(DWORD i=PortLen-1; i > 0; i--)
+ {
+ if(Port[i]== ' ')
+ Port[i] = 0;
+ }
+
+ if(PortLen > 5 || PortLen <= 3)
+ haveInvalidPort = true;
+ else
+ {
+ for (DWORD i=0; i< PortLen && Port[i] != 0;i++)
+ {
+ if(Port[i] < '0' || Port[i] >'9')
+ {
+ haveInvalidPort=true;
+ break;
+ }
+ }
+ }
+ if (haveInvalidPort)
+ {
+ ErrorMsg =
+ L"Invalid port number. Please use a number between 1025 and 65535.";
+ goto LExit;
+ }
+
+ short port = (short)_wtoi(Port);
+ if (!IsPortFree(port))
+ {
+ ErrorMsg =
+ L"The TCP Port you selected is already in use. "
+ L"Please choose a different port.";
+ goto LExit;
+ }
+ }
+
+
+ DWORD QuickConfigLen = MAX_PATH;
+ MsiGetPropertyW (hInstall, L"STDCONFIG", QuickConfig, &QuickConfigLen);
+ if(QuickConfig[0] !=0)
+ {
+ MEMORYSTATUSEX memstatus;
+ memstatus.dwLength =sizeof(memstatus);
+ wchar_t invalidValueMsg[256];
+
+ if (!GlobalMemoryStatusEx(&memstatus))
+ {
+ WcaLog(LOGMSG_STANDARD, "Error %u from GlobalMemoryStatusEx",
+ GetLastError());
+ er= ERROR_INSTALL_FAILURE;
+ goto LExit;
+ }
+ DWORD BufferPoolSizeLen= 16;
+ MsiGetPropertyW(hInstall, L"BUFFERPOOLSIZE", BufferPoolSize, &BufferPoolSizeLen);
+ /* Strip spaces */
+ for(DWORD i=BufferPoolSizeLen-1; i > 0; i--)
+ {
+ if(BufferPoolSize[i]== ' ')
+ BufferPoolSize[i] = 0;
+ }
+ unsigned long long availableMemory=
+ GetMaxBufferSize(memstatus.ullTotalPhys)/ONE_MB;
+ swprintf_s(invalidValueMsg,
+ L"Invalid buffer pool size. Please use a number between 1 and %llu",
+ availableMemory);
+ if(BufferPoolSizeLen == 0 || BufferPoolSizeLen > 15)
+ {
+ ErrorMsg= invalidValueMsg;
+ goto LExit;
+ }
+ for (DWORD i=0; i < BufferPoolSizeLen && BufferPoolSize[BufferPoolSizeLen];
+ i++)
+ {
+ if(BufferPoolSize[i]< '0' || BufferPoolSize[i] > '9')
+ {
+ ErrorMsg= invalidValueMsg;
+ goto LExit;
+ }
+ }
+ BufferPoolSize[BufferPoolSizeLen]=0;
+ MsiSetPropertyW(hInstall, L"BUFFERPOOLSIZE", BufferPoolSize);
+ long long sz = _wtoi64(BufferPoolSize);
+ if(sz <= 0 || sz > (long long)availableMemory)
+ {
+ if(sz > 0)
+ {
+ swprintf_s(invalidValueMsg,
+ L"Value for buffer pool size is too large."
+ L"Only approximately %llu MB is available for allocation."
+ L"Please use a number between 1 and %llu.",
+ availableMemory, availableMemory);
+ }
+ ErrorMsg= invalidValueMsg;
+ goto LExit;
+ }
+ }
+LExit:
+ MsiSetPropertyW (hInstall, L"WarningText", ErrorMsg);
+ return WcaFinalize(er);
+}
+
+/*
+ Sets Innodb buffer pool size (1/8 of RAM by default), if not already specified
+ via command line.
+ Calculates innodb log file size as min(50, innodb buffer pool size/8)
+*/
+extern "C" UINT __stdcall PresetDatabaseProperties(MSIHANDLE hInstall)
+{
+ unsigned long long InnodbBufferPoolSize= 256;
+ unsigned long long InnodbLogFileSize= 50;
+ wchar_t buff[MAX_PATH];
+ UINT er = ERROR_SUCCESS;
+ HRESULT hr= S_OK;
+ MEMORYSTATUSEX memstatus;
+ hr = WcaInitialize(hInstall, __FUNCTION__);
+ ExitOnFailure(hr, "Failed to initialize");
+ WcaLog(LOGMSG_STANDARD, "Initialized.");
+
+ /* Check if bufferpoolsize parameter was given on the command line*/
+ DWORD BufferPoolsizeParamLen = MAX_PATH;
+ MsiGetPropertyW(hInstall, L"BUFFERPOOLSIZE", buff, &BufferPoolsizeParamLen);
+
+ if (BufferPoolsizeParamLen && buff[0])
+ {
+ WcaLog(LOGMSG_STANDARD, "BUFFERPOOLSIZE=%s, len=%u",buff, BufferPoolsizeParamLen);
+ InnodbBufferPoolSize= _wtoi64(buff);
+ }
+ else
+ {
+ memstatus.dwLength = sizeof(memstatus);
+ if (!GlobalMemoryStatusEx(&memstatus))
+ {
+ WcaLog(LOGMSG_STANDARD, "Error %u from GlobalMemoryStatusEx",
+ GetLastError());
+ er= ERROR_INSTALL_FAILURE;
+ goto LExit;
+ }
+ unsigned long long totalPhys= memstatus.ullTotalPhys;
+ /* Give innodb 12.5% of available physical memory. */
+ InnodbBufferPoolSize= totalPhys/ONE_MB/8;
+ #ifdef _M_IX86
+ /*
+ For 32 bit processes, take virtual address space limitation into account.
+ Do not try to use more than 3/4 of virtual address space, even if there
+ is plenty of physical memory.
+ */
+ InnodbBufferPoolSize= min(GetMaxBufferSize(totalPhys)/ONE_MB*3/4,
+ InnodbBufferPoolSize);
+ #endif
+ swprintf_s(buff, L"%llu",InnodbBufferPoolSize);
+ MsiSetPropertyW(hInstall, L"BUFFERPOOLSIZE", buff);
+ }
+ InnodbLogFileSize = min(50, InnodbBufferPoolSize);
+ swprintf_s(buff, L"%llu",InnodbLogFileSize);
+ MsiSetPropertyW(hInstall, L"LOGFILESIZE", buff);
+
+LExit:
+ return WcaFinalize(er);
+}
+/* Remove service and data directory created by CreateDatabase operation */
+extern "C" UINT __stdcall CreateDatabaseRollback(MSIHANDLE hInstall)
+{
+ HRESULT hr = S_OK;
+ UINT er = ERROR_SUCCESS;
+ wchar_t* service= 0;
+ wchar_t* dir= 0;
+
+ hr = WcaInitialize(hInstall, __FUNCTION__);
+ ExitOnFailure(hr, "Failed to initialize");
+ WcaLog(LOGMSG_STANDARD, "Initialized.");
+ wchar_t data[2*MAX_PATH];
+ DWORD len= MAX_PATH;
+ MsiGetPropertyW(hInstall, L"CustomActionData", data, &len);
+
+ /* Property is encoded as [SERVICENAME]\[DBLOCATION] */
+ if(data[0] == L'\\')
+ {
+ dir= data+1;
+ }
+ else
+ {
+ service= data;
+ dir= wcschr(data, '\\');
+ if (dir)
+ {
+ *dir=0;
+ dir++;
+ }
+ }
+
+ if(service)
+ {
+ ExecRemoveService(service);
+ }
+ if(dir)
+ {
+ ExecRemoveDataDirectory(dir);
+ }
+LExit:
+ return WcaFinalize(er);
+}
+
+
+/*
+ Enables/disables optional "Launch upgrade wizard" checkbox at the end of
+ installation
+*/
+#define MAX_VERSION_PROPERTY_SIZE 64
+
+extern "C" UINT __stdcall CheckServiceUpgrades(MSIHANDLE hInstall)
+{
+ HRESULT hr = S_OK;
+ UINT er = ERROR_SUCCESS;
+ wchar_t* service= 0;
+ wchar_t* dir= 0;
+ wchar_t installerVersion[MAX_VERSION_PROPERTY_SIZE];
+ char installDir[MAX_PATH];
+ DWORD size =MAX_VERSION_PROPERTY_SIZE;
+ int installerMajorVersion, installerMinorVersion, installerPatchVersion;
+ bool upgradableServiceFound=false;
+
+ hr = WcaInitialize(hInstall, __FUNCTION__);
+ WcaLog(LOGMSG_STANDARD, "Initialized.");
+ if (MsiGetPropertyW(hInstall, L"ProductVersion", installerVersion, &size)
+ != ERROR_SUCCESS)
+ {
+ hr = HRESULT_FROM_WIN32(GetLastError());
+ ExitOnFailure(hr, "MsiGetPropertyW failed");
+ }
+ if (swscanf(installerVersion,L"%d.%d.%d",
+ &installerMajorVersion, &installerMinorVersion, &installerPatchVersion) !=3)
+ {
+ assert(FALSE);
+ }
+
+ size= MAX_PATH;
+ if (MsiGetPropertyA(hInstall,"INSTALLDIR", installDir, &size)
+ != ERROR_SUCCESS)
+ {
+ hr = HRESULT_FROM_WIN32(GetLastError());
+ ExitOnFailure(hr, "MsiGetPropertyW failed");
+ }
+
+
+ SC_HANDLE scm = OpenSCManager(NULL, NULL,
+ SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_CONNECT);
+ if (scm == NULL)
+ {
+ hr = HRESULT_FROM_WIN32(GetLastError());
+ ExitOnFailure(hr,"OpenSCManager failed");
+ }
+
+ static BYTE buf[64*1024];
+ static BYTE config_buffer[8*1024];
+
+ DWORD bufsize= sizeof(buf);
+ DWORD bufneed;
+ DWORD num_services;
+ BOOL ok= EnumServicesStatusExW(scm, SC_ENUM_PROCESS_INFO, SERVICE_WIN32,
+ SERVICE_STATE_ALL, buf, bufsize, &bufneed, &num_services, NULL, NULL);
+ if(!ok)
+ {
+ hr = HRESULT_FROM_WIN32(GetLastError());
+ ExitOnFailure(hr,"EnumServicesStatusEx failed");
+ }
+ LPENUM_SERVICE_STATUS_PROCESSW info =
+ (LPENUM_SERVICE_STATUS_PROCESSW)buf;
+ int index=-1;
+ for (ULONG i=0; i < num_services; i++)
+ {
+ SC_HANDLE service= OpenServiceW(scm, info[i].lpServiceName,
+ SERVICE_QUERY_CONFIG);
+ if (!service)
+ continue;
+ QUERY_SERVICE_CONFIGW *config=
+ (QUERY_SERVICE_CONFIGW*)(void *)config_buffer;
+ DWORD needed;
+ BOOL ok= QueryServiceConfigW(service, config,sizeof(config_buffer),
+ &needed);
+ CloseServiceHandle(service);
+ if (ok)
+ {
+ mysqld_service_properties props;
+ if (get_mysql_service_properties(config->lpBinaryPathName, &props))
+ continue;
+ /*
+ Only look for services that have mysqld.exe outside of the current
+ installation directory.
+ */
+ if(strstr(props.mysqld_exe,installDir) == 0)
+ {
+ WcaLog(LOGMSG_STANDARD, "found service %S, major=%d, minor=%d",
+ info[i].lpServiceName, props.version_major, props.version_minor);
+ if(props.version_major < installerMajorVersion
+ || (props.version_major == installerMajorVersion &&
+ props.version_minor <= installerMinorVersion))
+ {
+ upgradableServiceFound= true;
+ break;
+ }
+ }
+ }
+ }
+
+ if(!upgradableServiceFound)
+ {
+ /* Disable optional checkbox at the end of installation */
+ MsiSetPropertyW(hInstall, L"WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT", L"");
+ MsiSetPropertyW(hInstall, L"WIXUI_EXITDIALOGOPTIONALCHECKBOX",L"");
+ }
+ else
+ {
+ MsiSetPropertyW(hInstall, L"UpgradableServiceFound", L"1");
+ MsiSetPropertyW(hInstall, L"WIXUI_EXITDIALOGOPTIONALCHECKBOX",L"1");
+ }
+LExit:
+ if(scm)
+ CloseServiceHandle(scm);
+ return WcaFinalize(er);
+}
+
+
+/* DllMain - Initialize and cleanup WiX custom action utils */
+extern "C" BOOL WINAPI DllMain(
+ __in HINSTANCE hInst,
+ __in ULONG ulReason,
+ __in LPVOID
+ )
+{
+ switch(ulReason)
+ {
+ case DLL_PROCESS_ATTACH:
+ WcaGlobalInitialize(hInst);
+ break;
+
+ case DLL_PROCESS_DETACH:
+ WcaGlobalFinalize();
+ break;
+ }
+
+ return TRUE;
+}
diff --git a/win/packaging/ca/CustomAction.def b/win/packaging/ca/CustomAction.def
new file mode 100644
index 00000000000..0be77a97a08
--- /dev/null
+++ b/win/packaging/ca/CustomAction.def
@@ -0,0 +1,10 @@
+LIBRARY "wixca"
+VERSION 1.0
+EXPORTS
+PresetDatabaseProperties
+RemoveDataDirectory
+CreateDatabaseRollback
+CheckDatabaseProperties
+CheckDataDirectoryEmpty
+CheckDBInUse
+CheckServiceUpgrades
diff --git a/win/packaging/ca/CustomAction.rc b/win/packaging/ca/CustomAction.rc
new file mode 100644
index 00000000000..3f37126ee77
--- /dev/null
+++ b/win/packaging/ca/CustomAction.rc
@@ -0,0 +1,18 @@
+#include "afxres.h"
+#undef APSTUDIO_READONLY_SYMBOLS
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x0L
+ FILESUBTYPE 0x0L
+BEGIN
+END
+
diff --git a/win/packaging/create_msi.cmake.in b/win/packaging/create_msi.cmake.in
new file mode 100644
index 00000000000..d291d06161c
--- /dev/null
+++ b/win/packaging/create_msi.cmake.in
@@ -0,0 +1,445 @@
+SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@")
+SET(CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@")
+SET(CANDLE_EXECUTABLE "@CANDLE_EXECUTABLE@")
+SET(LIGHT_EXECUTABLE "@LIGHT_EXECUTABLE@")
+SET(CMAKE_COMMAND "@CMAKE_COMMAND@")
+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(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@)
+SET(MANUFACTURER "@MANUFACTURER@")
+SET(WIXCA_LOCATION "@WIXCA_LOCATION@")
+SET(COPYING_RTF "@COPYING_RTF@")
+SET(CPACK_WIX_CONFIG "@CPACK_WIX_CONFIG@")
+SET(CPACK_WIX_INCLUDE "@CPACK_WIX_INCLUDE@")
+SET(CPACK_WIX_UPGRADE_CODE "@CPACK_WIX_UPGRADE_CODE@")
+SET(CPACK_WIX_PACKAGE_NAME "@CPACK_WIX_PACKAGE_NAME@")
+SET(CPACK_WIX_PACKAGE_BASE_NAME "@CPACK_WIX_PACKAGE_BASE_NAME@")
+SET(SIGNCODE "@SIGNCODE@")
+SET(SIGNTOOL_EXECUTABLE "@SIGNTOOL_EXECUTABLE@")
+SET(SIGNTOOL_PARAMETERS "@SIGNTOOL_PARAMETERS@")
+SET(CMAKE_FULL_VER
+ "@CMAKE_MAJOR_VERSION@.@CMAKE_MINOR_VERSION@.@CMAKE_PATCH_VERSION@")
+SET(EXTRA_WIX_PREPROCESSOR_FLAGS "@EXTRA_WIX_PREPROCESSOR_FLAGS@")
+SET(WITH_THIRD_PARTY "@WITH_THIRD_PARTY@")
+SET(THIRD_PARTY_DOWNLOAD_LOCATION "@THIRD_PARTY_DOWNLOAD_LOCATION@")
+SET(THIRD_PARTY_FEATURE_CONDITION "@THIRD_PARTY_FEATURE_CONDITION@")
+SET(LIBMYSQL_LOCATION "@LIBMYSQL_LOCATION@")
+
+SET($ENV{VS_UNICODE_OUTPUT} "")
+IF(LIBMYSQL_LOCATION AND CMAKE_CFG_INTDIR)
+ # resolve libmysql full path
+ STRING(REPLACE "${CMAKE_CFG_INTDIR}" "${CMAKE_INSTALL_CONFIG_NAME}" LIBMYSQL_LOCATION "${LIBMYSQL_LOCATION}")
+ENDIF()
+
+FOREACH(third_party ${WITH_THIRD_PARTY})
+ INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/${third_party}.cmake)
+
+ # Check than above script produced ${third_party}.wxi and ${third_party}_feature.wxi
+ FOREACH(outfile ${third_party}.wxi ${third_party}_feature.wxi)
+ IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${outfile})
+ MESSAGE(FATAL_ERROR
+ "${CMAKE_CURRENT_SOURCE_DIR}/${third_party}.cmake did not produce "
+ "${CMAKE_CURRENT_BINARY_DIR}/${outfile}"
+ )
+ ENDIF()
+ ENDFOREACH()
+ENDFOREACH()
+
+
+IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ SET(CANDLE_ARCH -arch x64)
+ SET(Win64 " Win64='yes'")
+ SET(Platform x64)
+ SET(PlatformProgramFilesFolder ProgramFiles64Folder)
+ELSE()
+ SET(CANDLE_ARCH -arch x86)
+ SET(Platform x86)
+ SET(PlatformProgramFilesFolder ProgramFilesFolder)
+ SET(Win64)
+ENDIF()
+
+SET(ENV{VS_UNICODE_OUTPUT})
+# Workaround for CMake bug#11452
+# Switch off the monolithic install
+EXECUTE_PROCESS(
+ COMMAND ${CMAKE_COMMAND} -DCPACK_MONOLITHIC_INSTALL=0 ${CMAKE_BINARY_DIR}
+ OUTPUT_QUIET
+)
+
+
+INCLUDE(${CMAKE_BINARY_DIR}/CPackConfig.cmake)
+
+IF(CPACK_WIX_CONFIG)
+ INCLUDE(${CPACK_WIX_CONFIG})
+ENDIF()
+
+IF(NOT CPACK_WIX_UI)
+ SET(CPACK_WIX_UI "MyWixUI_Mondo")
+ENDIF()
+
+IF(CMAKE_INSTALL_CONFIG_NAME)
+ STRING(REPLACE "${CMAKE_CFG_INTDIR}" "${CMAKE_INSTALL_CONFIG_NAME}"
+ WIXCA_LOCATION "${WIXCA_LOCATION}")
+ SET(CONFIG_PARAM "-DCMAKE_INSTALL_CONFIG_NAME=${CMAKE_INSTALL_CONFIG_NAME}")
+ENDIF()
+
+
+SET(COMPONENTS_ALL "${CPACK_COMPONENTS_ALL}")
+FOREACH(comp ${COMPONENTS_ALL})
+ SET(ENV{DESTDIR} testinstall/${comp})
+ EXECUTE_PROCESS(
+ COMMAND ${CMAKE_COMMAND} ${CONFIG_PARAM} -DCMAKE_INSTALL_COMPONENT=${comp}
+ -DCMAKE_INSTALL_PREFIX= -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
+ OUTPUT_QUIET
+
+ )
+ # Exclude empty install components
+ SET(INCLUDE_THIS_COMPONENT 1)
+ SET(MANIFEST_FILENAME "${CMAKE_BINARY_DIR}/install_manifest_${comp}.txt")
+ IF(EXISTS ${MANIFEST_FILENAME})
+ FILE(READ ${MANIFEST_FILENAME} content)
+ STRING(LENGTH "${content}" content_length)
+ IF (content_length EQUAL 0)
+ MESSAGE(STATUS "Excluding empty component ${comp}")
+ SET(INCLUDE_THIS_COMPONENT 0)
+ ENDIF()
+ ENDIF()
+ IF(NOT INCLUDE_THIS_COMPONENT)
+ LIST(REMOVE_ITEM CPACK_COMPONENTS_ALL "${comp}")
+ ELSE()
+ SET(DIRS ${DIRS} testinstall/${comp})
+ ENDIF()
+ENDFOREACH()
+
+SET(WIX_FEATURES)
+FOREACH(comp ${CPACK_COMPONENTS_ALL})
+ STRING(TOUPPER "${comp}" comp_upper)
+ IF(NOT CPACK_COMPONENT_${comp_upper}_GROUP)
+ SET(WIX_FEATURE_${comp_upper}_COMPONENTS "${comp}")
+ SET(CPACK_COMPONENT_${comp_upper}_HIDDEN 1)
+ SET(CPACK_COMPONENT_GROUP_${comp_upper}_DISPLAY_NAME
+ ${CPACK_COMPONENT_${comp_upper}_DISPLAY_NAME})
+ SET(CPACK_COMPONENT_GROUP_${comp_upper}_DESCRIPTION
+ ${CPACK_COMPONENT_${comp_upper}_DESCRIPTION})
+ SET(CPACK_COMPONENT_GROUP_${comp_upper}_WIX_LEVEL
+ ${CPACK_COMPONENT_${comp_upper}_WIX_LEVEL})
+ SET(WIX_FEATURES ${WIX_FEATURES} WIX_FEATURE_${comp_upper})
+ ELSE()
+ SET(FEATURE_NAME WIX_FEATURE_${CPACK_COMPONENT_${comp_upper}_GROUP})
+ SET(WIX_FEATURES ${WIX_FEATURES} ${FEATURE_NAME})
+ LIST(APPEND ${FEATURE_NAME}_COMPONENTS ${comp})
+ ENDIF()
+ENDFOREACH()
+
+IF(WIX_FEATURES)
+ LIST(REMOVE_DUPLICATES WIX_FEATURES)
+ENDIF()
+
+SET(CPACK_WIX_FEATURES)
+
+FOREACH(f ${WIX_FEATURES})
+ STRING(TOUPPER "${f}" f_upper)
+ STRING(REPLACE "WIX_FEATURE_" "" f_upper ${f_upper})
+ IF (CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
+ SET(TITLE ${CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME})
+ ELSE()
+ SET(TITLE CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
+ ENDIF()
+
+ IF (CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
+ SET(DESCRIPTION ${CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION})
+ ELSE()
+ SET(DESCRIPTION CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
+ ENDIF()
+ IF(CPACK_COMPONENT_${f_upper}_WIX_LEVEL)
+ SET(Level ${CPACK_COMPONENT_${f_upper}_WIX_LEVEL})
+ ELSE()
+ SET(Level 1)
+ ENDIF()
+ IF(CPACK_COMPONENT_GROUP_${f_upper}_HIDDEN)
+ SET(DISPLAY "Display='hidden'")
+ SET(TITLE ${f_upper})
+ SET(DESCRIPTION ${f_upper})
+ ELSE()
+ SET(DISPLAY)
+ IF(CPACK_COMPONENT_GROUP_${f_upper}_EXPANDED)
+ SET(DISPLAY "Display='expand'")
+ ENDIF()
+ IF (CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
+ SET(TITLE ${CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME})
+ ELSE()
+ SET(TITLE CPACK_COMPONENT_GROUP_${f_upper}_DISPLAY_NAME)
+ ENDIF()
+ IF (CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
+ SET(DESCRIPTION ${CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION})
+ ELSE()
+ SET(DESCRIPTION CPACK_COMPONENT_GROUP_${f_upper}_DESCRIPTION)
+ ENDIF()
+ ENDIF()
+
+ SET(CPACK_WIX_FEATURES
+ "${CPACK_WIX_FEATURES}
+ <Feature Id='${f_upper}'
+ Title='${TITLE}'
+ Description='${DESCRIPTION}'
+ ConfigurableDirectory='INSTALLDIR'
+ AllowAdvertise='no'
+ Level='${Level}' ${DISPLAY} >"
+ )
+ FOREACH(c ${${f}_COMPONENTS})
+ STRING(TOUPPER "${c}" c_upper)
+ IF (CPACK_COMPONENT_${c_upper}_DISPLAY_NAME)
+ SET(TITLE ${CPACK_COMPONENT_${c_upper}_DISPLAY_NAME})
+ ELSE()
+ SET(TITLE CPACK_COMPONENT_${c_upper}_DISPLAY_NAME)
+ ENDIF()
+
+ IF (CPACK_COMPONENT_${c_upper}_DESCRIPTION)
+ SET(DESCRIPTION ${CPACK_COMPONENT_${c_upper}_DESCRIPTION})
+ ELSE()
+ SET(DESCRIPTION CPACK_COMPONENT_${c_upper}_DESCRIPTION)
+ ENDIF()
+ IF(CPACK_COMPONENT_${c_upper}_WIX_LEVEL)
+ SET(Level ${CPACK_COMPONENT_${c_upper}_WIX_LEVEL})
+ ELSE()
+ SET(Level 1)
+ ENDIF()
+ IF(CPACK_COMPONENT_${c_upper}_HIDDEN)
+ SET(CPACK_WIX_FEATURES
+ "${CPACK_WIX_FEATURES}
+ <ComponentGroupRef Id='componentgroup.${c}'/>")
+ ELSE()
+ SET(CPACK_WIX_FEATURES
+ "${CPACK_WIX_FEATURES}
+ <Feature Id='${c}'
+ Title='${TITLE}'
+ Description='${DESCRIPTION}'
+ ConfigurableDirectory='INSTALLDIR'
+ AllowAdvertise='no'
+ Level='${Level}'>
+ <ComponentGroupRef Id='componentgroup.${c}'/>
+ </Feature>")
+ ENDIF()
+
+ ENDFOREACH()
+ IF(${f}_EXTRA_FEATURES)
+ FOREACH(extra_feature ${${f}_EXTRA_FEATURES})
+ SET(CPACK_WIX_FEATURES
+ "${CPACK_WIX_FEATURES}
+ <FeatureRef Id='${extra_feature}' />
+ ")
+ ENDFOREACH()
+ ENDIF()
+ SET(CPACK_WIX_FEATURES
+ "${CPACK_WIX_FEATURES}
+ </Feature>
+ ")
+ENDFOREACH()
+
+
+
+MACRO(GENERATE_GUID VarName)
+ EXECUTE_PROCESS(COMMAND uuidgen -c
+ OUTPUT_VARIABLE ${VarName}
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ENDMACRO()
+
+MACRO(MAKE_WIX_IDENTIFIER str varname)
+ STRING(REPLACE "/" "." ${varname} "${str}")
+ STRING(REGEX REPLACE "[^a-zA-Z_0-9.]" "_" ${varname} "${${varname}}")
+ STRING(LENGTH "${${varname}}" len)
+ # Identifier should be smaller than 72 character
+ # We have to cut down the length to 70 chars, since we add 2 char prefix
+ # pretty often
+ IF(len GREATER 70)
+ MATH(EXPR diff "${len}-67")
+ STRING(SUBSTRING "${${varname}}" ${diff} 67 shortstr)
+ SET(${varname} "___${shortstr}")
+ ENDIF()
+ENDMACRO()
+
+
+
+FUNCTION(TRAVERSE_FILES dir topdir file file_comp dir_root)
+ FILE(GLOB all_files ${dir}/*)
+ IF(NOT all_files)
+ RETURN()
+ ENDIF()
+ FILE(RELATIVE_PATH dir_rel ${topdir} ${dir})
+ IF(dir_rel)
+ MAKE_DIRECTORY(${dir_root}/${dir_rel})
+ MAKE_WIX_IDENTIFIER("${dir_rel}" id)
+ SET(DirectoryRefId "D.${id}")
+ ELSE()
+ SET(DirectoryRefId "INSTALLDIR")
+ ENDIF()
+ FILE(APPEND ${file} "<DirectoryRef Id='${DirectoryRefId}'>\n")
+
+ SET(NONEXEFILES)
+ FOREACH(f ${all_files})
+ IF(NOT IS_DIRECTORY ${f})
+ FILE(RELATIVE_PATH rel ${topdir} ${f})
+ MAKE_WIX_IDENTIFIER("${rel}" id)
+ FILE(TO_NATIVE_PATH ${f} f_native)
+ GET_FILENAME_COMPONENT(f_ext "${f}" EXT)
+ GET_FILENAME_COMPONENT(name "${f}" NAME)
+
+ IF(name STREQUAL ".empty")
+ # Create an empty directory
+ GENERATE_GUID(guid)
+ FILE(APPEND ${file} " <Component Id='C.${id}' Guid='${guid}' ${Win64}> <CreateFolder/> </Component>\n")
+ FILE(APPEND ${file_comp} "<ComponentRef Id='C.${id}'/>\n")
+ ELSEIF(NOT ${file}.COMPONENT_EXCLUDE)
+ FILE(APPEND ${file} " <Component Id='C.${id}' Guid='*' ${Win64} >\n")
+ IF(${id}.COMPONENT_CONDITION)
+ FILE(APPEND ${file} " <Condition>${${id}.COMPONENT_CONDITION}</Condition>\n")
+ ENDIF()
+ FILE(APPEND ${file} " <File Id='F.${id}' KeyPath='yes' Source='${f_native}'")
+ IF(${id}.FILE_EXTRA)
+ FILE(APPEND ${file} ">\n${${id}.FILE_EXTRA}</File>")
+ ELSE()
+ FILE(APPEND ${file} "/>\n")
+ ENDIF()
+ FILE(APPEND ${file} " </Component>\n")
+ FILE(APPEND ${file_comp} " <ComponentRef Id='C.${id}'/>\n")
+ ENDIF()
+ ENDIF()
+ ENDFOREACH()
+ FILE(APPEND ${file} "</DirectoryRef>\n")
+ IF(NONEXEFILES)
+ GENERATE_GUID(guid)
+ SET(ComponentId "C._files_${COMP_NAME}.${DirectoryRefId}")
+ MAKE_WIX_IDENTIFIER("${ComponentId}" ComponentId)
+ FILE(APPEND ${file}
+ "<DirectoryRef Id='${DirectoryRefId}'>\n<Component Guid='${guid}'
+ Id='${ComponentId}' ${Win64}>${NONEXEFILES}\n</Component></DirectoryRef>\n")
+ FILE(APPEND ${file_comp} " <ComponentRef Id='${ComponentId}'/>\n")
+ ENDIF()
+ FOREACH(f ${all_files})
+ IF(IS_DIRECTORY ${f})
+ TRAVERSE_FILES(${f} ${topdir} ${file} ${file_comp} ${dir_root})
+ ENDIF()
+ ENDFOREACH()
+ENDFUNCTION()
+
+FUNCTION(TRAVERSE_DIRECTORIES dir topdir file prefix)
+ FILE(RELATIVE_PATH rel ${topdir} ${dir})
+ IF(rel)
+ IF (IS_DIRECTORY "${f}")
+ MAKE_WIX_IDENTIFIER("${rel}" id)
+ GET_FILENAME_COMPONENT(name ${dir} NAME)
+ FILE(APPEND ${file} "${prefix}<Directory Id='D.${id}' Name='${name}'>\n")
+ ENDIF()
+ ENDIF()
+ FILE(GLOB all_files ${dir}/*)
+ FOREACH(f ${all_files})
+ IF(IS_DIRECTORY ${f})
+ TRAVERSE_DIRECTORIES(${f} ${topdir} ${file} "${prefix} ")
+ ENDIF()
+ ENDFOREACH()
+ IF(rel)
+ IF(IS_DIRECTORY "${f}")
+ FILE(APPEND ${file} "${prefix}</Directory>\n")
+ ENDIF()
+ ENDIF()
+ENDFUNCTION()
+
+SET(CPACK_WIX_COMPONENTS)
+SET(CPACK_WIX_COMPONENT_GROUPS)
+GET_FILENAME_COMPONENT(abs . ABSOLUTE)
+FOREACH(d ${DIRS})
+ GET_FILENAME_COMPONENT(d ${d} ABSOLUTE)
+ GET_FILENAME_COMPONENT(d_name ${d} NAME)
+ FILE(WRITE ${abs}/${d_name}_component_group.wxs
+ "<ComponentGroup Id='componentgroup.${d_name}'>")
+ SET(COMP_NAME ${d_name})
+ TRAVERSE_FILES(${d} ${d} ${abs}/${d_name}.wxs
+ ${abs}/${d_name}_component_group.wxs "${abs}/dirs")
+ FILE(APPEND ${abs}/${d_name}_component_group.wxs "</ComponentGroup>")
+ IF(EXISTS ${d_name}.wxs)
+ FILE(READ ${d_name}.wxs WIX_TMP)
+ SET(CPACK_WIX_COMPONENTS "${CPACK_WIX_COMPONENTS}\n${WIX_TMP}")
+ FILE(REMOVE ${d_name}.wxs)
+ ENDIF()
+
+ FILE(READ ${d_name}_component_group.wxs WIX_TMP)
+
+ SET(CPACK_WIX_COMPONENT_GROUPS "${CPACK_WIX_COMPONENT_GROUPS}\n${WIX_TMP}")
+ FILE(REMOVE ${d_name}_component_group.wxs)
+ENDFOREACH()
+
+FILE(WRITE directories.wxs "<DirectoryRef Id='INSTALLDIR'>\n")
+TRAVERSE_DIRECTORIES(${abs}/dirs ${abs}/dirs directories.wxs "")
+FILE(APPEND directories.wxs "</DirectoryRef>\n")
+
+FILE(READ directories.wxs CPACK_WIX_DIRECTORIES)
+FILE(REMOVE directories.wxs)
+
+
+FOREACH(src ${CPACK_WIX_INCLUDE})
+SET(CPACK_WIX_INCLUDES
+"${CPACK_WIX_INCLUDES}
+ <?include ${src}?>"
+)
+ENDFOREACH()
+
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_server.wxs.in
+ ${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/extra.wxs.in
+ ${CMAKE_CURRENT_BINARY_DIR}/extra.wxs)
+
+SET(EXTRA_CANDLE_ARGS "$ENV{EXTRA_CANDLE_ARGS}")
+
+SET(EXTRA_LIGHT_ARGS -cc . -reusecab)
+IF("$ENV{EXTRA_LIGHT_ARGS}")
+ SET(EXTRA_LIGHT_ARGS "$ENV{EXTRA_LIGHT_ARGS}")
+ENDIF()
+
+FILE(REMOVE mysql_server.wixobj extra.wixobj)
+EXECUTE_PROCESS(
+ COMMAND ${CANDLE_EXECUTABLE}
+ ${EXTRA_WIX_PREPROCESSOR_FLAGS}
+ ${CANDLE_ARCH}
+ -ext WixUtilExtension
+ -ext WixFirewallExtension
+ mysql_server.wxs
+ ${EXTRA_CANDLE_ARGS}
+)
+
+EXECUTE_PROCESS(
+ COMMAND ${CANDLE_EXECUTABLE} ${CANDLE_ARCH}
+ ${EXTRA_WIX_PREPROCESSOR_FLAGS}
+ -ext WixUtilExtension
+ -ext WixFirewallExtension
+ ${CMAKE_CURRENT_BINARY_DIR}/extra.wxs
+ ${EXTRA_CANDLE_ARGS}
+)
+
+EXECUTE_PROCESS(
+ COMMAND ${LIGHT_EXECUTABLE} -ext WixUIExtension -ext WixUtilExtension
+ -ext WixFirewallExtension
+ mysql_server.wixobj extra.wixobj -out ${CPACK_PACKAGE_FILE_NAME}.msi
+ ${EXTRA_LIGHT_ARGS}
+)
+
+IF(SIGNCODE)
+ EXECUTE_PROCESS(
+ COMMAND ${SIGNTOOL_EXECUTABLE} sign ${SIGNTOOL_PARAMETERS}
+ ${CPACK_PACKAGE_FILE_NAME}.msi
+)
+ENDIF()
+CONFIGURE_FILE(${CPACK_PACKAGE_FILE_NAME}.msi
+ ${CMAKE_BINARY_DIR}/${CPACK_PACKAGE_FILE_NAME}.msi
+ COPYONLY)
+
+# Workaround for CMake bug#11452
+# Switch monolithic install on again
+EXECUTE_PROCESS(
+ COMMAND ${CMAKE_COMMAND} -DCPACK_MONOLITHIC_INSTALL=1 ${CMAKE_BINARY_DIR}
+ OUTPUT_QUIET
+)
+
diff --git a/win/packaging/custom_ui.wxs b/win/packaging/custom_ui.wxs
new file mode 100644
index 00000000000..8a87fb4d246
--- /dev/null
+++ b/win/packaging/custom_ui.wxs
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+ <Fragment>
+ <Property Id="PortTemplate" Value="####" />
+ <Property Id="PORT" Value="3306"></Property>
+ <Property Id="MSIRESTARTMANAGERCONTROL" Value="Disable"/>
+ <Property Id="CREATEDBINSTANCE"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Property>
+ <UI>
+ <Dialog Id="DatabaseCreationDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
+ <Control Id="ServiceNameLabel" Type="Text" X="20" Y="73" Width="70" Height="15" TabSkip="no" Text="Service Name:" />
+ <Control Id="ServiceName" Type="Edit" X="90" Y="73" Width="120" Height="15" Property="SERVICENAME" Text="{20}" />
+
+ <Control Id="RootPasswordLabel" Type="Text" X="20" Y="90" Width="120" Height="15" TabSkip="no" Text="&amp;Root password:" />
+ <Control Id="RootPassword" Type="Edit" X="20" Y="105" Width="120" Height="18" Property="ROOT_PASSWORD" Password="yes" Text="{20}" />
+
+ <Control Id="RootPasswordConfirmLabel" Type="Text" X="150" Y="90" Width="150" Height="15" TabSkip="no" Text="&amp;Confirm Root password:" />
+ <Control Id="RootPasswordConfirm" Type="Edit" X="150" Y="105" Width="120" Height="18" Property="ROOT_PASSWORD_CONFIRM" Password="yes" Text="{20}" />
+ <Control Id="BannerLine0" Type="Line" X="0" Y="128" Width="370" Height="0" />
+
+ <Control Id="PortLabel" Type="Text" X="20" Y="137" Width="40" Height="15" TabSkip="no" Text="TCP port:" />
+
+ <Control Id="Port" Type="MaskedEdit" X="60" Y="136" Width="30" Height="15" Property="PORT" Text="[PortTemplate]"/>
+ <!--<Control Id="FirewallExceptionCheckBox" Type="CheckBox" X="150" Y="136" Height="15" Property="FIREWALL_EXCEPTION" Width="200" CheckBoxValue="1"
+ Text="Create Firewall exception for this port"/>-->
+
+ <Control Id="BannerLine2" Type="Line" X="0" Y="155" Width="370" Height="0" />
+
+ <Control Id="FolderLabel" Type="Text" X="20" Y="181" Width="100" Height="15" TabSkip="no" Text="Database location:" />
+ <Control Id="Folder" Type="PathEdit" X="20" Y="204" Width="200" Height="18" Property="DATABASELOCATION" Indirect="no" />
+
+ <!-- Navigation buttons-->
+ <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
+ <Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
+ </Control>
+ <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
+ <!--
+ <Publish Event="ValidateProductID" Value="0">1</Publish>
+ <Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg">CostingComplete = 1</Publish>
+ -->
+ <!--<Publish Event="NewDialog" Value="SetupTypeDlg">ProductID</Publish>-->
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
+ <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>Create default [ProductName] instance</Text>
+ </Control>
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+ <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>{\WixUI_Font_Title}Default instance properties</Text>
+ </Control>
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
+ </Dialog>
+
+ <Dialog Id="ConfirmDataCleanupDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
+ <Control Id="ServiceRemoveText" Type="Text" X="20" Y="73" Width="300" Height="15" TabSkip="no">
+ <Text>Service '[SERVICENAME]' will be removed</Text>
+ </Control>
+ <Control Id="CleanupDataCheckBox" Type="CheckBox" X="20" Y="100" Height="15" Property="CLEANUP_DATA" Width="15" CheckBoxValue="0"/>
+ <Control Id="RemoveDataText" Type="Text" X="37" Y="101" Width="300" Height="200" TabSkip="no">
+ <Text>Remove default database directory '[DATABASELOCATION]'</Text>
+ </Control>
+
+ <!-- Navigation buttons-->
+ <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
+ <Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
+ </Control>
+ <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
+ <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
+ <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>Remove default [ProductName] database</Text>
+ </Control>
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+ <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>{\WixUI_Font_Title}Default instance properties</Text>
+ </Control>
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
+ </Dialog>
+ </UI>
+ <UI Id="MyWixUI_Mondo">
+ <UIRef Id="WixUI_FeatureTree" />
+ <UIRef Id="WixUI_ErrorProgressText" />
+ <DialogRef Id="DatabaseCreationDlg" />
+ <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="DatabaseCreationDlg" Order="999"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
+ <Publish Dialog="DatabaseCreationDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg" Order="3">1</Publish>
+ <Publish Dialog="DatabaseCreationDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="3">1</Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="DatabaseCreationDlg" Order="3" ><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="3" ><![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]></Publish>
+ <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="999"><![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]></Publish>
+ <Publish Dialog="ConfirmDataCleanupDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg">WixUI_InstallMode = "Change"</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="999">!DBInstance=3</Publish>
+ <Publish Dialog="ConfirmDataCleanupDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg">WixUI_InstallMode = "Remove"</Publish>
+ </UI>
+
+ <DirectoryRef Id='TARGETDIR'>
+ <Directory Id="CommonAppDataFolder">
+ <Directory Id="DatabasesRoot" Name="MariaDB">
+ <Directory Id="DATABASELOCATION" Name="MariaDB Server 5.1">
+ </Directory>
+ </Directory>
+ </Directory>
+ </DirectoryRef>
+
+ <Feature Id='DBInstance'
+ Title='Database instance'
+ Description='Install database instance'
+ ConfigurableDirectory='DATABASELOCATION'
+ AllowAdvertise='no'
+ Level='1'>
+ <Component Id="C.datadir" Guid="*" Directory="DATABASELOCATION">
+ <RegistryValue Root='HKLM'
+ Key='SOFTWARE\[Manufacturer]\[ProductName]'
+ Name='DatabaseLocation' Value='[DATABASELOCATION]' Type='string' KeyPath='yes'/>
+ <CreateFolder />
+ </Component>
+ <Component Id="C.service" Guid="*" Directory="DATABASELOCATION">
+ <Condition>SERVICENAME</Condition>
+ <RegistryValue Root='HKLM'
+ Key='SOFTWARE\[Manufacturer]\[ProductName]'
+ Name='ServiceName' Value='[SERVICENAME]' Type='string' KeyPath='yes'/>
+ <ServiceControl Id='DBInstanceServiceStop' Name='[SERVICENAME]' Stop='uninstall' Wait='yes'></ServiceControl>
+ <ServiceControl Id='DBInstanceServiceStart' Name='[SERVICENAME]' Start='install' Wait='no'></ServiceControl>
+ <ServiceControl Id='DBInstanceServiceRemove' Name='[SERVICENAME]' Remove='uninstall' Wait='yes'></ServiceControl>
+ </Component>
+ </Feature>
+
+ <CustomAction Id="QtExecDeferredExampleWithProperty_Cmd" Property="QtExecDeferredExampleWithProperty"
+ Value="&quot;[#F.bin.mysql_install_db.exe]&quot; &quot;--service=[SERVICENAME]&quot; &quot;--password=[ROOT_PASSWORD]&quot; &quot;--datadir=[DATABASELOCATION]&quot;"
+ Execute="immediate"/>
+ <CustomAction Id="QtExecDeferredExampleWithProperty" BinaryKey="WixCA" DllEntry="CAQuietExec"
+ Execute="deferred" Return="check" Impersonate="no"/>
+
+ <UI>
+ <ProgressText Action="QtExecDeferredExampleWithProperty">Running mysql_install_db.exe</ProgressText>
+ </UI>
+
+ <!-- Use Wix toolset "remember property" pattern to store properties between major upgrades etc -->
+ <InstallExecuteSequence>
+ <Custom Action="QtExecDeferredExampleWithProperty_Cmd" After="CostFinalize"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Custom>
+ <Custom Action="QtExecDeferredExampleWithProperty" After="InstallFiles"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Custom>
+ </InstallExecuteSequence>
+
+ <Property Id='SERVICENAME'>
+ <RegistrySearch Id='ServiceNameProperty' Root='HKLM'
+ Key='SOFTWARE\[Manufacturer]\[ProductName]'
+ Name='ServiceName' Type='raw' />
+ </Property>
+ <SetProperty After='AppSearch' Id="SERVICENAME" Value="MariaDB_51"><![CDATA[NOT SERVICENAME]]></SetProperty>
+ <Property Id="DATABASELOCATION">
+ <RegistrySearch Id='DatabaseLocationProperty' Root='HKLM'
+ Key='SOFTWARE\[Manufacturer]\[ProductName]'
+ Name='´DatabaseLocation' Type='raw' />
+ </Property>
+ <SetProperty After='AppSearch' Id="DATABASELOCATION" Value="[CommonAppDataFolder]\MariaDB\[ProductName]"><![CDATA[NOT DATABASELOCATION]]></SetProperty>
+ <CustomAction Id='SaveCmdLineValue_SERVICENAME' Property='CMDLINE_SERVICENAME'
+ Value='[SERVICENAME]' Execute='firstSequence' />
+ <CustomAction Id='SetFromCmdLineValue_SERVICENAME' Property='SERVICENAME' Value='[CMDLINE_SERVICENAME]' Execute='firstSequence' />
+ <CustomAction Id='SaveCmdLineValue_DATABASELOCATION' Property='CMDLINE_DATABASELOCATION'
+ Value='[DATABASELOCATION]' Execute='firstSequence' />
+ <CustomAction Id='SetFromCmdLineValue_DATABASELOCATION' Property='DATABASELOCATION' Value='[CMDLINE_DATABASELOCATION]' Execute='firstSequence' />
+
+ <InstallUISequence>
+ <Custom Action='SaveCmdLineValue_SERVICENAME' Before='AppSearch' />
+ <Custom Action='SetFromCmdLineValue_SERVICENAME' After='AppSearch'>CMDLINE_SERVICENAME</Custom>
+ <Custom Action='SaveCmdLineValue_DATABASELOCATION' Before='AppSearch' />
+ <Custom Action='SetFromCmdLineValue_DATABASELOCATION' After='AppSearch'>CMDLINE_DATABASELOCATION</Custom>
+ </InstallUISequence>
+ <InstallExecuteSequence>
+ <Custom Action='SaveCmdLineValue_SERVICENAME' Before='AppSearch' />
+ <Custom Action='SetFromCmdLineValue_SERVICENAME' After='AppSearch'>CMDLINE_SERVICENAME</Custom>
+ <Custom Action='SaveCmdLineValue_DATABASELOCATION' Before='AppSearch' />
+ <Custom Action='SetFromCmdLineValue_DATABASELOCATION' After='AppSearch'>CMDLINE_DATABASELOCATION</Custom>
+ </InstallExecuteSequence>
+ </Fragment>
+</Wix> \ No newline at end of file
diff --git a/win/packaging/extra.wxs.in b/win/packaging/extra.wxs.in
new file mode 100644
index 00000000000..2c01b024544
--- /dev/null
+++ b/win/packaging/extra.wxs.in
@@ -0,0 +1,888 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
+ <Fragment>
+ <!--
+ Check, if upgrade wizard was built
+ It currently requires MFC, which is not in SDK
+ neither in express edítions of VS.
+ -->
+ <?ifndef HaveUpgradeWizard ?>
+ <?define HaveUpgradeWizard="1"?>
+ <?endif?>
+
+ <!-- If Innodb is compiled in, enable "optimize for transactions" checkbox -->
+ <?ifndef HaveInnodb ?>
+ <?define HaveInnodb="0"?>
+ <?endif?>
+
+ <Property Id="PortTemplate" Value="#####" />
+ <?if $(var.HaveInnodb) = "1" ?>
+ <Property Id="BufferPoolSizeTemplate" Value="#######" />
+ <?endif?>
+ <!--
+ Installation parameters that can be passed via msiexec command line
+ For "booleans" (like skip networking), just providing any value means property set to "yes".
+ -->
+ <!-- instalation directory (default under program files)-->
+ <!--- (defined elsewhere) <Property Id="INSTALLDIR" Secure="yes" /> -->
+
+ <!-- Database data directory (default under INSTALLDIR\data) -->
+ <!--- (defined elsewhere) <Property Id="DATADIR" Secure="yes"/> -->
+
+ <!-- Service name of database instanced (default MySQL in GUI, nothing with command line) -->
+ <!-- (defined elsewhere) <Property Id="SERVICENAME" Secure="yes" /> -->
+
+ <!-- Root password -->
+ <Property Id="PASSWORD" Hidden="yes" Secure="yes" />
+ <Property Id="ESCAPEDPASSWORD" Hidden="yes" Secure="yes" />
+ <!-- Database port -->
+ <Property Id="PORT" Value="3306" Secure="yes"/>
+ <!-- Whether to allow remote access for root user -->
+ <Property Id="ALLOWREMOTEROOTACCESS" Secure="yes" />
+ <!-- Skip networking. This will switch configuration to use named pipe-->
+ <Property Id="SKIPNETWORKING" Secure="yes"/>
+ <!-- Whether to keep default (unauthenticated) user. Default is no-->
+ <Property Id="DEFAULTUSER" Secure="yes"/>
+ <!-- Whether to data on uninstall (default yes, after asking user consent) -->
+ <Property Id="CLEANUPDATA" Secure="yes" Value="1"/>
+ <!-- Force per machine installation -->
+ <Property Id="ALLUSERS" Secure="yes" Value="1"/>
+ <!-- Disable advertised shortcuts weirdness -->
+ <Property Id="DISABLEADVTSHORTCUTS" Secure="yes" Value="1"/>
+
+ <!-- Activate feedback plugin-->
+ <Property Id="FEEDBACK" Secure="yes"/>
+
+ <?if $(var.HaveInnodb) = "1" ?>
+ <!-- Quick configuration : set default storage engine to innodb, use strict sql_mode -->
+ <Property Id="STDCONFIG" Secure="yes" Value="1"/>
+ <?endif?>
+ <!-- Innodb Buffer pool size in MB-->
+ <Property Id="BUFFERPOOLSIZE" Secure="yes"/>
+
+
+ <CustomAction Id="LaunchUrl" BinaryKey="WixCA" DllEntry="WixShellExec" Execute="immediate" Return="check" Impersonate="yes" />
+
+
+ <!--
+ User interface dialogs
+ -->
+ <WixVariable Id='WixUIBannerBmp' Value='@CMAKE_CURRENT_SOURCE_DIR@\WixUIBannerBmp.jpg' />
+ <WixVariable Id='WixUIDialogBmp' Value='@CMAKE_CURRENT_SOURCE_DIR@\WixUIDialogBmp.jpg' />
+ <UI>
+
+ <!-- Dialog on uninstall of the database -->
+ <Dialog Id="ConfirmDataCleanupDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
+
+ <!--<Control Id="CleanupDataCheckBox" Type="CheckBox" X="20" Y="100" Height="30" Property="CLEANUPDATA" Width="300" CheckBoxValue="1"
+ Text="{\Font1}Remove default database directory &#xD;&#xA;'[DATADIR]'"/>
+ -->
+ <Control Id="RemoveDatadirButton" Type="PushButton" X="40" Y="65" Width="80" Height="18"
+ Text="Remove data">
+ <Publish Property="CLEANUPDATA" Value="1">1</Publish>
+ <Publish Event="NewDialog" Value="VerifyReadyDlg">WixUI_InstallMode</Publish>
+ <Publish Event="EndDialog" Value="Return">NOT WixUI_InstallMode</Publish>
+
+ </Control>
+ <Control Id="RemoveDatadirText" Type="Text" X="60" Y="85" Width="280" Height="20">
+ <Text>Remove default database directory [DATADIR]. Ensures proper cleanup on uninstall.</Text>
+ </Control>
+
+ <Control Id="KeepDatadirButton" Type="PushButton" X="40" Y="118" Width="80" Height="18"
+ Text="Keep data">
+ <Publish Property="CLEANUPDATA">1</Publish>
+ <Publish Event="NewDialog" Value="VerifyReadyDlg">WixUI_InstallMode</Publish>
+ <Publish Event="EndDialog" Value="Return">NOT WixUI_InstallMode</Publish>
+ </Control>
+ <Control Id="KeepDataDirText" Type="Text" X="60" Y="138" Width="280" Height="70" >
+ <Text>Do not remove [DATADIR]. Choose this option if you intend to use data in the future</Text>
+ </Control>
+
+
+ <!-- Navigation buttons-->
+ <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
+ <Publish Event="NewDialog" Value="CustomizeDlg">WixUI_InstallMode="Change"</Publish>
+ <Condition Action="disable">NOT WixUI_InstallMode</Condition>
+ </Control>
+ <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Disabled="yes" Text="&amp;Next">
+ <Publish Event="NewDialog" Value="VerifyReadyDlg">WixUI_InstallMode</Publish>
+ <Publish Event="EndDialog" Value="Return">NOT WixUI_InstallMode</Publish>
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
+ <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>Remove default [ProductName] database</Text>
+ </Control>
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+ <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>{\WixUI_Font_Title}Default instance properties</Text>
+ </Control>
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
+ </Dialog>
+
+ <!-- Dialog new or upgrade instance -->
+
+ <Property Id="CreateOrUpgradeChoice" Value="Create"/>
+
+ <Dialog Id="NewOrUpgradeInstanceDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
+ <Control Id="Text" Type="Text" X="40" Y="65" Width="270" Height="30">
+ <Text>Setup found existing database instances that can be upgraded to [ProductName].You can create a new instance and/or upgrade existing one.
+ </Text>
+ </Control>
+
+ <Control Id="CreateOrUpgradeButton"
+ Type="RadioButtonGroup" X="40" Y="100" Width="300" Height="70"
+ Property="CreateOrUpgradeChoice" Text="Specify what to do">
+ <RadioButtonGroup Property="CreateOrUpgradeChoice">
+ <RadioButton Value="Create" X="0" Y="0" Width="300" Height="25"
+ Text="{\Font1}Create new database instance."/>
+ <RadioButton Value="Upgrade" X="0" Y="30" Width="300" Height="25"
+ Text="{\Font1}Do not create a new database. Optionally upgrade existing instances." />
+ </RadioButtonGroup>
+ </Control>
+
+ <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
+ <Publish Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
+ </Control>
+ <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="&amp;Next">
+ <Publish Event="Remove" Value="DBInstance">CreateOrUpgradeChoice = "Upgrade" </Publish>
+ <Publish Event="AddLocal" Value="DBInstance">CreateOrUpgradeChoice = "Create"</Publish>
+ <Publish Event="NewDialog" Value="CustomizeDlg">1</Publish>
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
+ <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>Create or upgrade database instance</Text>
+ </Control>
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+ <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>{\WixUI_Font_Title}[ProductName] setup</Text>
+ </Control>
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
+ </Dialog>
+
+ <!-- Feedback dialog -->
+ <Dialog Id="Feedback" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
+
+ <Control Id="CheckBoxFeedback" Type="CheckBox" X="8" Y="61" Width="360" Height="12" Property="FEEDBACK" CheckBoxValue="1" TabSkip="no">
+ <Text>{\Font1}Enable the Feedback plugin and submit anonymous usage information</Text>
+ </Control>
+
+ <Control Id="Text" Type="Text" X="23" Y="82" Width="290" Height="55">
+ <Text>Monty Program has created a Feedback plugin for MariaDB which, if enabled, collects basic anonymous statistical information. This information is used by the developers to improve MariaDB. Enabling this plugin is an easy way to help with MariaDB development. Collected statistics, and more information on the plugin, can be viewed at http://mariadb.org/feedback_plugin </Text>
+ </Control>
+
+ <Control Id="MoreInfo" Type="PushButton" X="23" Y="140" Width="56" Height="17" Text="More Info" ToolTip="http://mariadb.org/feedback_plugin" >
+ <Publish Property="WixShellExecTarget" Value="http://mariadb.org/feedback_plugin" Order="1">1</Publish>
+ <Publish Event="DoAction" Value="LaunchUrl" Order="2">1</Publish>
+ </Control>
+
+
+ <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
+ <Publish Event="NewDialog" Value="ServicePortDlg">1</Publish>
+ </Control>
+ <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Text="&amp;Next">
+ <Publish Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
+ <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>Submit usage information</Text>
+ </Control>
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+ <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>{\WixUI_Font_Title}[ProductName] setup</Text>
+ </Control>
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
+ </Dialog>
+
+ <!-- Error popup dialog -->
+ <Dialog Id="WarningDlg" Width="320" Height="85" Title="[ProductName] Setup" NoMinimize="yes">
+ <Control Id="Icon" Type="Icon" X="15" Y="15" Width="24" Height="24"
+ ToolTip="Information icon" FixedSize="yes" IconSize="32" Text="WixUI_Ico_Info" />
+ <Control Id="Ok" Type="PushButton" X="132" Y="57" Width="56" Height="17"
+ Default="yes" Cancel="yes" Text="OK">
+ <Publish Property="WarningText">1</Publish>
+ <Publish Event="EndDialog" Value="Return">1</Publish>
+ </Control>
+ <Control Id="Text" Type="Text" X="48" Y="15" Width="260" Height="30">
+ <Text>[WarningText]</Text>
+ </Control>
+ </Dialog>
+
+
+ <Property Id="ModifyRootPassword" Value="1"/>
+ <TextStyle Id="Font1" FaceName="Tahoma" Size="8" Red="0" Green="0" Blue="0" Bold="yes" />
+
+ <!-- Root password plus default user dialog -->
+ <Dialog Id="UserSettingsDlg" X="50" Y="50" Width="370" Height="270" Title="User settings">
+ <Control Id="EditRootPassword" Type="Edit" X="104" Y="82" Width="91" Height="15" Property="PASSWORD" Password="yes" TabSkip="no">
+ <Text>{100}</Text>
+ <Condition Action="enable">ModifyRootPassword</Condition>
+ <Condition Action="disable">NOT ModifyRootPassword</Condition>
+ </Control>
+ <Control Id="EditRootPasswordConfirm" Type="Edit" X="104" Y="103" Width="91" Height="15" Property="RootPasswordConfirm" Password="yes" TabSkip="no">
+ <Text>{100}</Text>
+ <Condition Action="enable">ModifyRootPassword</Condition>
+ <Condition Action="disable">NOT ModifyRootPassword</Condition>
+ </Control>
+
+ <Control Id="CheckBoxModifyRootPassword" Type="CheckBox" X="8" Y="62" Width="222" Height="18" Property="ModifyRootPassword" CheckBoxValue="1" TabSkip="no">
+ <Text>{\Font1}Modify root password</Text>
+ <Publish Property="PASSWORD" >NOT ModifyRootPassword</Publish>
+ <Publish Property="RootPasswordConfirm">NOT ModifyRootPassword</Publish>
+ <Publish Property="ALLOWREMOTEROOTACCESS">NOT ModifyRootPassword</Publish>
+ <Publish Property="ALLOWREMOTEROOTACCESS" Value="1">ModifyRootPassword</Publish>
+ </Control>
+
+ <Control Id="Text5" Type="Text" X="23" Y="82" Width="77" Height="14" TabSkip="yes">
+ <Text>New root password:</Text>
+ </Control>
+ <Control Id="Text6" Type="Text" X="201" Y="85" Width="100" Height="17" TabSkip="yes">
+ <Text>Enter new root password</Text>
+ </Control>
+ <Control Id="Text8" Type="Text" X="23" Y="105" Width="75" Height="17" TabSkip="yes">
+ <Text>Confirm:</Text>
+ </Control>
+
+ <Control Id="Text10" Type="Text" X="201" Y="104" Width="100" Height="17" TabSkip="yes">
+ <Text>Retype the password</Text>
+ </Control>
+ <Control Id="CheckBoxALLOWREMOTEROOTACCESS" Type="CheckBox" X="23" Y="122" Width="196" Height="18" Property="ALLOWREMOTEROOTACCESS"
+ CheckBoxValue="--allow-remote-root-access" TabSkip="no">
+ <Text>{\Font1}Enable root access from remote machines</Text>
+ <Condition Action="enable">ModifyRootPassword</Condition>
+ <Condition Action="disable">NOT ModifyRootPassword</Condition>
+ </Control>
+
+ <Control Id="CheckBoxCreateDefaultUser" Type="CheckBox" X="8" Y="154" Width="200" Height="18" Property="DEFAULTUSER"
+ CheckBoxValue="--default-user" TabSkip="no">
+ <Text>{\Font1}Create An Anonymous Account</Text>
+ </Control>
+ <Control Id="Text14" Type="Text" X="21" Y="174" Width="268" Height="16" TabSkip="yes">
+ <Text>This option will create an anonymous account on this server. </Text>
+ </Control>
+ <Control Id="Text13" Type="Text" X="21" Y="190" Width="254" Height="24" TabSkip="yes">
+ <Text>Please note: this setting can lead to insecure systems.</Text>
+ </Control>
+
+ <!-- Navigation buttons-->
+ <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
+ <Publish Event="NewDialog" Value="CustomizeDlg">1</Publish>
+ </Control>
+ <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="&amp;Next">
+ <Publish Property="WarningText" Value="Passwords do not match."><![CDATA[PASSWORD <> RootPasswordConfirm]]></Publish>
+ <Publish Event="SpawnDialog" Value="WarningDlg"><![CDATA[WarningText <>""]]></Publish>
+ <Publish Property="SERVICENAME" Value="MySQL">NOT SERVICENAME AND NOT WarningText</Publish>
+ <Publish Event="NewDialog" Value="ServicePortDlg"><![CDATA[WarningText=""]]></Publish>
+ <Condition Action="enable"><![CDATA[NOT ModifyRootPassword OR PASSWORD]]> </Condition>
+ <Condition Action="disable"><![CDATA[ModifyRootPassword AND (NOT PASSWORD)]]> </Condition>
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
+ <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text> [ProductName] database configuration</Text>
+ </Control>
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+ <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>{\WixUI_Font_Title}Default instance properties</Text>
+ </Control>
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />
+ </Dialog>
+
+ <Property Id="InstallService" Value="1"/>
+ <Property Id="EnableNetworking" Value="1"/>
+
+ <!-- Service and port configuration -->
+ <Dialog Id="ServicePortDlg" Width="370" Height="270" Title="Database settings">
+ <Control Id="InstallAsService" Type="CheckBox" X="9" Y="61" Width="222" Height="19" Property="InstallService" CheckBoxValue="1" TabSkip="no">
+ <Text>{\Font1}Install as service</Text>
+ </Control>
+ <Control Id="EditServiceName" Type="Edit" X="104" Y="82" Width="91" Height="15" Property="SERVICENAME" TabSkip="no">
+ <Text>{20}</Text>
+ <Condition Action="enable">InstallService</Condition>
+ <Condition Action="disable">Not InstallService</Condition>
+ </Control>
+ <Control Id="Text5" Type="Text" X="25" Y="82" Width="77" Height="14" TabSkip="yes">
+ <Text>Service Name:</Text>
+ </Control>
+ <Control Id="CheckBoxEnableNetworking" Type="CheckBox" Height="18" Width="102" X="9" Y="117" Property="EnableNetworking" CheckBoxValue="1">
+ <Text>{\Font1}Enable networking</Text>
+ <!--<Publish Property="PORT">NOT EnableNetworking</Publish>-->
+ <Publish Property="SKIPNETWORKING" Value="--skip-networking">NOT EnableNetworking</Publish>
+ <Publish Property="SKIPNETWORKING">EnableNetworking</Publish>
+ </Control>
+ <Control Id="LabelTCPPort" Type="Text" Height="17" Width="75" X="25" Y="142" Text="TCP port:" />
+ <Control Id="Port" Type="MaskedEdit" X="104" Y="140" Width="28" Height="15" Property="PORT" Sunken="yes" Text="[PortTemplate]">
+ <Condition Action="enable" >EnableNetworking</Condition>
+ <Condition Action="disable">Not EnableNetworking</Condition>
+ </Control>
+
+ <?if $(var.HaveInnodb) = "1" ?>
+ <Control Id="CheckBoxStandardConfig" Type="CheckBox" Height="18" Width="220" X="9" Y="171" Property="STDCONFIG" CheckBoxValue="1">
+ <Text>{\Font1}Optimize for transactions</Text>
+ </Control>
+
+ <Control Id="StandardConfigExplain" Type="Text" X="25" Y="190" Width="270" Height="14" TabSkip="yes">
+ <Text>(Uses transactional storage engine and "strict" SQL mode)</Text>
+ <Condition Action="enable" >STDCONFIG</Condition>
+ <Condition Action="disable">Not STDCONFIG</Condition>
+ </Control>
+ <Control Id="LabelInnodbBufferpool" Type="Text" Height="17" Width="77" X="25" Y="210" Text="Buffer pool size:" >
+ <Condition Action="enable" >STDCONFIG</Condition>
+ <Condition Action="disable">Not STDCONFIG</Condition>
+ </Control>
+ <Control Id="BPSize" Type="MaskedEdit" X="104" Y="208" Width="40" Height="15" Property="BUFFERPOOLSIZE" Sunken="yes" Text="[BufferPoolSizeTemplate]">
+ <Condition Action="enable" >STDCONFIG</Condition>
+ <Condition Action="disable">Not STDCONFIG</Condition>
+ </Control>
+ <Control Id="LabelMB" Type="Text" Height="17" Width="15" X="150" Y="210" Text="MB" >
+ <Condition Action="enable" >STDCONFIG</Condition>
+ <Condition Action="disable">Not STDCONFIG</Condition>
+ </Control>
+ <?endif?>
+
+ <!-- Navigation buttons-->
+ <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="&amp;Back">
+ <Publish Event="NewDialog" Value="UserSettingsDlg">1</Publish>
+ </Control>
+ <Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="no" Text="&amp;Next">
+ <Publish Property="SERVICENAME">NOT InstallService</Publish>
+ <Publish Property="WarningText" Value="Please enter valid port or uncheck 'Enable Networking' checkbox">
+ <![CDATA[EnableNetworking AND NOT PORT AND NOT WarningText]]>
+ </Publish>
+ <Publish Property="WarningText" Value="Please enter valid service name port or uncheck 'Install Service' checkbox">
+ <![CDATA[InstallService AND NOT SERVICENAME AND NOT WarningText]]>
+ </Publish>
+ <Publish Event="DoAction" Value="CheckDatabaseProperties">NOT WarningText</Publish>
+ <Publish Event="SpawnDialog" Value="WarningDlg">WarningText</Publish>
+ <Publish Event="NewDialog" Value="Feedback">Not WarningText</Publish>
+ </Control>
+ <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="no" Text="Cancel">
+ <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+ </Control>
+ <Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="WixUI_Bmp_Banner" />
+ <Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>[ProductName] database configuration</Text>
+ </Control>
+ <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="2" />
+ <Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes">
+ <Text>{\WixUI_Font_Title}Default instance properties</Text>
+ </Control>
+ <Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="2" />
+ </Dialog>
+ </UI>
+
+ <Property Id="CRLF" Value="&#xD;&#xA;" />
+ <CustomAction Id="CheckDataDirectoryEmpty" BinaryKey="wixca.dll" DllEntry="CheckDataDirectoryEmpty" Execute="immediate" Impersonate="yes"/>
+ <!-- What to do when navigation buttons are clicked -->
+ <UI Id="MyWixUI_Mondo">
+ <UIRef Id="WixUI_FeatureTree" />
+ <UIRef Id="WixUI_ErrorProgressText" />
+ <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="VerifyReadyDlg" Order="999">
+ OLDERVERSIONBEINGUPGRADED
+ </Publish>
+ <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="NewOrUpgradeInstanceDlg" Order="999">
+ NOT Installed AND UpgradableServiceFound
+ </Publish>
+
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="Feedback" Order="3" ><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg" Order="3"> <![CDATA[OLDERVERSIONBEINGUPGRADED <>""]]></Publish>
+ <Publish Dialog="VerifyReadyDlg" Control="Back" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="1" ><![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]></Publish>
+
+
+ <Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="NewOrUpgradeInstanceDlg" Order="999">
+ NOT Installed AND UpgradableServiceFound
+ </Publish>
+ <Publish Dialog="CustomizeDlg" Control="Next" Event="DoAction" Value="CheckDataDirectoryEmpty" Order="1"><![CDATA[&DBInstance=3 AND NOT !DBInstance=3]]></Publish>
+ <Publish Dialog="CustomizeDlg" Property="DATADIRNOTEMPTY" Control="Next" Order="1"><![CDATA[NOT(&DBInstance=3 AND NOT !DBInstance=3)]]></Publish>
+ <Publish Dialog="CustomizeDlg" Control="Next" Property="WarningText" Order="2"
+ Value="Selected data directory [DATADIR] is not empty. Either clean it, or choose another location for 'Database Instance' feature.">
+ DATADIRNOTEMPTY
+ </Publish>
+ <Publish Dialog="CustomizeDlg" Control="Next" Event="SpawnDialog" Value="WarningDlg" Order="3">WarningText</Publish>
+ <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="4">
+ <![CDATA[(&DBInstance=2) AND (!DBInstance=3)]]>
+ </Publish>
+ <Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="UserSettingsDlg" Order="5">
+ <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND NOT WarningText]]>
+ </Publish>
+
+ <Publish Dialog="ConfirmDataCleanupDlg" Control="Back" Event="NewDialog" Value="CustomizeDlg">WixUI_InstallMode = "Change"</Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="ConfirmDataCleanupDlg" Order="999">
+ !DBInstance=3 AND (CLEANUPDATA Or USECONFIRMDATACLEANUPDLG)
+ </Publish>
+ <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Property="USECONFIRMDATACLEANUPDLG" Value="1" Order="999">
+ !DBInstance=3 AND CLEANUPDATA
+ </Publish>
+ <Publish Dialog="ConfirmDataCleanupDlg" Control="Back" Event="NewDialog" Value="MaintenanceTypeDlg">WixUI_InstallMode = "Remove"</Publish>
+ </UI>
+
+ <!-- End of UI section -->
+
+ <!-- Extra folders we need (DATADIR and shortcut folder) -->
+ <DirectoryRef Id='INSTALLDIR'>
+ <Directory Id="DATADIR" Name="data">
+ </Directory>
+ <Directory Id="ProgramMenuFolder">
+ <Directory Id="ShortcutFolder" Name="@CPACK_WIX_PACKAGE_NAME@">
+ </Directory>
+ </Directory>
+ </DirectoryRef>
+
+
+ <!-- Extra feature (database instance). This could be split to several subfeatures if desired (e.g firewall exception)-->
+ <Feature Id='DBInstance'
+ Title='Database instance'
+ Description=
+ 'Install database instance. Only new database can be installed with this feature.'
+ ConfigurableDirectory='DATADIR'
+ AllowAdvertise='no'
+ Level='1'>
+
+ <!-- Data directory with some reasonable security settings -->
+ <Component Id="C.datadir" Guid="*" Directory="DATADIR">
+ <RegistryValue Root='HKLM'
+ Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
+ Name='DATADIR' Value='[DATADIR]' Type='string' KeyPath='yes'/>
+ <CreateFolder>
+ <util:PermissionEx User="[LogonUser]" GenericAll="yes" />
+ <util:PermissionEx User="NetworkService" GenericAll="yes" />
+ </CreateFolder>
+ </Component>
+
+ <!-- Database service conditioned on SERVICENAME property-->
+ <Component Id="C.service" Guid="*" Directory="DATADIR">
+ <Condition>SERVICENAME</Condition>
+ <RegistryValue Root='HKLM'
+ Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
+ Name='SERVICENAME' Value='[SERVICENAME]' Type='string' KeyPath='yes'/>
+ <ServiceControl Id='DBInstanceServiceStop' Name='[SERVICENAME]' Stop='both' Remove='uninstall' Wait='yes'/>
+ <ServiceControl Id='DBInstanceServiceStart' Name='[SERVICENAME]' Start='install' Wait='yes'/>
+ </Component>
+ <?if $(var.HaveInnodb) = "1" ?>
+ <Component Id="C.myiniconfig" Guid="*" Directory="DATADIR">
+ <Condition>STDCONFIG</Condition>
+ <RegistryValue Root='HKLM'
+ Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
+ Name='STDCONFIG' Value='1' Type='string' KeyPath='yes'/>
+ <IniFile Id="Ini1"
+ Action="createLine"
+ Directory="DATADIR"
+ Section="mysqld"
+ Name="my.ini"
+ Key="sql_mode"
+ Value="&quot;STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION&quot;" />
+ <IniFile Id="Ini2"
+ Action="createLine"
+ Directory="DATADIR"
+ Section="mysqld"
+ Name="my.ini"
+ Key="default_storage_engine"
+ Value="innodb" />
+ <IniFile Id="Ini3"
+ Action="createLine"
+ Directory="DATADIR"
+ Section="mysqld"
+ Name="my.ini"
+ Key="innodb_buffer_pool_size"
+ Value="[BUFFERPOOLSIZE]M" />
+ <IniFile Id="Ini4"
+ Action="createLine"
+ Directory="DATADIR"
+ Section="mysqld"
+ Name="my.ini"
+ Key="innodb_log_file_size"
+ Value="[LOGFILESIZE]M" />
+ </Component>
+ <?endif?>
+
+ <Component Id="C.feedback" Guid="*" Directory="DATADIR">
+ <Condition>FEEDBACK</Condition>
+ <RegistryValue Root='HKLM'
+ Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
+ Name='FEEDBACK' Value='1' Type='string' KeyPath='yes'/>
+ <IniFile Id="Ini5"
+ Action="createLine"
+ Directory="DATADIR"
+ Section="mysqld"
+ Name="my.ini"
+ Key="feedback"
+ Value="ON" />
+ </Component>
+
+ <!--- Grant service account permission to the database folder (Windows 7 and later) -->
+ <Component Id="C.serviceaccount.permission" Guid="*" Directory='DATADIR' Transitive='yes'>
+ <Condition><![CDATA[SERVICENAME AND (VersionNT > 600)]]></Condition>
+ <RegistryValue Root='HKLM'
+ Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
+ Name='servicepermission' Value='1' Type='string' KeyPath='yes'/>
+ <CreateFolder>
+ <util:PermissionEx User="NT SERVICE\[SERVICENAME]" GenericAll="yes" />
+ </CreateFolder>
+ </Component>
+
+ <!-- Shortcuts in program menu (mysql client etc) -->
+ <Component Id="c.shortcuts" Guid="*" Directory="ShortcutFolder">
+ <!-- shortcut to my.ini-->
+ <RegistryValue Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall" Name="shortcuts" Value="1" Type="string" KeyPath="yes" />
+ <RemoveFolder Id="RemoveShorcutFolder" On="uninstall" />
+ <Shortcut Id="shortcut.my.ini"
+ Name="my.ini (@CPACK_WIX_PACKAGE_NAME@)"
+ Target="[System64Folder]notepad.exe"
+ Arguments="&quot;[DATADIR]my.ini&quot;"
+ Directory="ShortcutFolder"
+ Description="Edit database configuration" />
+ <Shortcut Id="shortcut.errorlog"
+ Name="Error log (@CPACK_WIX_PACKAGE_NAME@)"
+ Target="[System64Folder]notepad.exe"
+ Arguments="&quot;[DATADIR][ComputerName].err&quot;"
+ Directory="ShortcutFolder"
+ Description="View Database Error log" />
+ <Shortcut Id="shortcut.dbfolder" Name="Database directory (@CPACK_WIX_PACKAGE_NAME@)"
+ Target="[DATADIR]" />
+ </Component>
+
+ <!-- add reference so mysql client won't get uninstalled and we have a shortcut pointing to nowhere-->
+ <ComponentRef Id="C.bin.mysql.exe"/>
+
+ <Component Id="c.shortcuts.commandline" Guid="*" Directory="ShortcutFolder">
+ <RegistryValue
+ Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall"
+ Name="shortcuts.commandline"
+ Value="1" Type="string" KeyPath="yes" />
+ <!-- shortcut to client-->
+ <Shortcut Id="shortcut.mysql.exe"
+ Name="MySQL Client (@CPACK_WIX_PACKAGE_NAME@)"
+ Target="[System64Folder]cmd.exe"
+ Arguments="/k &quot; &quot;[D.bin]mysql.exe&quot; &quot;--defaults-file=[DATADIR]my.ini&quot; -uroot -p&quot;"
+ Directory="ShortcutFolder"
+ WorkingDirectory="D.bin"
+ Description="Starts mysql.exe for root user" />
+ </Component>
+ <Component Id="c.shortcuts.commandprompt.db" Guid="*" Directory="ShortcutFolder" Transitive="yes">
+ <Condition>SERVICENAME</Condition>
+ <RegistryValue
+ Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall"
+ Name="shortcuts.commandprompt.db"
+ Value="1" Type="string" KeyPath="yes" />
+ <!-- just command prompt in the bin directory (so all utilities can be called) -->
+ <Shortcut Id="shortcut.commandprompt.exe.db"
+ Name="Command Prompt (@CPACK_WIX_PACKAGE_NAME@)"
+ Target="[System64Folder]cmd.exe"
+ Directory="ShortcutFolder"
+ Arguments="/k &quot;set MYSQL_HOME=[DATADIR]&amp;&amp; set PATH=[D.bin];%PATH%;&amp;&amp;echo Setting environment for [ProductName] &quot;"
+ Description="Opens command line in the installation bin directory" />
+ </Component>
+
+
+ </Feature>
+
+ <Feature Id="SharedClientServerComponents"
+ Title='Utilities used by both server and client.'
+ Description=
+ 'Client utilities that are also used with server.Required for upgrade.'
+ ConfigurableDirectory='INSTALLDIR'
+ AllowAdvertise='no'
+ Level='1'
+ Display='hidden'>
+ <ComponentRef Id='C.bin.mysql.exe'/>
+ <ComponentRef Id='C.bin.mysqladmin.exe'/>
+ <ComponentRef Id='C.bin.mysql_upgrade.exe'/>
+ <ComponentRef Id='C.bin.mysqlcheck.exe'/>
+ <Component Id="c.shortcuts.commandprompt.nodb" Guid="*" Directory="ShortcutFolder" Transitive="yes">
+ <Condition>NOT SERVICENAME</Condition>
+ <RegistryValue
+ Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall"
+ Name="shortcuts.commandprompt.nodb"
+ Value="1" Type="string" KeyPath="yes" />
+ <!-- just command prompt in the bin directory (so all utilities can be called) -->
+ <Shortcut Id="shortcut.commandprompt.exe.nodb"
+ Name="Command Prompt (@CPACK_WIX_PACKAGE_NAME@)"
+ Target="[System64Folder]cmd.exe"
+ Directory="ShortcutFolder"
+ Arguments="/k &quot;set PATH=[D.bin];%PATH%;&amp;&amp;echo Setting environment for [ProductName] &quot;"
+ Description="Opens command line in the installation bin directory" />
+ </Component>
+ <?if $(var.HaveUpgradeWizard) != "0" ?>
+ <ComponentRef Id='C.bin.mysql_upgrade_wizard.exe'/>
+ <Component Id="c.shortcuts.upgrade_wizard" Guid="*" Directory="ShortcutFolder" Transitive="yes">
+ <RegistryValue
+ Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall"
+ Name="shortcuts.upgrade_wizard"
+ Value="1" Type="string" KeyPath="yes" />
+ <Shortcut Id="shortcut.upgrade_wizard"
+ Name="Upgrade Wizard (@CPACK_WIX_PACKAGE_NAME@)"
+ Target="[INSTALLDIR]bin\mysql_upgrade_wizard.exe"
+ Directory="ShortcutFolder"
+ Description="Upgrades older instances of MariaDB/MySQL services to version @MAJOR_VERSION@.@MINOR_VERSION@"
+ Advertise="no"/>
+ </Component>
+ <?endif?>
+ </Feature>
+
+ <!-- Optional 3rd party tools -->
+ <DirectoryRef Id='TARGETDIR'>
+ <Directory Id='CommonFilesFolder'>
+ <Directory Id='MariaDBShared' Name='MariaDBShared'/>
+ </Directory>
+ <Directory Id='DesktopFolder'/>
+ </DirectoryRef>
+
+
+ <?if "@WITH_THIRD_PARTY@" != "" ?>
+
+ <!-- Include definition of 3party components -->
+ <?foreach tool in @WITH_THIRD_PARTY@ ?>
+ <?include "${CMAKE_CURRENT_BINARY_DIR}\$(var.tool).wxi" ?>
+ <?endforeach ?>
+
+ <Feature Id="ThirdPartyTools"
+ Title='Third party tools'
+ Description= 'Third party tools'
+ AllowAdvertise='no'
+ Level='1'
+ Display='expand'>
+ @THIRD_PARTY_FEATURE_CONDITION@
+ <!-- Include definition of 3rd party features -->
+ <?foreach tool in @WITH_THIRD_PARTY@ ?>
+ <?include "${CMAKE_CURRENT_BINARY_DIR}\$(var.tool)_feature.wxi" ?>
+ <?endforeach ?>
+
+ </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>
+ <SetProperty Sequence='execute' Before='CreateDatabaseCommand' Id="DEFAULTUSER" Value="--default-user">DEFAULTUSER</SetProperty>
+ <CustomAction Id='CheckDatabaseProperties' BinaryKey='wixca.dll' DllEntry='CheckDatabaseProperties' />
+ <CustomAction Id='PresetDatabaseProperties' BinaryKey='wixca.dll' DllEntry='PresetDatabaseProperties' />
+ <CustomAction Id="CreateDatabaseCommand" Property="CreateDatabase"
+ Value=
+ "&quot;[#F.bin.mysql_install_db.exe]&quot; &quot;--service=[SERVICENAME]&quot; --port=[PORT] &quot;--password=[ESCAPEDPASSWORD]&quot; &quot;--datadir=[DATADIR]\&quot; [SKIPNETWORKING] [ALLOWREMOTEROOTACCESS] [DEFAULTUSER]"
+ Execute="immediate"
+ HideTarget="yes"
+ />
+ <CustomAction Id="CreateDatabaseRollbackCommand" Property="CreateDatabaseRollback"
+ Value="[SERVICENAME]\[DATADIR]"
+ Execute="immediate"/>
+ <CustomAction Id="CreateDatabase" BinaryKey="WixCA" DllEntry="CAQuietExec"
+ Execute="deferred" Return="check" Impersonate="no" />
+ <CustomAction Id="CreateDatabaseRollback" BinaryKey="wixca.dll" DllEntry="CreateDatabaseRollback"
+ Execute="rollback" Return="check" Impersonate="no"/>
+ <UI>
+ <ProgressText Action="CreateDatabase">Running mysql_install_db.exe</ProgressText>
+ </UI>
+
+ <!-- Error injection script activated by TEST_FAIL=1 passed to msiexec (to see how good custom action rollback works) -->
+ <Property Id="FailureProgram">
+ <![CDATA[
+ Function Main()
+ Main = 3
+ End Function
+ ]]>
+ </Property>
+ <CustomAction Id="FakeFailure"
+ VBScriptCall="Main"
+ Property="FailureProgram"
+ Execute="deferred" />
+
+ <CustomAction Id='ErrorDataDirNotEmpty'
+ Error='Chosen data directory [DATADIR] is not empty. It must be empty prior to installation.'/>
+ <InstallExecuteSequence>
+ <Custom Action="CheckDataDirectoryEmpty" After="CostFinalize">
+ <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
+ </Custom>
+ <Custom Action="ErrorDataDirNotEmpty" After="CheckDataDirectoryEmpty" >DATADIRNOTEMPTY</Custom>
+ <Custom Action="CheckDatabaseProperties" Before="CreateDatabaseCommand">SERVICENAME</Custom>
+ <Custom Action="CreateDatabaseCommand" After="CostFinalize" >
+ <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
+ </Custom>
+ <Custom Action="CreateDatabase" After="InstallFiles">
+ <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
+ </Custom>
+ <Custom Action="CreateDatabaseRollbackCommand" After="CostFinalize">
+ <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
+ </Custom>
+ <Custom Action="CreateDatabaseRollback" Before="CreateDatabase">
+ <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED=""]]>
+ </Custom>
+ <Custom Action='FakeFailure' Before='InstallFinalize'>
+ <![CDATA[&DBInstance=3 AND NOT !DBInstance=3 AND OLDERVERSIONBEINGUPGRADED="" AND TESTFAIL]]>
+ </Custom>
+ </InstallExecuteSequence>
+
+
+ <!-- Custom action to remove data on uninstall -->
+ <Binary Id='wixca.dll' SourceFile='@WIXCA_LOCATION@' />
+ <CustomAction Id="RemoveDataDirectory.SetProperty" Return="check"
+ Property="RemoveDataDirectory" Value="[DATADIR]" />
+ <CustomAction Id="RemoveDataDirectory" BinaryKey="wixca.dll"
+ DllEntry="RemoveDataDirectory"
+ Execute="deferred"
+ Impersonate="no"
+ Return="ignore" />
+ <InstallExecuteSequence>
+ <Custom Action="RemoveDataDirectory.SetProperty" After="CreateDatabaseCommand" >
+ <![CDATA[($C.datadir=2) AND (CLEANUPDATA) AND NOT UPGRADINGPRODUCTCODE]]>
+ </Custom>
+ <Custom Action="RemoveDataDirectory" Before="RemoveFiles">
+ <![CDATA[($C.datadir=2) AND (CLEANUPDATA) AND NOT UPGRADINGPRODUCTCODE]]>
+ </Custom>
+ </InstallExecuteSequence>
+
+ <InstallExecuteSequence>
+ <StopServices>SERVICENAME</StopServices>
+ <DeleteServices>SERVICENAME</DeleteServices>
+ </InstallExecuteSequence>
+ <CustomAction Id="CheckDBInUse" Return="ignore"
+ BinaryKey="wixca.dll" DllEntry="CheckDBInUse" Execute="firstSequence"/>
+ <InstallExecuteSequence>
+ <Custom Action="CheckDBInUse" Before="LaunchConditions">Installed</Custom>
+ <Custom Action="PresetDatabaseProperties" After="CheckDBInUse"></Custom>
+ </InstallExecuteSequence>
+ <InstallUISequence>
+ <Custom Action="CheckDBInUse" Before="LaunchConditions">Installed</Custom>
+ <Custom Action="PresetDatabaseProperties" After="CheckDBInUse"></Custom>
+ </InstallUISequence>
+
+ <!-- Store some properties persistently in registry, mainly for upgrades -->
+
+ <Feature Id='StoreInstallLocation' Level='1' Absent='disallow' Display='hidden'>
+ <Component Directory='INSTALLDIR' Guid='*' Id='C.storeinstalllocation'>
+ <RegistryValue Root='HKLM' Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
+ Name='INSTALLDIR' Value='[INSTALLDIR]' Type='string' KeyPath='yes'/>
+ </Component>
+ </Feature>
+
+ <?foreach STOREDVAR in SERVICENAME;DATADIR;INSTALLDIR?>
+
+ <Property Id='$(var.STOREDVAR)' Secure='yes'>
+ <RegistrySearch Id='$(var.STOREDVAR)Property' Root='HKLM'
+ Key='SOFTWARE\@MANUFACTURER@\@CPACK_WIX_PACKAGE_NAME@'
+ Name='$(var.STOREDVAR)' Type='raw' />
+ </Property>
+ <CustomAction Id='SaveCmdLineValue_$(var.STOREDVAR)' Property='CMDLINE_$(var.STOREDVAR)'
+ Value='[$(var.STOREDVAR)]' Execute='firstSequence' />
+ <CustomAction Id='SetFromCmdLineValue_$(var.STOREDVAR)' Property='$(var.STOREDVAR)'
+ Value='[CMDLINE_$(var.STOREDVAR)]' Execute='firstSequence' />
+ <InstallUISequence>
+ <Custom Action='SaveCmdLineValue_$(var.STOREDVAR)' Before='AppSearch' />
+ <Custom Action='SetFromCmdLineValue_$(var.STOREDVAR)' After='AppSearch'>CMDLINE_$(var.STOREDVAR)</Custom>
+ </InstallUISequence>
+ <InstallExecuteSequence>
+ <Custom Action='SaveCmdLineValue_$(var.STOREDVAR)' Before='AppSearch' />
+ <Custom Action='SetFromCmdLineValue_$(var.STOREDVAR)' After='AppSearch'>CMDLINE_$(var.STOREDVAR)</Custom>
+ </InstallExecuteSequence>
+
+ <?endforeach?>
+
+ <!--
+ Optionally, start upgrade wizard on exit.
+ -->
+
+
+
+ <?if $(var.HaveUpgradeWizard) != "0" ?>
+ <UI>
+ <Publish Dialog="ExitDialog"
+ Control="Finish"
+ Event="DoAction"
+ Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
+ </UI>
+ <Property
+ Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT"
+ Value="Launch wizard to upgrade existing MariaDB or MySQL services." />
+ <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1"/>
+ <Property Id="WixShellExecTarget" Value="[#F.bin.mysql_upgrade_wizard.exe]" />
+ <CustomAction Id="LaunchApplication"
+ BinaryKey="WixCA"
+ DllEntry="WixShellExec"
+ Impersonate="yes" />
+ <CustomAction
+ Id="CheckServiceUpgrades" Return="ignore" BinaryKey="wixca.dll"
+ DllEntry="CheckServiceUpgrades"
+ Execute="immediate" />
+ <InstallUISequence>
+ <Custom Action="CheckServiceUpgrades" After="CostFinalize">
+ $C.bin.mysql_upgrade_wizard.exe = 3 AND NOT Installed
+ </Custom>
+ </InstallUISequence>
+ <SetProperty Before="ExecuteAction" Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT"
+ Sequence="ui" Value="[NonExistentProperty]">
+ <![CDATA[($C.bin.mysql_upgrade_wizard.exe <> 3) AND NOT Installed]]>
+ </SetProperty>
+ <SetProperty Before="ExecuteAction" Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX"
+ Sequence="ui" Value="[NonExistentProperty]">
+ <![CDATA[($C.bin.mysql_upgrade_wizard.exe <> 3) AND NOT Installed]]>
+ </SetProperty>
+
+ <?endif ?> <!-- HaveUpgradeWizard -->
+
+ <!--
+ Author the registry entries for "add or remove programs"
+ We choose to define ARPSYSTEMCOMPONENT to 1 because we want to show
+ "do you want to remove data directory" on uninstall
+ -->
+ <Property Id="ARPSYSTEMCOMPONENT" Value="1" Secure="yes" />
+ <Property Id="ARPINSTALLLOCATION" Secure="yes"/>
+ <SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="InstallValidate" Sequence="execute"/>
+ <Feature Id='ARPRegistryEntries'
+ Title='Add or remove program entries'
+ Description='Add or remove program entries'
+ AllowAdvertise='no'
+ Absent='disallow' Display='hidden'
+ Level='1'>
+ <Component Id="C.arp_entries" Guid="*" Directory="INSTALLDIR">
+ <RemoveFolder Id="RemoveINSTALLDIR" On="uninstall"/>
+ <RegistryValue Root='HKLM'
+ Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
+ Name='DisplayName' Value='[ProductName]' Type='string' KeyPath='yes'/>
+ <RegistryValue Root='HKLM'
+ Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
+ Name='Publisher' Value='@MANUFACTURER@' Type='string'/>
+ <RegistryValue Root='HKLM'
+ Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
+ Name='DisplayVersion' Value='[ProductVersion]' Type='string'/>
+ <RegistryValue Root='HKLM'
+ Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
+ Name='InstallLocation' Value='[INSTALLDIR]' Type='string'/>
+ <RegistryValue Root='HKLM'
+ Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
+ Name='UninstallString' Value='msiexec.exe /I [ProductCode]' Type='string'/>
+ <RegistryValue Root='HKLM'
+ Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
+ Name='MajorVersion' Value='@MAJOR_VERSION@' Type='string'/>
+ <RegistryValue Root='HKLM'
+ Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\@CPACK_WIX_PACKAGE_NAME@'
+ Name='MinorVersion' Value='@MINOR_VERSION@' Type='string'/>
+ </Component>
+ </Feature>
+
+ <!-- Extra condition to block the installer if NSIS based installation is detected-->
+ <Property Id="NSISINSTALLKEY">
+ <RegistrySearch Id='NSISKey' Type='raw'
+ Root='HKLM' Key='Software\Microsoft\Windows\CurrentVersion\Uninstall\MariaDB' Name='DisplayName' />
+ </Property>
+ <Condition
+ Message=
+ 'Previous version of MariaDB was found, that used incompatible installer.&#xD;&#xA;Please remove &quot;[NSISINSTALLKEY]&quot; before you proceed with this installation.'
+ >
+ <![CDATA[ NOT(NSISINSTALLKEY << "MariaDB @MAJOR_VERSION@.@MINOR_VERSION@.") OR Installed]]>
+ </Condition>
+ <Condition Message=
+ 'Setting the ALLUSERS property is not allowed because [ProductName] is a per-machine application. Setup will now exit.'>
+ <![CDATA[ALLUSERS = "1"]]>
+ </Condition>
+ </Fragment>
+</Wix>
diff --git a/win/packaging/heidisql.cmake b/win/packaging/heidisql.cmake
new file mode 100644
index 00000000000..f826c9a6633
--- /dev/null
+++ b/win/packaging/heidisql.cmake
@@ -0,0 +1,23 @@
+SET(HEIDISQL_BASE_NAME "HeidiSQL_7.0_Portable")
+SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip")
+SET(HEIDISQL_URL "http://heidisql.googlecode.com/files/${HEIDISQL_ZIP}")
+SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})
+
+IF(NOT EXISTS ${HEIDISQL_DOWNLOAD_DIR}/${HEIDISQL_ZIP})
+ MAKE_DIRECTORY(${HEIDISQL_DOWNLOAD_DIR})
+ MESSAGE(STATUS "Downloading ${HEIDISQL_URL} to ${HEIDISQL_DOWNLOAD_DIR}/${HEIDISQL_ZIP}")
+ FILE(DOWNLOAD ${HEIDISQL_URL} ${HEIDISQL_DOWNLOAD_DIR}/${HEIDISQL_ZIP} TIMEOUT 60)
+ EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E chdir ${HEIDISQL_DOWNLOAD_DIR}
+ ${CMAKE_COMMAND} -E tar xfz ${HEIDISQL_DOWNLOAD_DIR}/${HEIDISQL_ZIP}
+ )
+ENDIF()
+
+SET(LIBMYSQLDLL_SOURCE ${HEIDISQL_DOWNLOAD_DIR}/libmysql.dll)
+IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ # Use our libmysql if it is 32 bit.
+ IF(LIBMYSQL_LOCATION)
+ SET(LIBMYSQLDLL_SOURCE "${LIBMYSQL_LOCATION}")
+ ENDIF()
+ENDIF()
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/heidisql.wxi.in ${CMAKE_CURRENT_BINARY_DIR}/heidisql.wxi)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/heidisql_feature.wxi.in ${CMAKE_CURRENT_BINARY_DIR}/heidisql_feature.wxi)
diff --git a/win/packaging/heidisql.wxi.in b/win/packaging/heidisql.wxi.in
new file mode 100644
index 00000000000..1e6e3d552a8
--- /dev/null
+++ b/win/packaging/heidisql.wxi.in
@@ -0,0 +1,51 @@
+<Include>
+<Property Id="HEIDISQLINSTALLED" Secure="yes">
+<RegistrySearch Id="HeidiSQL"
+ Root="HKLM"
+ Key="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\HeidiSQL_is1"
+ Name="UninstallString"
+ Type="raw"
+ Win64="no"
+/>
+</Property>
+<DirectoryRef Id="MariaDBShared">
+ <Directory Id="D.HeidiSQL" Name="HeidiSQL">
+ <Component Id="component.HeidiSQL" Guid="96ea3879-5320-4098-8f26-2f655d2f716c" Win64="no">
+
+ <File Id="heidisql.gpl.txt" Name="gpl.txt" Source="${HEIDISQL_DOWNLOAD_DIR}\gpl.txt" />
+ <File Id="heidisql.heidisql.exe" Name="heidisql.exe" Source="${HEIDISQL_DOWNLOAD_DIR}\heidisql.exe" KeyPath="yes">
+ <Shortcut Id="desktopHeidiSQL" Directory="DesktopFolder" Name="HeidiSQL" Advertise="yes"/>
+ </File>
+ <!--
+ Forced file removal for heidisql.exe might be required.
+ HeidiSQL is self-updating, thus the version that was installed by MSI not necessarily matches
+ the version of the file on uninstall. MSI would not touch such file by default and leave it after
+ uninstallation. We use RemoveFile to force delete in any case.
+ -->
+ <RemoveFile Id="Remove_HeidiSQL_exe" Name="heidisql.exe" On="uninstall" />
+
+ <File Id="heidisql.license.txt" Name="license.txt" Source="${HEIDISQL_DOWNLOAD_DIR}\license.txt" />
+ <File Id="heidisql.readme.txt" Name="readme.txt" Source="${HEIDISQL_DOWNLOAD_DIR}\readme.txt" />
+ </Component>
+ <Component Id="component.HeidiSQL_MenuShortcut" Guid="*" Win64="no">
+ <RegistryValue Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\Uninstall" Name="shortcuts.heidisql" Value="1" Type="string" KeyPath="yes" />
+ <Shortcut Id="startmenuHeidiSQL" Directory="ShortcutFolder" Name="HeidiSQL" Target="[D.HeidiSQL]\heidisql.exe"/>
+ </Component>
+ <Component Id="component.HeidiSQL_libmysql.dll" Guid="*" Win64="no">
+ <File Id="heidisql.libmysql.dll" Name="libmysql.dll" Source="${HEIDISQL_DOWNLOAD_DIR}\libmysql.dll" />
+ </Component>
+ <Component Id="component.HeidiSQL_CleanupSettings" Guid="*" Win64="no">
+ <Condition>HEIDISQLINSTALLED</Condition>
+ <RegistryValue Root="HKCU" Key="Software\@CPACK_WIX_PACKAGE_NAME@\UninstallCleanupHeidiSQLSettings" Name="cleanup.heidisql" Value="1" Type="string" KeyPath="yes" />
+ <RemoveRegistryKey Id="HeidiSQL_RegistryCleanup" Root="HKCU" Key="SOFTWARE\HeidiSQL" Action="removeOnUninstall" />
+ </Component>
+ </Directory>
+</DirectoryRef>
+
+<ComponentGroup Id="HeidiSQL">
+ <ComponentRef Id="component.HeidiSQL"/>
+ <ComponentRef Id="component.HeidiSQL_MenuShortcut"/>
+ <ComponentRef Id="component.HeidiSQL_libmysql.dll"/>
+ <ComponentRef Id="component.HeidiSQL_CleanupSettings"/>
+</ComponentGroup>
+</Include>
diff --git a/win/packaging/heidisql_feature.wxi.in b/win/packaging/heidisql_feature.wxi.in
new file mode 100644
index 00000000000..3f60fcd8f27
--- /dev/null
+++ b/win/packaging/heidisql_feature.wxi.in
@@ -0,0 +1,10 @@
+<Include>
+<Feature Id="HeidiSQL"
+ Title='HeidiSQL'
+ Description= 'Powerful, easy and free MySQL/MariaDB GUI client by Ansgar Becker'
+ AllowAdvertise='no'
+ Level='1'>
+ <Condition Level="0">HEIDISQLINSTALLED AND NOT REMOVE ~= ALL</Condition>
+ <ComponentGroupRef Id='HeidiSQL'/>
+</Feature>
+</Include>
diff --git a/win/packaging/mysql_server.wxs.in b/win/packaging/mysql_server.wxs.in
new file mode 100644
index 00000000000..82c17d7577c
--- /dev/null
+++ b/win/packaging/mysql_server.wxs.in
@@ -0,0 +1,87 @@
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
+ xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
+ <Product
+ Id="*"
+ UpgradeCode="@CPACK_WIX_UPGRADE_CODE@"
+ Name="@CPACK_WIX_PACKAGE_NAME@"
+ Version="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
+ Language="1033"
+ Manufacturer="@MANUFACTURER@">
+
+ <Package Id='*'
+ Keywords='Installer'
+ Description='MariaDB Server'
+ Manufacturer='@MANUFACTURER@'
+ InstallerVersion='200'
+ Languages='1033'
+ Compressed='yes'
+ SummaryCodepage='1252'
+ Platform='@Platform@'/>
+
+ <Media Id='1' Cabinet='product.cab' EmbedCab='yes' CompressionLevel='high' />
+
+ <!-- Upgrade -->
+ <Upgrade Id="@CPACK_WIX_UPGRADE_CODE@">
+ <?if "@PATCH_VERSION@" != "0"?>
+ <UpgradeVersion
+ Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.0"
+ IncludeMinimum="yes"
+ Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
+ Property="OLDERVERSIONBEINGUPGRADED"
+ MigrateFeatures="yes"
+ />
+ <?endif?>
+ <UpgradeVersion
+ Minimum="@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@"
+ Maximum="@MAJOR_VERSION@.@MINOR_VERSION@.999"
+ OnlyDetect="yes"
+ Property="NEWERVERSIONDETECTED" />
+ </Upgrade>
+ <Condition Message="A more recent version of [ProductName] is already installed. Setup will now exit.">
+ NOT NEWERVERSIONDETECTED OR Installed
+ </Condition>
+ <InstallExecuteSequence>
+ <RemoveExistingProducts After="InstallFinalize"/>
+ </InstallExecuteSequence>
+
+
+ <InstallUISequence>
+ <AppSearch After="FindRelatedProducts"/>
+ </InstallUISequence>
+
+ <!-- UI -->
+ <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR"></Property>
+ <UIRef Id="WixUI_ErrorProgressText" />
+ <UIRef Id="@CPACK_WIX_UI@" />
+
+
+ <!-- License -->
+ <WixVariable
+ Id="WixUILicenseRtf"
+ Value="@COPYING_RTF@"/>
+
+ <!-- Installation root-->
+ <Directory Id='TARGETDIR' Name='SourceDir'>
+ <Directory Id='@PlatformProgramFilesFolder@'>
+ <Directory Id='INSTALLDIR' Name='@CPACK_WIX_PACKAGE_BASE_NAME@ @MAJOR_VERSION@.@MINOR_VERSION@'>
+ </Directory>
+ </Directory>
+ </Directory>
+
+ <!-- CPACK_WIX_FEATURES -->
+ @CPACK_WIX_FEATURES@
+
+ <!-- CPACK_WIX_DIRECTORIES -->
+ @CPACK_WIX_DIRECTORIES@
+
+ <!--CPACK_WIX_COMPONENTS-->
+ @CPACK_WIX_COMPONENTS@
+
+ <!--CPACK_WIX_COMPONENTS_GROUPS -->
+ @CPACK_WIX_COMPONENT_GROUPS@
+
+ <!--CPACK_WIX_INCLUDES -->
+ @CPACK_WIX_INCLUDES@
+ </Product>
+
+</Wix>
diff --git a/win/upgrade_wizard/CMakeLists.txt b/win/upgrade_wizard/CMakeLists.txt
new file mode 100644
index 00000000000..44d6249ea1e
--- /dev/null
+++ b/win/upgrade_wizard/CMakeLists.txt
@@ -0,0 +1,44 @@
+IF(NOT MSVC)
+ RETURN()
+ENDIF()
+IF(CMAKE_USING_VC_FREE_TOOLS)
+ # No MFC, so it cannot be built
+ RETURN()
+ENDIF()
+
+# We need MFC
+FIND_PACKAGE(MFC)
+IF(NOT MFC_FOUND)
+ IF(BUILD_RELEASE)
+ MESSAGE(FATAL_ERROR
+ "Can't find MFC. It is necessary for producing official package"
+ )
+ ENDIF()
+ RETURN()
+ENDIF()
+
+# MFC should be statically linked
+SET(CMAKE_MFC_FLAG 1)
+
+# Enable exception handling (avoids warnings)
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
+
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/sql)
+MYSQL_ADD_EXECUTABLE(mysql_upgrade_wizard
+ upgrade.cpp upgradeDlg.cpp upgrade.rc
+ COMPONENT Server)
+TARGET_LINK_LIBRARIES(mysql_upgrade_wizard winservice)
+# 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)
+
+# Embed Vista "admin" manifest, since upgrade_wizard needs admin privileges
+# to change service configuration. Due to a CMake bug http://www.vtk.org/Bug/view.php?id=11171
+# it is not possible currenly to do it with linker flags. Work around is to use
+# manifest tool mt.exe and embed the manifest post-build.
+GET_TARGET_PROPERTY(upgrade_wizard_location mysql_upgrade_wizard LOCATION)
+ADD_CUSTOM_COMMAND(
+ TARGET mysql_upgrade_wizard POST_BUILD
+ COMMAND mt.exe -manifest ${CMAKE_CURRENT_SOURCE_DIR}/upgrade_wizard.exe.manifest
+ "-outputresource:${upgrade_wizard_location};#1"
+)
diff --git a/win/upgrade_wizard/res/upgrade.ico b/win/upgrade_wizard/res/upgrade.ico
new file mode 100644
index 00000000000..33a6178346a
--- /dev/null
+++ b/win/upgrade_wizard/res/upgrade.ico
Binary files differ
diff --git a/win/upgrade_wizard/res/upgrade.rc2 b/win/upgrade_wizard/res/upgrade.rc2
new file mode 100644
index 00000000000..8a1da4177c5
--- /dev/null
+++ b/win/upgrade_wizard/res/upgrade.rc2
@@ -0,0 +1,13 @@
+//
+// zzz.RC2 - resources Microsoft Visual C++ does not edit directly
+//
+
+#ifdef APSTUDIO_INVOKED
+#error this file is not editable by Microsoft Visual C++
+#endif //APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Add manually edited resources here...
+
+/////////////////////////////////////////////////////////////////////////////
diff --git a/win/upgrade_wizard/resource.h b/win/upgrade_wizard/resource.h
new file mode 100644
index 00000000000..4c05cea2fd0
--- /dev/null
+++ b/win/upgrade_wizard/resource.h
@@ -0,0 +1,27 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ generated include file.
+// Used by upgrade.rc
+//
+#define IDD_UPGRADE_DIALOG 102
+#define IDR_MAINFRAME 128
+#define IDC_LIST1 1000
+#define IDC_PROGRESS1 1004
+#define IDC_EDIT1 1005
+#define IDC_EDIT2 1006
+#define IDC_EDIT3 1007
+#define IDC_EDIT7 1011
+#define IDC_EDIT8 1012
+#define IDC_EDIT9 1013
+#define IDC_BUTTON1 1014
+#define IDC_BUTTON2 1015
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 129
+#define _APS_NEXT_COMMAND_VALUE 32771
+#define _APS_NEXT_CONTROL_VALUE 1016
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/win/upgrade_wizard/stdafx.h b/win/upgrade_wizard/stdafx.h
new file mode 100644
index 00000000000..87db7036005
--- /dev/null
+++ b/win/upgrade_wizard/stdafx.h
@@ -0,0 +1,47 @@
+
+// stdafx.h : include file for standard system include files,
+// or project specific include files that are used frequently,
+// but are changed infrequently
+
+#pragma once
+
+#ifndef _SECURE_ATL
+#define _SECURE_ATL 1
+#endif
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
+
+// turns off MFC's hiding of some common and often safely ignored warning messages
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h> // MFC core and standard components
+#include <afxext.h> // MFC extensions
+
+
+
+
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h> // MFC support for Windows Common Controls
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/win/upgrade_wizard/targetver.h b/win/upgrade_wizard/targetver.h
new file mode 100644
index 00000000000..90e767bfce7
--- /dev/null
+++ b/win/upgrade_wizard/targetver.h
@@ -0,0 +1,8 @@
+#pragma once
+
+// Including SDKDDKVer.h defines the highest available Windows platform.
+
+// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
+// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
+
+#include <SDKDDKVer.h>
diff --git a/win/upgrade_wizard/upgrade.cpp b/win/upgrade_wizard/upgrade.cpp
new file mode 100644
index 00000000000..aa9efa15ecc
--- /dev/null
+++ b/win/upgrade_wizard/upgrade.cpp
@@ -0,0 +1,57 @@
+
+// upgrade.cpp : Defines the class behaviors for the application.
+//
+
+#include "stdafx.h"
+#include "upgrade.h"
+#include "upgradeDlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CUpgradeApp
+
+BEGIN_MESSAGE_MAP(CUpgradeApp, CWinApp)
+ ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
+END_MESSAGE_MAP()
+
+
+// CUpgradeApp construction
+
+CUpgradeApp::CUpgradeApp()
+{
+ // TODO: add construction code here,
+ // Place all significant initialization in InitInstance
+}
+
+
+// The one and only CUpgradeApp object
+
+CUpgradeApp theApp;
+
+
+// CUpgradeApp initialization
+
+BOOL CUpgradeApp::InitInstance()
+{
+ // InitCommonControlsEx() is required on Windows XP if an application
+ // manifest specifies use of ComCtl32.dll version 6 or later to enable
+ // visual styles. Otherwise, any window creation will fail.
+ INITCOMMONCONTROLSEX InitCtrls;
+ InitCtrls.dwSize = sizeof(InitCtrls);
+ // Set this to include all the common control classes you want to use
+ // in your application.
+ InitCtrls.dwICC = ICC_WIN95_CLASSES;
+
+ InitCommonControlsEx(&InitCtrls);
+ CWinApp::InitInstance();
+ CUpgradeDlg dlg;
+ m_pMainWnd = &dlg;
+ dlg.DoModal();
+ // Since the dialog has been closed, return FALSE so that we exit the
+ // application, rather than start the application's message pump.
+ return FALSE;
+}
+
diff --git a/win/upgrade_wizard/upgrade.h b/win/upgrade_wizard/upgrade.h
new file mode 100644
index 00000000000..26c107b6ee8
--- /dev/null
+++ b/win/upgrade_wizard/upgrade.h
@@ -0,0 +1,32 @@
+
+// zzz.h : main header file for the PROJECT_NAME application
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+ #error "include 'stdafx.h' before including this file for PCH"
+#endif
+
+#include "resource.h" // main symbols
+
+
+// CzzzApp:
+// See zzz.cpp for the implementation of this class
+//
+
+class CUpgradeApp : public CWinApp
+{
+public:
+ CUpgradeApp();
+
+// Overrides
+public:
+ virtual BOOL InitInstance();
+
+// Implementation
+
+ DECLARE_MESSAGE_MAP()
+};
+
+extern CUpgradeApp theApp; \ No newline at end of file
diff --git a/win/upgrade_wizard/upgrade.rc b/win/upgrade_wizard/upgrade.rc
new file mode 100644
index 00000000000..30656651b79
--- /dev/null
+++ b/win/upgrade_wizard/upgrade.rc
@@ -0,0 +1,148 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#ifndef APSTUDIO_INVOKED
+#include "targetver.h"
+#endif
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// German (Germany) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_DEU)
+LANGUAGE LANG_GERMAN, SUBLANG_GERMAN
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#ifndef APSTUDIO_INVOKED\r\n"
+ "#include ""targetver.h""\r\n"
+ "#endif\r\n"
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "#define _AFX_NO_SPLITTER_RESOURCES\r\n"
+ "#define _AFX_NO_OLE_RESOURCES\r\n"
+ "#define _AFX_NO_TRACKER_RESOURCES\r\n"
+ "#define _AFX_NO_PROPERTY_RESOURCES\r\n"
+ "\r\n"
+ "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n"
+ "LANGUAGE 9, 1\r\n"
+ "#include ""res\\upgrade.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
+ "#include ""afxres.rc"" // Standard components\r\n"
+ "#endif\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDR_MAINFRAME ICON "res\\upgrade.ico"
+#endif // German (Germany) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (United States) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_UPGRADE_DIALOG DIALOGEX 0, 0, 320, 200
+STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_APPWINDOW
+CAPTION "MariaDB Upgrade Wizard"
+FONT 8, "MS Shell Dlg"
+BEGIN
+ DEFPUSHBUTTON "OK",IDOK,113,169,50,14
+ PUSHBUTTON "Cancel",IDCANCEL,191,169,50,14
+ LISTBOX IDC_LIST1,24,39,216,80,LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
+ EDITTEXT IDC_EDIT1,97,124,193,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ EDITTEXT IDC_EDIT2,98,138,181,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ CONTROL "",IDC_PROGRESS1,"msctls_progress32",PBS_SMOOTH | WS_BORDER,26,153,243,14
+ EDITTEXT IDC_EDIT3,98,151,40,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ EDITTEXT IDC_EDIT7,27,124,65,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ EDITTEXT IDC_EDIT8,27,137,62,12,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ EDITTEXT IDC_EDIT9,27,151,62,14,ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+ PUSHBUTTON "Select all",IDC_BUTTON1,245,61,50,14
+ PUSHBUTTON "Clear all",IDC_BUTTON2,246,88,50,14
+ LTEXT "Select services you want to upgrade and click on the [Upgrade] button.\nMake sure to backup data directories prior to upgrade.",IDC_STATIC,25,14,215,26
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_UPGRADE_DIALOG, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 313
+ TOPMARGIN, 7
+ BOTTOMMARGIN, 193
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+#endif // English (United States) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+#define _AFX_NO_SPLITTER_RESOURCES
+#define _AFX_NO_OLE_RESOURCES
+#define _AFX_NO_TRACKER_RESOURCES
+#define _AFX_NO_PROPERTY_RESOURCES
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE 9, 1
+#include "res\upgrade.rc2" // non-Microsoft Visual C++ edited resources
+#include "afxres.rc" // Standard components
+#endif
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/win/upgrade_wizard/upgradeDlg.cpp b/win/upgrade_wizard/upgradeDlg.cpp
new file mode 100644
index 00000000000..d996c0ebe5d
--- /dev/null
+++ b/win/upgrade_wizard/upgradeDlg.cpp
@@ -0,0 +1,627 @@
+
+// upgradeDlg.cpp : implementation file
+//
+
+#include "stdafx.h"
+#include "upgrade.h"
+#include "upgradeDlg.h"
+#include "windows.h"
+#include "winsvc.h"
+#include <msi.h>
+#pragma comment(lib, "msi")
+#pragma comment(lib, "version")
+#include <map>
+#include <string>
+#include <vector>
+
+#include <winservice.h>
+
+using namespace std;
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+#define PRODUCT_NAME "MariaDB"
+
+// CUpgradeDlg dialog
+
+CUpgradeDlg::CUpgradeDlg(CWnd* pParent /*=NULL*/)
+ : CDialog(CUpgradeDlg::IDD, pParent)
+{
+ m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
+}
+
+void CUpgradeDlg::DoDataExchange(CDataExchange* pDX)
+{
+ CDialog::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_LIST1, m_Services);
+ DDX_Control(pDX, IDC_PROGRESS1, m_Progress);
+ DDX_Control(pDX, IDOK, m_Ok);
+ DDX_Control(pDX, IDCANCEL, m_Cancel);
+ DDX_Control(pDX, IDC_EDIT1, m_IniFilePath);
+ DDX_Control(pDX, IDC_EDIT2, m_DataDir);
+ DDX_Control(pDX, IDC_EDIT3, m_Version);
+ DDX_Control(pDX, IDC_EDIT7, m_IniFileLabel);
+ DDX_Control(pDX, IDC_EDIT8, m_DataDirLabel);
+ DDX_Control(pDX, IDC_EDIT9, m_VersionLabel);
+ DDX_Control(pDX, IDC_BUTTON1, m_SelectAll);
+ DDX_Control(pDX, IDC_BUTTON2, m_ClearAll);
+}
+
+BEGIN_MESSAGE_MAP(CUpgradeDlg, CDialog)
+ ON_WM_PAINT()
+ ON_WM_QUERYDRAGICON()
+ ON_LBN_SELCHANGE(IDC_LIST1, &CUpgradeDlg::OnLbnSelchangeList1)
+ ON_CONTROL(CLBN_CHKCHANGE, IDC_LIST1, OnChkChange)
+ ON_BN_CLICKED(IDOK, &CUpgradeDlg::OnBnClickedOk)
+ ON_BN_CLICKED(IDCANCEL, &CUpgradeDlg::OnBnClickedCancel)
+ ON_BN_CLICKED(IDC_BUTTON1,&CUpgradeDlg::OnBnSelectAll)
+ ON_BN_CLICKED(IDC_BUTTON2,&CUpgradeDlg::OnBnClearAll)
+END_MESSAGE_MAP()
+
+
+struct ServiceProperties
+{
+ string servicename;
+ string myini;
+ string datadir;
+ string version;
+};
+
+vector<ServiceProperties> services;
+
+/*
+ Get version from an executable.
+ Returned version is either major.minor.patch or
+ <unknown> , of executable does not have any version
+ info embedded (like MySQL 5.1 for example)
+*/
+void GetExeVersion(const string& filename, int *major, int *minor, int *patch)
+{
+ DWORD handle;
+ *major= *minor= *patch= 0;
+
+ DWORD size = GetFileVersionInfoSize(filename.c_str(), &handle);
+ BYTE* versionInfo = new BYTE[size];
+ if (!GetFileVersionInfo(filename.c_str(), handle, size, versionInfo))
+ {
+ delete[] versionInfo;
+ return;
+ }
+ // we have version information
+ UINT len = 0;
+ VS_FIXEDFILEINFO* vsfi = NULL;
+ VerQueryValue(versionInfo, "\\", (void**)&vsfi, &len);
+
+ *major= (int)HIWORD(vsfi->dwFileVersionMS);
+ *minor= (int)LOWORD(vsfi->dwFileVersionMS);
+ *patch= (int)HIWORD(vsfi->dwFileVersionLS);
+ delete[] versionInfo;
+}
+
+
+void GetMyVersion(int *major, int *minor, int *patch)
+{
+ char path[MAX_PATH];
+ *major= *minor= *patch =0;
+ if (GetModuleFileName(NULL, path, MAX_PATH))
+ {
+ GetExeVersion(path, major, minor, patch);
+ }
+}
+// CUpgradeDlg message handlers
+
+/* Handle selection changes in services list */
+void CUpgradeDlg::SelectService(int index)
+{
+ m_IniFilePath.SetWindowText(services[index].myini.c_str());
+ m_DataDir.SetWindowText(services[index].datadir.c_str());
+ m_Version.SetWindowText(services[index].version.c_str());
+}
+
+
+
+/*
+ Iterate over services, lookup for mysqld.exe ones.
+ Compare mysqld.exe version with current version, and display
+ service if corresponding mysqld.exe has lower version.
+
+ The version check is not strict, i.e we allow to "upgrade"
+ for the same major.minor combination. This can be useful for
+ "upgrading" from 32 to 64 bit, or for MySQL=>Maria conversion.
+*/
+void CUpgradeDlg::PopulateServicesList()
+{
+
+ SC_HANDLE scm = OpenSCManager(NULL, NULL,
+ SC_MANAGER_ENUMERATE_SERVICE | SC_MANAGER_CONNECT);
+ if (scm == NULL)
+ {
+ ErrorExit("OpenSCManager failed");
+ }
+
+ static BYTE buf[64*1024];
+ static BYTE configBuffer[8*1024];
+
+ DWORD bufsize= sizeof(buf);
+ DWORD bufneed;
+ DWORD num_services;
+ BOOL ok= EnumServicesStatusEx(scm, SC_ENUM_PROCESS_INFO, SERVICE_WIN32,
+ SERVICE_STATE_ALL, buf, bufsize, &bufneed, &num_services, NULL, NULL);
+ if(!ok)
+ ErrorExit("EnumServicesStatusEx failed");
+
+
+ LPENUM_SERVICE_STATUS_PROCESS info =
+ (LPENUM_SERVICE_STATUS_PROCESS)buf;
+ int index=-1;
+ for (ULONG i=0; i < num_services; i++)
+ {
+ SC_HANDLE service= OpenService(scm, info[i].lpServiceName,
+ SERVICE_QUERY_CONFIG);
+ if (!service)
+ continue;
+ QUERY_SERVICE_CONFIGW *config=
+ (QUERY_SERVICE_CONFIGW*)(void *)configBuffer;
+ DWORD needed;
+ BOOL ok= QueryServiceConfigW(service, config,sizeof(configBuffer), &needed);
+ CloseServiceHandle(service);
+ if (ok)
+ {
+ mysqld_service_properties service_props;
+
+ if (get_mysql_service_properties(config->lpBinaryPathName,
+ &service_props))
+ continue;
+
+ /* Check if service uses mysqld in installation directory */
+ if (_strnicmp(service_props.mysqld_exe, m_InstallDir.c_str(),
+ m_InstallDir.size()) == 0)
+ continue;
+
+ if(m_MajorVersion > service_props.version_major ||
+ (m_MajorVersion == service_props.version_major && m_MinorVersion >=
+ service_props.version_minor))
+ {
+ ServiceProperties props;
+ props.myini= service_props.inifile;
+ props.datadir= service_props.datadir;
+ props.servicename = info[i].lpServiceName;
+ if (service_props.version_major)
+ {
+ char ver[64];
+ sprintf(ver, "%d.%d.%d", service_props.version_major,
+ service_props.version_minor, service_props.version_patch);
+ props.version= ver;
+ }
+ else
+ props.version= "<unknown>";
+
+ index = m_Services.AddString(info[i].lpServiceName);
+ services.resize(index+1);
+ services[index] = props;
+ }
+ }
+ if (index != -1)
+ {
+ m_Services.SetCurSel(0);
+ SelectService(m_Services.GetCurSel());
+ }
+ }
+ if (services.size())
+ {
+ SelectService(0);
+ }
+ else
+ {
+ char message[128];
+ sprintf(message,
+ "There is no service that can be upgraded to " PRODUCT_NAME " %d.%d.%d",
+ m_MajorVersion, m_MinorVersion, m_PatchVersion);
+ MessageBox(message, PRODUCT_NAME " Upgrade Wizard", MB_ICONINFORMATION);
+ exit(0);
+ }
+ if(scm)
+ CloseServiceHandle(scm);
+}
+
+BOOL CUpgradeDlg::OnInitDialog()
+{
+ CDialog::OnInitDialog();
+ m_UpgradeRunning= FALSE;
+ // Set the icon for this dialog. The framework does this automatically
+ // when the application's main window is not a dialog
+ SetIcon(m_hIcon, TRUE); // Set big icon
+ SetIcon(m_hIcon, FALSE); // Set small icon
+ m_Ok.SetWindowText("Upgrade");
+ m_DataDirLabel.SetWindowText("Data directory:");
+ m_IniFileLabel.SetWindowText("Configuration file:");
+ m_VersionLabel.SetWindowText("Version:");
+
+ char myFilename[MAX_PATH];
+ GetModuleFileName(NULL, myFilename, MAX_PATH);
+ char *p= strrchr(myFilename,'\\');
+ if(p)
+ p[1]=0;
+ m_InstallDir= myFilename;
+
+ GetMyVersion(&m_MajorVersion, &m_MinorVersion, &m_PatchVersion);
+ char windowTitle[64];
+
+ sprintf(windowTitle, PRODUCT_NAME " %d.%d.%d Upgrade Wizard",
+ m_MajorVersion, m_MinorVersion, m_PatchVersion);
+ SetWindowText(windowTitle);
+
+ m_JobObject= CreateJobObject(NULL, NULL);
+
+ /*
+ Make all processes associated with the job terminate when the
+ last handle to the job is closed or job is teminated.
+ */
+ JOBOBJECT_EXTENDED_LIMIT_INFORMATION jeli = {0};
+ jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
+ SetInformationJobObject(m_JobObject, JobObjectExtendedLimitInformation,
+ &jeli, sizeof(jeli));
+
+
+ m_Progress.ShowWindow(SW_HIDE);
+ m_Ok.EnableWindow(FALSE);
+ PopulateServicesList();
+ return TRUE; // return TRUE unless you set the focus to a control
+}
+
+// If you add a minimize button to your dialog, you will need the code below
+// to draw the icon. For MFC applications using the document/view model,
+// this is automatically done for you by the framework.
+
+void CUpgradeDlg::OnPaint()
+{
+ if (IsIconic())
+ {
+ CPaintDC dc(this); // device context for painting
+
+ SendMessage(WM_ICONERASEBKGND,
+ reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
+
+ // Center icon in client rectangle
+ int cxIcon = GetSystemMetrics(SM_CXICON);
+ int cyIcon = GetSystemMetrics(SM_CYICON);
+ CRect rect;
+ GetClientRect(&rect);
+ int x = (rect.Width() - cxIcon + 1) / 2;
+ int y = (rect.Height() - cyIcon + 1) / 2;
+
+ // Draw the icon
+ dc.DrawIcon(x, y, m_hIcon);
+ }
+ else
+ {
+ CDialog::OnPaint();
+ }
+}
+
+// The system calls this function to obtain the cursor to display while the user
+// drags the minimized window.
+HCURSOR CUpgradeDlg::OnQueryDragIcon()
+{
+ return static_cast<HCURSOR>(m_hIcon);
+}
+
+
+void CUpgradeDlg::OnLbnSelchangeList1()
+{
+ SelectService(m_Services.GetCurSel());
+}
+
+void CUpgradeDlg::OnChkChange()
+{
+ if(m_Services.GetCheck( m_Services.GetCurSel()))
+ {
+ GetDlgItem(IDOK)->EnableWindow();
+ }
+ else
+ {
+ for(int i=0; i< m_Services.GetCount(); i++)
+ {
+ if(m_Services.GetCheck(i))
+ return;
+ }
+ // all items unchecked, disable OK button
+ GetDlgItem(IDOK)->EnableWindow(FALSE);
+ }
+}
+
+
+
+void CUpgradeDlg::ErrorExit(LPCSTR str)
+{
+ MessageBox(str, "Fatal Error", MB_ICONERROR);
+ exit(1);
+}
+
+
+const int MAX_MESSAGES=512;
+
+/* Main thread of the child process */
+static HANDLE hChildThread;
+
+void CUpgradeDlg::UpgradeOneService(const string& servicename)
+{
+ static string allMessages[MAX_MESSAGES];
+ static char npname[MAX_PATH];
+ static char pipeReadBuf[1];
+ SECURITY_ATTRIBUTES saAttr;
+ STARTUPINFO si={0};
+ PROCESS_INFORMATION pi;
+ saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
+ saAttr.bInheritHandle = TRUE;
+ saAttr.lpSecurityDescriptor = NULL;
+
+ HANDLE hPipeRead, hPipeWrite;
+ if(!CreatePipe(&hPipeRead, &hPipeWrite, &saAttr, 1))
+ ErrorExit("CreateNamedPipe failed");
+
+ /* Make sure read end of the pipe is not inherited */
+ if (!SetHandleInformation(hPipeRead, HANDLE_FLAG_INHERIT, 0) )
+ ErrorExit("Stdout SetHandleInformation");
+
+ string commandline("mysql_upgrade_service.exe --service=");
+ commandline += servicename;
+ si.cb = sizeof(si);
+ si.hStdInput= GetStdHandle(STD_INPUT_HANDLE);
+ si.hStdOutput= hPipeWrite;
+ si.hStdError= hPipeWrite;
+ si.wShowWindow= SW_HIDE;
+ si.dwFlags= STARTF_USESTDHANDLES |STARTF_USESHOWWINDOW;
+
+
+ /*
+ We will try to assign child process to a job, to be able to
+ terminate the process and all of its children. It might fail,
+ in case current process is already part of the job which does
+ not allows breakaways.
+ */
+ if (CreateProcess(NULL, (LPSTR)commandline.c_str(), NULL, NULL, TRUE,
+ CREATE_BREAKAWAY_FROM_JOB|CREATE_SUSPENDED, NULL, NULL, &si, &pi))
+ {
+ if(!AssignProcessToJobObject(m_JobObject, pi.hProcess))
+ {
+ char errmsg[128];
+ sprintf(errmsg, "AssignProcessToJobObject failed, error %d",
+ GetLastError());
+ ErrorExit(errmsg);
+ }
+ ResumeThread(pi.hThread);
+ }
+ else
+ {
+ /*
+ Creating a process with CREATE_BREAKAWAY_FROM_JOB, reset this flag
+ and retry.
+ */
+ if (!CreateProcess(NULL, (LPSTR)commandline.c_str(), NULL, NULL, TRUE,
+ 0, NULL, NULL, &si, &pi))
+ {
+ string errmsg("Create Process ");
+ errmsg+= commandline;
+ errmsg+= " failed";
+ ErrorExit(errmsg.c_str());
+ }
+ }
+
+ hChildThread = pi.hThread;
+ DWORD nbytes;
+ int lines=0;
+ CloseHandle(hPipeWrite);
+
+ string output_line;
+ while(ReadFile(hPipeRead, pipeReadBuf, 1, &nbytes, NULL))
+ {
+ if(pipeReadBuf[0] == '\n')
+ {
+ 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);
+ }
+ else
+ {
+ if(pipeReadBuf[0] != '\r')
+ output_line.push_back(pipeReadBuf[0]);
+ }
+ }
+ CloseHandle(hPipeWrite);
+
+ if(WaitForSingleObject(pi.hProcess, INFINITE) != WAIT_OBJECT_0)
+ ErrorExit("WaitForSingleObject failed");
+ DWORD exitcode;
+ if (!GetExitCodeProcess(pi.hProcess, &exitcode))
+ ErrorExit("GetExitCodeProcess failed");
+
+ if (exitcode != 0)
+ {
+ string errmsg= "mysql_upgrade_service returned error for service ";
+ errmsg += servicename;
+ errmsg += ":\r\n";
+ errmsg+= output_line;
+ ErrorExit(errmsg.c_str());
+ }
+ CloseHandle(pi.hProcess);
+ hChildThread= 0;
+ CloseHandle(pi.hThread);
+}
+
+
+void CUpgradeDlg::UpgradeServices()
+{
+
+ /*
+ Disable some dialog items during upgrade (OK button,
+ services list)
+ */
+ m_Ok.EnableWindow(FALSE);
+ m_Services.EnableWindow(FALSE);
+ m_SelectAll.EnableWindow(FALSE);
+ m_ClearAll.EnableWindow(FALSE);
+
+ /*
+ Temporarily repurpose IniFileLabel/IniFilePath and
+ DatDirLabel/DataDir controls to show progress messages.
+ */
+ m_VersionLabel.ShowWindow(FALSE);
+ m_Version.ShowWindow(FALSE);
+ m_Progress.ShowWindow(TRUE);
+ m_IniFileLabel.SetWindowText("Converting service:");
+ m_IniFilePath.SetWindowText("");
+ m_DataDirLabel.SetWindowText("Progress message:");
+ m_DataDir.SetWindowText("");
+
+
+ m_ProgressTotal=0;
+ for(int i=0; i< m_Services.GetCount(); i++)
+ {
+ if(m_Services.GetCheck(i))
+ m_ProgressTotal++;
+ }
+ m_ProgressCurrent=0;
+ for(int i=0; i< m_Services.GetCount(); i++)
+ {
+ if(m_Services.GetCheck(i))
+ {
+ m_IniFilePath.SetWindowText(services[i].servicename.c_str());
+ m_Services.SelectString(0, services[i].servicename.c_str());
+ UpgradeOneService(services[i].servicename);
+ m_ProgressCurrent++;
+ }
+ }
+
+ MessageBox("Service(s) successfully upgraded", "Success",
+ MB_ICONINFORMATION);
+
+ /* Rebuild services list */
+ vector<ServiceProperties> new_instances;
+ for(int i=0; i< m_Services.GetCount(); i++)
+ {
+ if(!m_Services.GetCheck(i))
+ new_instances.push_back(services[i]);
+ }
+
+ services= new_instances;
+ m_Services.ResetContent();
+ for(size_t i=0; i< services.size();i++)
+ m_Services.AddString(services[i].servicename.c_str());
+ if(services.size())
+ {
+ m_Services.SelectString(0,services[0].servicename.c_str());
+ SelectService(0);
+ }
+ else
+ {
+ /* Nothing to do, there are no upgradable services */
+ exit(0);
+ }
+
+ /*
+ Restore controls that were temporarily repurposed for
+ progress info to their normal state
+ */
+ m_IniFileLabel.SetWindowText("Configuration file:");
+ m_DataDirLabel.SetWindowText("Data Directory:");
+ m_VersionLabel.ShowWindow(TRUE);
+ m_Version.ShowWindow(TRUE);
+ m_Progress.SetPos(0);
+ m_Progress.ShowWindow(FALSE);
+
+ /* Re-enable controls */
+ m_Ok.EnableWindow(TRUE);
+ m_Services.EnableWindow(TRUE);
+ m_SelectAll.EnableWindow(TRUE);
+ m_ClearAll.EnableWindow(TRUE);
+
+ m_UpgradeRunning= FALSE;
+}
+
+
+/* Thread procedure for upgrade services operation */
+static UINT UpgradeServicesThread(void *param)
+{
+ CUpgradeDlg *dlg= (CUpgradeDlg *)param;
+ dlg->UpgradeServices();
+ return 0;
+}
+
+
+/*
+ Do upgrade for all services currently selected
+ in the list. Since it is a potentially lengthy operation that
+ might block it has to be done in a background thread.
+*/
+void CUpgradeDlg::OnBnClickedOk()
+{
+ if(m_UpgradeRunning)
+ return;
+ m_UpgradeRunning= TRUE;
+ AfxBeginThread(UpgradeServicesThread, this);
+}
+
+
+/*
+ Cancel button clicked.
+ If upgrade is running, suspend mysql_upgrade_service,
+ and ask user whether he really wants to stop.Terminate
+ upgrade wizard and all subprocesses if users wants it.
+
+ If upgrade is not running, terminate the Wizard
+*/
+void CUpgradeDlg::OnBnClickedCancel()
+{
+ if(m_UpgradeRunning)
+ {
+ bool suspended = (SuspendThread(hChildThread) != (DWORD)-1);
+ int ret = MessageBox(
+ "Upgrade is in progress. Are you sure you want to terminate?",
+ 0, MB_YESNO|MB_DEFBUTTON2|MB_ICONQUESTION);
+ if(ret != IDYES)
+ {
+ if(suspended)
+ ResumeThread(hChildThread);
+ return;
+ }
+ }
+ TerminateJobObject(m_JobObject, 1);
+ exit(1);
+}
+
+/*
+ Select all services from the list
+*/
+void CUpgradeDlg::OnBnSelectAll()
+{
+ for(int i=0; i < m_Services.GetCount(); i++)
+ m_Services.SetCheck(i, 1);
+ m_Ok.EnableWindow(TRUE);
+}
+
+/*
+ Clear all services in the list
+*/
+void CUpgradeDlg::OnBnClearAll()
+{
+ for(int i=0; i < m_Services.GetCount(); i++)
+ m_Services.SetCheck(i, 0);
+ m_Ok.EnableWindow(FALSE);
+}
diff --git a/win/upgrade_wizard/upgradeDlg.h b/win/upgrade_wizard/upgradeDlg.h
new file mode 100644
index 00000000000..97243291748
--- /dev/null
+++ b/win/upgrade_wizard/upgradeDlg.h
@@ -0,0 +1,73 @@
+
+// upgradeDlg.h : header file
+//
+
+#pragma once
+#include "afxcmn.h"
+#include "afxwin.h"
+#include <string>
+
+
+// CUpgradeDlg dialog
+class CUpgradeDlg : public CDialog
+{
+ // Construction
+public:
+ CUpgradeDlg(CWnd* pParent = NULL); // standard constructor
+
+ // Dialog Data
+ enum { IDD = IDD_UPGRADE_DIALOG };
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+ // job object for current process and children
+ HANDLE m_JobObject;
+
+ // Services are being upgraded
+ BOOL m_UpgradeRunning;
+
+ // ProgressBar related: number of services to upgrade
+ int m_ProgressTotal;
+
+ //ProgressBar related: current service being upgraded
+ int m_ProgressCurrent;
+
+protected:
+ HICON m_hIcon;
+
+ // Generated message map functions
+ virtual BOOL OnInitDialog();
+ void PopulateServicesList();
+ afx_msg void OnPaint();
+ afx_msg HCURSOR OnQueryDragIcon();
+ DECLARE_MESSAGE_MAP()
+public:
+ void SelectService(int index);
+ void UpgradeServices();
+ void UpgradeOneService(const std::string& name);
+ void ErrorExit(const char *);
+ std::string m_InstallDir;
+ CCheckListBox m_Services;
+ CProgressCtrl m_Progress;
+ CButton m_Ok;
+ CButton m_Cancel;
+ CButton m_SelectAll;
+ CButton m_ClearAll;
+ int m_MajorVersion;
+ int m_MinorVersion;
+ int m_PatchVersion;
+
+ CEdit m_IniFilePath;
+ afx_msg void OnLbnSelchangeList1();
+ afx_msg void OnChkChange();
+ CEdit m_DataDir;
+ CEdit m_Version;
+ afx_msg void OnBnClickedOk();
+ afx_msg void OnBnClickedCancel();
+ afx_msg void OnBnSelectAll();
+ afx_msg void OnBnClearAll();
+ CEdit m_IniFileLabel;
+ CEdit m_DataDirLabel;
+ CEdit m_VersionLabel;
+};
diff --git a/win/upgrade_wizard/upgrade_wizard.exe.manifest b/win/upgrade_wizard/upgrade_wizard.exe.manifest
new file mode 100644
index 00000000000..6b40eebcbd9
--- /dev/null
+++ b/win/upgrade_wizard/upgrade_wizard.exe.manifest
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+ <security>
+ <requestedPrivileges>
+ <requestedExecutionLevel level="requireAdministrator" uiAccess="false"></requestedExecutionLevel>
+ </requestedPrivileges>
+ </security>
+ </trustInfo>
+ <dependency>
+ <dependentAssembly>
+ <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"></assemblyIdentity>
+ </dependentAssembly>
+ </dependency>
+</assembly> \ No newline at end of file