Commit c827968a authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Handle different installation layouts.

using  cmake option INSTALL_LAYOUT=STANDALONE would produce the layout as in 
tar.gz or zip packages.
INSTALL_LAYOUT=UNIX will produce unixish install layout  (with mysqld being in sbin subdirectory , libs in lib/mysql etc). This layout is used for RPM packages.

Subtle differences in both packages unfortunately lead to the need to recompile MySQL to use with other package type - as otherwise for example default plugins or data directories would be wrong set.

There are numerous other variables that  allow fine-tuning packaging layout. (INSTALL_BINDIR, INSTALL_LIBDIR , INSTALL_PLUGINDIR etc).

This options are different from autotools as they do not expect full paths to directories, but only subdirectory of CMAKE_INSTALL_PREFIX.

There are 2 special options that expect full directory paths
- MYSQL_DATADIR that defines default MYSQL data directory (autotools equivalent
is --localstatedir)
- SYSCONFDIR  can be added to search my.cnf search path (autotools equivalent is --sysconfdir)
parent 80f57fb2
......@@ -82,6 +82,7 @@ INCLUDE(libutils)
INCLUDE(dtrace)
INCLUDE(plugin)
INCLUDE(install_macros)
INCLUDE(install_layout)
INCLUDE(mysql_add_executable)
# Handle options
......@@ -165,12 +166,17 @@ IF(WIN32)
SET(SHAREDIR share)
ELSE()
SET(DEFAULT_MYSQL_HOME ${CMAKE_INSTALL_PREFIX})
SET(SHAREDIR ${DEFAULT_MYSQL_HOME}/share)
SET(SHAREDIR ${DEFAULT_MYSQL_HOME}/${INSTALL_MYSQLSHAREDIR})
ENDIF()
SET(DEFAULT_BASEDIR "${DEFAULT_MYSQL_HOME}")
SET(MYSQL_DATADIR "${DEFAULT_MYSQL_HOME}/data")
SET(MYSQL_DATADIR "${DEFAULT_MYSQL_HOME}/${INSTALL_MYSQLDATADIR}" CACHE PATH
"default MySQL data directory")
SET(DEFAULT_CHARSET_HOME "${DEFAULT_MYSQL_HOME}")
SET(PLUGINDIR "${DEFAULT_MYSQL_HOME}/${INSTALL_PLUGINDIR}")
IF(SYSCONFDIR)
SET(DEFAULT_SYSCONFDIR "${SYSCONFDIR}")
ENDIF()
# Optionally read user configuration, generated by configure.js.
......@@ -255,11 +261,11 @@ ELSE()
SET(CPACK_GENERATOR "TGZ")
ENDIF()
INCLUDE(CPack)
INSTALL(FILES COPYING EXCEPTIONS-CLIENT README DESTINATION .)
INSTALL(FILES COPYING EXCEPTIONS-CLIENT README DESTINATION ${INSTALL_DOCREADMEDIR})
IF(UNIX)
INSTALL(FILES Docs/INSTALL-BINARY DESTINATION .)
INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR})
ENDIF()
# MYSQL_DOCS_LOCATON is used in "make dist", points to the documentation directory
SET(MYSQL_DOCS_LOCATION "" CACHE PATH "Location from where documentation is copied")
MARK_AS_ADVANCED(MYSQL_DOCS_LOCATION)
INSTALL(DIRECTORY Docs DESTINATION .)
INSTALL(DIRECTORY Docs/ DESTINATION ${INSTALL_DOCDIR})
......@@ -21,4 +21,5 @@ EXTRA_DIST = \
merge_archives_unix.cmake.in \
dtrace_prelink.cmake \
versioninfo.rc.in \
mysql_add_executable.cmake
mysql_add_executable.cmake \
install_layout.cmake
......@@ -11,7 +11,6 @@ my $srcdir = dirname(dirname(abs_path($0)));
foreach my $option (@ARGV)
{
if (substr ($option, 0, 2) == "--")
{
$option = substr($option, 2);
......@@ -83,6 +82,12 @@ foreach my $option (@ARGV)
$cmakeargs = $cmakeargs." -DWITH_CHARSETS=complex";
next;
}
if ($option =~ /localstatedir=/)
{
$cmakeargs = $cmakeargs." -DMYSQL_DATADIR=".substr($option,14);
next;
}
$option = uc($option);
$option =~ s/-/_/g;
$cmakeargs = $cmakeargs." -D".$option."=1";
......
# 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.
# Currently, there are 2 different installation layouts ,
# one is used in tar.gz packages (Windows zip is about the same), another one
# in RPMs.
# There are currently 2 layouts defines, named STANDALONE (tar.gz layout)
# and UNIX (rpm layout). To force a directory layout when invoking cmake use
# -DINSTALL_LAYOUT=[STANDALONE|UNIX].
# This wil use a predefined layout. There is a possibility to further fine-tune
# installation directories. Several variables are can be overwritten
#
# - INSTALL_BINDIR (directory with client executables and Unix shell scripts)
# - INSTALL_SBINDIR (directory with mysqld)
# - INSTALL_LIBDIR (directory with client end embedded libraries)
# - INSTALL_PLUGINDIR (directory for plugins)
# - INSTALL_INCLUDEDIR (directory for MySQL headers)
# - INSTALL_DOCDIR (documentation)
# - INSTALL_MANDIR (man pages)
# - INSTALL_SCRIPTDIR (several scripts, rarely used)
# - INSTALL_MYSQLSHAREDIR (MySQL character sets and localized error messages)
# - INSTALL_SHAREDIR (location of aclocal/mysql.m4)
# - INSTALL_SQLBENCHDIR (sql-bench)
# - INSTALL_MYSQLTESTDIR (mysql-test)
# - INSTALL_DOCREADMEDIR (readme and similar)
# - INSTALL_SUPPORTFILESDIR (used only in standalone installer)
# Default installation layout on Unix is UNIX (kent wants it so)
IF(NOT INSTALL_LAYOUT)
IF(WIN32)
SET(DEFAULT_INSTALL_LAYOUT "STANDALONE")
ELSE()
SET(DEFAULT_INSTALL_LAYOUT "UNIX")
ENDIF()
ENDIF()
SET(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}"
CACHE STRING "Installation directory layout. Options are: STANDALONE (as in zip or tar.gz installer) or UNIX")
IF(NOT INSTALL_LAYOUT MATCHES "STANDALONE")
IF(NOT INSTALL_LAYOUT MATCHES "UNIX")
SET(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}")
ENDIF()
ENDIF()
IF(UNIX)
IF(INSTALL_LAYOUT MATCHES "UNIX")
SET(default_prefix "/usr")
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(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_LIBDIR_STANDALONE "lib")
SET(INSTALL_INCLUDEDIR_STANDALONE "include")
SET(INSTALL_PLUGINDIR_STANDALONE "lib/plugin")
SET(INSTALL_DOCDIR_STANDALONE "doc")
SET(INSTALL_MANDIR_STANDALONE "man")
SET(INSTALL_MYSQLSHAREDIR_STANDALONE "share")
SET(INSTALL_SHAREDIR_STANDALONE "share")
SET(INSTALL_SCRIPTDIR_STANDALONE "scripts")
SET(INSTALL_MYSQLTESTDIR_STANDALONE "mysql-test")
SET(INSTALL_SQLBENCHROOTDIR_STANDALONE ".")
SET(INSTALL_DOCREADMEDIR_STANDALONE ".")
SET(INSTALL_SUPPORTFILESDIR_STANDALONE "support-files")
SET(INSTALL_MYSQLDATADIR_STANDALONE "data")
# UNIX layout
SET(INSTALL_BINDIR_UNIX "bin")
SET(INSTALL_SBINDIR_UNIX "sbin")
SET(INSTALL_LIBDIR_UNIX "lib/mysql")
SET(INSTALL_PLUGINDIR_UNIX "lib/mysql/plugin")
SET(INSTALL_DOCDIR_UNIX "share/mysql/doc/MySQL-server-${MYSQL_NO_DASH_VERSION}")
SET(INSTALL_MANDIR_UNIX "share/mysql/man")
SET(INSTALL_INCLUDEDIR_UNIX "include/mysql")
SET(INSTALL_MYSQLSHAREDIR_UNIX "share/mysql")
SET(INSTALL_SHAREDIR_UNIX "share")
SET(INSTALL_SCRIPTDIR_UNIX "bin")
SET(INSTALL_MYSQLTESTDIR_UNIX "mysql-test")
SET(INSTALL_SQLBENCHROOTDIR_UNIX "")
SET(INSTALL_DOCREADMEDIR_UNIX "share/mysql/doc/MySQL-server-${MYSQL_NO_DASH_VERSION}")
SET(INSTALL_SUPPORTFILESDIR_UNIX "")
SET(INSTALL_MYSQLDATADIR_STANDALONE "var")
# Clear cached variables if install layout was changed
IF(OLD_INSTALL_LAYOUT)
IF(NOT OLD_INSTALL_LAYOUT STREQUAL INSTALL_LAYOUR)
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
MYSQLTEST SQLBENCHROOT 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()
......@@ -257,7 +257,7 @@ MACRO(MERGE_LIBRARIES)
MESSAGE(FATAL_ERROR "Unknown library type")
ENDIF()
IF(NOT ARG_NOINSTALL)
MYSQL_INSTALL_TARGETS(${TARGET} DESTINATION lib)
MYSQL_INSTALL_TARGETS(${TARGET} DESTINATION "${INSTALL_LIBDIR}")
ENDIF()
ENDMACRO()
......
......@@ -29,7 +29,7 @@ INCLUDE(cmake_parse_arguments)
FUNCTION (MYSQL_ADD_EXECUTABLE)
# Pass-through arguments for ADD_EXECUTABLE
CMAKE_PARSE_ARGUMENTS(ARG
"WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL"
"WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL;DESTINATION"
""
${ARGN}
)
......@@ -41,6 +41,9 @@ FUNCTION (MYSQL_ADD_EXECUTABLE)
ADD_EXECUTABLE(${target} ${ARG_WIN32} ${ARG_MACOSX_BUNDLE} ${ARG_EXCLUDE_FROM_ALL} ${sources})
# tell CPack where to install
IF(NOT ARG_EXCLUDE_FROM_ALL)
MYSQL_INSTALL_TARGETS(${target} DESTINATION bin)
IF(NOT ARG_DESTINATION)
SET(ARG_DESTINATION ${INSTALL_BINDIR})
ENDIF()
MYSQL_INSTALL_TARGETS(${target} DESTINATION ${ARG_DESTINATION})
ENDIF()
ENDFUNCTION()
\ No newline at end of file
......@@ -162,8 +162,7 @@ MACRO(MYSQL_ADD_PLUGIN)
SET_TARGET_PROPERTIES(${target} PROPERTIES
OUTPUT_NAME "${ARG_MODULE_OUTPUT_NAME}")
# Install dynamic library
SET(INSTALL_LOCATION lib/plugin)
MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_LOCATION})
MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR})
ENDIF()
ENDMACRO()
......
......@@ -636,6 +636,8 @@
#cmakedefine DEFAULT_BASEDIR "@DEFAULT_BASEDIR@"
#cmakedefine MYSQL_DATADIR "@MYSQL_DATADIR@"
#cmakedefine DEFAULT_CHARSET_HOME "@DEFAULT_CHARSET_HOME@"
#cmakedefine PLUGINDIR "@PLUGINDIR@"
#cmakedefine DEFAULT_SYSCONFDIR "@DEFAULT_SYSCONFDIR@"
#define PACKAGE "mysql"
#define PACKAGE_BUGREPORT ""
......
......@@ -54,8 +54,7 @@ SET(HEADERS
${HEADERS_GEN_CONFIGURE}
)
INSTALL(FILES ${HEADERS} DESTINATION include)
INSTALL(DIRECTORY mysql/ DESTINATION include
FILES_MATCHING PATTERN "*.h")
INSTALL(FILES ${HEADERS} DESTINATION ${INSTALL_INCLUDEDIR})
INSTALL(DIRECTORY mysql/ DESTINATION ${INSTALL_INCLUDEDIR} FILES_MATCHING PATTERN "*.h")
......@@ -154,7 +154,7 @@ SET(LIBS clientlib dbug strings vio mysys ${ZLIB_LIBRARY} ${SSL_LIBRARIES})
# and link them together into shared library.
MERGE_LIBRARIES(mysqlclient STATIC ${LIBS})
IF(UNIX)
INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r mysqlclient lib)
INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r mysqlclient ${INSTALL_LIBDIR})
ENDIF()
IF(NOT DISABLE_SHARED)
......@@ -177,6 +177,6 @@ IF(NOT DISABLE_SHARED)
#(mysqlclient in this case)
SET_TARGET_PROPERTIES(mysqlclient PROPERTIES CLEAN_DIRECT_OUTPUT 1)
SET_TARGET_PROPERTIES(libmysql PROPERTIES CLEAN_DIRECT_OUTPUT 1)
INSTALL_SYMLINK(${CMAKE_SHARED_LIBRARY_PREFIX}mysqlclient_r libmysql lib)
INSTALL_SYMLINK(${CMAKE_SHARED_LIBRARY_PREFIX}mysqlclient_r libmysql ${INSTALL_LIBDIR})
ENDIF()
ENDIF()
......@@ -17,8 +17,8 @@
FILE(GLOB MAN1_FILES *.1)
FILE(GLOB MAN8_FILES *.8)
IF(MAN1_FILES)
INSTALL(FILES ${MAN1_FILES} DESTINATION man/man1)
INSTALL(FILES ${MAN1_FILES} DESTINATION ${INSTALL_MANDIR}/man1)
ENDIF()
IF(MAN8_FILES)
INSTALL(FILES ${MAN8_FILES} DESTINATION man/man8)
INSTALL(FILES ${MAN8_FILES} DESTINATION ${INSTALL_MANDIR}/man8)
ENDIF()
......@@ -15,13 +15,14 @@
INSTALL(
DIRECTORY .
DESTINATION mysql-test
DESTINATION ${INSTALL_MYSQLTESTDIR}
PATTERN "var/" EXCLUDE
PATTERN "lib/My/SafeProcess" EXCLUDE
PATTERN "CPack" EXCLUDE
PATTERN "CMake" EXCLUDE
PATTERN "mtr.out" EXCLUDE
PATTERN "CMake*" EXCLUDE
PATTERN "mtr.out*" EXCLUDE
PATTERN ".cvsignore" EXCLUDE
PATTERN "*.am" EXCLUDE
)
......
......@@ -24,4 +24,4 @@ INSTALL(TARGETS my_safe_process DESTINATION "mysql-test/lib/My/SafeProcess")
IF(WIN32)
INSTALL(TARGETS my_safe_kill DESTINATION "mysql-test/lib/My/SafeProcess")
ENDIF()
INSTALL(FILES safe_process.pl Base.pm DESTINATION "mysql-test/lib/My/SafeProcess")
INSTALL(FILES safe_process.pl Base.pm DESTINATION "${INSTALL_MYSQLTESTDIR}/lib/My/SafeProcess")
......@@ -66,7 +66,7 @@ INSTALL(FILES
${CMAKE_CURRENT_SOURCE_DIR}/mysql_system_tables_data.sql
${CMAKE_CURRENT_SOURCE_DIR}/fill_help_tables.sql
${CMAKE_CURRENT_SOURCE_DIR}/mysql_test_data_timezone.sql
DESTINATION share
DESTINATION ${INSTALL_MYSQLSHAREDIR}
)
# TCMalloc hacks
......@@ -137,13 +137,23 @@ ENDIF(UNIX)
# i.e. makes access relative the current directory. This matches
# the documentation, so better not change this.
SET(prefix .)
SET(bindir ./bin)
SET(sbindir ./bin)
SET(scriptdir ./bin)
SET(libexecdir ./bin)
SET(pkgdatadir ./share)
SET(localstatedir ./data)
IF(INSTALL_LAYOUT MATCHES "STANDALONE")
SET(prefix ".")
ELSE()
SET(prefix "${CMAKE_INSTALL_PREFIX}")
ENDIF()
SET(bindir ${prefix}/${INSTALL_BINDIR})
SET(sbindir ${prefix}/${INSTALL_SBINDIR})
SET(scriptdir ${prefix}/${INSTALL_BINDIR})
SET(libexecdir ${prefix}/${INSTALL_SBINDIR})
SET(pkgdatadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
IF(INSTALL_LAYOUT MATCHES "STANDALONE")
SET(localstatedir ${prefix}/data)
ELSE()
SET(localstatedir ${MYSQL_DATADIR})
ENDIF()
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_install_db.sh
${CMAKE_CURRENT_BINARY_DIR}/mysql_install_db ESCAPE_QUOTES @ONLY)
......@@ -158,15 +168,16 @@ INSTALL(FILES
SET(prefix "${CMAKE_INSTALL_PREFIX}")
SET(sysconfdir ${prefix})
SET(bindir ${prefix}/bin)
SET(libexecdir ${prefix}/bin)
SET(scriptdir ${prefix}/bin)
SET(datadir ${prefix}/share)
SET(pkgdatadir ${prefix}/share)
SET(pkgincludedir ${prefix}/include)
SET(pkglibdir ${prefix}/lib)
SET(pkgplugindir ${prefix}/lib/plugin)
SET(localstatedir ${prefix}/data)
SET(bindir ${prefix}/${INSTALL_BINDIR})
SET(libexecdir ${prefix}/${INSTALL_SBINDIR})
SET(scriptdir ${prefix}/${INSTALL_BINDIR})
SET(datadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
SET(pkgdatadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
SET(pkgincludedir ${prefix}/${INSTALL_INCLUDEDIR})
SET(pkglibdir ${prefix}/${INSTALL_LIBDIR})
SET(pkgplugindir ${prefix}/${INSTALL_PLUGINDIR})
SET(localstatedir ${MYSQL_DATADIR})
# some scripts use @TARGET_LINUX@
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(TARGET_LINUX 1)
......@@ -242,7 +253,7 @@ IF(WIN32)
${CMAKE_CURRENT_BINARY_DIR}/${file}.pl ESCAPE_QUOTES @ONLY)
INSTALL(FILES
"CMAKE_CURRENT_BINARY_DIR}/${file}.pl"
${CMAKE_CURRENT_BINARY_DIR}/${file}.pl
DESTINATION scripts
PERMISSIONS OWNER_READ OWNER_WRITE
OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
......@@ -254,7 +265,7 @@ IF(WIN32)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh
${CMAKE_CURRENT_BINARY_DIR}/${file}.pl ESCAPE_QUOTES @ONLY)
INSTALL(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${file}.pl"
${CMAKE_CURRENT_BINARY_DIR}/${file}.pl
DESTINATION scripts
PERMISSIONS OWNER_READ OWNER_WRITE
OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
......@@ -279,6 +290,7 @@ ELSE()
mysqld_multi
mysqlaccess
mysqlaccess.conf
mysqld_safe
)
FOREACH(file ${BIN_SCRIPTS})
IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${file}.sh)
......@@ -291,38 +303,18 @@ ELSE()
MESSAGE(FATAL_ERROR "Can not find ${file}.sh or ${file} in "
"${CMAKE_CURRENT_SOURCE_DIR}" )
ENDIF()
INSTALL(FILES
${CMAKE_CURRENT_BINARY_DIR}/${file}
DESTINATION bin
DESTINATION ${INSTALL_BINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE
OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
ENDFOREACH()
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysqld_safe.sh
${CMAKE_CURRENT_BINARY_DIR}/mysqld_safe @ONLY)
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/mysqld_safe"
DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE
OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
# For some reason, mysqld_safe needs to be also in scripts directory
INSTALL(FILES
"${CMAKE_CURRENT_BINARY_DIR}/mysqld_safe"
DESTINATION scripts
PERMISSIONS OWNER_READ OWNER_WRITE
OWNER_EXECUTE GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
ENDIF()
# Install libgcc as mylibgcc.a
IF(CMAKE_COMPILER_IS_GNUCXX)
IF(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_FLAGS MATCHES "-static")
EXECUTE_PROCESS (
COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1}
${CMAKE_CXX_FLAGS} --print-libgcc
......@@ -332,7 +324,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
ERROR_QUIET
)
IF(${RESULT} EQUAL 0 AND EXISTS ${LIBGCC_LOCATION})
INSTALL(FILES "${LIBGCC_LOCATION}" DESTINATION lib)
INSTALL(FILES "${LIBGCC_LOCATION}" DESTINATION ${INSTALL_LIBDIR})
ENDIF()
ENDIF()
......@@ -361,6 +361,9 @@ then
if test -x "$MY_BASEDIR_VERSION/libexec/mysqld"
then
ledir="$MY_BASEDIR_VERSION/libexec"
elif test -x "$MY_BASEDIR_VERSION/sbin/mysqld"
then
ledir="$MY_BASEDIR_VERSION/sbin"
else
ledir="$MY_BASEDIR_VERSION/bin"
fi
......@@ -373,6 +376,10 @@ elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/libexec/mysqld"
then
MY_BASEDIR_VERSION="$MY_PWD" # Where libexec, share and var are
ledir="$MY_PWD/libexec" # Where mysqld is
elif test -f "$relpkgdata"/english/errmsg.sys -a -x "$MY_PWD/sbin/mysqld"
then
MY_BASEDIR_VERSION="$MY_PWD" # Where sbin, share and var are
ledir="$MY_PWD/sbin" # Where mysqld is
# Since we didn't find anything, used the compiled-in defaults
else
MY_BASEDIR_VERSION='@prefix@'
......
......@@ -22,6 +22,16 @@ ${CMAKE_SOURCE_DIR}/sql-bench/Comments/*
${CMAKE_SOURCE_DIR}/sql-bench/limits/*
)
IF(NOT INSTALL_SQLBENCHDIR)
RETURN()
ENDIF()
IF(INSTALL_SQLBENCHROOTDIR STREQUAL ".")
SET(prefix)
ELSE()
SET(prefix ${INSTALL_SQLBENCHROOTDIR}/)
ENDIF()
GET_FILENAME_COMPONENT(basedir ${CMAKE_SOURCE_DIR} ABSOLUTE)
FOREACH(file ${all_files})
IF(NOT IS_DIRECTORY ${file} AND NOT ${file} MATCHES "Make" )
......@@ -42,10 +52,10 @@ FOREACH(file ${all_files})
CONFIGURE_FILE(${file} ${target} COPYONLY)
IF (ext MATCHES ".bat")
IF(WIN32)
INSTALL(FILES ${target} DESTINATION ${dir})
INSTALL(FILES ${target} DESTINATION ${prefix}${dir})
ENDIF()
ELSE()
INSTALL(FILES ${target} DESTINATION ${dir})
INSTALL(FILES ${target} DESTINATION ${prefix}${dir})
ENDIF()
ENDIF()
ENDFOREACH()
......@@ -100,7 +100,7 @@ ELSE()
SET(MYSQLD_SOURCE main.cc ${DTRACE_PROBES_ALL})
ENDIF()
MYSQL_ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE})
MYSQL_ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE} DESTINATION ${INSTALL_SBINDIR})
IF(NOT WITHOUT_DYNAMIC_PLUGINS)
SET_TARGET_PROPERTIES(mysqld PROPERTIES ENABLE_EXPORTS TRUE)
......@@ -231,11 +231,11 @@ ADD_CUSTOM_TARGET(dist
IF(INSTALL_LAYOUT STREQUAL "STANDALONE")
# We need to create empty directories (data/test) the installation.
# This does not work with current CPack due to http://www.cmake.org/Bug/view.php?id=8767
# Avoid completely empty directories and install dummy file instead.
SET(DUMMY_FILE ${CMAKE_CURRENT_BINARY_DIR}/.empty )
FILE(WRITE ${DUMMY_FILE} "")
INSTALL(FILES ${DUMMY_FILE} DESTINATION data/test)
......@@ -271,3 +271,5 @@ ELSE()
# Not windows or cross compiling, just install an empty directory
INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql)
ENDIF()
ENDIF()
......@@ -45,8 +45,8 @@ SET(files
FOREACH (dir ${dirs})
INSTALL(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${dir}
DESTINATION share)
DESTINATION ${INSTALL_MYSQLSHAREDIR})
ENDFOREACH()
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/charsets DESTINATION share)
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/charsets DESTINATION ${INSTALL_MYSQLSHAREDIR})
INSTALL(FILES ${files} DESTINATION share)
INSTALL(FILES ${files} DESTINATION ${INSTALL_MYSQLSHAREDIR})
......@@ -15,59 +15,68 @@
IF(WIN32)
SET(localstatedir "C:\\mysql\\data")
SET(install_destination .)
SET(ini_file_extension "ini")
ELSE()
SET(localstatedir "/usr/local/mysql/data")
SET(prefix "/usr/local")
SET(libexedir "/usr/local/mysql/bin")
SET(bindir "/usr/local/mysql/bin" )
SET(sbindir "/usr/local/mysql/bin")
SET(datadir "/usr/local/mysql/data")
SET(localstatedir "${MYSQL_DATADIR}")
SET(prefix "${CMAKE_INSTALL_PREFIX}")
SET(libexecdir "${CMAKE_INSTALL_PREFIX}/${INSTALL_SBINDIR}")
SET(bindir "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}" )
SET(sbindir "${libexecdir}")
SET(datadir "${MYSQL_DATADIR}")
SET(CC ${CMAKE_C_COMPILER})
SET(CXX ${CMAKE_CXX_COMPILER})
SET(CFLAGS ${CMAKE_C_FLAGS})
SET(CXXFLAGS ${CMAKE_CXX_FLAGS})
SET(MYSQLD_USER "mysql")
SET(install_destination "support-files")
SET(ini_file_extension "cnf")
ENDIF()
FOREACH(inifile my-huge my-innodb-heavy-4G my-large my-medium my-small)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${inifile}.cnf.sh
${CMAKE_CURRENT_BINARY_DIR}/${inifile}.${ini_file_extension} @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${inifile}.${ini_file_extension} DESTINATION ${install_destination})
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${inifile}.${ini_file_extension} DESTINATION ${INSTALL_DOCREADMEDIR})
ENDFOREACH()
IF(UNIX)
IF(INSTALL_LAYOUT MATCHES "STANDALONE")
SET(prefix ".")
SET(inst_location ${INSTALL_SUPPORTFILESDIR})
ELSE()
SET(prefix ${CMAKE_INSTALL_PREFIX})
SET(inst_location ${INSTALL_MYSQLSHAREDIR})
ENDIF()
FILE(GLOB ndb_ini_files ${CMAKE_CURRENT_SOURCE_DIR}/*.ini)
INSTALL(FILES ${ndb_ini_files} DESTINATION ${install_destination})
INSTALL(FILES ${ndb_ini_files} DESTINATION ${inst_location})
FOREACH(script mysqld_multi.server mysql-log-rotate)
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${script}.sh
${CMAKE_CURRENT_BINARY_DIR}/${script} @ONLY )
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${script} DESTINATION support-files
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${script}
DESTINATION ${inst_location}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
ENDFOREACH()
INSTALL(FILES magic DESTINATION support-files)
INSTALL(FILES mysql.m4 DESTINATION share/aclocal)
IF(INSTALL_SUPPORTFILESDIR)
INSTALL(FILES magic DESTINATION ${inst_location})
ENDIF()
INSTALL(FILES mysql.m4 DESTINATION ${INSTALL_SHAREDIR}/aclocal)
CONFIGURE_FILE(MySQL-shared-compat.spec.sh ${CMAKE_CURRENT_BINARY_DIR}/MySQL-shared-compat.spec @ONLY)
CONFIGURE_FILE(mysql.spec.sh ${CMAKE_CURRENT_BINARY_DIR}/mysql.spec @ONLY)
CONFIGURE_FILE(mysql.spec.sh ${CMAKE_CURRENT_BINARY_DIR}/mysql.${VERSION}.spec @ONLY)
CONFIGURE_FILE(MySQL-shared-compat.spec.sh ${CMAKE_CURRENT_BINARY_DIR}/MySQL-shared-compat.spec @ONLY)
# mysql.server needs another set variables
SET(bindir ./bin)
SET(sbindir ./bin)
SET(scriptdir ./bin)
SET(libexecdir ./bin)
SET(pkgdatadir "${CMAKE_INSTALL_PREFIX}/data")
SET(bindir ${prefix}/${INSTALL_BINDIR})
SET(sbindir ${prefix}/${INSTALL_SBINDIR})
SET(scriptdir ${prefix}/${INSTALL_SCRIPTDIR})
SET(libexecdir ${prefix}/${INSTALL_SBINDIR})
SET(pkgdatadir ${prefix}/${INSTALL_MYSQLSHAREDIR})
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql.server.sh
${CMAKE_CURRENT_BINARY_DIR}/mysql.server @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql.server
DESTINATION support-files
DESTINATION ${inst_location}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
ENDIF()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment