diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/aws_sdk.cmake | 98 | ||||
-rw-r--r-- | cmake/build_configurations/mysql_release.cmake | 7 | ||||
-rw-r--r-- | cmake/configure.pl | 10 | ||||
-rw-r--r-- | cmake/cpack_rpm.cmake | 4 | ||||
-rw-r--r-- | cmake/create_initial_db.cmake | 2 | ||||
-rw-r--r-- | cmake/install_macros.cmake | 15 | ||||
-rw-r--r-- | cmake/libutils.cmake | 2 | ||||
-rw-r--r-- | cmake/maintainer.cmake | 2 | ||||
-rw-r--r-- | cmake/make_dist.cmake.in | 8 | ||||
-rw-r--r-- | cmake/mariadb_connector_c.cmake | 2 | ||||
-rw-r--r-- | cmake/mysql_add_executable.cmake | 12 | ||||
-rw-r--r-- | cmake/os/GNU.cmake | 30 | ||||
-rw-r--r-- | cmake/os/SunOS.cmake | 2 | ||||
-rw-r--r-- | cmake/os/Windows.cmake | 19 | ||||
-rw-r--r-- | cmake/os/WindowsCache.cmake | 4 | ||||
-rw-r--r-- | cmake/plugin.cmake | 26 | ||||
-rw-r--r-- | cmake/readline.cmake | 19 | ||||
-rw-r--r-- | cmake/ssl.cmake | 37 | ||||
-rw-r--r-- | cmake/submodules.cmake | 2 | ||||
-rw-r--r-- | cmake/symlinks.cmake | 76 | ||||
-rw-r--r-- | cmake/wsrep.cmake | 44 |
21 files changed, 353 insertions, 68 deletions
diff --git a/cmake/aws_sdk.cmake b/cmake/aws_sdk.cmake new file mode 100644 index 00000000000..f6f88f2b880 --- /dev/null +++ b/cmake/aws_sdk.cmake @@ -0,0 +1,98 @@ +MACRO (SKIP_AWS_SDK MSG) + SET(${RETVAL} OFF PARENT_SCOPE) + SET(${REASON} ${MSG} PARENT_SCOPE) + RETURN() +ENDMACRO() + +FUNCTION (CHECK_AWS_SDK RETVAL REASON) + # AWS_SDK_EXTERNAL_PROJECT must be ON + IF(NOT AWS_SDK_EXTERNAL_PROJECT) + SKIP_AWS_SDK("AWS_SDK_EXTERNAL_PROJECT is not ON") + ENDIF() + IF(NOT NOT_FOR_DISTRIBUTION) + SKIP_AWS_SDK("AWS SDK has Apache 2.0 License which is not complatible with GPLv2. Set -DNOT_FOR_DISTRIBUTION=ON if you need it") + ENDIF() + # Check compiler support + IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU") + EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) + IF (GCC_VERSION VERSION_LESS 4.8) + SKIP_AWS_SDK("GCC VERSION too old (${GCC_VERSION}, required is 4.8 or later") + ENDIF() + ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + IF ((CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3) OR + (CLANG_VERSION_STRING AND CLANG_VERSION_STRING VERSION_LESS 3.3)) + SKIP_AWS_SDK("Clang version too old, required is 3.3 or later") + ENDIF() + ELSEIF(MSVC) + IF (MSVC_VERSION LESS 1800) + SKIP_AWS_SDK("MSVC version too old, required is VS2015 or later") + ENDIF() + ELSE() + SKIP_AWS_SDK("Unsupported compiler") + ENDIF() + + # Check OS support + IF (NOT(WIN32 OR APPLE OR (CMAKE_SYSTEM_NAME MATCHES "Linux"))) + SKIP_AWS_SDK("OS unsupported by AWS SDK") + ENDIF() + + # Build from source, using ExternalProject_Add + # AWS C++ SDK requires cmake 2.8.12 + IF(CMAKE_VERSION VERSION_LESS "2.8.12") + SKIP_AWS_SDK("CMake is too old") + ENDIF() + + IF(UNIX) + # Check librairies required for building SDK + FIND_PACKAGE(CURL) + SET_PACKAGE_PROPERTIES(CURL PROPERTIES TYPE REQUIRED) + IF(NOT CURL_FOUND) + SKIP_AWS_SDK("AWS C++ SDK requires libcurl development package") + ENDIF() + FIND_PATH(UUID_INCLUDE_DIR uuid/uuid.h) + IF(NOT UUID_INCLUDE_DIR) + SKIP_AWS_SDK("AWS C++ SDK requires uuid development package") + ENDIF() + IF(NOT APPLE) + FIND_LIBRARY(UUID_LIBRARIES uuid) + SET_PACKAGE_PROPERTIES(UUID_LIBRARIES PROPERTIES TYPE REQUIRED) + IF(NOT UUID_LIBRARIES) + SKIP_AWS_SDK("AWS C++ SDK requires uuid development package") + ENDIF() + FIND_PACKAGE(OpenSSL) + SET_PACKAGE_PROPERTIES(OpenSSL PROPERTIES TYPE REQUIRED) + IF(NOT OPENSSL_FOUND) + SKIP_AWS_SDK("AWS C++ SDK requires openssl development package") + ENDIF() + ENDIF() + ENDIF() + SET(${RETVAL} ON PARENT_SCOPE) +ENDFUNCTION() + + +# USE_AWS_SDK_LIBS(target sdk_component1 ... sdk_component_N) +# Example usage +# USE_AWS_SDK_LIBS(aws_key_management kms s3) +FUNCTION(USE_AWS_SDK_LIBS) + SET(SDK_COMPONENTS ${ARGN}) + LIST(GET SDK_COMPONENTS 0 target) + IF(NOT TARGET ${target}) + MESSAGE(FATAL_ERROR "${target} is not a valid target") + ENDIF() + SET(NON_DISTRIBUTABLE_WARNING "Apache 2.0" CACHE INTERNAL "") + LIST(REMOVE_AT SDK_COMPONENTS 0) + FOREACH(comp ${SDK_COMPONENTS}) + SET_PROPERTY(GLOBAL PROPERTY AWS_SDK_LIBS ${comp} APPEND) + TARGET_LINK_LIBRARIES(${target} aws-cpp-sdk-${comp}) + ENDFOREACH() + TARGET_LINK_LIBRARIES(${target} aws-cpp-sdk-core) + TARGET_INCLUDE_DIRECTORIES(${target} PRIVATE ${PROJECT_BINARY_DIR}/extra/aws_sdk/aws_sdk_cpp/include) + # Link OS libraries that AWS SDK depends on + IF(WIN32) + TARGET_LINK_LIBRARIES(${target} bcrypt winhttp wininet userenv version) + ELSE() + FIND_PACKAGE(CURL REQUIRED) + FIND_PACKAGE(OpenSSL REQUIRED) + TARGET_LINK_LIBRARIES(${target} ${OPENSSL_LIBRARIES} ${CURL_LIBRARIES} ${UUID_LIBRARIES}) + ENDIF() +ENDFUNCTION() diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 2db09ed2e37..a19470e6df1 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. -# Copyright (c) 2011, 2018, MariaDB Corporation +# Copyright (c) 2011, 2021, MariaDB Corporation. # # 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 @@ -104,6 +104,7 @@ ELSEIF(RPM) SET(CHECKMODULE /usr/bin/checkmodule CACHE FILEPATH "") SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE FILEPATH "") SET(WITH_JEMALLOC "yes" CACHE STRING "") + SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "") IF(RPM MATCHES "fedora|centos|rhel") SET(WITH_INNODB_BZIP2 OFF CACHE STRING "") SET(WITH_INNODB_LZO OFF CACHE STRING "") @@ -120,6 +121,7 @@ ELSEIF(DEB) SET(WITH_LIBWRAP ON) SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON) SET(WITH_JEMALLOC "yes" CACHE STRING "") + SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "") SET(WITH_INNODB_BZIP2 OFF CACHE STRING "") SET(WITH_INNODB_LZMA OFF CACHE STRING "") SET(WITH_INNODB_LZO OFF CACHE STRING "") @@ -129,6 +131,7 @@ ELSE() SET(WITH_PCRE bundled CACHE STRING "") SET(WITH_ZLIB bundled CACHE STRING "") SET(WITH_JEMALLOC static CACHE STRING "") + SET(PLUGIN_AUTH_SOCKET STATIC CACHE STRING "") SET(WITH_INNODB_BZIP2 OFF CACHE STRING "") SET(WITH_INNODB_LZ4 OFF CACHE STRING "") SET(WITH_INNODB_LZO OFF CACHE STRING "") @@ -234,7 +237,7 @@ IF(UNIX) IF(CMAKE_SYSTEM_NAME MATCHES "Linux") IF(CMAKE_C_COMPILER_ID MATCHES "Intel") SET(COMMON_C_FLAGS "-static-intel -static-libgcc -g -mp -restrict") - SET(COMMON_CXX_FLAGS "-static-intel -static-libgcc -g -mp -restrict -fno-exceptions -fno-rtti") + SET(COMMON_CXX_FLAGS "-static-intel -static-libgcc -g -mp -restrict -fno-exceptions") IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ia64") SET(COMMON_C_FLAGS "${COMMON_C_FLAGS} -no-ftz -no-prefetch") SET(COMMON_CXX_FLAGS "${COMMON_CXX_FLAGS} -no-ftz -no-prefetch") diff --git a/cmake/configure.pl b/cmake/configure.pl index c296c5ba4b8..4085110b6fa 100644 --- a/cmake/configure.pl +++ b/cmake/configure.pl @@ -93,6 +93,11 @@ foreach my $option (@ARGV) { $option = substr($option, 2); } + elsif (substr ($option, 0, 2) eq "-D") + { + # Must be cmake config option + $option = substr($option, 1); + } else { # This must be environment variable @@ -119,6 +124,11 @@ foreach my $option (@ARGV) $just_print=1; next; } + if ($option =~ /D.*=/) + { + $cmakeargs = $cmakeargs." -".$option; + next; + } if($option =~ /with-plugins=/) { my @plugins= split(/,/, substr($option,13)); diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index 80b11185f9b..85edf0c1cbc 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -214,7 +214,7 @@ SETA(CPACK_RPM_server_PACKAGE_REQUIRES IF(WITH_WSREP) SETA(CPACK_RPM_server_PACKAGE_REQUIRES - "galera" "rsync" "lsof" "grep" "gawk" "iproute" + "galera-4" "rsync" "lsof" "grep" "gawk" "iproute" "coreutils" "findutils" "tar") ENDIF() @@ -283,7 +283,7 @@ ELSEIF(RPM MATCHES "sles") "mariadb-server = %{version}-%{release}" ) ENDIF() -IF(RPM MATCHES "fedora31" OR RPM MATCHES "(rhel|centos)8") +IF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)8") SET(PYTHON_SHEBANG "/usr/bin/python3" CACHE STRING "python shebang") ENDIF() diff --git a/cmake/create_initial_db.cmake b/cmake/create_initial_db.cmake index 9d061d86711..3c42bb24ead 100644 --- a/cmake/create_initial_db.cmake +++ b/cmake/create_initial_db.cmake @@ -52,7 +52,7 @@ SET(BOOTSTRAP_COMMAND --datadir=. --default-storage-engine=MyISAM --max_allowed_packet=8M - --net_buffer_length=16K + --net_buffer_length=32K ) GET_FILENAME_COMPONENT(CWD . ABSOLUTE) diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index ee1a39066b1..6bcafbe766e 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -71,9 +71,10 @@ FUNCTION(INSTALL_MANPAGE file) ${MYSQL_DOC_DIR}/man/*${file}.8* ${GLOB_EXPR} ) - ENDIF() + ENDIF() FILE(GLOB_RECURSE MANPAGES ${GLOB_EXPR}) + IF(MANPAGES) LIST(GET MANPAGES 0 MANPAGE) STRING(REPLACE "${file}man.1" "${file}.1" MANPAGE "${MANPAGE}") @@ -100,19 +101,17 @@ FUNCTION(INSTALL_SCRIPT) IF(NOT ARG_DESTINATION) SET(ARG_DESTINATION ${INSTALL_BINDIR}) ENDIF() - IF(ARG_COMPONENT) - SET(COMP COMPONENT ${ARG_COMPONENT}) - ELSE() - SET(COMP) - ENDIF() + SET(COMP ${ARG_COMPONENT}) IF (COMP MATCHES ${SKIP_COMPONENTS}) RETURN() ENDIF() - INSTALL(PROGRAMS ${script} DESTINATION ${ARG_DESTINATION} ${COMP}) + INSTALL(PROGRAMS ${script} DESTINATION ${ARG_DESTINATION} COMPONENT ${COMP}) + get_filename_component(dest "${script}" NAME) + CREATE_MARIADB_SYMLINK(${dest} ${ARG_DESTINATION} ${COMP}) - INSTALL_MANPAGE(${script}) + INSTALL_MANPAGE(${dest}) ENDFUNCTION() diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake index 4112faa341c..0f8786fc264 100644 --- a/cmake/libutils.cmake +++ b/cmake/libutils.cmake @@ -317,7 +317,7 @@ ELSEIF(UNIX) ENDIF() ENDIF() -# We try to hide the symbols in yassl/zlib to avoid name clashes with +# We try to hide the symbols in bundled libraries to avoid name clashes with # other libraries like openssl. FUNCTION(RESTRICT_SYMBOL_EXPORTS target) IF(VISIBILITY_HIDDEN_FLAG) diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake index 8dbe7a6df47..5a1d186cf58 100644 --- a/cmake/maintainer.cmake +++ b/cmake/maintainer.cmake @@ -22,6 +22,8 @@ ENDIF() SET(MY_WARNING_FLAGS -Wall -Wdeclaration-after-statement + -Wenum-compare + -Wenum-conversion -Wextra -Wformat-security -Wno-format-truncation diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in index 75691f944d6..d662dd76730 100644 --- a/cmake/make_dist.cmake.in +++ b/cmake/make_dist.cmake.in @@ -57,6 +57,14 @@ IF(GIT_EXECUTABLE) IF(NOT RESULT EQUAL 0) SET(GIT_EXECUTABLE) ENDIF() + EXECUTE_PROCESS( + COMMAND "${GIT_EXECUTABLE}" submodule foreach "${GIT_EXECUTABLE} checkout-index --all --prefix=${PACKAGE_DIR}/wsrep-lib/$path/" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/wsrep-lib + RESULT_VARIABLE RESULT + ) + IF(NOT RESULT EQUAL 0) + SET(GIT_EXECUTABLE) + ENDIF() ENDIF() CONFIGURE_FILE(${CMAKE_BINARY_DIR}/include/source_revision.h diff --git a/cmake/mariadb_connector_c.cmake b/cmake/mariadb_connector_c.cmake index ca0e16c8518..1ec62c6f6b2 100644 --- a/cmake/mariadb_connector_c.cmake +++ b/cmake/mariadb_connector_c.cmake @@ -8,7 +8,7 @@ SET(CONC_WITH_SIGNCODE ${SIGNCODE}) SET(SIGN_OPTIONS ${SIGNTOOL_PARAMETERS}) SET(CONC_WITH_EXTERNAL_ZLIB ON) -IF(SSL_DEFINES MATCHES "YASSL") +IF(SSL_DEFINES MATCHES "WOLFSSL") IF(WIN32) SET(CONC_WITH_SSL "SCHANNEL") ELSE() diff --git a/cmake/mysql_add_executable.cmake b/cmake/mysql_add_executable.cmake index 6650b088281..f63fcbe3265 100644 --- a/cmake/mysql_add_executable.cmake +++ b/cmake/mysql_add_executable.cmake @@ -63,21 +63,25 @@ FUNCTION (MYSQL_ADD_EXECUTABLE) UNSET(EXCLUDE_FROM_ALL) ENDIF() ADD_EXECUTABLE(${target} ${WIN32} ${MACOSX_BUNDLE} ${EXCLUDE_FROM_ALL} ${sources}) + # tell CPack where to install IF(NOT ARG_EXCLUDE_FROM_ALL) IF(NOT ARG_DESTINATION) SET(ARG_DESTINATION ${INSTALL_BINDIR}) ENDIF() IF(ARG_COMPONENT) - SET(COMP COMPONENT ${ARG_COMPONENT}) + SET(COMP ${ARG_COMPONENT}) ELSEIF(MYSQL_INSTALL_COMPONENT) - SET(COMP COMPONENT ${MYSQL_INSTALL_COMPONENT}) + SET(COMP ${MYSQL_INSTALL_COMPONENT}) ELSE() - SET(COMP COMPONENT Client) + SET(COMP Client) ENDIF() IF (COMP MATCHES ${SKIP_COMPONENTS}) RETURN() ENDIF() - MYSQL_INSTALL_TARGETS(${target} DESTINATION ${ARG_DESTINATION} ${COMP}) + MYSQL_INSTALL_TARGETS(${target} DESTINATION ${ARG_DESTINATION} COMPONENT ${COMP}) ENDIF() + + # create mariadb named symlink + CREATE_MARIADB_SYMLINK(${target} ${ARG_DESTINATION} ${COMP}) ENDFUNCTION() diff --git a/cmake/os/GNU.cmake b/cmake/os/GNU.cmake new file mode 100644 index 00000000000..898241e6c9e --- /dev/null +++ b/cmake/os/GNU.cmake @@ -0,0 +1,30 @@ +# Copyright (c) 2010, 2013, 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 + +# This file includes GNU/Hurd specific options and quirks, related to system checks + +# Something that needs to be set on legacy reasons +SET(_GNU_SOURCE 1) +SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE=1) + +# Ensure we have clean build for shared libraries +# without unresolved symbols +# Not supported with AddressSanitizer and ThreadSanitizer +IF(NOT WITH_ASAN AND NOT WITH_TSAN) + SET(LINK_FLAG_NO_UNDEFINED "-Wl,--no-undefined") +ENDIF() + +# 64 bit file offset support flag +SET(_FILE_OFFSET_BITS 64) diff --git a/cmake/os/SunOS.cmake b/cmake/os/SunOS.cmake index 4a77b53fb31..27daf2dff1c 100644 --- a/cmake/os/SunOS.cmake +++ b/cmake/os/SunOS.cmake @@ -70,7 +70,7 @@ CHECK_C_SOURCE_RUNS( # Check is special processor flag needs to be set on older GCC -#that defaults to v8 sparc . Code here is taken from my_rdtsc.c +#that defaults to v8 sparc . Code here is taken from my_rdtsc.h IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SIZEOF_VOID_P EQUAL 4 AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc") SET(SOURCE diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index dbb18a488c7..29891dfdabd 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -96,7 +96,8 @@ IF(MSVC) # Disable mingw based pkg-config found in Strawberry perl SET(PKG_CONFIG_EXECUTABLE 0 CACHE INTERNAL "") - SET(MSVC_CRT_TYPE /MT CACHE STRING + + SET(MSVC_CRT_TYPE /MD CACHE STRING "Runtime library - specify runtime library for linking (/MT,/MTd,/MD,/MDd)" ) SET(VALID_CRT_TYPES /MTd /MDd /MD /MT) @@ -106,9 +107,7 @@ IF(MSVC) IF(MSVC_CRT_TYPE MATCHES "/MD") # Dynamic runtime (DLLs), need to install CRT libraries. - SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE)# upgrade wizard SET(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT VCCRT) - SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS TRUE) SET(CMAKE_INSTALL_UCRT_LIBRARIES TRUE) IF(MSVC_CRT_TYPE STREQUAL "/MDd") SET (CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY TRUE) @@ -284,3 +283,17 @@ ENDIF() SET(FN_NO_CASE_SENSE 1) SET(USE_SYMDIR 1) + +# Force static C runtime for targets in current directory +# (useful to get rid of MFC dll's dependency, or in installer) +MACRO(FORCE_STATIC_CRT) + FOREACH(flag + CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT + CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT + CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL + ) + STRING(REGEX REPLACE "/MD[d]?" "/MT" "${flag}" "${${flag}}" ) + ENDFOREACH() +ENDMACRO() diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index 31b46365539..2a24405b690 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -25,7 +25,6 @@ SET(HAVE_ACCESS 1 CACHE INTERNAL "") SET(HAVE_ALARM CACHE INTERNAL "") SET(HAVE_ALLOCA_H CACHE INTERNAL "") SET(HAVE_ARPA_INET_H CACHE INTERNAL "") -SET(HAVE_ASM_MSR_H CACHE INTERNAL "") SET(HAVE_BACKTRACE CACHE INTERNAL "") SET(HAVE_BACKTRACE_SYMBOLS CACHE INTERNAL "") SET(HAVE_BACKTRACE_SYMBOLS_FD CACHE INTERNAL "") @@ -133,7 +132,6 @@ SET(HAVE_PTHREAD_YIELD_NP CACHE INTERNAL "") SET(HAVE_PTHREAD_YIELD_ZERO_ARG CACHE INTERNAL "") SET(HAVE_PUTENV 1 CACHE INTERNAL "") SET(HAVE_PWD_H CACHE INTERNAL "") -SET(HAVE_RDTSCLL CACHE INTERNAL "") SET(HAVE_READDIR_R CACHE INTERNAL "") SET(HAVE_READLINK CACHE INTERNAL "") SET(HAVE_READ_REAL_TIME CACHE INTERNAL "") @@ -154,6 +152,7 @@ SET(HAVE_SIGSET CACHE INTERNAL "") SET(HAVE_SIGTERM 1 CACHE INTERNAL "") SET(HAVE_SIGTHREADMASK CACHE INTERNAL "") SET(HAVE_SIGWAIT CACHE INTERNAL "") +SET(HAVE_SIGWAITINFO CACHE INTERNAL "") SET(HAVE_SIZEOF_CHARP TRUE CACHE INTERNAL "") SET(SIZEOF_CHARP ${CMAKE_SIZEOF_VOID_P} CACHE INTERNAL "") SET(HAVE_SIZEOF_IN6_ADDR TRUE CACHE INTERNAL "") @@ -301,7 +300,6 @@ SET(HAVE_SYS_UTSNAME_H CACHE INTERNAL "") SET(HAVE_PTHREAD_ATTR_GETGUARDSIZE CACHE INTERNAL "") SET(HAVE_SOCKPEERCRED 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 "") SET(HAVE_GCC_C11_ATOMICS_WITHOUT_LIBATOMIC CACHE INTERNAL "") diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index e7e9d2a3642..008ac9e9471 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -25,12 +25,13 @@ INCLUDE(CMakeParseArguments) # [MODULE_OUTPUT_NAME module_name] # [STATIC_OUTPUT_NAME static_name] # [RECOMPILE_FOR_EMBEDDED] +# [NOT_EMBEDDED] # [LINK_LIBRARIES lib1...libN] # [DEPENDS target1...targetN] MACRO(MYSQL_ADD_PLUGIN) CMAKE_PARSE_ARGUMENTS(ARG - "STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED;CLIENT" + "STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;NOT_EMBEDDED;RECOMPILE_FOR_EMBEDDED;CLIENT;EXPORT_SYMBOLS" "MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT;CONFIG" "LINK_LIBRARIES;DEPENDS" ${ARGN} @@ -139,8 +140,10 @@ MACRO(MYSQL_ADD_PLUGIN) ADD_LIBRARY(${target} STATIC ${SOURCES}) DTRACE_INSTRUMENT(${target}) ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDS}) - RESTRICT_SYMBOL_EXPORTS(${target}) - IF(WITH_EMBEDDED_SERVER) + IF(NOT ARG_EXPORT_SYMBOLS) + RESTRICT_SYMBOL_EXPORTS(${target}) + ENDIF() + IF(WITH_EMBEDDED_SERVER AND (NOT ARG_NOT_EMBEDDED)) # Embedded library should contain PIC code and be linkable # to shared libraries (on systems that need PIC) IF(ARG_RECOMPILE_FOR_EMBEDDED OR NOT _SKIP_PIC) @@ -165,19 +168,30 @@ MACRO(MYSQL_ADD_PLUGIN) TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES}) ENDIF() + SET(${with_var} ON CACHE INTERNAL "Link ${plugin} statically to the server" FORCE) + # Update mysqld dependencies SET (MYSQLD_STATIC_PLUGIN_LIBS ${MYSQLD_STATIC_PLUGIN_LIBS} ${target} ${ARG_LINK_LIBRARIES} CACHE INTERNAL "" FORCE) - SET(${with_var} ON CACHE INTERNAL "Link ${plugin} statically to the server" FORCE) + IF(WITH_EMBEDDED_SERVER AND (NOT ARG_NOT_EMBEDDED)) + SET (EMBEDDED_PLUGIN_LIBS ${EMBEDDED_PLUGIN_LIBS} + ${target} ${ARG_LINK_LIBRARIES} CACHE INTERNAL "" FORCE) + ENDIF() + + IF(ARG_NOT_EMBEDDED) + SET(builtin_entry "#ifndef EMBEDDED_LIBRARY\n builtin_maria_${target}_plugin,\n#endif") + ELSE() + SET(builtin_entry " builtin_maria_${target}_plugin,") + ENDIF() IF(ARG_MANDATORY) SET (mysql_mandatory_plugins - "${mysql_mandatory_plugins} builtin_maria_${target}_plugin,") + "${mysql_mandatory_plugins}${builtin_entry}\n") SET (mysql_mandatory_plugins ${mysql_mandatory_plugins} PARENT_SCOPE) ELSE() SET (mysql_optional_plugins - "${mysql_optional_plugins} builtin_maria_${target}_plugin,") + "${mysql_optional_plugins}${builtin_entry}\n") SET (mysql_optional_plugins ${mysql_optional_plugins} PARENT_SCOPE) ENDIF() ELSEIF(PLUGIN_${plugin} MATCHES "(DYNAMIC|AUTO|YES)" diff --git a/cmake/readline.cmake b/cmake/readline.cmake index 916504f96ac..9c35d8c7d22 100644 --- a/cmake/readline.cmake +++ b/cmake/readline.cmake @@ -134,7 +134,7 @@ MACRO (MYSQL_FIND_SYSTEM_READLINE) SET(USE_NEW_READLINE_INTERFACE 1) ELSE() IF(NOT_FOR_DISTRIBUTION) - SET(NON_DISTRIBUTABLE_WARNING "GPLv3") + SET(NON_DISTRIBUTABLE_WARNING "GPLv3" CACHE INTERNAL "") SET(USE_NEW_READLINE_INTERFACE 1) ELSE() SET(USE_NEW_READLINE_INTERFACE 0) @@ -160,8 +160,20 @@ MACRO (MYSQL_FIND_SYSTEM_LIBEDIT) int res= (*rl_completion_entry_function)(0,0); completion_matches(0,0); }" - LIBEDIT_INTERFACE) - SET(USE_LIBEDIT_INTERFACE ${LIBEDIT_INTERFACE}) + LIBEDIT_HAVE_COMPLETION_INT) + + CHECK_CXX_SOURCE_COMPILES(" + #include <stdio.h> + #include <readline.h> + int main(int argc, char **argv) + { + char res= *(*rl_completion_entry_function)(0,0); + completion_matches(0,0); + }" + LIBEDIT_HAVE_COMPLETION_CHAR) + IF(LIBEDIT_HAVE_COMPLETION_INT OR LIBEDIT_HAVE_COMPLETION_CHAR) + SET(USE_LIBEDIT_INTERFACE 1) + ENDIF() ENDIF() ENDMACRO() @@ -187,6 +199,7 @@ MACRO (MYSQL_CHECK_READLINE) IF(USE_LIBEDIT_INTERFACE) SET(MY_READLINE_INCLUDE_DIR ${LIBEDIT_INCLUDE_DIR}) SET(MY_READLINE_LIBRARY ${LIBEDIT_LIBRARY} ${CURSES_LIBRARY}) + SET(USE_NEW_READLINE_INTERFACE ${LIBEDIT_HAVE_COMPLETION_CHAR}) ELSE() MYSQL_USE_BUNDLED_READLINE() ENDIF() diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake index 1db6787aeb6..a6793cf3c55 100644 --- a/cmake/ssl.cmake +++ b/cmake/ssl.cmake @@ -15,7 +15,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA # We support different versions of SSL: -# - "bundled" uses source code in <source dir>/extra/yassl +# - "bundled" uses source code in <source dir>/extra/wolfssl # - "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" @@ -35,7 +35,7 @@ # '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 "bundled (use wolfssl)") SET(WITH_SSL_DOC "${WITH_SSL_DOC}, yes (prefer os library if present, otherwise use bundled)") SET(WITH_SSL_DOC @@ -48,29 +48,20 @@ MACRO (CHANGE_SSL_SETTINGS string) ENDMACRO() MACRO (MYSQL_USE_BUNDLED_SSL) - SET(INC_DIRS - ${CMAKE_SOURCE_DIR}/extra/yassl/include - ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/include + SET(INC_DIRS + ${CMAKE_BINARY_DIR}/extra/wolfssl + ${CMAKE_SOURCE_DIR}/extra/wolfssl/wolfssl + ${CMAKE_SOURCE_DIR}/extra/wolfssl/wolfssl/wolfssl ) - SET(SSL_LIBRARIES yassl taocrypt) + SET(SSL_LIBRARIES wolfssl wolfcrypt) SET(SSL_INCLUDE_DIRS ${INC_DIRS}) - SET(SSL_INTERNAL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/mySTL) - 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") - SET(HAVE_EncryptAes128Ctr OFF CACHE INTERNAL "yassl doesn't support AES-CTR") - SET(HAVE_EncryptAes128Gcm OFF CACHE INTERNAL "yassl doesn't support AES-GCM") + SET(SSL_DEFINES "-DHAVE_OPENSSL -DHAVE_WOLFSSL -DWOLFSSL_USER_SETTINGS") + SET(HAVE_ERR_remove_thread_state ON CACHE INTERNAL "wolfssl doesn't have ERR_remove_thread_state") + SET(HAVE_EncryptAes128Ctr OFF CACHE INTERNAL "wolfssl does support AES-CTR, but differently from openssl") + SET(HAVE_EncryptAes128Gcm OFF CACHE INTERNAL "wolfssl does not support AES-GCM") + SET(HAVE_X509_check_host ON CACHE INTERNAL "wolfssl does support X509_check_host") CHANGE_SSL_SETTINGS("bundled") - ADD_SUBDIRECTORY(extra/yassl) - ADD_SUBDIRECTORY(extra/yassl/taocrypt) - 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}) - ENDFOREACH() + ADD_SUBDIRECTORY(extra/wolfssl) MESSAGE_ONCE(SSL_LIBRARIES "SSL_LIBRARIES = ${SSL_LIBRARIES}") ENDMACRO() @@ -157,6 +148,8 @@ MACRO (MYSQL_CHECK_SSL) HAVE_EncryptAes128Ctr) CHECK_SYMBOL_EXISTS(EVP_aes_128_gcm "openssl/evp.h" HAVE_EncryptAes128Gcm) + CHECK_SYMBOL_EXISTS(X509_check_host "openssl/x509v3.h" + HAVE_X509_check_host) SET(CMAKE_REQUIRED_INCLUDES) SET(CMAKE_REQUIRED_LIBRARIES) ELSE() diff --git a/cmake/submodules.cmake b/cmake/submodules.cmake index fca67a0508b..34dcfbea77a 100644 --- a/cmake/submodules.cmake +++ b/cmake/submodules.cmake @@ -45,6 +45,6 @@ ENDIF() IF(update_result OR NOT EXISTS ${CMAKE_SOURCE_DIR}/libmariadb/CMakeLists.txt) MESSAGE(FATAL_ERROR "No MariaDB Connector/C! Run - ${GIT_EXECUTABLE} submodule update --init + ${GIT_EXECUTABLE} submodule update --init --recursive Then restart the build.${SUBMODULE_UPDATE_CONFIG_MESSAGE}") ENDIF() diff --git a/cmake/symlinks.cmake b/cmake/symlinks.cmake new file mode 100644 index 00000000000..ec638bc82de --- /dev/null +++ b/cmake/symlinks.cmake @@ -0,0 +1,76 @@ +# Create lists +if(COMMAND REGISTER_SYMLINK) + return() +endif() + +macro(REGISTER_SYMLINK from to) + list(APPEND MARIADB_SYMLINK_FROMS ${from}) + list(APPEND MARIADB_SYMLINK_TOS ${to}) +endmacro() + +# MariaDB names for executables +REGISTER_SYMLINK("mysql" "mariadb") +REGISTER_SYMLINK("mysqlaccess" "mariadb-access") +REGISTER_SYMLINK("mysqladmin" "mariadb-admin") +REGISTER_SYMLINK("mariabackup" "mariadb-backup") +REGISTER_SYMLINK("mysqlbinlog" "mariadb-binlog") +REGISTER_SYMLINK("mysqlcheck" "mariadb-check") +REGISTER_SYMLINK("mysql_client_test_embedded" "mariadb-client-test-embedded") +REGISTER_SYMLINK("mysql_client_test" "mariadb-client-test") +REGISTER_SYMLINK("mariadb_config" "mariadb-config") +REGISTER_SYMLINK("mysql_convert_table_format" "mariadb-convert-table-format") +REGISTER_SYMLINK("mysqldump" "mariadb-dump") +REGISTER_SYMLINK("mysqldumpslow" "mariadb-dumpslow") +REGISTER_SYMLINK("mysql_embedded" "mariadb-embedded") +REGISTER_SYMLINK("mysql_find_rows" "mariadb-find-rows") +REGISTER_SYMLINK("mysql_fix_extensions" "mariadb-fix-extensions") +REGISTER_SYMLINK("mysqlhotcopy" "mariadb-hotcopy") +REGISTER_SYMLINK("mysqlimport" "mariadb-import") +REGISTER_SYMLINK("mysql_install_db" "mariadb-install-db") +REGISTER_SYMLINK("mysql_ldb" "mariadb-ldb") +REGISTER_SYMLINK("mysql_plugin" "mariadb-plugin") +REGISTER_SYMLINK("mysql_secure_installation" "mariadb-secure-installation") +REGISTER_SYMLINK("mysql_setpermission" "mariadb-setpermission") +REGISTER_SYMLINK("mysqlshow" "mariadb-show") +REGISTER_SYMLINK("mysqlslap" "mariadb-slap") +REGISTER_SYMLINK("mysqltest" "mariadb-test") +REGISTER_SYMLINK("mysqltest_embedded" "mariadb-test-embedded") +REGISTER_SYMLINK("mysql_tzinfo_to_sql" "mariadb-tzinfo-to-sql") +REGISTER_SYMLINK("mysql_upgrade" "mariadb-upgrade") +REGISTER_SYMLINK("mysql_upgrade_service" "mariadb-upgrade-service") +REGISTER_SYMLINK("mysql_upgrade_wizard" "mariadb-upgrade-wizard") +REGISTER_SYMLINK("mysql_waitpid" "mariadb-waitpid") +REGISTER_SYMLINK("mysqld" "mariadbd") +REGISTER_SYMLINK("mysqld_multi" "mariadbd-multi") +REGISTER_SYMLINK("mysqld_safe" "mariadbd-safe") +REGISTER_SYMLINK("mysqld_safe_helper" "mariadbd-safe-helper") + +# Add MariaDB symlinks +macro(CREATE_MARIADB_SYMLINK src dir comp) + # Find the MariaDB name for executable + list(FIND MARIADB_SYMLINK_FROMS ${src} _index) + + if (${_index} GREATER -1) + list(GET MARIADB_SYMLINK_TOS ${_index} mariadbname) + endif() + + if (mariadbname) + CREATE_MARIADB_SYMLINK_IN_DIR(${src} ${mariadbname} ${dir} ${comp}) + endif() +endmacro(CREATE_MARIADB_SYMLINK) + +# Add MariaDB symlinks in directory +macro(CREATE_MARIADB_SYMLINK_IN_DIR src dest dir comp) + if(UNIX) + add_custom_target( + SYM_${dest} ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${dest} + ) + + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${dest} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E create_symlink ${src} ${dest} + COMMENT "mklink ${src} -> ${dest}") + + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${dest} DESTINATION ${dir} COMPONENT ${comp}) + endif() +endmacro(CREATE_MARIADB_SYMLINK_IN_DIR) diff --git a/cmake/wsrep.cmake b/cmake/wsrep.cmake index 990198ecf72..368ae61d1d3 100644 --- a/cmake/wsrep.cmake +++ b/cmake/wsrep.cmake @@ -17,6 +17,7 @@ # # Galera library does not compile with windows # +IF (NOT WITHOUT_SERVER) IF(UNIX) SET(with_wsrep_default ON) ELSE() @@ -24,23 +25,46 @@ ELSE() ENDIF() OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default}) +OPTION(WITH_WSREP_ALL + "Build all components of WSREP (unit tests, sample programs)" + OFF) -# Set the patch version -SET(WSREP_PATCH_VERSION "24") +IF(WITH_WSREP) + # Set the patch version + SET(WSREP_PATCH_VERSION "22") -# Obtain wsrep API version -FILE(STRINGS "${MySQL_SOURCE_DIR}/wsrep/wsrep_api.h" WSREP_API_VERSION - LIMIT_COUNT 1 REGEX "WSREP_INTERFACE_VERSION") -STRING(REGEX MATCH "([0-9]+)" WSREP_API_VERSION "${WSREP_API_VERSION}") + IF(NOT EXISTS "${CMAKE_SOURCE_DIR}/wsrep-lib/wsrep-API/v26/wsrep_api.h") + MESSAGE(FATAL_ERROR "No MariaDB wsrep-API code! Run + ${GIT_EXECUTABLE} submodule update --init --recursive +Then restart the build. +") + ENDIF() + # Obtain wsrep API version + FILE(STRINGS "${CMAKE_SOURCE_DIR}/wsrep-lib/wsrep-API/v26/wsrep_api.h" WSREP_API_VERSION + LIMIT_COUNT 1 REGEX "WSREP_INTERFACE_VERSION") + STRING(REGEX MATCH "([0-9]+)" WSREP_API_VERSION "${WSREP_API_VERSION}") -SET(WSREP_VERSION "${WSREP_API_VERSION}.${WSREP_PATCH_VERSION}" - CACHE INTERNAL "WSREP version") + SET(WSREP_VERSION "${WSREP_API_VERSION}.${WSREP_PATCH_VERSION}" + CACHE INTERNAL "WSREP version") -SET(WSREP_PROC_INFO ${WITH_WSREP}) + SET(WSREP_PROC_INFO ${WITH_WSREP}) -IF(WITH_WSREP) SET(WSREP_PATCH_VERSION "wsrep_${WSREP_VERSION}") + if (NOT WITH_WSREP_ALL) + SET(WSREP_LIB_WITH_UNIT_TESTS OFF CACHE BOOL + "Disable unit tests for wsrep-lib") + SET(WSREP_LIB_WITH_DBSIM OFF CACHE BOOL + "Disable building dbsim for wsrep-lib") + endif() + INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/wsrep-lib/include) + INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/wsrep-lib/wsrep-API/v26) + + SET(old_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) + SET(BUILD_SHARED_LIBS OFF) + ADD_SUBDIRECTORY(wsrep-lib) + SET(BUILD_SHARED_LIBS ${old_BUILD_SHARED_LIBS}) ENDIF() IF (NOT WIN32) ADD_FEATURE_INFO(WSREP WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)") ENDIF() +ENDIF(NOT WITHOUT_SERVER) |