diff options
-rwxr-xr-x | CMakeLists.txt | 16 | ||||
-rw-r--r-- | cmake/Makefile.am | 3 | ||||
-rw-r--r-- | cmake/configure.pl | 7 | ||||
-rwxr-xr-x | cmake/install_layout.cmake | 128 | ||||
-rw-r--r-- | cmake/libutils.cmake | 2 | ||||
-rw-r--r-- | cmake/mysql_add_executable.cmake | 7 | ||||
-rw-r--r-- | cmake/plugin.cmake | 3 | ||||
-rw-r--r-- | config.h.cmake | 2 | ||||
-rw-r--r-- | include/CMakeLists.txt | 5 | ||||
-rwxr-xr-x | libmysql/CMakeLists.txt | 4 | ||||
-rw-r--r-- | man/CMakeLists.txt | 4 | ||||
-rw-r--r-- | mysql-test/CMakeLists.txt | 7 | ||||
-rw-r--r-- | mysql-test/lib/My/SafeProcess/CMakeLists.txt | 2 | ||||
-rwxr-xr-x | scripts/CMakeLists.txt | 76 | ||||
-rw-r--r-- | scripts/mysqld_safe.sh | 7 | ||||
-rw-r--r-- | sql-bench/CMakeLists.txt | 14 | ||||
-rwxr-xr-x | sql/CMakeLists.txt | 6 | ||||
-rw-r--r-- | sql/share/CMakeLists.txt | 6 | ||||
-rw-r--r-- | support-files/CMakeLists.txt | 49 |
19 files changed, 256 insertions, 92 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 752e66ae746..668675d4444 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/cmake/Makefile.am b/cmake/Makefile.am index d072178d1b9..600cd442f6f 100644 --- a/cmake/Makefile.am +++ b/cmake/Makefile.am @@ -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 diff --git a/cmake/configure.pl b/cmake/configure.pl index 3768b046530..f52435e2cde 100644 --- a/cmake/configure.pl +++ b/cmake/configure.pl @@ -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"; diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake new file mode 100755 index 00000000000..b1a285a0695 --- /dev/null +++ b/cmake/install_layout.cmake @@ -0,0 +1,128 @@ +# 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() diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake index ff74809d224..677504f89af 100644 --- a/cmake/libutils.cmake +++ b/cmake/libutils.cmake @@ -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() diff --git a/cmake/mysql_add_executable.cmake b/cmake/mysql_add_executable.cmake index cb0237332c2..2157d03e6d1 100644 --- a/cmake/mysql_add_executable.cmake +++ b/cmake/mysql_add_executable.cmake @@ -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 diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index b9169ebb73e..f312cd2d4e8 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -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() diff --git a/config.h.cmake b/config.h.cmake index e101a02e295..3b4a463714f 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -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 "" diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index c16f8ea1ff8..0d4220555f6 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -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") diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index c7a0a80cbeb..acdff87f4a0 100755 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -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() diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt index 35da3411805..29de4432c0c 100644 --- a/man/CMakeLists.txt +++ b/man/CMakeLists.txt @@ -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() diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt index 54203336dee..75e7502751c 100644 --- a/mysql-test/CMakeLists.txt +++ b/mysql-test/CMakeLists.txt @@ -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 ) diff --git a/mysql-test/lib/My/SafeProcess/CMakeLists.txt b/mysql-test/lib/My/SafeProcess/CMakeLists.txt index d22d4fddddf..ec2a13b910c 100644 --- a/mysql-test/lib/My/SafeProcess/CMakeLists.txt +++ b/mysql-test/lib/My/SafeProcess/CMakeLists.txt @@ -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") diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 0b574fc0621..44de52f254f 100755 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -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() diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index 70b9b9f630e..f08e870d5e0 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -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@' diff --git a/sql-bench/CMakeLists.txt b/sql-bench/CMakeLists.txt index e69fa9fa18f..88d15dc706f 100644 --- a/sql-bench/CMakeLists.txt +++ b/sql-bench/CMakeLists.txt @@ -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() diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 6fab01596b9..a5a925b8dc2 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -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() + diff --git a/sql/share/CMakeLists.txt b/sql/share/CMakeLists.txt index 7a67833f9e3..944120cfc24 100644 --- a/sql/share/CMakeLists.txt +++ b/sql/share/CMakeLists.txt @@ -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}) diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt index e9438cf6ae3..ff98a7dd885 100644 --- a/support-files/CMakeLists.txt +++ b/support-files/CMakeLists.txt @@ -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() |