summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-09-10 23:02:25 +0200
committerSergei Golubchik <sergii@pisem.net>2013-09-10 23:02:25 +0200
commit62643f81e6749913cdd250ec0db9529968addc50 (patch)
tree5deb1fbf586ee4cd46e02914cd65f1d23c7ac3f5 /cmake
parent0e1070125f8fb2ffeba985345b001b3ca436bd44 (diff)
parent265bbf5fe172f1ccb68d2b9c1da93dc7ad1c6cee (diff)
downloadmariadb-git-62643f81e6749913cdd250ec0db9529968addc50.tar.gz
merge with 5.5-tokudb tree. In particular:
* add TokuDB, together with the ft-index library * cmake support, auto-detecting whether tokudb can be built * fix packaging - tokudb-engine.rpm, deb * remove PBXT * add jemalloc * the server is built with jemalloc by default even if TokuDB is not built * documentation files in RPM are installed in the correct location * support for optional deb packages (tokudb has specific build requirements) * move plugins from mariadb-server deb to appropriate debs (server/test/libmariadbclient) * correct mariadb-test.deb to be not architecture-independent * fix out-of-tree builds to never modify in-tree files * new handler::prepare_index_scan() method
Diffstat (limited to 'cmake')
-rw-r--r--cmake/cpack_deb.cmake9
-rw-r--r--cmake/cpack_rpm.cmake8
-rw-r--r--cmake/install_layout.cmake15
-rw-r--r--cmake/install_macros.cmake30
-rw-r--r--cmake/jemalloc.cmake43
-rw-r--r--cmake/plugin.cmake12
6 files changed, 106 insertions, 11 deletions
diff --git a/cmake/cpack_deb.cmake b/cmake/cpack_deb.cmake
new file mode 100644
index 00000000000..5fb9db1f07f
--- /dev/null
+++ b/cmake/cpack_deb.cmake
@@ -0,0 +1,9 @@
+#
+# One day it'll be a complete solution for building deb packages with CPack
+# But for now it's only to make INSTALL_DOCUMENTATION function happy
+#
+IF(DEB)
+SET(CPACK_COMPONENT_SERVER_GROUP "server")
+SET(CPACK_COMPONENT_README_GROUP "server")
+ENDIF(DEB)
+
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index ee800fca4e4..c21b863c71f 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -86,10 +86,10 @@ SET(ignored
"%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man8*"
)
-SET(CPACK_RPM_server_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*")
-SET(CPACK_RPM_common_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf")
-SET(CPACK_RPM_shared_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*")
-SET(CPACK_RPM_client_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*")
+SET(CPACK_RPM_server_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*")
+SET(CPACK_RPM_common_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONFDIR}/my.cnf")
+SET(CPACK_RPM_shared_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*")
+SET(CPACK_RPM_client_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*")
SET(CPACK_RPM_compat_USER_FILELIST ${ignored})
SET(CPACK_RPM_devel_USER_FILELIST ${ignored})
SET(CPACK_RPM_test_USER_FILELIST ${ignored})
diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake
index 22b0255a22a..d5f60832884 100644
--- a/cmake/install_layout.cmake
+++ b/cmake/install_layout.cmake
@@ -41,7 +41,8 @@
# - INSTALL_BINDIR (directory with client executables and scripts)
# - INSTALL_SBINDIR (directory with mysqld)
# - INSTALL_SCRIPTDIR (several scripts, rarely used)
-# - INSTALL_SYSCONFDIR (config files. Usually /etc or nothing)
+# - INSTALL_SYSCONFDIR (my.cnf config file. Usually /etc or nothing)
+# - INSTALL_SYSCONF2DIR (additional config files, e.g. /etc/mysql/conf.d)
#
# - INSTALL_LIBDIR (directory with client end embedded libraries)
# - INSTALL_PLUGINDIR (directory for plugins)
@@ -145,6 +146,7 @@ SET(INSTALL_BINDIR_RPM "bin")
SET(INSTALL_SBINDIR_RPM "sbin")
SET(INSTALL_SCRIPTDIR_RPM "bin")
SET(INSTALL_SYSCONFDIR_RPM "/etc")
+SET(INSTALL_SYSCONF2DIR_RPM "/etc/my.cnf.d")
#
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
SET(INSTALL_LIBDIR_RPM "lib64")
@@ -156,8 +158,8 @@ ENDIF()
#
SET(INSTALL_INCLUDEDIR_RPM "include/mysql")
#
-SET(INSTALL_DOCDIR_RPM "share/doc/${CPACK_SOURCE_PACKAGE_FILE_NAME}")
-SET(INSTALL_DOCREADMEDIR_RPM "share/doc/${CPACK_SOURCE_PACKAGE_FILE_NAME}")
+SET(INSTALL_DOCDIR_RPM "share/doc")
+SET(INSTALL_DOCREADMEDIR_RPM "share/doc")
SET(INSTALL_INFODIR_RPM "share/info")
SET(INSTALL_MANDIR_RPM "share/man")
#
@@ -178,14 +180,15 @@ SET(INSTALL_UNIX_ADDRDIR_RPM "${INSTALL_MYSQLDATADIR_RPM}/mysql.sock"
SET(INSTALL_BINDIR_DEB "bin")
SET(INSTALL_SBINDIR_DEB "sbin")
SET(INSTALL_SCRIPTDIR_DEB "bin")
+SET(INSTALL_SYSCONF2DIR_DEB "/etc/mysql/conf.d")
#
SET(INSTALL_LIBDIR_DEB "lib")
SET(INSTALL_PLUGINDIR_DEB "lib/mysql/plugin")
#
SET(INSTALL_INCLUDEDIR_DEB "include/mysql")
#
-SET(INSTALL_DOCDIR_DEB "docs")
-SET(INSTALL_DOCREADMEDIR_DEB ".")
+SET(INSTALL_DOCDIR_DEB "share/doc")
+SET(INSTALL_DOCREADMEDIR_DEB "share/doc")
SET(INSTALL_MANDIR_DEB "share/man")
SET(INSTALL_INFODIR_DEB "share/info")
#
@@ -238,7 +241,7 @@ 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 SYSCONF
+FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN SYSCONF SYSCONF2
INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA PLUGINTEST UNIX_ADDR)
SET(INSTALL_${var}DIR ${INSTALL_${var}DIR_${INSTALL_LAYOUT}}
CACHE STRING "${var} installation directory" ${FORCE})
diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake
index 14e43ee5e95..9f4148342a7 100644
--- a/cmake/install_macros.cmake
+++ b/cmake/install_macros.cmake
@@ -130,6 +130,36 @@ FUNCTION(INSTALL_SCRIPT)
INSTALL_MANPAGE(${script})
ENDFUNCTION()
+
+FUNCTION(INSTALL_DOCUMENTATION)
+ MYSQL_PARSE_ARGUMENTS(ARG "COMPONENT" "" ${ARGN})
+ SET(files ${ARG_DEFAULT_ARGS})
+ IF(NOT ARG_COMPONENT)
+ SET(ARG_COMPONENT Server)
+ ENDIF()
+ IF (ARG_COMPONENT MATCHES "Readme")
+ SET(destination ${INSTALL_DOCREADMEDIR})
+ ELSE()
+ SET(destination ${INSTALL_DOCDIR})
+ ENDIF()
+
+ STRING(TOUPPER ${ARG_COMPONENT} COMPUP)
+ IF(CPACK_COMPONENT_${COMPUP}_GROUP)
+ SET(group ${CPACK_COMPONENT_${COMPUP}_GROUP})
+ ELSE()
+ SET(group ${ARG_COMPONENT})
+ ENDIF()
+
+ IF(RPM)
+ SET(destination "${destination}/MariaDB-${group}-${VERSION}")
+ ELSEIF(DEB)
+ SET(destination "${destination}/mariadb-${group}-${MAJOR_VERSION}.${MINOR_VERSION}")
+ ENDIF()
+
+ INSTALL(FILES ${files} DESTINATION ${destination} COMPONENT ${ARG_COMPONENT})
+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.
diff --git a/cmake/jemalloc.cmake b/cmake/jemalloc.cmake
new file mode 100644
index 00000000000..50aa7768317
--- /dev/null
+++ b/cmake/jemalloc.cmake
@@ -0,0 +1,43 @@
+# old cmake does not have ExternalProject file
+IF(CMAKE_VERSION VERSION_LESS "2.8.6")
+ MACRO (CHECK_JEMALLOC)
+ ENDMACRO()
+ RETURN()
+ENDIF()
+
+INCLUDE(ExternalProject)
+
+MACRO (USE_BUNDLED_JEMALLOC)
+ SET(SOURCE_DIR "${CMAKE_SOURCE_DIR}/extra/jemalloc")
+ SET(BINARY_DIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/extra/jemalloc/build")
+ SET(LIBJEMALLOC "libjemalloc")
+ SET(JEMALLOC_CONFIGURE_OPTS "CC=${CMAKE_C_COMPILER}" "--with-private-namespace=jemalloc_internal_" "--enable-cc-silence")
+ IF (CMAKE_BUILD_TYPE MATCHES "Debug" AND NOT APPLE) # see the comment in CMakeLists.txt
+ LIST(APPEND JEMALLOC_CONFIGURE_OPTS --enable-debug)
+ ENDIF()
+ ExternalProject_Add(jemalloc
+ PREFIX extra/jemalloc
+ SOURCE_DIR ${SOURCE_DIR}
+ BINARY_DIR ${BINARY_DIR}
+ STAMP_DIR ${BINARY_DIR}
+ CONFIGURE_COMMAND "${SOURCE_DIR}/configure" ${JEMALLOC_CONFIGURE_OPTS}
+ BUILD_COMMAND ${CMAKE_MAKE_PROGRAM} "build_lib_static"
+ INSTALL_COMMAND ""
+ )
+ ADD_LIBRARY(libjemalloc STATIC IMPORTED)
+ SET_TARGET_PROPERTIES(libjemalloc PROPERTIES IMPORTED_LOCATION "${BINARY_DIR}/lib/libjemalloc_pic.a")
+ ADD_DEPENDENCIES(libjemalloc jemalloc)
+ENDMACRO()
+
+SET(WITH_JEMALLOC "yes" CACHE STRING
+ "Which jemalloc to use (possible values are 'no', 'bundled', 'yes' (same as bundled)")
+#"Which jemalloc to use (possible values are 'no', 'bundled', 'system', 'yes' (system if possible, otherwise bundled)")
+
+MACRO (CHECK_JEMALLOC)
+ IF(WIN32)
+ SET(WITH_JEMALLOC "no")
+ ENDIF()
+ IF(WITH_JEMALLOC STREQUAL "bundled" OR WITH_JEMALLOC STREQUAL "yes")
+ USE_BUNDLED_JEMALLOC()
+ ENDIF()
+ENDMACRO()
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
index b06d6ac9ca3..afc359d1d09 100644
--- a/cmake/plugin.cmake
+++ b/cmake/plugin.cmake
@@ -207,7 +207,17 @@ MACRO(MYSQL_ADD_PLUGIN)
SET_TARGET_PROPERTIES(${target} PROPERTIES
OUTPUT_NAME "${ARG_MODULE_OUTPUT_NAME}")
# Install dynamic library
- IF(NOT ARG_COMPONENT)
+ IF(ARG_COMPONENT)
+ IF(RPM AND NOT CPACK_COMPONENTS_ALL MATCHES ${ARG_COMPONENT})
+ SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} ${ARG_COMPONENT} PARENT_SCOPE)
+ SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_REQUIRES "MariaDB-server" PARENT_SCOPE)
+
+ # workarounds for cmake issues #13248 and #12864:
+ SET(CPACK_RPM_${ARG_COMPONENT}_USER_FILELIST ${ignored} PARENT_SCOPE)
+ SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_PROVIDES "cmake_bug_13248" PARENT_SCOPE)
+ SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_OBSOLETES "cmake_bug_13248" PARENT_SCOPE)
+ ENDIF()
+ ELSE()
SET(ARG_COMPONENT Server)
ENDIF()
MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR} COMPONENT ${ARG_COMPONENT})