summaryrefslogtreecommitdiff
path: root/win
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@montyprogram.com>2011-01-29 18:51:12 +0100
committerVladislav Vaintroub <wlad@montyprogram.com>2011-01-29 18:51:12 +0100
commitb19e99865ccf3e946ebe59bf09add8e0452904ac (patch)
tree23cb9e8176ef9d0e276b47d197e11d195b2ecafb /win
parent3edf4dcd5a36be8d5acc94e0c5e29e77e47cd15b (diff)
downloadmariadb-git-b19e99865ccf3e946ebe59bf09add8e0452904ac.tar.gz
MWL#55 : cherrypick MySQL 5.5 CMake/build improvements in order
to be able to build MSI based installer
Diffstat (limited to 'win')
-rw-r--r--win/Makefile.am38
-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.in84
-rw-r--r--win/cmake/install_layout.cmake223
-rw-r--r--win/cmake/install_macros.cmake338
-rw-r--r--win/cmake/mysql_add_executable.cmake56
-rw-r--r--win/cmake/mysql_version.cmake140
-rw-r--r--win/cmake/package_name.cmake134
-rw-r--r--win/cmake/versioninfo.rc.in23
-rw-r--r--win/make_mariadb_win_dist7
12 files changed, 1175 insertions, 2 deletions
diff --git a/win/Makefile.am b/win/Makefile.am
index 19a1b6a64d6..b657acfd65c 100644
--- a/win/Makefile.am
+++ b/win/Makefile.am
@@ -18,5 +18,39 @@ 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-vs10.bat build-vs10_x64.bat
-
+ 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 \
+ 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_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..f2b8c67bcf2
--- /dev/null
+++ b/win/cmake/create_initial_db.cmake.in
@@ -0,0 +1,84 @@
+# 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=.
+ --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/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..ac59c8ecf66
--- /dev/null
+++ b/win/cmake/install_macros.cmake
@@ -0,0 +1,338 @@
+# 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)
+ IF(NOT SIGNTOOL_EXECUTABLE)
+ MESSAGE(FATAL_ERROR
+ "signtool is not found. Signing executables not possible")
+ ENDIF()
+ IF(NOT DEFINED SIGNCODE_ENABLED)
+ FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/testsign.c "int main(){return 0;}")
+ MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/testsign)
+ TRY_COMPILE(RESULT ${CMAKE_CURRENT_BINARY_DIR}/testsign ${CMAKE_CURRENT_BINARY_DIR}/testsign.c
+ COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/testsign.exe
+ )
+
+ EXECUTE_PROCESS(COMMAND
+ ${SIGNTOOL_EXECUTABLE} sign ${SIGNTOOL_PARAMETERS} ${CMAKE_CURRENT_BINARY_DIR}/testsign.exe
+ RESULT_VARIABLE ERR ERROR_QUIET OUTPUT_QUIET
+ )
+ IF(ERR EQUAL 0)
+ SET(SIGNCODE_ENABLED 1 CACHE INTERNAL "Can sign executables")
+ ELSE()
+ MESSAGE(STATUS "Disable authenticode signing for executables")
+ SET(SIGNCODE_ENABLED 0 CACHE INTERNAL "Invalid or missing certificate")
+ ENDIF()
+ 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}\" sign ${SIGNTOOL_PARAMETERS} \"${target_location}\"
+ RESULT_VARIABLE ERR)
+ 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 AND SIGNCODE_ENABLED)
+ 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..728ee409257
--- /dev/null
+++ b/win/cmake/mysql_version.cmake
@@ -0,0 +1,140 @@
+
+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 "Source 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)
+ 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..97c45ec86c0
--- /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@,0
+PRODUCTVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH@,0
+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@.0\0"
+ VALUE "ProductVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH@.0\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1252
+ END
+END
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"