summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/abi_check.cmake2
-rw-r--r--cmake/build_configurations/mysql_release.cmake9
-rw-r--r--cmake/character_sets.cmake4
-rw-r--r--cmake/configure.pl20
-rw-r--r--cmake/cpack_deb.cmake1
-rw-r--r--cmake/cpack_rpm.cmake8
-rw-r--r--cmake/cpu_info.cmake30
-rw-r--r--cmake/create_initial_db.cmake.in7
-rw-r--r--cmake/jemalloc.cmake21
-rw-r--r--cmake/libutils.cmake27
-rw-r--r--cmake/maintainer.cmake6
-rw-r--r--cmake/mysql_version.cmake4
-rw-r--r--cmake/os/Windows.cmake4
-rw-r--r--cmake/os/WindowsCache.cmake5
-rw-r--r--cmake/package_name.cmake4
-rw-r--r--cmake/pcre.cmake16
-rw-r--r--cmake/plugin.cmake42
-rw-r--r--cmake/ssl.cmake215
-rw-r--r--cmake/zlib.cmake2
19 files changed, 336 insertions, 91 deletions
diff --git a/cmake/abi_check.cmake b/cmake/abi_check.cmake
index cca595c5635..e8d2737f116 100644
--- a/cmake/abi_check.cmake
+++ b/cmake/abi_check.cmake
@@ -28,7 +28,7 @@ ELSE()
SET(RUN_ABI_CHECK 0)
ENDIF()
-IF(CMAKE_COMPILER_IS_GNUCC AND RUN_ABI_CHECK)
+IF(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang" AND RUN_ABI_CHECK)
IF(CMAKE_C_COMPILER MATCHES "ccache$")
SET(COMPILER ${CMAKE_C_COMPILER_ARG1})
STRING(REGEX REPLACE "^ " "" COMPILER ${COMPILER})
diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake
index 68453bab608..35d6f0c52ef 100644
--- a/cmake/build_configurations/mysql_release.cmake
+++ b/cmake/build_configurations/mysql_release.cmake
@@ -46,6 +46,8 @@ SET(FEATURE_SET_large 5)
SET(FEATURE_SET_xlarge 6)
SET(FEATURE_SET_community 7)
+#SET(WITH_CASSANDRA_STORAGE_ENGINE ON)
+
IF(FEATURE_SET)
STRING(TOLOWER ${FEATURE_SET} feature_set)
SET(num ${FEATURE_SET_${feature_set}})
@@ -82,7 +84,7 @@ IF(FEATURE_SET)
# Update cache with current values, remove engines we do not care about
# from build.
- FOREACH(eng ARCHIVE BLACKHOLE FEDERATED INNOBASE PARTITION EXAMPLE)
+ FOREACH(eng ARCHIVE BLACKHOLE FEDERATED INNOBASE PARTITION)
IF(NOT WITH_${eng}_STORAGE_ENGINE)
SET(WITHOUT_${eng}_STORAGE_ENGINE ON CACHE BOOL "")
MARK_AS_ADVANCED(WITHOUT_${eng}_STORAGE_ENGINE)
@@ -103,7 +105,6 @@ ELSEIF(DEB)
SET(WITH_SSL system CACHE STRING "")
SET(WITH_ZLIB system CACHE STRING "")
SET(WITH_LIBWRAP ON)
- SET(WITH_MAX ON)
SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON)
ELSE()
SET(WITH_SSL bundled CACHE STRING "")
@@ -144,12 +145,12 @@ IF(UNIX)
ENDIF()
# Remove libaio dependency from mysqld
- SET(XTRADB_PREFER_STATIC_LIBAIO 1)
+ #SET(XTRADB_PREFER_STATIC_LIBAIO 1)
# Unfortunately, linking shared libmysqld with static aio
# does not work, unless we add also dynamic one. This also means
# libmysqld.so will depend on libaio.so
- SET(LIBMYSQLD_SO_EXTRA_LIBS aio)
+ #SET(LIBMYSQLD_SO_EXTRA_LIBS aio)
ENDIF()
ENDIF()
diff --git a/cmake/character_sets.cmake b/cmake/character_sets.cmake
index 74a39e09cac..1c93441cbb1 100644
--- a/cmake/character_sets.cmake
+++ b/cmake/character_sets.cmake
@@ -25,14 +25,14 @@ ENDIF()
SET(CHARSETS ${DEFAULT_CHARSET} latin1 utf8 utf8mb4)
SET(CHARSETS_COMPLEX
big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2
- sjis tis620 ucs2 ujis utf8 utf8mb4 utf16 utf32)
+ sjis tis620 ucs2 ujis utf8 utf8mb4 utf16 utf16le utf32)
SET(CHARSETS_AVAILABLE
binary armscii8 ascii big5 cp1250 cp1251 cp1256 cp1257
cp850 cp852 cp866 cp932 dec8 eucjpms euckr gb2312 gbk geostd8
greek hebrew hp8 keybcs2 koi8r koi8u
latin1 latin2 latin5 latin7 macce macroman
-sjis swe7 tis620 ucs2 ujis utf8 utf8mb4 utf16 utf32)
+sjis swe7 tis620 ucs2 ujis utf8 utf8mb4 utf16 utf16le utf32)
SET (EXTRA_CHARSETS "all")
diff --git a/cmake/configure.pl b/cmake/configure.pl
index d5c0b9b061a..a71795a3bc8 100644
--- a/cmake/configure.pl
+++ b/cmake/configure.pl
@@ -150,6 +150,16 @@ foreach my $option (@ARGV)
$cmakeargs = $cmakeargs." -DWITH_ZLIB=system";
next;
}
+ if($option =~ /with-libevent=/)
+ {
+ $cmakeargs = $cmakeargs." -DWITH_LIBEVENT=system";
+ next;
+ }
+ if($option =~ /with-libevent/)
+ {
+ $cmakeargs = $cmakeargs." -DWITH_LIBEVENT=bundled";
+ next;
+ }
if($option =~ /with-ssl=/)
{
$cmakeargs = $cmakeargs." -DWITH_SSL=yes";
@@ -237,6 +247,16 @@ foreach my $option (@ARGV)
print("configure.pl : ignoring $option\n");
next;
}
+ if ($option =~ /with-client-ldflags/)
+ {
+ print("configure.pl : ignoring $option\n");
+ next;
+ }
+ if ($option =~ /with-mysqld-ldflags=/)
+ {
+ print("configure.pl : ignoring $option\n");
+ next;
+ }
$option = uc($option);
$option =~ s/-/_/g;
diff --git a/cmake/cpack_deb.cmake b/cmake/cpack_deb.cmake
index 5fb9db1f07f..22985e5ac56 100644
--- a/cmake/cpack_deb.cmake
+++ b/cmake/cpack_deb.cmake
@@ -5,5 +5,6 @@
IF(DEB)
SET(CPACK_COMPONENT_SERVER_GROUP "server")
SET(CPACK_COMPONENT_README_GROUP "server")
+SET(CPACK_COMPONENTS_ALL Server Test SharedLibraries)
ENDIF(DEB)
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index 4e9410306a8..e5206d9690c 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -21,11 +21,12 @@ SET(CPACK_COMPONENT_MANPAGESCLIENT_GROUP "client")
SET(CPACK_COMPONENT_README_GROUP "server")
SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "shared")
SET(CPACK_COMPONENT_COMMON_GROUP "common")
+SET(CPACK_COMPONENT_CLIENTPLUGINS_GROUP "common")
SET(CPACK_COMPONENT_COMPAT_GROUP "compat")
SET(CPACK_COMPONENTS_ALL Server ManPagesServer IniFiles Server_Scripts
SupportFiles Development ManPagesDevelopment
ManPagesTest Readme ManPagesClient Test
- Common Client SharedLibraries)
+ Common Client SharedLibraries ClientPlugins)
SET(CPACK_RPM_PACKAGE_NAME "MariaDB")
IF(CMAKE_VERSION VERSION_LESS "3.6.0")
@@ -38,6 +39,7 @@ ENDIF()
SET(CPACK_RPM_PACKAGE_RELEASE "1%{?dist}")
SET(CPACK_RPM_PACKAGE_LICENSE "GPLv2")
SET(CPACK_RPM_PACKAGE_RELOCATABLE FALSE)
+SET(CPACK_PACKAGE_RELOCATABLE FALSE)
SET(CPACK_RPM_PACKAGE_GROUP "Applications/Databases")
SET(CPACK_RPM_PACKAGE_URL "http://mariadb.org")
SET(CPACK_RPM_PACKAGE_SUMMARY "MariaDB: a very fast and robust SQL database server")
@@ -46,8 +48,8 @@ SET(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_RPM_PACKAGE_SUMMARY}
It is GPL v2 licensed, which means you can use the it free of charge under the
conditions of the GNU General Public License Version 2 (http://www.gnu.org/licenses/).
-MariaDB documentation can be found at http://kb.askmonty.org/
-MariaDB bug reports should be submitted through https://mariadb.atlassian.net/
+MariaDB documentation can be found at https://mariadb.com/kb
+MariaDB bug reports should be submitted through https://jira.mariadb.org
")
diff --git a/cmake/cpu_info.cmake b/cmake/cpu_info.cmake
new file mode 100644
index 00000000000..32b98142ace
--- /dev/null
+++ b/cmake/cpu_info.cmake
@@ -0,0 +1,30 @@
+# Copyright (c) 2009, 2011, 2012 Oracle and/or its affiliates. All rights reserved.
+#
+# 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
+
+# Symbols with information about the CPU.
+
+FIND_PROGRAM(GETCONF getconf)
+MARK_AS_ADVANCED(GETCONF)
+
+IF(GETCONF)
+ EXECUTE_PROCESS(
+ COMMAND ${GETCONF} LEVEL1_DCACHE_LINESIZE
+ OUTPUT_VARIABLE CPU_LEVEL1_DCACHE_LINESIZE
+ )
+ENDIF()
+IF(CPU_LEVEL1_DCACHE_LINESIZE AND CPU_LEVEL1_DCACHE_LINESIZE GREATER 0)
+ELSE()
+ SET(CPU_LEVEL1_DCACHE_LINESIZE 64)
+ENDIF()
diff --git a/cmake/create_initial_db.cmake.in b/cmake/create_initial_db.cmake.in
index ce638b14e39..c77e28d882c 100644
--- a/cmake/create_initial_db.cmake.in
+++ b/cmake/create_initial_db.cmake.in
@@ -40,10 +40,11 @@ FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql mysql_perf
ENDFOREACH()
ENDFOREACH()
FILE(READ ${CMAKE_SOURCE_DIR}/scripts/fill_help_tables.sql CONTENTS)
-FILE(APPEND bootstrap.sql ${CONTENTS})
+FILE(APPEND bootstrap.sql "${CONTENTS}")
+FILE(REMOVE_RECURSE mysql performance_schema)
+FILE(REMOVE ibdata1 ib_logfile0 ib_logfile1)
-FILE(REMOVE_RECURSE mysql)
MAKE_DIRECTORY(mysql)
IF(WIN32)
SET(CONSOLE --console)
@@ -58,8 +59,6 @@ SET(BOOTSTRAP_COMMAND
--basedir=.
--datadir=.
--default-storage-engine=MyISAM
- --loose-skip-innodb
- --loose-skip-ndbcluster
--max_allowed_packet=8M
--net_buffer_length=16K
)
diff --git a/cmake/jemalloc.cmake b/cmake/jemalloc.cmake
index 39a97334071..5a3c1bd935b 100644
--- a/cmake/jemalloc.cmake
+++ b/cmake/jemalloc.cmake
@@ -1,7 +1,7 @@
INCLUDE (CheckLibraryExists)
SET(WITH_JEMALLOC auto CACHE STRING
- "Build with jemalloc (possible values are 'yes', 'no', 'auto')")
+ "Build with jemalloc. Possible values are 'yes', 'no', 'auto'")
MACRO (CHECK_JEMALLOC)
# compatibility with old WITH_JEMALLOC values
@@ -18,17 +18,24 @@ MACRO (CHECK_JEMALLOC)
IF(WITH_JEMALLOC STREQUAL "static")
SET(libname jemalloc_pic)
SET(CMAKE_REQUIRED_LIBRARIES pthread dl m)
+ SET(what bundled)
ELSE()
- SET(libname jemalloc)
+ SET(libname jemalloc c)
+ SET(what system)
ENDIF()
- CHECK_LIBRARY_EXISTS(${libname} malloc_stats_print "" HAVE_JEMALLOC)
+ FOREACH(lib ${libname})
+ CHECK_LIBRARY_EXISTS(${lib} malloc_stats_print "" HAVE_JEMALLOC_IN_${lib})
+ IF (HAVE_JEMALLOC_IN_${lib})
+ SET(LIBJEMALLOC ${lib})
+ SET(MALLOC_LIBRARY "${what} jemalloc")
+ BREAK()
+ ENDIF()
+ ENDFOREACH()
SET(CMAKE_REQUIRED_LIBRARIES)
- IF (HAVE_JEMALLOC)
- SET(LIBJEMALLOC ${libname})
- ELSEIF (NOT WITH_JEMALLOC STREQUAL "auto")
- MESSAGE(FATAL_ERROR "${libname} is not found")
+ IF (NOT LIBJEMALLOC AND NOT WITH_JEMALLOC STREQUAL "auto")
+ MESSAGE(FATAL_ERROR "jemalloc is not found")
ENDIF()
ENDIF()
ENDMACRO()
diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake
index 41b7d9d1d86..2e65e8b5ba3 100644
--- a/cmake/libutils.cmake
+++ b/cmake/libutils.cmake
@@ -188,7 +188,7 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
# binaries properly)
ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD
COMMAND rm ${TARGET_LOCATION}
- COMMAND /usr/bin/libtool -static -o ${TARGET_LOCATION}
+ COMMAND libtool -static -o ${TARGET_LOCATION}
${STATIC_LIBS}
)
ELSE()
@@ -309,20 +309,22 @@ FUNCTION(GET_DEPENDEND_OS_LIBS target result)
SET(${result} ${ret} PARENT_SCOPE)
ENDFUNCTION()
-MACRO(RESTRICT_SYMBOL_EXPORTS target)
- SET(VISIBILITY_HIDDEN_FLAG)
+INCLUDE(CheckCCompilerFlag)
- IF(CMAKE_COMPILER_IS_GNUCXX AND UNIX)
- CHECK_C_COMPILER_FLAG("-fvisibility=hidden" HAVE_VISIBILITY_HIDDEN)
- IF(HAVE_VISIBILITY_HIDDEN)
- SET(VISIBILITY_HIDDEN_FLAG "-fvisibility=hidden")
- ENDIF()
- ENDIF()
+SET(VISIBILITY_HIDDEN_FLAG)
- IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
- SET(VISIBILITY_HIDDEN_FLAG "-xldscope=hidden")
+IF(CMAKE_C_COMPILER_ID MATCHES "SunPro")
+ SET(VISIBILITY_HIDDEN_FLAG "-xldscope=hidden")
+ELSEIF(UNIX)
+ CHECK_C_COMPILER_FLAG("-fvisibility=hidden" HAVE_VISIBILITY_HIDDEN)
+ IF(HAVE_VISIBILITY_HIDDEN)
+ SET(VISIBILITY_HIDDEN_FLAG "-fvisibility=hidden")
ENDIF()
+ENDIF()
+# We try to hide the symbols in yassl/zlib to avoid name clashes with
+# other libraries like openssl.
+FUNCTION(RESTRICT_SYMBOL_EXPORTS target)
IF(VISIBILITY_HIDDEN_FLAG)
GET_TARGET_PROPERTY(COMPILE_FLAGS ${target} COMPILE_FLAGS)
IF(NOT COMPILE_FLAGS)
@@ -332,5 +334,4 @@ MACRO(RESTRICT_SYMBOL_EXPORTS target)
SET_TARGET_PROPERTIES(${target} PROPERTIES
COMPILE_FLAGS "${COMPILE_FLAGS} ${VISIBILITY_HIDDEN_FLAG}")
ENDIF()
-
-ENDMACRO()
+ENDFUNCTION()
diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake
index 872d61d9aac..4fe2546d709 100644
--- a/cmake/maintainer.cmake
+++ b/cmake/maintainer.cmake
@@ -35,17 +35,17 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
ENDIF()
# Turn on Werror (warning => error) when using maintainer mode.
-IF(MYSQL_MAINTAINER_MODE MATCHES "ON")
+IF(MYSQL_MAINTAINER_MODE MATCHES "ERR")
SET(MY_C_WARNING_FLAGS "${MY_C_WARNING_FLAGS} -DFORCE_INIT_OF_VARS -Werror")
SET(MY_CXX_WARNING_FLAGS "${MY_CXX_WARNING_FLAGS} -DFORCE_INIT_OF_VARS -Werror")
ENDIF()
# Set warning flags for GCC/Clang
-IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
+IF(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
SET(MY_MAINTAINER_C_WARNINGS "${MY_C_WARNING_FLAGS}")
ENDIF()
# Set warning flags for G++/Clang++
-IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
SET(MY_MAINTAINER_CXX_WARNINGS "${MY_CXX_WARNING_FLAGS}")
ENDIF()
diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake
index 7fa5240e324..f147f6ef2bf 100644
--- a/cmake/mysql_version.cmake
+++ b/cmake/mysql_version.cmake
@@ -49,7 +49,9 @@ MACRO(GET_MYSQL_VERSION)
MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_PATCH" PATCH_VERSION)
MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_EXTRA" EXTRA_VERSION)
- IF(NOT MAJOR_VERSION OR NOT MINOR_VERSION OR NOT PATCH_VERSION)
+IF(NOT "${MAJOR_VERSION}" MATCHES "[0-9]+" OR
+ NOT "${MINOR_VERSION}" MATCHES "[0-9]+" OR
+ NOT "${PATCH_VERSION}" MATCHES "[0-9]+")
MESSAGE(FATAL_ERROR "VERSION file cannot be parsed.")
ENDIF()
diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake
index 283f79b3b41..84276115723 100644
--- a/cmake/os/Windows.cmake
+++ b/cmake/os/Windows.cmake
@@ -90,10 +90,6 @@ IF(MSVC)
STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}")
ENDFOREACH()
- # Remove support for exceptions
- FOREACH(flag CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_INIT)
- STRING(REPLACE "/EHsc" "" "${flag}" "${${flag}}")
- ENDFOREACH()
# Fix CMake's predefined huge stack size
FOREACH(type EXE SHARED MODULE)
diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake
index 1694b238e7b..2808a6f749f 100644
--- a/cmake/os/WindowsCache.cmake
+++ b/cmake/os/WindowsCache.cmake
@@ -347,7 +347,6 @@ SET(C_HAS___inline 1 CACHE INTERNAL "")
SET(FIONREAD_IN_SYS_IOCTL CACHE INTERNAL "")
SET(FIONREAD_IN_SYS_FILIO CACHE INTERNAL "")
SET(GWINSZ_IN_SYS_IOCTL CACHE INTERNAL "")
-SET(HAVE_CXXABI_H CACHE INTERNAL "")
SET(HAVE_NDIR_H CACHE INTERNAL "")
SET(HAVE_SYS_NDIR_H CACHE INTERNAL "")
SET(HAVE_SYS_NDIR_H CACHE INTERNAL "")
@@ -367,4 +366,8 @@ SET(HAVE_PTHREAD_ATTR_GETGUARDSIZE CACHE INTERNAL "")
SET(HAVE_UCONTEXT_H CACHE INTERNAL "")
SET(HAVE_SOCKPEERCRED CACHE INTERNAL "")
SET(HAVE_GGDB3 CACHE INTERNAL "")
+SET(HAVE_ABI_CXA_DEMANGLE CACHE INTERNAL "")
+SET(HAVE_GCC_ATOMIC_BUILTINS CACHE INTERNAL "")
+SET(HAVE_GCC_C11_ATOMICS CACHE INTERNAL "")
+SET(HAVE_VISIBILITY_HIDDEN CACHE INTERNAL "")
ENDIF(MSVC)
diff --git a/cmake/package_name.cmake b/cmake/package_name.cmake
index 4ba8fc18e3f..48ca3a4814d 100644
--- a/cmake/package_name.cmake
+++ b/cmake/package_name.cmake
@@ -30,6 +30,10 @@ IF(NOT VERSION)
SET(64BIT 1)
ENDIF()
+ IF(NOT 64BIT AND CMAKE_SYSTEM_PROCESSOR MATCHES "^mips64")
+ SET(DEFAULT_MACHINE "mips")
+ ENDIF()
+
IF(CMAKE_SYSTEM_NAME MATCHES "Windows")
SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 0)
SET(DEFAULT_PLATFORM "win")
diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake
new file mode 100644
index 00000000000..894bde38974
--- /dev/null
+++ b/cmake/pcre.cmake
@@ -0,0 +1,16 @@
+SET(WITH_PCRE "auto" CACHE STRING
+ "Which pcre to use (possible values are 'bundled', 'system', or 'auto')")
+
+MACRO (CHECK_PCRE)
+ IF(WITH_PCRE STREQUAL "system" OR WITH_PCRE STREQUAL "auto")
+ CHECK_LIBRARY_EXISTS(pcre pcre_stack_guard "" HAVE_PCRE)
+ ENDIF()
+ IF(NOT HAVE_PCRE OR WITH_PCRE STREQUAL "bundled")
+ IF (WITH_PCRE STREQUAL "system")
+ MESSAGE(FATAL_ERROR "system pcre is not found or unusable")
+ ENDIF()
+ SET(PCRE_INCLUDES ${CMAKE_BINARY_DIR}/pcre ${CMAKE_SOURCE_DIR}/pcre)
+ ADD_SUBDIRECTORY(pcre)
+ ENDIF()
+ENDMACRO()
+
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
index e166275811e..ba7bac837b1 100644
--- a/cmake/plugin.cmake
+++ b/cmake/plugin.cmake
@@ -29,7 +29,7 @@ INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake)
MACRO(MYSQL_ADD_PLUGIN)
MYSQL_PARSE_ARGUMENTS(ARG
- "LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT"
+ "LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT;CONFIG"
"STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED"
${ARGN}
)
@@ -37,7 +37,7 @@ MACRO(MYSQL_ADD_PLUGIN)
# Add common include directories
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/sql
- ${CMAKE_SOURCE_DIR}/regex
+ ${PCRE_INCLUDES}
${SSL_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIR})
@@ -73,7 +73,8 @@ MACRO(MYSQL_ADD_PLUGIN)
AND NOT ARG_MODULE_ONLY)
SET(WITH_${plugin} 1)
- ELSEIF(WITHOUT_${plugin}_STORAGE_ENGINE OR WITH_NONE OR ${plugin}_DISABLED)
+ ELSEIF(WITHOUT_${plugin} OR WITHOUT_${plugin}_STORAGE_ENGINE OR
+ WITH_NONE OR ARG_DISABLED)
SET(WITHOUT_${plugin} 1)
SET(WITH_${plugin}_STORAGE_ENGINE 0)
SET(WITH_${plugin} 0)
@@ -126,6 +127,7 @@ MACRO(MYSQL_ADD_PLUGIN)
IF(ARG_RECOMPILE_FOR_EMBEDDED OR NOT _SKIP_PIC)
# Recompile some plugins for embedded
ADD_CONVENIENCE_LIBRARY(${target}_embedded ${SOURCES})
+ RESTRICT_SYMBOL_EXPORTS(${target}_embedded)
DTRACE_INSTRUMENT(${target}_embedded)
IF(ARG_RECOMPILE_FOR_EMBEDDED)
SET_TARGET_PROPERTIES(${target}_embedded
@@ -154,12 +156,12 @@ MACRO(MYSQL_ADD_PLUGIN)
IF(ARG_MANDATORY)
SET (mysql_mandatory_plugins
- "${mysql_mandatory_plugins} builtin_maria_${target}_plugin,"
- PARENT_SCOPE)
+ "${mysql_mandatory_plugins} builtin_maria_${target}_plugin,")
+ SET (mysql_mandatory_plugins ${mysql_mandatory_plugins} PARENT_SCOPE)
ELSE()
SET (mysql_optional_plugins
- "${mysql_optional_plugins} builtin_maria_${target}_plugin,"
- PARENT_SCOPE)
+ "${mysql_optional_plugins} builtin_maria_${target}_plugin,")
+ SET (mysql_optional_plugins ${mysql_optional_plugins} PARENT_SCOPE)
ENDIF()
ELSEIF(NOT WITHOUT_${plugin} AND NOT ARG_STATIC_ONLY AND NOT WITHOUT_DYNAMIC_PLUGINS)
@@ -177,8 +179,15 @@ MACRO(MYSQL_ADD_PLUGIN)
# executable to the linker command line (it would result into link error).
# Thus we skip TARGET_LINK_LIBRARIES on Linux, as it would only generate
# an additional dependency.
- IF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
- TARGET_LINK_LIBRARIES (${target} mysqld ${ARG_LINK_LIBRARIES})
+ IF(MSVC)
+ ADD_DEPENDENCIES(${target} gen_mysqld_lib)
+ TARGET_LINK_LIBRARIES(${target} mysqld_import_lib)
+ ELSEIF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ TARGET_LINK_LIBRARIES (${target} mysqld)
+ ENDIF()
+
+ IF(ARG_LINK_LIBRARIES)
+ TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES})
ENDIF()
ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES})
@@ -191,14 +200,23 @@ MACRO(MYSQL_ADD_PLUGIN)
OUTPUT_NAME "${ARG_MODULE_OUTPUT_NAME}")
# Install dynamic library
IF(ARG_COMPONENT)
- IF(RPM AND NOT CPACK_COMPONENTS_ALL MATCHES ${ARG_COMPONENT})
+ IF(CPACK_COMPONENTS_ALL AND NOT CPACK_COMPONENTS_ALL MATCHES ${ARG_COMPONENT})
+ IF (ARG_STORAGE_ENGINE)
+ SET(ver " = %{version}-%{release}")
+ ENDIF()
SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} ${ARG_COMPONENT} PARENT_SCOPE)
- SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_REQUIRES "MariaDB-server" PARENT_SCOPE)
+ SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_REQUIRES "MariaDB${ver}" PARENT_SCOPE)
+
+ IF (NOT ARG_CONFIG)
+ SET(ARG_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/${target}.cnf")
+ FILE(WRITE ${ARG_CONFIG} "[mariadb]\nplugin-load-add=${ARG_MODULE_OUTPUT_NAME}.so\n")
+ ENDIF()
+ INSTALL(FILES ${ARG_CONFIG} COMPONENT ${ARG_COMPONENT} DESTINATION ${INSTALL_SYSCONF2DIR})
# 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)
+ SET(CPACK_RPM_${ARG_COMPONENT}_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*" PARENT_SCOPE)
ENDIF()
ELSE()
SET(ARG_COMPONENT Server)
diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake
index 6f7bd92c777..c5985a38621 100644
--- a/cmake/ssl.cmake
+++ b/cmake/ssl.cmake
@@ -14,85 +14,232 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+# We support different versions of SSL:
+# - "bundled" uses source code in <source dir>/extra/yassl
+# - "system" (typically) uses headers/libraries in /usr/lib and /usr/lib64
+# - a custom installation of openssl can be used like this
+# - cmake -DCMAKE_PREFIX_PATH=</path/to/custom/openssl> -DWITH_SSL="system"
+# or
+# - cmake -DWITH_SSL=</path/to/custom/openssl>
+#
+# The default value for WITH_SSL is "bundled"
+# set in cmake/build_configurations/feature_set.cmake
+#
+# For custom build/install of openssl, see the accompanying README and
+# INSTALL* files. When building with gcc, you must build the shared libraries
+# (in addition to the static ones):
+# ./config --prefix=</path/to/custom/openssl> --shared; make; make install
+# On some platforms (mac) you need to choose 32/64 bit architecture.
+# Build/Install of openssl on windows is slightly different: you need to run
+# perl and nmake. You might also need to
+# 'set path=</path/to/custom/openssl>\bin;%PATH%
+# in order to find the .dll files at runtime.
+
+SET(WITH_SSL_DOC "bundled (use yassl)")
+SET(WITH_SSL_DOC
+ "${WITH_SSL_DOC}, yes (prefer os library if present, otherwise use bundled)")
+SET(WITH_SSL_DOC
+ "${WITH_SSL_DOC}, system (use os library)")
+SET(WITH_SSL_DOC
+ "${WITH_SSL_DOC}, </path/to/custom/installation>")
+
MACRO (CHANGE_SSL_SETTINGS string)
- SET(WITH_SSL ${string} CACHE STRING "Options are: no bundled yes(prefer os library if present otherwise use bundled) system(use os library)" FORCE)
+ SET(WITH_SSL ${string} CACHE STRING ${WITH_SSL_DOC} FORCE)
ENDMACRO()
MACRO (MYSQL_USE_BUNDLED_SSL)
SET(INC_DIRS
- ${CMAKE_SOURCE_DIR}/extra/yassl/include
- ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include
+ ${CMAKE_SOURCE_DIR}/extra/yassl/include
+ ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include
)
SET(SSL_LIBRARIES yassl taocrypt)
SET(SSL_INCLUDE_DIRS ${INC_DIRS})
SET(SSL_INTERNAL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL)
- SET(SSL_DEFINES "-DHAVE_YASSL -DYASSL_PURE_C -DYASSL_PREFIX -DHAVE_OPENSSL -DMULTI_THREADED")
+ SET(SSL_DEFINES "-DHAVE_YASSL -DYASSL_PREFIX -DHAVE_OPENSSL -DMULTI_THREADED")
SET(HAVE_ERR_remove_thread_state OFF CACHE INTERNAL "yassl doesn't have ERR_remove_thread_state")
CHANGE_SSL_SETTINGS("bundled")
- #Remove -fno-implicit-templates
- #(yassl sources cannot be compiled with it)
- SET(SAVE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
- IF(CMAKE_CXX_FLAGS)
- STRING(REPLACE "-fno-implicit-templates" "" CMAKE_CXX_FLAGS
- ${CMAKE_CXX_FLAGS})
- ENDIF()
ADD_SUBDIRECTORY(extra/yassl)
ADD_SUBDIRECTORY(extra/yassl/taocrypt)
- SET(CMAKE_CXX_FLAGS ${SAVE_CXX_FLAGS})
GET_TARGET_PROPERTY(src yassl SOURCES)
FOREACH(file ${src})
SET(SSL_SOURCES ${SSL_SOURCES} ${CMAKE_SOURCE_DIR}/extra/yassl/${file})
ENDFOREACH()
GET_TARGET_PROPERTY(src taocrypt SOURCES)
FOREACH(file ${src})
- SET(SSL_SOURCES ${SSL_SOURCES} ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/${file})
+ SET(SSL_SOURCES ${SSL_SOURCES}
+ ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/${file})
ENDFOREACH()
ENDMACRO()
# MYSQL_CHECK_SSL
#
# Provides the following configure options:
-# WITH_SSL=[yes|no|bundled]
+# WITH_SSL=[yes|bundled|system|<path/to/custom/installation>]
MACRO (MYSQL_CHECK_SSL)
IF(NOT WITH_SSL)
IF(WIN32)
CHANGE_SSL_SETTINGS("bundled")
ELSE()
- CHANGE_SSL_SETTINGS("no")
+ SET(WITH_SSL "yes")
ENDIF()
ENDIF()
+ # See if WITH_SSL is of the form </path/to/custom/installation>
+ FILE(GLOB WITH_SSL_HEADER ${WITH_SSL}/include/openssl/ssl.h)
+ IF (WITH_SSL_HEADER)
+ SET(WITH_SSL_PATH ${WITH_SSL} CACHE PATH "path to custom SSL installation")
+ ENDIF()
+
IF(WITH_SSL STREQUAL "bundled")
MYSQL_USE_BUNDLED_SSL()
- ELSEIF(WITH_SSL STREQUAL "system" OR WITH_SSL STREQUAL "yes")
- # Check for system library
- SET(OPENSSL_FIND_QUIETLY TRUE)
- INCLUDE(FindOpenSSL)
- FIND_LIBRARY(CRYPTO_LIBRARY crypto)
- MARK_AS_ADVANCED(CRYPTO_LIBRARY)
- INCLUDE(CheckSymbolExists)
- SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
- SET(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
- CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h"
- HAVE_SHA512_DIGEST_LENGTH)
- CHECK_SYMBOL_EXISTS(ERR_remove_thread_state "openssl/err.h"
- HAVE_ERR_remove_thread_state)
- SET(CMAKE_REQUIRED_INCLUDES)
- SET(CMAKE_REQUIRED_LIBRARIES)
- IF(OPENSSL_FOUND AND CRYPTO_LIBRARY AND HAVE_SHA512_DIGEST_LENGTH)
+ # Reset some variables, in case we switch from /path/to/ssl to "bundled".
+ IF (WITH_SSL_PATH)
+ UNSET(WITH_SSL_PATH)
+ UNSET(WITH_SSL_PATH CACHE)
+ ENDIF()
+ IF (OPENSSL_ROOT_DIR)
+ UNSET(OPENSSL_ROOT_DIR)
+ UNSET(OPENSSL_ROOT_DIR CACHE)
+ ENDIF()
+ IF (OPENSSL_INCLUDE_DIR)
+ UNSET(OPENSSL_INCLUDE_DIR)
+ UNSET(OPENSSL_INCLUDE_DIR CACHE)
+ ENDIF()
+ IF (WIN32 AND OPENSSL_APPLINK_C)
+ UNSET(OPENSSL_APPLINK_C)
+ UNSET(OPENSSL_APPLINK_C CACHE)
+ ENDIF()
+ IF (OPENSSL_LIBRARIES)
+ UNSET(OPENSSL_LIBRARIES)
+ UNSET(OPENSSL_LIBRARIES CACHE)
+ ENDIF()
+ ELSEIF(WITH_SSL STREQUAL "system" OR
+ WITH_SSL STREQUAL "yes" OR
+ WITH_SSL_PATH
+ )
+ # First search in WITH_SSL_PATH.
+ FIND_PATH(OPENSSL_ROOT_DIR
+ NAMES include/openssl/ssl.h
+ NO_CMAKE_PATH
+ NO_CMAKE_ENVIRONMENT_PATH
+ HINTS ${WITH_SSL_PATH}
+ )
+ # Then search in standard places (if not found above).
+ FIND_PATH(OPENSSL_ROOT_DIR
+ NAMES include/openssl/ssl.h
+ )
+
+ FIND_PATH(OPENSSL_INCLUDE_DIR
+ NAMES openssl/ssl.h
+ HINTS ${OPENSSL_ROOT_DIR}/include
+ )
+
+ IF (WIN32)
+ FIND_FILE(OPENSSL_APPLINK_C
+ NAMES openssl/applink.c
+ HINTS ${OPENSSL_ROOT_DIR}/include
+ )
+ MESSAGE(STATUS "OPENSSL_APPLINK_C ${OPENSSL_APPLINK_C}")
+ ENDIF()
+
+ # On mac this list is <.dylib;.so;.a>
+ # We prefer static libraries, so we revert it here.
+ IF (WITH_SSL_PATH)
+ LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
+ ENDIF()
+ MESSAGE(STATUS "suffixes <${CMAKE_FIND_LIBRARY_SUFFIXES}>")
+ FIND_LIBRARY(OPENSSL_LIBRARIES
+ NAMES ssl ssleay32 ssleay32MD
+ HINTS ${OPENSSL_ROOT_DIR}/lib)
+ FIND_LIBRARY(CRYPTO_LIBRARY
+ NAMES crypto libeay32
+ HINTS ${OPENSSL_ROOT_DIR}/lib)
+ IF (WITH_SSL_PATH)
+ LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
+ ENDIF()
+
+ IF(OPENSSL_INCLUDE_DIR AND
+ OPENSSL_LIBRARIES AND
+ CRYPTO_LIBRARY
+ )
+ # Verify version number. Version information looks like:
+ # #define OPENSSL_VERSION_NUMBER 0x1000103fL
+ # Encoded as MNNFFPPS: major minor fix patch status
+ FILE(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h"
+ OPENSSL_VERSION_NUMBER
+ REGEX "^#define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9].*"
+ )
+ STRING(REGEX REPLACE
+ "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9]).*$" "\\1"
+ OPENSSL_MAJOR_VERSION "${OPENSSL_VERSION_NUMBER}"
+ )
+ INCLUDE(CheckSymbolExists)
+ SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
+ CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h"
+ HAVE_SHA512_DIGEST_LENGTH)
+ SET(OPENSSL_FOUND TRUE)
+ ELSE()
+ SET(OPENSSL_FOUND FALSE)
+ ENDIF()
+
+ IF(OPENSSL_FOUND AND HAVE_SHA512_DIGEST_LENGTH)
+ MESSAGE(STATUS "OPENSSL_INCLUDE_DIR = ${OPENSSL_INCLUDE_DIR}")
+ MESSAGE(STATUS "OPENSSL_LIBRARIES = ${OPENSSL_LIBRARIES}")
+ MESSAGE(STATUS "CRYPTO_LIBRARY = ${CRYPTO_LIBRARY}")
+ MESSAGE(STATUS "OPENSSL_MAJOR_VERSION = ${OPENSSL_MAJOR_VERSION}")
+
+
SET(SSL_SOURCES "")
SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARY})
+ IF(CMAKE_SYSTEM_NAME MATCHES "SunOS")
+ SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${LIBSOCKET})
+ ENDIF()
+ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
+ SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${LIBDL})
+ ENDIF()
+ MESSAGE(STATUS "SSL_LIBRARIES = ${SSL_LIBRARIES}")
SET(SSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
SET(SSL_INTERNAL_INCLUDE_DIRS "")
SET(SSL_DEFINES "-DHAVE_OPENSSL")
- CHANGE_SSL_SETTINGS("system")
+
+ SET(CMAKE_REQUIRED_LIBRARIES ${SSL_LIBRARIES})
+ CHECK_SYMBOL_EXISTS(ERR_remove_thread_state "openssl/err.h"
+ HAVE_ERR_remove_thread_state)
ELSE()
IF(WITH_SSL STREQUAL "system")
MESSAGE(SEND_ERROR "Cannot find appropriate system libraries for SSL. Use WITH_SSL=bundled to enable SSL support")
ENDIF()
MYSQL_USE_BUNDLED_SSL()
ENDIF()
- ELSEIF(NOT WITH_SSL STREQUAL "no")
- MESSAGE(SEND_ERROR "Wrong option for WITH_SSL. Valid values are : yes, no, bundled")
+ ELSE()
+ MESSAGE(SEND_ERROR
+ "Wrong option for WITH_SSL. Valid values are: ${WITH_SSL_DOC}")
+ ENDIF()
+ENDMACRO()
+
+
+# Many executables will depend on libeay32.dll and ssleay32.dll at runtime.
+# In order to ensure we find the right version(s), we copy them into
+# the same directory as the executables.
+# NOTE: Using dlls will likely crash in malloc/free,
+# see INSTALL.W32 which comes with the openssl sources.
+# So we should be linking static versions of the libraries.
+MACRO (COPY_OPENSSL_DLLS target_name)
+ IF (WIN32 AND WITH_SSL_PATH)
+ GET_FILENAME_COMPONENT(CRYPTO_NAME "${CRYPTO_LIBRARY}" NAME_WE)
+ GET_FILENAME_COMPONENT(OPENSSL_NAME "${OPENSSL_LIBRARIES}" NAME_WE)
+ FILE(GLOB HAVE_CRYPTO_DLL "${WITH_SSL_PATH}/bin/${CRYPTO_NAME}.dll")
+ FILE(GLOB HAVE_OPENSSL_DLL "${WITH_SSL_PATH}/bin/${OPENSSL_NAME}.dll")
+ IF (HAVE_CRYPTO_DLL AND HAVE_OPENSSL_DLL)
+ ADD_CUSTOM_COMMAND(OUTPUT ${target_name}
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "${WITH_SSL_PATH}/bin/${CRYPTO_NAME}.dll"
+ "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${CRYPTO_NAME}.dll"
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different
+ "${WITH_SSL_PATH}/bin/${OPENSSL_NAME}.dll"
+ "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${OPENSSL_NAME}.dll"
+ )
+ ADD_CUSTOM_TARGET(${target_name} ALL)
+ ENDIF()
ENDIF()
ENDMACRO()
diff --git a/cmake/zlib.cmake b/cmake/zlib.cmake
index c70d0e29ecf..03d2c542ba4 100644
--- a/cmake/zlib.cmake
+++ b/cmake/zlib.cmake
@@ -50,7 +50,6 @@ MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
IF(WITH_ZLIB STREQUAL "bundled")
MYSQL_USE_BUNDLED_ZLIB()
ELSE()
- SET(ZLIB_FIND_QUIETLY TRUE)
INCLUDE(FindZLIB)
IF(ZLIB_FOUND)
INCLUDE(CheckFunctionExists)
@@ -60,7 +59,6 @@ MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS)
CHECK_FUNCTION_EXISTS(deflateBound HAVE_DEFLATEBOUND)
SET(CMAKE_REQUIRED_LIBRARIES)
IF(HAVE_CRC32 AND HAVE_COMPRESSBOUND AND HAVE_DEFLATEBOUND)
- SET(ZLIB_LIBRARY z CACHE INTERNAL "System zlib library")
SET(WITH_ZLIB "system" CACHE STRING
"Which zlib to use (possible values are 'bundled' or 'system')")
SET(ZLIB_SOURCES "")