diff options
author | Vladislav Vaintroub <vvaintroub@mysql.com> | 2010-01-24 16:23:16 +0100 |
---|---|---|
committer | Vladislav Vaintroub <vvaintroub@mysql.com> | 2010-01-24 16:23:16 +0100 |
commit | c827968a2df5ad35e64cea0116abf862776cef26 (patch) | |
tree | c43eba4b5b19fd0edbb74db874eadf3a2a91f9c7 /support-files/CMakeLists.txt | |
parent | 80f57fb2524bfd451c603bce92ad061d85b42aae (diff) | |
download | mariadb-git-c827968a2df5ad35e64cea0116abf862776cef26.tar.gz |
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)
Diffstat (limited to 'support-files/CMakeLists.txt')
-rw-r--r-- | support-files/CMakeLists.txt | 49 |
1 files changed, 29 insertions, 20 deletions
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() |