diff options
Diffstat (limited to 'cmake')
45 files changed, 604 insertions, 694 deletions
diff --git a/cmake/CPackRPM.cmake b/cmake/CPackRPM.cmake deleted file mode 100644 index 1d22387d098..00000000000 --- a/cmake/CPackRPM.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# -# Wrapper for CPackRPM.cmake -# - -# load the original CPackRPM.cmake -set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) -unset(CMAKE_MODULE_PATH) -include(CPackRPM) -set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH}) - -# per-component cleanup -foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV) - unset(TMP_RPM_${_RPM_SPEC_HEADER}) - unset(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) -endforeach() - diff --git a/cmake/FindBISON.cmake b/cmake/FindBISON.cmake new file mode 100644 index 00000000000..28ae3f8fecb --- /dev/null +++ b/cmake/FindBISON.cmake @@ -0,0 +1,8 @@ +IF(DEFINED BISON_EXECUTABLE) + SET(bison_quiet QUIET) +ENDIF() + +set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) +unset(CMAKE_MODULE_PATH) +find_package(BISON ${BISON_FIND_VERSION} ${bison_quiet} ${BISON_FIND_REQUIRED}) +set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH}) diff --git a/cmake/FindJNI.cmake b/cmake/FindJNI.cmake new file mode 100644 index 00000000000..fb2f4801a70 --- /dev/null +++ b/cmake/FindJNI.cmake @@ -0,0 +1,8 @@ +if(DEFINED JAVA_AWT_LIBRARY) + return() +endif() + +set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) +unset(CMAKE_MODULE_PATH) +include(FindJNI) +set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH}) diff --git a/cmake/FindJava.cmake b/cmake/FindJava.cmake new file mode 100644 index 00000000000..95bbf8682cd --- /dev/null +++ b/cmake/FindJava.cmake @@ -0,0 +1,8 @@ +if(DEFINED Java_JAVA_EXECUTABLE) + return() +endif() + +set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) +unset(CMAKE_MODULE_PATH) +include(FindJava) +set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH}) diff --git a/cmake/FindLZ4.cmake b/cmake/FindLZ4.cmake new file mode 100644 index 00000000000..e97dd63e2b0 --- /dev/null +++ b/cmake/FindLZ4.cmake @@ -0,0 +1,9 @@ +find_path(LZ4_INCLUDE_DIR NAMES lz4.h) +find_library(LZ4_LIBRARY NAMES lz4) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS( + LZ4 DEFAULT_MSG + LZ4_LIBRARY LZ4_INCLUDE_DIR) + +mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARY) diff --git a/cmake/FindZSTD.cmake b/cmake/FindZSTD.cmake new file mode 100644 index 00000000000..0fd73501327 --- /dev/null +++ b/cmake/FindZSTD.cmake @@ -0,0 +1,18 @@ +find_path( + ZSTD_INCLUDE_DIR + NAMES "zstd.h" +) + +find_library( + ZSTD_LIBRARY + NAMES zstd +) + +set(ZSTD_LIBRARIES ${ZSTD_LIBRARY}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args( + ZSTD DEFAULT_MSG ZSTD_INCLUDE_DIR ZSTD_LIBRARIES) + +mark_as_advanced(ZSTD_INCLUDE_DIR ZSTD_LIBRARIES ZSTD_FOUND) + diff --git a/cmake/Internal/CPack/CPackRPM.cmake b/cmake/Internal/CPack/CPackRPM.cmake new file mode 100644 index 00000000000..2729667e319 --- /dev/null +++ b/cmake/Internal/CPack/CPackRPM.cmake @@ -0,0 +1,68 @@ +# +# Wrapper for CPackRPM.cmake +# + +# +# Support for per-component LICENSE and VENDOR +# +# per component values, if present, are copied into global CPACK_RPM_PACKAGE_xxx +# +macro(set_from_component WHAT) + set(orig_CPACK_RPM_PACKAGE_${WHAT} ${CPACK_RPM_PACKAGE_${WHAT}}) + if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${WHAT}) + set(CPACK_RPM_PACKAGE_${WHAT} ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${WHAT}}) + endif() +endmacro() +macro(restore WHAT) + set(CPACK_RPM_PACKAGE_${WHAT} ${orig_CPACK_RPM_PACKAGE_${WHAT}}) +endmacro() + +set_from_component(LICENSE) +set_from_component(VENDOR) + +# +# Support for the %posttrans scriptlet +# +# the scriptlet, if present, is appended (together with the %posttrans tag) +# to the pre-uninstall scriptlet +# +set(base_time "PRE") +set(base_type "UNINSTALL") +set(base_var CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_${base_time}_${base_type}_SCRIPT_FILE) +set(acc) + +macro(read_one_file time_ type_ tag_) + set(var CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_${time_}_${type_}_SCRIPT_FILE) + if (${var}) + file(READ ${${var}} content) + set(acc "${tag_}\n${content}\n\n${acc}") + endif() +endmacro() + +read_one_file("POST" "TRANS" "%posttrans") +if (acc) + set(orig_${base_var} ${${base_var}}) + read_one_file(${base_time} ${base_type} "") + set(${base_var} ${CPACK_TOPLEVEL_DIRECTORY}/SPECS/${CPACK_RPM_PACKAGE_COMPONENT}_${base_time}_${base_type}.scriptlet) + file(WRITE ${${base_var}} "${acc}") +endif() + +# load the original CPackRPM.cmake +set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) +unset(CMAKE_MODULE_PATH) +if (CMAKE_VERSION VERSION_GREATER "3.12.99") + include(Internal/CPack/CPackRPM) +else() + include(CPackRPM) +endif() +set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH}) + +restore(LICENSE) +restore(VENDOR) +set(${base_var} ${orig_${base_var}}) + +# per-component cleanup +foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV) + unset(TMP_RPM_${_RPM_SPEC_HEADER}) + unset(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) +endforeach() diff --git a/cmake/bison.cmake b/cmake/bison.cmake index 24adcb788d9..717cd50dedd 100644 --- a/cmake/bison.cmake +++ b/cmake/bison.cmake @@ -20,7 +20,16 @@ IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") SET(BISON_EXECUTABLE /opt/csw/bin/bison) ENDIF() ENDIF() -FIND_PROGRAM(BISON_EXECUTABLE bison DOC "path to the bison executable") +IF(WIN32) + SET(BISON_PATH_HINTS + HINTS + C:/gnuwin32/bin + C:/cygwin64/bin + C:/cygwin/bin) +ENDIF() +FIND_PROGRAM(BISON_EXECUTABLE bison + ${BISON_PATH_HINTS} + DOC "path to the bison executable") MARK_AS_ADVANCED(BISON_EXECUTABLE "") IF(NOT BISON_EXECUTABLE) MESSAGE("Warning: Bison executable not found in PATH") diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index 5af197c7f11..efd736809e0 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -28,7 +28,10 @@ ENDIF() IF(SIZEOF_VOIDP EQUAL 8) SET(64BIT 1) ENDIF() - + +# include aws_key_management plugin in release builds +OPTION(AWS_SDK_EXTERNAL_PROJECT "Allow download and build AWS C++ SDK" ON) + SET(FEATURE_SET "community" CACHE STRING " Selection of features. Options are - xsmall : @@ -60,7 +63,7 @@ IF(FEATURE_SET) SET(WITH_NONE ON) ENDIF() - IF(num GREATER FEATURE_SET_xsmall) + IF(num GREATER FEATURE_SET_xsmall AND NOT WIN32) SET(WITH_EMBEDDED_SERVER ON CACHE BOOL "") ENDIF() IF(num GREATER FEATURE_SET_small) @@ -84,25 +87,26 @@ IF(FEATURE_SET) ENDIF() SET(WITH_INNODB_SNAPPY OFF CACHE STRING "") +SET(WITH_NUMA 0 CACHE BOOL "") IF(WIN32) - SET(WITH_LIBARCHIVE STATIC CACHE STRING "") + SET(INSTALL_MYSQLTESTDIR "" CACHE STRING "") + SET(INSTALL_SQLBENCHDIR "" CACHE STRING "") + SET(INSTALL_SUPPORTFILESDIR "" CACHE STRING "") ELSEIF(RPM) SET(WITH_SSL system CACHE STRING "") SET(WITH_ZLIB system CACHE STRING "") SET(CHECKMODULE /usr/bin/checkmodule CACHE FILEPATH "") SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE FILEPATH "") - SET(WITH_LIBARCHIVE ON CACHE STRING "") ELSEIF(DEB) SET(WITH_SSL system CACHE STRING "") SET(WITH_ZLIB system CACHE STRING "") SET(WITH_LIBWRAP ON) SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON) - SET(WITH_LIBARCHIVE ON CACHE STRING "") ELSE() SET(WITH_SSL bundled CACHE STRING "") + SET(WITH_PCRE bundled CACHE STRING "") SET(WITH_ZLIB bundled CACHE STRING "") SET(WITH_JEMALLOC static CACHE STRING "") - SET(WITH_LIBARCHIVE STATIC CACHE STRING "") ENDIF() IF(NOT COMPILATION_COMMENT) @@ -133,7 +137,7 @@ IF(UNIX) RedHat/Fedora/Oracle Linux: yum install libaio-devel SuSE: zypper install libaio-devel - If you really do not want it, pass -DIGNORE_AIO_CHECK to cmake. + If you really do not want it, pass -DIGNORE_AIO_CHECK=ON to cmake. ") ENDIF() diff --git a/cmake/build_depends.cmake b/cmake/build_depends.cmake index 0d17c22cf98..333df580200 100644 --- a/cmake/build_depends.cmake +++ b/cmake/build_depends.cmake @@ -16,6 +16,11 @@ IF(RPM) ENDIF() ENDMACRO() + # FindBoost.cmake doesn't leave any trace, do it here + IF (Boost_INCLUDE_DIR) + FIND_FILE(Boost_config_hpp boost/config.hpp PATHS ${Boost_INCLUDE_DIR}) + ENDIF() + GET_CMAKE_PROPERTY(ALL_VARS CACHE_VARIABLES) FOREACH (V ${ALL_VARS}) GET_PROPERTY(H CACHE ${V} PROPERTY HELPSTRING) diff --git a/cmake/bzip2.cmake b/cmake/bzip2.cmake deleted file mode 100644 index 26fd703120e..00000000000 --- a/cmake/bzip2.cmake +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (C) 2014, SkySQL Ab. 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-1335 USA - -SET(WITH_INNODB_BZIP2 AUTO CACHE STRING - "Build with bzip2. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'") - -MACRO (MYSQL_CHECK_BZIP2) - IF (WITH_INNODB_BZIP2 STREQUAL "ON" OR WITH_INNODB_BZIP2 STREQUAL "AUTO") - CHECK_INCLUDE_FILES(bzlib.h HAVE_BZLIB2_H) - CHECK_LIBRARY_EXISTS(bz2 BZ2_bzBuffToBuffCompress "" HAVE_BZLIB2_COMPRESS) - CHECK_LIBRARY_EXISTS(bz2 BZ2_bzBuffToBuffDecompress "" HAVE_BZLIB2_DECOMPRESS) - - IF (HAVE_BZLIB2_COMPRESS AND HAVE_BZLIB2_DECOMPRESS AND HAVE_BZLIB2_H) - ADD_DEFINITIONS(-DHAVE_BZIP2=1) - LINK_LIBRARIES(bz2) - ELSE() - IF (WITH_INNODB_BZIP2 STREQUAL "ON") - MESSAGE(FATAL_ERROR "Required bzip2 library is not found") - ENDIF() - ENDIF() - ENDIF() -ENDMACRO() diff --git a/cmake/cat.cmake b/cmake/cat.cmake deleted file mode 100644 index 3a76b20da99..00000000000 --- a/cmake/cat.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) 2009 Sun Microsystems, Inc. -# Use is subject to license terms. -# -# 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-1335 USA - -# Concatenate files -# -# Parameters : -# IN - input files (list) -# OUT - output file -FILE(WRITE ${OUT} "") -FOREACH(FILENAME ${IN}) - FILE(READ ${FILENAME} CONTENTS) - FILE(APPEND ${OUT} "${CONTENTS}") -ENDFOREACH() - - diff --git a/cmake/check_compiler_flag.cmake b/cmake/check_compiler_flag.cmake index 547325e4fa2..3c05c6bafd3 100644 --- a/cmake/check_compiler_flag.cmake +++ b/cmake/check_compiler_flag.cmake @@ -16,7 +16,7 @@ SET(fail_patterns #The regex patterns above are not localized, thus LANG=C SET(ENV{LANG} C) MACRO (MY_CHECK_C_COMPILER_FLAG flag) - STRING(REGEX REPLACE "[-,= +]" "_" result "HAVE_C_${flag}") + STRING(REGEX REPLACE "[-,= +]" "_" result "have_C_${flag}") SET(SAVE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}") CHECK_C_SOURCE_COMPILES("int main(void) { return 0; }" ${result} @@ -25,7 +25,7 @@ MACRO (MY_CHECK_C_COMPILER_FLAG flag) ENDMACRO() MACRO (MY_CHECK_CXX_COMPILER_FLAG flag) - STRING(REGEX REPLACE "[-,= +]" "_" result "HAVE_CXX_${flag}") + STRING(REGEX REPLACE "[-,= +]" "_" result "have_CXX_${flag}") SET(SAVE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${flag}") CHECK_CXX_SOURCE_COMPILES("int main(void) { return 0; }" ${result} @@ -44,7 +44,7 @@ FUNCTION(MY_CHECK_AND_SET_COMPILER_FLAG flag_to_set) MY_CHECK_CXX_COMPILER_FLAG(${flag_to_check}) STRING(REGEX REPLACE "[-,= +]" "_" result "${flag_to_check}") FOREACH(lang C CXX) - IF (HAVE_${lang}_${result}) + IF (have_${lang}_${result}) IF(ARGN) FOREACH(type ${ARGN}) SET(CMAKE_${lang}_FLAGS_${type} "${CMAKE_${lang}_FLAGS_${type}} ${flag_to_set}" PARENT_SCOPE) diff --git a/cmake/check_minimal_version.cmake b/cmake/check_minimal_version.cmake deleted file mode 100644 index 5bef555b32d..00000000000 --- a/cmake/check_minimal_version.cmake +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2009 Sun Microsystems, Inc. -# Use is subject to license terms. -# -# 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-1335 USA - -# This is a helper script is used to check for the minimal required version -# It helps to decide whether to use autoconf based configure or cmake's -# configure -CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR) diff --git a/cmake/cmake_parse_arguments.cmake b/cmake/cmake_parse_arguments.cmake deleted file mode 100644 index 800fef6e728..00000000000 --- a/cmake/cmake_parse_arguments.cmake +++ /dev/null @@ -1,47 +0,0 @@ - -# Copyright (c) 2007, 2010, 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-1335 USA - -# Handy macro to parse macro arguments -MACRO(MYSQL_PARSE_ARGUMENTS prefix arg_names option_names) - SET(DEFAULT_ARGS) - FOREACH(arg_name ${arg_names}) - SET(${prefix}_${arg_name}) - ENDFOREACH(arg_name) - FOREACH(option ${option_names}) - SET(${prefix}_${option} FALSE) - ENDFOREACH(option) - - SET(current_arg_name DEFAULT_ARGS) - SET(current_arg_list) - FOREACH(arg ${ARGN}) - SET(larg_names ${arg_names}) - LIST(FIND larg_names "${arg}" is_arg_name) - IF (is_arg_name GREATER -1) - SET(${prefix}_${current_arg_name} ${current_arg_list}) - SET(current_arg_name ${arg}) - SET(current_arg_list) - ELSE (is_arg_name GREATER -1) - SET(loption_names ${option_names}) - LIST(FIND loption_names "${arg}" is_option) - IF (is_option GREATER -1) - SET(${prefix}_${arg} TRUE) - ELSE (is_option GREATER -1) - SET(current_arg_list ${current_arg_list} ${arg}) - ENDIF (is_option GREATER -1) - ENDIF (is_arg_name GREATER -1) - ENDFOREACH(arg) - SET(${prefix}_${current_arg_name} ${current_arg_list}) -ENDMACRO()
\ No newline at end of file diff --git a/cmake/configure.pl b/cmake/configure.pl index 45847aa576f..3139587a8e1 100644 --- a/cmake/configure.pl +++ b/cmake/configure.pl @@ -165,21 +165,26 @@ foreach my $option (@ARGV) $cmakeargs = $cmakeargs." -DWITH_LIBEVENT=bundled"; next; } - if($option =~ /with-ssl=/) + if($option =~ /with-ssl=yes/) { $cmakeargs = $cmakeargs." -DWITH_SSL=yes"; next; } - if($option =~ /with-debug/) + if($option =~ /with-ssl=system/) { - $cmakeargs = $cmakeargs." -DCMAKE_BUILD_TYPE=Debug -DSECURITY_HARDENED=OFF"; + $cmakeargs = $cmakeargs." -DWITH_SSL=system"; next; } - if($option =~ /with-ssl/) + if($option =~ /with-ssl$/) { $cmakeargs = $cmakeargs." -DWITH_SSL=bundled"; next; } + if($option =~ /with-debug/) + { + $cmakeargs = $cmakeargs." -DCMAKE_BUILD_TYPE=Debug -DSECURITY_HARDENED=OFF"; + next; + } if($option =~ /prefix=/) { $cmake_install_prefix= substr($option, 7); diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index a0449b5918d..827b1e166a4 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -39,6 +39,7 @@ ELSE() SET(CPACK_RPM_FILE_NAME "RPM-DEFAULT") OPTION(CPACK_RPM_DEBUGINFO_PACKAGE "" ON) MARK_AS_ADVANCED(CPACK_RPM_DEBUGINFO_PACKAGE) + SET(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/usr/src/debug/${CPACK_RPM_PACKAGE_NAME}-${VERSION}") ENDIF() SET(CPACK_RPM_PACKAGE_RELEASE "1%{?dist}") @@ -46,16 +47,21 @@ 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_SUMMARY ${CPACK_PACKAGE_SUMMARY}) SET(CPACK_RPM_PACKAGE_URL ${CPACK_PACKAGE_URL}) -SET(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_RPM_PACKAGE_SUMMARY} +SET(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}") -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/). +SET(CPACK_RPM_shared_PACKAGE_VENDOR "MariaDB Corporation Ab") +SET(CPACK_RPM_shared_PACKAGE_LICENSE "LGPLv2.1") +SET(CPACK_RPM_shared_PACKAGE_SUMMARY "LGPL MariaDB client library") +SET(CPACK_RPM_shared_PACKAGE_DESCRIPTION " +This is LGPL MariaDB client library that can be used to connect to MySQL +or MariaDB. -MariaDB documentation can be found at https://mariadb.com/kb -MariaDB bug reports should be submitted through https://jira.mariadb.org +This code is based on the LGPL libmysql client library from MySQL 3.23 +and PHP's mysqlnd extension. +This product includes PHP software, freely available from +<http://www.php.net/software/> ") SET(CPACK_RPM_SPEC_MORE_DEFINE " @@ -68,6 +74,8 @@ SET(CPACK_RPM_SPEC_MORE_DEFINE " %define _bindir ${INSTALL_BINDIRABS} %define _sbindir ${INSTALL_SBINDIRABS} %define _sysconfdir ${INSTALL_SYSCONFDIR} +%define restart_flag_dir %{_localstatedir}/lib/rpm-state/mariadb +%define restart_flag %{restart_flag_dir}/need-restart %{?filter_setup: %filter_provides_in \\\\.\\\\(test\\\\|result\\\\|h\\\\|cc\\\\|c\\\\|inc\\\\|opt\\\\|ic\\\\|cnf\\\\|rdiff\\\\|cpp\\\\)$ @@ -92,8 +100,13 @@ SET(ignored "%ignore /etc" "%ignore /etc/init.d" "%ignore /etc/logrotate.d" + "%ignore /etc/security" "%ignore /etc/systemd" "%ignore /etc/systemd/system" + "%ignore /lib" + "%ignore /lib/security" + "%ignore /lib64" + "%ignore /lib64/security" "%ignore ${CMAKE_INSTALL_PREFIX}" "%ignore ${CMAKE_INSTALL_PREFIX}/bin" "%ignore ${CMAKE_INSTALL_PREFIX}/include" @@ -107,8 +120,8 @@ SET(ignored "%ignore ${CMAKE_INSTALL_PREFIX}/share/aclocal" "%ignore ${CMAKE_INSTALL_PREFIX}/share/doc" "%ignore ${CMAKE_INSTALL_PREFIX}/share/man" - "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man1" - "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man8" + "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man1*" + "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man8*" "%ignore ${CMAKE_INSTALL_PREFIX}/share/pkgconfig" ) @@ -130,15 +143,13 @@ ENDMACRO(SETA) SETA(CPACK_RPM_client_PACKAGE_OBSOLETES "mysql-client" - "MySQL-client" - "MySQL-OurDelta-client") + "MySQL-client") SETA(CPACK_RPM_client_PACKAGE_PROVIDES "MySQL-client" "mysql-client") SETA(CPACK_RPM_devel_PACKAGE_OBSOLETES - "MySQL-devel" - "MySQL-OurDelta-devel") + "MySQL-devel") SETA(CPACK_RPM_devel_PACKAGE_PROVIDES "MySQL-devel") @@ -147,8 +158,7 @@ SETA(CPACK_RPM_server_PACKAGE_OBSOLETES "MySQL" "mysql-server" "MySQL-server" - "MariaDB-Galera-server" - "MySQL-OurDelta-server") + "MariaDB-Galera-server") SETA(CPACK_RPM_server_PACKAGE_PROVIDES "MariaDB" "MySQL" @@ -156,22 +166,8 @@ SETA(CPACK_RPM_server_PACKAGE_PROVIDES "msqlormysql" "mysql-server") -SETA(CPACK_RPM_shared_PACKAGE_OBSOLETES - "mysql-shared" - "MySQL-shared-standard" - "MySQL-shared-pro" - "MySQL-shared-pro-cert" - "MySQL-shared-pro-gpl" - "MySQL-shared-pro-gpl-cert" - "MySQL-shared" - "MySQL-OurDelta-shared") -SETA(CPACK_RPM_shared_PACKAGE_PROVIDES - "MySQL-shared" - "mysql-shared") - SETA(CPACK_RPM_test_PACKAGE_OBSOLETES - "MySQL-test" - "MySQL-OurDelta-test") + "MySQL-test") SETA(CPACK_RPM_test_PACKAGE_PROVIDES "MySQL-test") @@ -194,8 +190,11 @@ SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/r SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-preun.sh) SET(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postin.sh) SET(CPACK_RPM_server_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postun.sh) +SET(CPACK_RPM_server_POST_TRANS_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-posttrans.sh) SET(CPACK_RPM_shared_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh) SET(CPACK_RPM_shared_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh) +SET(CPACK_RPM_compat_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh) +SET(CPACK_RPM_compat_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh) MACRO(ALTERNATIVE_NAME real alt) SET(ver "%{version}-%{release}") @@ -216,11 +215,8 @@ ALTERNATIVE_NAME("test" "mysql-test") # Argh! Different distributions call packages differently, to be a drop-in # replacement we have to fake distribution-speficic dependencies -IF(RPM MATCHES "(rhel|centos)5") - ALTERNATIVE_NAME("shared" "mysql") -ELSEIF(RPM MATCHES "(rhel|centos)6") +IF(RPM MATCHES "(rhel|centos)6") ALTERNATIVE_NAME("client" "mysql") - ALTERNATIVE_NAME("shared" "mysql-libs") ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7") SET(epoch 1) # this is fedora ALTERNATIVE_NAME("client" "mariadb") @@ -228,10 +224,9 @@ ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7") ALTERNATIVE_NAME("devel" "mariadb-devel") ALTERNATIVE_NAME("server" "mariadb-server") ALTERNATIVE_NAME("server" "mysql-compat-server") - ALTERNATIVE_NAME("shared" "mariadb-libs") - ALTERNATIVE_NAME("shared" "mysql-libs") ALTERNATIVE_NAME("test" "mariadb-test") - SET(CPACK_RPM_common_PACKAGE_CONFLICTS "mariadb-libs < 1:%{version}-%{release}") +ELSEIF(RPM MATCHES "(rhel|centos)8") + SET(PYTHON_SHEBANG "/usr/bin/python3") ELSEIF(RPM MATCHES "sles") ALTERNATIVE_NAME("server" "mariadb") SETA(CPACK_RPM_server_PACKAGE_PROVIDES @@ -244,18 +239,37 @@ ENDIF() # If we want to build build MariaDB-shared-compat, # extract compat libraries from MariaDB-shared-5.3 rpm -FILE(GLOB compat_rpm RELATIVE ${CMAKE_SOURCE_DIR} +FILE(GLOB compat53 RELATIVE ${CMAKE_SOURCE_DIR} "${CMAKE_SOURCE_DIR}/../MariaDB-shared-5.3.*.rpm") -IF (compat_rpm) - MESSAGE("Using ${compat_rpm} to build MariaDB-compat") - INSTALL(CODE "EXECUTE_PROCESS( - COMMAND rpm2cpio ${CMAKE_SOURCE_DIR}/${compat_rpm} - COMMAND cpio --extract --make-directories */libmysqlclient*.so.* - - WORKING_DIRECTORY \$ENV{DESTDIR}) - EXECUTE_PROCESS( - COMMAND chmod -R a+rX . - WORKING_DIRECTORY \$ENV{DESTDIR})" - COMPONENT Compat) +FILE(GLOB compat101 RELATIVE ${CMAKE_SOURCE_DIR} + "${CMAKE_SOURCE_DIR}/../MariaDB-shared-10.1.*.rpm") +IF(compat53 AND compat101) + FOREACH(compat_rpm "${compat53}" "${compat101}") + MESSAGE("Using ${compat_rpm} to build MariaDB-compat") + INSTALL(CODE "EXECUTE_PROCESS( + COMMAND rpm2cpio ${CMAKE_SOURCE_DIR}/${compat_rpm} + COMMAND cpio --extract --make-directories */libmysqlclient*.so.* - + WORKING_DIRECTORY \$ENV{DESTDIR}) + EXECUTE_PROCESS( + COMMAND chmod -R a+rX . + WORKING_DIRECTORY \$ENV{DESTDIR})" + COMPONENT Compat) + ENDFOREACH() + + EXECUTE_PROCESS( + COMMAND rpm -q --provides -p "${CMAKE_SOURCE_DIR}/${compat101}" + ERROR_QUIET + OUTPUT_VARIABLE compat_provides) + EXECUTE_PROCESS( + COMMAND rpm -q --obsoletes -p "${CMAKE_SOURCE_DIR}/${compat101}" + ERROR_QUIET + OUTPUT_VARIABLE compat_obsoletes) + + STRING(REPLACE "\n" " " compat_provides "${compat_provides}") + STRING(REPLACE "\n" " " compat_obsoletes "${compat_obsoletes}") + SETA(CPACK_RPM_compat_PACKAGE_PROVIDES "${compat_provides}") + SETA(CPACK_RPM_compat_PACKAGE_OBSOLETES "${compat_obsoletes}") + SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} Compat) # RHEL6/CentOS6 install Postfix by default, and it requires @@ -263,22 +277,18 @@ IF (compat_rpm) # And the latter conflicts with our rpms. # Make sure that for these distribuions all our rpms require # MariaDB-compat, that will replace mysql-libs-5.1 - IF(RPM MATCHES "(rhel|centos)6") + IF(RPM MATCHES "(rhel|centos)[67]") SET(CPACK_RPM_common_PACKAGE_REQUIRES "MariaDB-compat") + SET(CPACK_RPM_compat_PACKAGE_CONFLICTS "mariadb-libs < 1:10.1.0") ENDIF() -ENDIF(compat_rpm) - -SET(CPACK_RPM_compat_PACKAGE_PROVIDES "mysql-libs = 5.3.5") # exact version doesn't matter as long as it greater than 5.1 -SET(CPACK_RPM_compat_PACKAGE_OBSOLETES "mysql-libs < 5.3.5") +ENDIF() ################ IF(CMAKE_VERSION VERSION_GREATER "3.9.99") SET(CPACK_SOURCE_GENERATOR "RPM") SETA(CPACK_RPM_SOURCE_PKG_BUILD_PARAMS - "-DBUILD_CONFIG=mysql_release" "-DRPM=${RPM}" - "-DCPACK_RPM_BUILD_SOURCE_DIRS_PREFIX=/usr/src/debug/${CPACK_RPM_PACKAGE_NAME}-${VERSION}" ) MACRO(ADDIF var) @@ -287,6 +297,7 @@ MACRO(ADDIF var) ENDIF() ENDMACRO() +ADDIF(CMAKE_BUILD_TYPE) ADDIF(BUILD_CONFIG) ADDIF(WITH_SSL) diff --git a/cmake/cpack_source_ignore_files.cmake b/cmake/cpack_source_ignore_files.cmake index 65abf9e8a9d..eb1ec191d17 100644 --- a/cmake/cpack_source_ignore_files.cmake +++ b/cmake/cpack_source_ignore_files.cmake @@ -15,6 +15,7 @@ SET(CPACK_SOURCE_IGNORE_FILES \\\\.git/ +\\\\.git$ \\\\.gitignore$ \\\\.gitattributes$ CMakeCache\\\\.txt$ @@ -40,7 +41,6 @@ scripts/mysql_fix_extensions$ scripts/mysql_install_db$ scripts/mysql_secure_installation$ scripts/mysql_setpermission$ -scripts/mysql_zap$ scripts/mysqlaccess$ scripts/mysqld_multi$ scripts/mysqld_safe$ diff --git a/cmake/cpu_info.cmake b/cmake/cpu_info.cmake index f3ddd33df3a..1acfad5897f 100644 --- a/cmake/cpu_info.cmake +++ b/cmake/cpu_info.cmake @@ -37,8 +37,3 @@ ELSE() ) ENDIF() 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/crc32-vpmsum.cmake b/cmake/crc32-vpmsum.cmake new file mode 100644 index 00000000000..c1a2dee56e2 --- /dev/null +++ b/cmake/crc32-vpmsum.cmake @@ -0,0 +1,5 @@ +IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le") + SET(HAVE_CRC32_VPMSUM 1) + SET(CRC32_VPMSUM_LIBRARY crc32-vpmsum) + ADD_SUBDIRECTORY(extra/crc32-vpmsum) +ENDIF() diff --git a/cmake/create_initial_db.cmake.in b/cmake/create_initial_db.cmake.in index 4847d5ef35d..cc07947a164 100644 --- a/cmake/create_initial_db.cmake.in +++ b/cmake/create_initial_db.cmake.in @@ -82,7 +82,3 @@ EXECUTE_PROCESS ( IF(NOT RESULT EQUAL 0) MESSAGE(FATAL_ERROR "Could not create initial database \n ${OUT} \n ${ERR}") ENDIF() - -EXECUTE_PROCESS ( - COMMAND "@CMAKE_COMMAND@" -E touch ${CMAKE_CURRENT_BINARY_DIR}/initdb.dep -) diff --git a/cmake/ctest.cmake b/cmake/ctest.cmake index 08852a366f6..5bc1ce5f832 100644 --- a/cmake/ctest.cmake +++ b/cmake/ctest.cmake @@ -1,12 +1,12 @@ -INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake) +INCLUDE(CMakeParseArguments) MACRO(MY_ADD_TEST name) ADD_TEST(${name} ${name}-t) ENDMACRO() -MACRO (MY_ADD_TESTS) - MYSQL_PARSE_ARGUMENTS(ARG "LINK_LIBRARIES;EXT" "" ${ARGN}) +MACRO(MY_ADD_TESTS) + CMAKE_PARSE_ARGUMENTS(ARG "" "EXT" "LINK_LIBRARIES" ${ARGN}) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/unittest/mytap) @@ -15,7 +15,7 @@ MACRO (MY_ADD_TESTS) SET(ARG_EXT "c") ENDIF() - FOREACH(name ${ARG_DEFAULT_ARGS}) + FOREACH(name ${ARG_UNPARSED_ARGUMENTS}) ADD_EXECUTABLE(${name}-t "${name}-t.${ARG_EXT}") TARGET_LINK_LIBRARIES(${name}-t mytap ${ARG_LINK_LIBRARIES}) MY_ADD_TEST(${name}) diff --git a/cmake/for_clients.cmake b/cmake/for_clients.cmake index dd79ea1039d..e5916c56ddc 100644 --- a/cmake/for_clients.cmake +++ b/cmake/for_clients.cmake @@ -45,10 +45,10 @@ MACRO(EXTRACT_LINK_LIBRARIES target var) ENDIF() ENDMACRO() -EXTRACT_LINK_LIBRARIES(mysqlclient LIBS) +EXTRACT_LINK_LIBRARIES(libmariadb LIBS) EXTRACT_LINK_LIBRARIES(mysqlserver EMB_LIBS) -SET(LIBS "-lmysqlclient ${ZLIB_DEPS} ${LIBS} ${openssl_libs}") +SET(LIBS "-lmariadb ${ZLIB_DEPS} ${LIBS} ${openssl_libs}") SET(EMB_LIBS "-lmysqld ${ZLIB_DEPS} ${EMB_LIBS} ${openssl_libs}") MACRO(REPLACE_FOR_CLIENTS VAR) @@ -66,12 +66,12 @@ ENDMACRO() # FIXME until we have a --cxxflags, we need to remove -AC99 # to make --cflags usable for HP C++ (aCC) REPLACE_FOR_CLIENTS(CFLAGS "[DU]DBUG_OFF" "[DU]SAFE_MUTEX" "[DU]NDEBUG" - "[DU]UNIV_MUST_NOT_INLINE" "[DU]FORCE_INIT_OF_VARS" "[DU]EXTRA_DEBUG" "[DU]HAVE_valgrind" + "[DU]FORCE_INIT_OF_VARS" "[DU]EXTRA_DEBUG" "[DU]HAVE_valgrind" "O" "O[0-9]" "xO[0-9]" "W[-A-Za-z]*" "mtune=[-A-Za-z0-9]*" "g" "fPIC" "mcpu=[-A-Za-z0-9]*" "unroll2" "ip" "mp" "march=[-A-Za-z0-9]*" "Xa" "xstrconst" "xc99=none" "AC99" "restrict" "W[-A-Za-z]*=[-A-Za-z0-9]*") # Same for --libs -REPLACE_FOR_CLIENTS(LIBS lmtmalloc static-libcxa i-static static-intel) +REPLACE_FOR_CLIENTS(LIBS "Wl,[^ ]*" lmtmalloc static-libcxa i-static static-intel) REPLACE_FOR_CLIENTS(EMB_LIBS lmtmalloc static-libcxa i-static static-intel) diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake index e4d317e979c..b2d9b7734ce 100644 --- a/cmake/install_layout.cmake +++ b/cmake/install_layout.cmake @@ -128,6 +128,8 @@ SET(INSTALL_SUPPORTFILESDIR_STANDALONE "support-files") SET(INSTALL_MYSQLDATADIR_STANDALONE "data") SET(INSTALL_UNIX_ADDRDIR_STANDALONE "/tmp/mysql.sock") +SET(INSTALL_PAMDIR_STANDALONE "share") +SET(INSTALL_PAMDATADIR_STANDALONE "share") # # RPM layout # @@ -139,11 +141,10 @@ SET(INSTALL_SYSCONF2DIR_RPM "/etc/my.cnf.d") # IF(CMAKE_SIZEOF_VOID_P EQUAL 8) SET(INSTALL_LIBDIR_RPM "lib64") - SET(INSTALL_PLUGINDIR_RPM "lib64/mysql/plugin") ELSE() SET(INSTALL_LIBDIR_RPM "lib") - SET(INSTALL_PLUGINDIR_RPM "lib/mysql/plugin") ENDIF() +SET(INSTALL_PLUGINDIR_RPM "${INSTALL_LIBDIR_RPM}/mysql/plugin") # SET(INSTALL_INCLUDEDIR_RPM "include/mysql") # @@ -164,6 +165,8 @@ SET(INSTALL_UNIX_ADDRDIR_RPM "${INSTALL_MYSQLDATADIR_RPM}/mysql.sock" SET(INSTALL_SYSTEMD_UNITDIR_RPM "/usr/lib/systemd/system") SET(INSTALL_SYSTEMD_SYSUSERSDIR_RPM "/usr/lib/sysusers.d") SET(INSTALL_SYSTEMD_TMPFILESDIR_RPM "/usr/lib/tmpfiles.d") +SET(INSTALL_PAMDIR_RPM "/${INSTALL_LIBDIR_RPM}/security") +SET(INSTALL_PAMDATADIR_RPM "/etc/security") # # DEB layout @@ -171,9 +174,10 @@ SET(INSTALL_SYSTEMD_TMPFILESDIR_RPM "/usr/lib/tmpfiles.d") SET(INSTALL_BINDIR_DEB "bin") SET(INSTALL_SBINDIR_DEB "sbin") SET(INSTALL_SCRIPTDIR_DEB "bin") +SET(INSTALL_SYSCONFDIR_DEB "/etc") SET(INSTALL_SYSCONF2DIR_DEB "/etc/mysql/conf.d") # -SET(INSTALL_LIBDIR_DEB "lib") +SET(INSTALL_LIBDIR_DEB "lib/${CMAKE_CXX_LIBRARY_ARCHITECTURE}") SET(INSTALL_PLUGINDIR_DEB "lib/mysql/plugin") # SET(INSTALL_INCLUDEDIR_DEB "include/mysql") @@ -185,7 +189,7 @@ SET(INSTALL_INFODIR_DEB "share/info") # SET(INSTALL_SHAREDIR_DEB "share") SET(INSTALL_MYSQLSHAREDIR_DEB "share/mysql") -SET(INSTALL_MYSQLTESTDIR_DEB "mysql-test") +SET(INSTALL_MYSQLTESTDIR_DEB "share/mysql/mysql-test") SET(INSTALL_SQLBENCHDIR_DEB ".") SET(INSTALL_SUPPORTFILESDIR_DEB "share/mysql") # @@ -195,6 +199,8 @@ SET(INSTALL_UNIX_ADDRDIR_DEB "/var/run/mysqld/mysqld.sock") SET(INSTALL_SYSTEMD_UNITDIR_DEB "/lib/systemd/system") SET(INSTALL_SYSTEMD_SYSUSERSDIR_DEB "/usr/lib/sysusers.d") SET(INSTALL_SYSTEMD_TMPFILESDIR_DEB "/usr/lib/tmpfiles.d") +SET(INSTALL_PAMDIR_DEB "/lib/${CMAKE_CXX_LIBRARY_ARCHITECTURE}/security") +SET(INSTALL_PAMDATADIR_DEB "/etc/security") # # SVR4 layout @@ -234,17 +240,18 @@ 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 SYSCONF2 - INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA UNIX_ADDR - SYSTEMD_UNIT SYSTEMD_SYSUSERS SYSTEMD_TMPFILES) - SET(INSTALL_${var}DIR ${INSTALL_${var}DIR_${INSTALL_LAYOUT}} - CACHE STRING "${var} installation directory" ${FORCE}) - MARK_AS_ADVANCED(INSTALL_${var}DIR) - - IF(IS_ABSOLUTE ${INSTALL_${var}DIR}) - SET(INSTALL_${var}DIRABS ${INSTALL_${var}DIR}) - ELSE() - SET(INSTALL_${var}DIRABS "${CMAKE_INSTALL_PREFIX}/${INSTALL_${var}DIR}") +GET_CMAKE_PROPERTY(ALL_VARS VARIABLES) +FOREACH (V ${ALL_VARS}) + IF (V MATCHES "^(INSTALL_([A-Z_0-9]+)DIR)_${INSTALL_LAYOUT}$") + SET(var ${CMAKE_MATCH_1}) + SET(${var} "${${V}}" CACHE STRING "${CMAKE_MATCH_2} installation directory" ${FORCE}) + MARK_AS_ADVANCED(${var}) + + IF(IS_ABSOLUTE "${${var}}") + SET(${var}ABS "${${var}}") + ELSE() + SET(${var}ABS "${CMAKE_INSTALL_PREFIX}/${${var}}") + ENDIF() ENDIF() ENDFOREACH() diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index bb89a57ab11..c0802399e5d 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -13,12 +13,12 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) -INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake) +INCLUDE(CMakeParseArguments) FUNCTION (INSTALL_DEBUG_SYMBOLS) IF(MSVC) - MYSQL_PARSE_ARGUMENTS(ARG + CMAKE_PARSE_ARGUMENTS(ARG + "" "COMPONENT;INSTALL_LOCATION" "" ${ARGN} @@ -30,29 +30,20 @@ FUNCTION (INSTALL_DEBUG_SYMBOLS) IF(NOT ARG_INSTALL_LOCATION) SET(ARG_INSTALL_LOCATION lib) ENDIF() - SET(targets ${ARG_DEFAULT_ARGS}) + SET(targets ${ARG_UNPARSED_ARGUMENTS}) FOREACH(target ${targets}) GET_TARGET_PROPERTY(target_type ${target} TYPE) - + IF(target_type MATCHES "STATIC") + RETURN() + ENDIF() set(comp "") - - IF(target MATCHES "mysqld" OR type MATCHES "MODULE") - #MESSAGE("PDB: ${targets}") + + IF((target STREQUAL "mysqld")) SET(comp Server) ENDIF() - - IF(NOT comp MATCHES Server) - IF(ARG_COMPONENT MATCHES Development - OR ARG_COMPONENT MATCHES SharedLibraries - OR ARG_COMPONENT MATCHES Embedded) - SET(comp Debuginfo) - ENDIF() - ENDIF() - IF(NOT comp) - SET(comp Debuginfo_archive_only) # not in MSI - ENDIF() - IF(NOT target_type MATCHES "STATIC") + INSTALL(FILES $<TARGET_PDB_FILE:${target}> DESTINATION symbols COMPONENT Debuginfo) + IF(comp) INSTALL(FILES $<TARGET_PDB_FILE:${target}> DESTINATION ${ARG_INSTALL_LOCATION} COMPONENT ${comp}) ENDIF() ENDFOREACH() @@ -98,13 +89,14 @@ FUNCTION(INSTALL_MANPAGE file) ENDFUNCTION() FUNCTION(INSTALL_SCRIPT) - MYSQL_PARSE_ARGUMENTS(ARG + CMAKE_PARSE_ARGUMENTS(ARG + "" "DESTINATION;COMPONENT" "" ${ARGN} ) - SET(script ${ARG_DEFAULT_ARGS}) + SET(script ${ARG_UNPARSED_ARGUMENTS}) IF(NOT ARG_DESTINATION) SET(ARG_DESTINATION ${INSTALL_BINDIR}) ENDIF() @@ -125,8 +117,8 @@ ENDFUNCTION() FUNCTION(INSTALL_DOCUMENTATION) - MYSQL_PARSE_ARGUMENTS(ARG "COMPONENT" "" ${ARGN}) - SET(files ${ARG_DEFAULT_ARGS}) + CMAKE_PARSE_ARGUMENTS(ARG "" "COMPONENT" "" ${ARGN}) + SET(files ${ARG_UNPARSED_ARGUMENTS}) IF(NOT ARG_COMPONENT) SET(ARG_COMPONENT Server) ENDIF() @@ -227,8 +219,9 @@ ENDFUNCTION() # FUNCTION(MYSQL_INSTALL_TARGETS) - MYSQL_PARSE_ARGUMENTS(ARG - "DESTINATION;COMPONENT" + CMAKE_PARSE_ARGUMENTS(ARG + "" + "DESTINATION;COMPONENT" "" ${ARGN} ) @@ -238,7 +231,7 @@ FUNCTION(MYSQL_INSTALL_TARGETS) MESSAGE(FATAL_ERROR "COMPONENT argument required") ENDIF() - SET(TARGETS ${ARG_DEFAULT_ARGS}) + SET(TARGETS ${ARG_UNPARSED_ARGUMENTS}) IF(NOT TARGETS) MESSAGE(FATAL_ERROR "Need target list for MYSQL_INSTALL_TARGETS") ENDIF() @@ -246,10 +239,9 @@ FUNCTION(MYSQL_INSTALL_TARGETS) MESSAGE(FATAL_ERROR "Need DESTINATION parameter for MYSQL_INSTALL_TARGETS") ENDIF() - FOREACH(target ${TARGETS}) # If signing is required, sign executables before installing - IF(SIGNCODE) + IF(SIGNCODE) SIGN_TARGET(${target} ${COMP}) ENDIF() # Install man pages on Unix @@ -272,7 +264,8 @@ SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug FUNCTION(INSTALL_DEBUG_TARGET target) - MYSQL_PARSE_ARGUMENTS(ARG + CMAKE_PARSE_ARGUMENTS(ARG + "" "DESTINATION;RENAME;PDB_DESTINATION;COMPONENT" "" ${ARGN} diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake index 00d2def5877..ffe746bfb08 100644 --- a/cmake/libutils.cmake +++ b/cmake/libutils.cmake @@ -57,14 +57,14 @@ IF(WIN32 OR CYGWIN OR APPLE OR WITH_PIC OR DISABLE_SHARED OR NOT CMAKE_SHARED_LI SET(_SKIP_PIC 1) ENDIF() -INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake) -# CREATE_EXPORT_FILE (VAR target api_functions) +INCLUDE(CMakeParseArguments) +# CREATE_EXPORTS_FILE (VAR target api_functions) # Internal macro, used to create source file for shared libraries that # otherwise consists entirely of "convenience" libraries. On Windows, # also exports API functions as dllexport. On unix, creates a dummy file # that references all exports and this prevents linker from creating an # empty library(there are unportable alternatives, --whole-archive) -MACRO(CREATE_EXPORT_FILE VAR TARGET API_FUNCTIONS) +MACRO(CREATE_EXPORTS_FILE VAR TARGET API_FUNCTIONS) IF(WIN32) SET(DUMMY ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_dummy.c) SET(EXPORTS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_exports.def) @@ -222,13 +222,14 @@ ENDMACRO() # [OUTPUT_NAME output_name] #) MACRO(MERGE_LIBRARIES) - MYSQL_PARSE_ARGUMENTS(ARG - "EXPORTS;OUTPUT_NAME;COMPONENT;VERSION;SOVERSION" + CMAKE_PARSE_ARGUMENTS(ARG "STATIC;SHARED;MODULE;NOINSTALL" + "OUTPUT_NAME;COMPONENT;VERSION;SOVERSION" + "EXPORTS" ${ARGN} ) - LIST(GET ARG_DEFAULT_ARGS 0 TARGET) - SET(LIBS ${ARG_DEFAULT_ARGS}) + LIST(GET ARG_UNPARSED_ARGUMENTS 0 TARGET) + SET(LIBS ${ARG_UNPARSED_ARGUMENTS}) LIST(REMOVE_AT LIBS 0) IF(ARG_STATIC) IF (NOT ARG_OUTPUT_NAME) @@ -258,7 +259,7 @@ MACRO(MERGE_LIBRARIES) ENDIF() ENDFOREACH() ENDIF() - CREATE_EXPORT_FILE(SRC ${TARGET} "${ARG_EXPORTS}") + CREATE_EXPORTS_FILE(SRC ${TARGET} "${ARG_EXPORTS}") IF(NOT ARG_NOINSTALL) ADD_VERSION_INFO(${TARGET} SHARED SRC) ENDIF() diff --git a/cmake/lz4.cmake b/cmake/lz4.cmake deleted file mode 100644 index 098bf54f64a..00000000000 --- a/cmake/lz4.cmake +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright (C) 2014, SkySQL Ab. 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-1335 USA - -SET(WITH_INNODB_LZ4 AUTO CACHE STRING - "Build with lz4. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'") - -MACRO (MYSQL_CHECK_LZ4) - IF (WITH_INNODB_LZ4 STREQUAL "ON" OR WITH_INNODB_LZ4 STREQUAL "AUTO") - CHECK_INCLUDE_FILES(lz4.h HAVE_LZ4_H) - CHECK_LIBRARY_EXISTS(lz4 LZ4_compress_limitedOutput "" HAVE_LZ4_SHARED_LIB) - CHECK_LIBRARY_EXISTS(lz4 LZ4_compress_default "" HAVE_LZ4_COMPRESS_DEFAULT) - IF ((HAVE_LZ4_SHARED_LIB OR HAVE_LZ4_COMPRESS_DEFAULT) AND HAVE_LZ4_H) - IF (HAVE_LZ4_COMPRESS_DEFAULT) - ADD_DEFINITIONS(-DHAVE_LZ4_COMPRESS_DEFAULT=1) - ENDIF() - ADD_DEFINITIONS(-DHAVE_LZ4=1) - LINK_LIBRARIES(lz4) - ELSE() - IF (WITH_INNODB_LZ4 STREQUAL "ON") - MESSAGE(FATAL_ERROR "Required lz4 library is not found") - ENDIF() - ENDIF() - ENDIF() -ENDMACRO() - -MACRO (MYSQL_CHECK_LZ4_STATIC) - IF (WITH_INNODB_LZ4 STREQUAL "ON" OR WITH_INNODB_LZ4 STREQUAL "AUTO") - CHECK_INCLUDE_FILES(lz4.h HAVE_LZ4_H) - CHECK_LIBRARY_EXISTS(liblz4.a LZ4_compress_limitedOutput "" HAVE_LZ4_LIB) - CHECK_LIBRARY_EXISTS(liblz4.a LZ4_compress_default "" HAVE_LZ4_COMPRESS_DEFAULT) - IF ((HAVE_LZ4_LIB OR HAVE_LZ4_COMPRESS_DEFAULT) AND HAVE_LZ4_H) - IF (HAVE_LZ4_COMPRESS_DEFAULT) - ADD_DEFINITIONS(-DHAVE_LZ4_COMPRESS_DEFAULT=1) - ENDIF() - ADD_DEFINITIONS(-DHAVE_LZ4=1) - LINK_LIBRARIES(liblz4.a) - ELSE() - IF (WITH_INNODB_LZ4 STREQUAL "ON") - MESSAGE(FATAL_ERROR "Required lz4 library is not found") - ENDIF() - ENDIF() - ENDIF() -ENDMACRO() diff --git a/cmake/lzma.cmake b/cmake/lzma.cmake deleted file mode 100644 index 93de0a2934d..00000000000 --- a/cmake/lzma.cmake +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (C) 2014, SkySQL Ab. 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-1335 USA - -SET(WITH_INNODB_LZMA AUTO CACHE STRING - "Build with lzma. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'") - -MACRO (MYSQL_CHECK_LZMA) - IF (WITH_INNODB_LZMA STREQUAL "ON" OR WITH_INNODB_LZMA STREQUAL "AUTO") - CHECK_INCLUDE_FILES(lzma.h HAVE_LZMA_H) - CHECK_LIBRARY_EXISTS(lzma lzma_stream_buffer_decode "" HAVE_LZMA_DECODE) - CHECK_LIBRARY_EXISTS(lzma lzma_easy_buffer_encode "" HAVE_LZMA_ENCODE) - - IF (HAVE_LZMA_DECODE AND HAVE_LZMA_ENCODE AND HAVE_LZMA_H) - ADD_DEFINITIONS(-DHAVE_LZMA=1) - LINK_LIBRARIES(lzma) - ELSE() - IF (WITH_INNODB_LZMA STREQUAL "ON") - MESSAGE(FATAL_ERROR "Required lzma library is not found") - ENDIF() - ENDIF() - ENDIF() -ENDMACRO() diff --git a/cmake/lzo.cmake b/cmake/lzo.cmake deleted file mode 100644 index 236eac2d1e5..00000000000 --- a/cmake/lzo.cmake +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (C) 2014, SkySQL Ab. 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-1335 USA - -SET(WITH_INNODB_LZO AUTO CACHE STRING - "Build with lzo. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'") - -MACRO (MYSQL_CHECK_LZO_STATIC) - IF (WITH_INNODB_LZO STREQUAL "ON" OR WITH_INNODB_LZO STREQUAL "AUTO") - CHECK_INCLUDE_FILES(lzo/lzo1x.h HAVE_LZO_H) - CHECK_LIBRARY_EXISTS(liblzo2.a lzo1x_1_compress "" HAVE_LZO_LIB) - - IF(HAVE_LZO_LIB AND HAVE_LZO_H) - ADD_DEFINITIONS(-DHAVE_LZO=1) - LINK_LIBRARIES(liblzo2.a) - ELSE() - IF (WITH_INNODB_LZO STREQUAL "ON") - MESSAGE(FATAL_ERROR "Required lzo library is not found") - ENDIF() - ENDIF() - ENDIF() -ENDMACRO() - -MACRO (MYSQL_CHECK_LZO) - IF (WITH_INNODB_LZO STREQUAL "ON" OR WITH_INNODB_LZO STREQUAL "AUTO") - CHECK_INCLUDE_FILES(lzo/lzo1x.h HAVE_LZO_H) - CHECK_LIBRARY_EXISTS(lzo2 lzo1x_1_compress "" HAVE_LZO_SHARED_LIB) - - IF(HAVE_LZO_SHARED_LIB AND HAVE_LZO_H) - ADD_DEFINITIONS(-DHAVE_LZO=1) - LINK_LIBRARIES(lzo2) - ELSE() - IF (WITH_INNODB_LZO STREQUAL "ON") - MESSAGE(FATAL_ERROR "Required lzo library is not found") - ENDIF() - ENDIF() - ENDIF() -ENDMACRO() diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in index d9153604a46..11b46f1c15b 100644 --- a/cmake/make_dist.cmake.in +++ b/cmake/make_dist.cmake.in @@ -43,15 +43,18 @@ IF(GIT_EXECUTABLE) MESSAGE(STATUS "Running git checkout-index") EXECUTE_PROCESS( COMMAND "${GIT_EXECUTABLE}" checkout-index --all --prefix=${PACKAGE_DIR}/ + COMMAND "${GIT_EXECUTABLE}" submodule foreach "${GIT_EXECUTABLE} checkout-index --all --prefix=${PACKAGE_DIR}/$path/" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} RESULT_VARIABLE RESULT ) - IF(NOT RESULT EQUAL 0) - SET(GIT_EXECUTABLE) + SET(GIT_EXECUTABLE) ENDIF() ENDIF() +CONFIGURE_FILE(${CMAKE_BINARY_DIR}/storage/rocksdb/rdb_source_revision.h + ${PACKAGE_DIR}/storage/rocksdb/rdb_source_revision.h COPYONLY) + IF(NOT GIT_EXECUTABLE) MESSAGE(STATUS "git not found or source dir is not a repo, use CPack") diff --git a/cmake/mariadb_connector_c.cmake b/cmake/mariadb_connector_c.cmake new file mode 100644 index 00000000000..0f08c3464c4 --- /dev/null +++ b/cmake/mariadb_connector_c.cmake @@ -0,0 +1,44 @@ +SET(OPT CONC_) + +IF (CMAKE_BUILD_TYPE STREQUAL "Debug") + SET(CONC_WITH_RTC ON) +ENDIF() + +SET(CONC_WITH_SIGNCODE ${SIGNCODE}) +SET(SIGN_OPTIONS ${SIGNTOOL_PARAMETERS}) +SET(CONC_WITH_EXTERNAL_ZLIB ON) + +IF(SSL_DEFINES MATCHES "YASSL") + IF(WIN32) + SET(CONC_WITH_SSL "SCHANNEL") + ELSE() + SET(CONC_WITH_SSL "GNUTLS") # that's what debian wants, right? + ENDIF() +ELSE() + SET(CONC_WITH_SSL "OPENSSL") + SET(OPENSSL_FOUND TRUE) +ENDIF() + +SET(CONC_WITH_CURL OFF) +SET(CONC_WITH_MYSQLCOMPAT ON) + +IF (INSTALL_LAYOUT STREQUAL "RPM") + SET(CONC_INSTALL_LAYOUT "RPM") +ELSE() + SET(CONC_INSTALL_LAYOUT "DEFAULT") +ENDIF() + +SET(PLUGIN_INSTALL_DIR ${INSTALL_PLUGINDIR}) +SET(MARIADB_UNIX_ADDR ${MYSQL_UNIX_ADDR}) + +SET(CLIENT_PLUGIN_PVIO_NPIPE STATIC) +SET(CLIENT_PLUGIN_PVIO_SHMEM STATIC) +SET(CLIENT_PLUGIN_PVIO_SOCKET STATIC) + +MESSAGE("== Configuring MariaDB Connector/C") +ADD_SUBDIRECTORY(libmariadb) + +#remove after merging libmariadb > v3.0.9 +IF(TARGET caching_sha2_password AND CMAKE_C_FLAGS_DEBUG MATCHES "-Werror") + SET_PROPERTY(TARGET caching_sha2_password APPEND_STRING PROPERTY COMPILE_FLAGS -Wno-unused-function) +ENDIF() diff --git a/cmake/misc.cmake b/cmake/misc.cmake new file mode 100644 index 00000000000..2a0c57b1973 --- /dev/null +++ b/cmake/misc.cmake @@ -0,0 +1,19 @@ +IF ("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_LESS "2.8.7") + FUNCTION(MESSAGE_ONCE id out) + MESSAGE(STATUS "${out}") + ENDFUNCTION() +ELSE() + FUNCTION(MESSAGE_ONCE id out) + STRING(MD5 hash "${out}") + IF(NOT __msg1_${id} STREQUAL "${hash}") + MESSAGE(STATUS "${out}") + ENDIF() + SET(__msg1_${id} ${hash} CACHE INTERNAL "") + ENDFUNCTION() +ENDIF() + +MACRO(SET_IF_UNSET VAR VAL) + IF(NOT DEFINED ${VAR}) + SET(${VAR} ${VAL}) + ENDIF() +ENDMACRO() diff --git a/cmake/mysql_add_executable.cmake b/cmake/mysql_add_executable.cmake index 12635f2b582..d3a888f9a75 100644 --- a/cmake/mysql_add_executable.cmake +++ b/cmake/mysql_add_executable.cmake @@ -24,19 +24,20 @@ # - add version resource # - instruct CPack to do autenticode signing if SIGNCODE is set -INCLUDE(cmake_parse_arguments) +INCLUDE(CMakeParseArguments) FUNCTION (MYSQL_ADD_EXECUTABLE) # Pass-through arguments for ADD_EXECUTABLE - MYSQL_PARSE_ARGUMENTS(ARG - "WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL;DESTINATION;COMPONENT" + CMAKE_PARSE_ARGUMENTS(ARG + "WIN32;MACOSX_BUNDLE;EXCLUDE_FROM_ALL" + "DESTINATION;COMPONENT" "" ${ARGN} ) - LIST(GET ARG_DEFAULT_ARGS 0 target) - LIST(REMOVE_AT ARG_DEFAULT_ARGS 0) + LIST(GET ARG_UNPARSED_ARGUMENTS 0 target) + LIST(REMOVE_AT ARG_UNPARSED_ARGUMENTS 0) - SET(sources ${ARG_DEFAULT_ARGS}) + SET(sources ${ARG_UNPARSED_ARGUMENTS}) ADD_VERSION_INFO(${target} EXECUTABLE sources) IF(MSVC) @@ -46,7 +47,22 @@ FUNCTION (MYSQL_ADD_EXECUTABLE) ENDIF() ENDIF() - ADD_EXECUTABLE(${target} ${ARG_WIN32} ${ARG_MACOSX_BUNDLE} ${ARG_EXCLUDE_FROM_ALL} ${sources}) + IF (ARG_WIN32) + SET(WIN32 WIN32) + ELSE() + UNSET(WIN32) + ENDIF() + IF (ARG_MACOSX_BUNDLE) + SET(MACOSX_BUNDLE MACOSX_BUNDLE) + ELSE() + UNSET(MACOSX_BUNDLE) + ENDIF() + IF (ARG_EXCLUDE_FROM_ALL) + SET(EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL) + ELSE() + 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) diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake index ca8dafaa465..114af99f954 100644 --- a/cmake/mysql_version.cmake +++ b/cmake/mysql_version.cmake @@ -17,7 +17,7 @@ # Global constants, only to be changed between major releases. # -SET(SHARED_LIB_MAJOR_VERSION "18") +SET(SHARED_LIB_MAJOR_VERSION "19") SET(PROTOCOL_VERSION "10") SET(DOT_FRM_VERSION "6") @@ -69,29 +69,28 @@ ENDMACRO() # Get mysql version and other interesting variables GET_MYSQL_VERSION() -SET(MYSQL_TCP_PORT_DEFAULT "3306") +SET(MYSQL_TCP_PORT_DEFAULT 0) +SET_IF_UNSET(MYSQL_TCP_PORT 3306) -IF(NOT MYSQL_TCP_PORT) - SET(MYSQL_TCP_PORT ${MYSQL_TCP_PORT_DEFAULT}) - SET(MYSQL_TCP_PORT_DEFAULT "0") -ELSEIF(MYSQL_TCP_PORT EQUAL MYSQL_TCP_PORT_DEFAULT) - SET(MYSQL_TCP_PORT_DEFAULT "0") -ENDIF() - -IF(NOT COMPILATION_COMMENT) - SET(COMPILATION_COMMENT "Source distribution") -ENDIF() +SET_IF_UNSET(COMPILATION_COMMENT "Source distribution") INCLUDE(package_name) IF(NOT CPACK_PACKAGE_FILE_NAME) GET_PACKAGE_FILE_NAME(CPACK_PACKAGE_FILE_NAME) ENDIF() -IF(NOT CPACK_SOURCE_PACKAGE_FILE_NAME) - SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mariadb-${VERSION}") -ENDIF() -SET(CPACK_PACKAGE_CONTACT "MariaDB team <info@montyprogram.com>") -SET(CPACK_PACKAGE_VENDOR "Monty Program AB") +SET_IF_UNSET(CPACK_SOURCE_PACKAGE_FILE_NAME "mariadb-${VERSION}") +SET_IF_UNSET(CPACK_PACKAGE_CONTACT "MariaDB Developers <maria-developers@lists.launchpad.net>") +SET_IF_UNSET(CPACK_PACKAGE_VENDOR "MariaDB Foundation") +SET_IF_UNSET(CPACK_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION_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 https://mariadb.com/kb +MariaDB bug reports should be submitted through https://jira.mariadb.org + +") SET(CPACK_SOURCE_GENERATOR "TGZ") # Defintions for windows version resources diff --git a/cmake/numa.cmake b/cmake/numa.cmake new file mode 100644 index 00000000000..4bace0ee7f4 --- /dev/null +++ b/cmake/numa.cmake @@ -0,0 +1,43 @@ +MACRO (MYSQL_CHECK_NUMA) + + IF(CMAKE_SYSTEM_NAME MATCHES "Linux") + CHECK_INCLUDE_FILES(numa.h HAVE_NUMA_H) + CHECK_INCLUDE_FILES(numaif.h HAVE_NUMAIF_H) + + IF(HAVE_NUMA_H AND HAVE_NUMAIF_H) + OPTION(WITH_NUMA "Explicitly set NUMA memory allocation policy" ON) + ELSE() + OPTION(WITH_NUMA "Explicitly set NUMA memory allocation policy" OFF) + ENDIF() + + IF(WITH_NUMA AND HAVE_NUMA_H AND HAVE_NUMAIF_H) + SET(SAVE_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} numa) + CHECK_C_SOURCE_COMPILES( + " + #include <numa.h> + #include <numaif.h> + int main() + { + struct bitmask *all_nodes= numa_all_nodes_ptr; + set_mempolicy(MPOL_DEFAULT, 0, 0); + return all_nodes != NULL; + }" + HAVE_LIBNUMA) + SET(CMAKE_REQUIRED_LIBRARIES ${SAVE_CMAKE_REQUIRED_LIBRARIES}) + IF(HAVE_LIBNUMA) + ADD_DEFINITIONS(-DHAVE_LIBNUMA=1) + SET(NUMA_LIBRARY "numa") + ENDIF() + ENDIF() + + IF(WITH_NUMA AND NOT HAVE_LIBNUMA) + # Forget it in cache, abort the build. + UNSET(WITH_NUMA CACHE) + UNSET(NUMA_LIBRARY CACHE) + MESSAGE(FATAL_ERROR "Could not find numa headers/libraries") + ENDIF() + ENDIF() + +ENDMACRO() + diff --git a/cmake/os/Linux.cmake b/cmake/os/Linux.cmake index 80650539c25..1575c16bb4c 100644 --- a/cmake/os/Linux.cmake +++ b/cmake/os/Linux.cmake @@ -45,7 +45,7 @@ SET(_FILE_OFFSET_BITS 64) # Linux specific HUGETLB /large page support CHECK_SYMBOL_EXISTS(SHM_HUGETLB sys/shm.h HAVE_DECL_SHM_HUGETLB) IF(HAVE_DECL_SHM_HUGETLB) - SET(HAVE_LARGE_PAGES 1) + SET(HAVE_LINUX_LARGE_PAGES 1) SET(HUGETLB_USE_PROC_MEMINFO 1) SET(HAVE_LARGE_PAGE_OPTION 1) ENDIF() diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index 2e7577ec5e9..1eae92924a6 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -24,9 +24,6 @@ INCLUDE (CheckCSourceRuns) INCLUDE (CheckSymbolExists) INCLUDE (CheckTypeSize) -# Optionally read user configuration, generated by configure.js. -# This is left for backward compatibility reasons only. -INCLUDE(${CMAKE_BINARY_DIR}/win/configure.data OPTIONAL) # avoid running system checks by using pre-cached check results # system checks are expensive on VS since every tiny program is to be compiled in @@ -63,11 +60,35 @@ IF(MINGW AND CMAKE_SIZEOF_VOID_P EQUAL 4) ENDIF() 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 + "Runtime library - specify runtime library for linking (/MT,/MTd,/MD,/MDd)" + ) + SET(VALID_CRT_TYPES /MTd /MDd /MD /MT) + IF (NOT ";${VALID_CRT_TYPES};" MATCHES ";${MSVC_CRT_TYPE};") + MESSAGE(FATAL_ERROR "Invalid value ${MSVC_CRT_TYPE} for MSVC_CRT_TYPE, choose one of /MT,/MTd,/MD,/MDd ") + ENDIF() + + 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) + ENDIF() + INCLUDE(InstallRequiredSystemLibraries) + ENDIF() + # Enable debug info also in Release build, # and create PDB to be able to analyze crashes. FOREACH(type EXE SHARED MODULE) - SET(CMAKE_{type}_LINKER_FLAGS_RELEASE + SET(CMAKE_${type}_LINKER_FLAGS_RELEASE "${CMAKE_${type}_LINKER_FLAGS_RELEASE} /debug") + SET(CMAKE_${type}_LINKER_FLAGS_MINSIZEREL + "${CMAKE_${type}_LINKER_FLAGS_MINSIZEREL} /debug") ENDFOREACH() # Force static runtime libraries @@ -77,6 +98,10 @@ IF(MSVC) # information for use with the debugger. The symbolic debugging # information includes the names and types of variables, as well as # functions and line numbers. No .pdb file is produced by the compiler. + # + # - Remove preprocessor flag _DEBUG that older cmakes use with Config=Debug, + # it is as defined by Debug runtimes itself (/MTd /MDd) + FOREACH(lang C CXX) SET(CMAKE_${lang}_FLAGS_RELEASE "${CMAKE_${lang}_FLAGS_RELEASE} /Z7") ENDFOREACH() @@ -84,9 +109,15 @@ IF(MSVC) 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) - STRING(REPLACE "/MD" "/MT" "${flag}" "${${flag}}") + CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT + CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL + ) + STRING(REGEX REPLACE "/M[TD][d]?" "${MSVC_CRT_TYPE}" "${flag}" "${${flag}}" ) + STRING(REGEX REPLACE "/D[ ]?_DEBUG" "" "${flag}" "${${flag}}") STRING(REPLACE "/Zi" "/Z7" "${flag}" "${${flag}}") + IF(NOT "${${flag}}" MATCHES "/Z7") + STRING(APPEND ${flag} " /Z7") + ENDIF() ENDFOREACH() @@ -114,15 +145,27 @@ IF(MSVC) ENDIF() #TODO: update the code and remove the disabled warnings - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4800 /wd4805 /wd4996 /we4700") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800 /wd4805 /wd4996 /wd4291 /wd4577 /we4099 /we4700") - - IF(CMAKE_SIZEOF_VOID_P MATCHES 8) - # _WIN64 is defined by the compiler itself. - # Yet, we define it here again to work around a bug with Intellisense - # described here: http://tinyurl.com/2cb428. - # Syntax highlighting is important for proper debugger functionality. - ADD_DEFINITIONS("-D_WIN64") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4805 /wd4996 /we4700 /we4311 /we4477 /we4302 /we4090") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4805 /wd4291 /wd4996 /we4099 /we4700 /we4311 /we4477 /we4302 /we4090") + IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + # Temporarily disable size_t warnings, due to their amount + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267") + ENDIF() + IF(MYSQL_MAINTAINER_MODE MATCHES "ERR") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX") + FOREACH(type EXE SHARED MODULE) + FOREACH(cfg RELEASE DEBUG RELWITHDEBINFO) + SET(CMAKE_${type}_LINKER_FLAGS_${cfg} "${CMAKE_${type}_LINKER_FLAGS_${cfg}} /WX") + ENDFOREACH() + ENDFOREACH() + ENDIF() + IF(MSVC_VERSION LESS 1910) + # Noisy warning C4800: 'type': forcing value to bool 'true' or 'false' (performance warning), + # removed in VS2017 + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4800") + ELSE() + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /d2OptimizeHugeFunctions") ENDIF() ENDIF() @@ -182,7 +225,6 @@ CHECK_SYMBOL_REPLACEMENT(S_IROTH _S_IREAD sys/stat.h) CHECK_SYMBOL_REPLACEMENT(S_IFIFO _S_IFIFO sys/stat.h) CHECK_SYMBOL_REPLACEMENT(SIGQUIT SIGTERM signal.h) CHECK_SYMBOL_REPLACEMENT(SIGPIPE SIGINT signal.h) -CHECK_SYMBOL_REPLACEMENT(isnan _isnan "math.h;float.h") CHECK_SYMBOL_REPLACEMENT(finite _finite "math;float.h") CHECK_FUNCTION_REPLACEMENT(popen _popen) CHECK_FUNCTION_REPLACEMENT(pclose _pclose) diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index a4d46df2af6..a18f7cc7fe2 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -22,8 +22,6 @@ IF(MSVC) SET(BFD_H_EXISTS 0 CACHE INTERNAL "") SET(HAVE_ACCESS 1 CACHE INTERNAL "") -SET(HAVE_AIO_H CACHE INTERNAL "") -SET(HAVE_AIO_READ CACHE INTERNAL "") SET(HAVE_ALARM CACHE INTERNAL "") SET(HAVE_ALLOCA_H CACHE INTERNAL "") SET(HAVE_ARPA_INET_H CACHE INTERNAL "") @@ -32,56 +30,41 @@ SET(HAVE_BACKTRACE CACHE INTERNAL "") SET(HAVE_BACKTRACE_SYMBOLS CACHE INTERNAL "") SET(HAVE_BACKTRACE_SYMBOLS_FD CACHE INTERNAL "") SET(HAVE_BFILL CACHE INTERNAL "") -SET(HAVE_BMOVE CACHE INTERNAL "") SET(HAVE_BSD_SIGNALS CACHE INTERNAL "") -SET(HAVE_BSEARCH 1 CACHE INTERNAL "") SET(HAVE_BSS_START CACHE INTERNAL "") -SET(HAVE_BZERO CACHE INTERNAL "") -SET(HAVE_CHOWN CACHE INTERNAL "") SET(HAVE_CLOCK_GETTIME CACHE INTERNAL "") SET(HAVE_COMPRESS CACHE INTERNAL "") SET(HAVE_CRYPT CACHE INTERNAL "") SET(HAVE_CRYPT_H CACHE INTERNAL "") SET(HAVE_CUSERID CACHE INTERNAL "") -SET(HAVE_CXX_NEW 1 CACHE INTERNAL "") SET(HAVE_DECL_MADVISE CACHE INTERNAL "") -SET(HAVE_DIRECTIO CACHE INTERNAL "") SET(HAVE_DIRENT_H CACHE INTERNAL "") SET(HAVE_DLERROR CACHE INTERNAL "") SET(HAVE_DLFCN_H CACHE INTERNAL "") SET(HAVE_DLOPEN CACHE INTERNAL "") -SET(HAVE_DOPRNT CACHE INTERNAL "") SET(HAVE_EXECINFO_H CACHE INTERNAL "") SET(HAVE_FCHMOD CACHE INTERNAL "") SET(HAVE_FCNTL CACHE INTERNAL "") SET(HAVE_FCNTL_H 1 CACHE INTERNAL "") SET(HAVE_FCNTL_NONBLOCK CACHE INTERNAL "") -SET(HAVE_FCONVERT CACHE INTERNAL "") SET(HAVE_FDATASYNC CACHE INTERNAL "") SET(HAVE_DECL_FDATASYNC CACHE INTERNAL "") SET(HAVE_FEDISABLEEXCEPT CACHE INTERNAL "") SET(HAVE_FENV_H CACHE INTERNAL "") SET(HAVE_FESETROUND CACHE INTERNAL "") -SET(HAVE_FGETLN CACHE INTERNAL "") SET(HAVE_FINITE CACHE INTERNAL "") SET(HAVE_FINITE_IN_MATH_H CACHE INTERNAL "") -SET(HAVE_FLOATINGPOINT_H CACHE INTERNAL "") SET(HAVE_FLOAT_H 1 CACHE INTERNAL "") -SET(HAVE_FLOCKFILE CACHE INTERNAL "") SET(HAVE_FNMATCH_H CACHE INTERNAL "") -SET(HAVE_FPSETMASK CACHE INTERNAL "") SET(HAVE_FPU_CONTROL_H CACHE INTERNAL "") SET(HAVE_FSEEKO CACHE INTERNAL "") SET(HAVE_FSYNC CACHE INTERNAL "") SET(HAVE_FTIME 1 CACHE INTERNAL "") SET(HAVE_FTRUNCATE CACHE INTERNAL "") -SET(HAVE_GETADDRINFO 1 CACHE INTERNAL "") SET(HAVE_GETIFADDRS CACHE INTERNAL "") SET(HAVE_GETCWD 1 CACHE INTERNAL "") SET(HAVE_GETHOSTBYADDR_R CACHE INTERNAL "") SET(HAVE_GETHRTIME CACHE INTERNAL "") -SET(HAVE_GETLINE CACHE INTERNAL "") -SET(HAVE_GETNAMEINFO CACHE INTERNAL "") SET(HAVE_GETPAGESIZE CACHE INTERNAL "") SET(HAVE_GETPASS CACHE INTERNAL "") SET(HAVE_GETPASSPHRASE CACHE INTERNAL "") @@ -102,18 +85,12 @@ SET(HAVE_IPPROTO_IPV6 CACHE INTERNAL "") SET(HAVE_IPV6 TRUE CACHE INTERNAL "") SET(HAVE_IPV6_V6ONLY 1 CACHE INTERNAL "") SET(HAVE_ISINF CACHE INTERNAL "") -SET(HAVE_ISSETUGID CACHE INTERNAL "") -SET(HAVE_GETUID CACHE INTERNAL "") -SET(HAVE_GETEUID CACHE INTERNAL "") -SET(HAVE_GETGID CACHE INTERNAL "") -SET(HAVE_GETEGID CACHE INTERNAL "") SET(HAVE_LANGINFO_H CACHE INTERNAL "") SET(HAVE_LDIV 1 CACHE INTERNAL "") SET(HAVE_LIMITS_H 1 CACHE INTERNAL "") SET(HAVE_LOCALE_H 1 CACHE INTERNAL "") SET(HAVE_LOCALTIME_R 1 CACHE INTERNAL "") -SET(HAVE_LOG2 CACHE INTERNAL "") -SET(HAVE_LONGJMP 1 CACHE INTERNAL "") +#SET(HAVE_LOG2 CACHE INTERNAL "") SET(HAVE_LRAND48 CACHE INTERNAL "") SET(HAVE_LSTAT CACHE INTERNAL "") SET(HAVE_MADVISE CACHE INTERNAL "") @@ -141,8 +118,6 @@ SET(HAVE_PAM_APPL_H CACHE INTERNAL "") SET(HAVE_POLL_H CACHE INTERNAL "") SET(HAVE_POPEN CACHE INTERNAL "") SET(HAVE_POLL CACHE INTERNAL "") -SET(HAVE_PORT_CREATE CACHE INTERNAL "") -SET(HAVE_PORT_H CACHE INTERNAL "") SET(HAVE_POSIX_FALLOCATE CACHE INTERNAL "") SET(HAVE_POSIX_SIGNALS CACHE INTERNAL "") SET(HAVE_PREAD CACHE INTERNAL "") @@ -152,12 +127,11 @@ SET(HAVE_PTHREAD_ATTR_GETSTACKSIZE CACHE INTERNAL "") SET(HAVE_PTHREAD_ATTR_SETSCOPE CACHE INTERNAL "") SET(HAVE_PTHREAD_ATTR_SETSTACKSIZE CACHE INTERNAL "") SET(HAVE_PTHREAD_CONDATTR_CREATE CACHE INTERNAL "") -SET(HAVE_PTHREAD_CONDATTR_SETCLOCK CACHE INTERNAL "") +SET(HAVE_PTHREAD_GETAFFINITY_NP CACHE INTERNAL "") SET(HAVE_PTHREAD_INIT CACHE INTERNAL "") SET(HAVE_PTHREAD_KEY_DELETE CACHE INTERNAL "") SET(HAVE_PTHREAD_RWLOCK_RDLOCK CACHE INTERNAL "") SET(HAVE_PTHREAD_SIGMASK CACHE INTERNAL "") -SET(HAVE_PTHREAD_THREADMASK CACHE INTERNAL "") SET(HAVE_PTHREAD_YIELD_NP CACHE INTERNAL "") SET(HAVE_PTHREAD_YIELD_ZERO_ARG CACHE INTERNAL "") SET(HAVE_PUTENV 1 CACHE INTERNAL "") @@ -167,27 +141,16 @@ SET(HAVE_READDIR_R CACHE INTERNAL "") SET(HAVE_READLINK CACHE INTERNAL "") SET(HAVE_READ_REAL_TIME CACHE INTERNAL "") SET(HAVE_REALPATH CACHE INTERNAL "") -SET(HAVE_REGCOMP CACHE INTERNAL "") SET(HAVE_RENAME 1 CACHE INTERNAL "") -SET(HAVE_RE_COMP CACHE INTERNAL "") -SET(HAVE_RINT CACHE INTERNAL "") +#SET(HAVE_RINT CACHE INTERNAL "") SET(HAVE_RWLOCK_INIT CACHE INTERNAL "") SET(HAVE_SCHED_H CACHE INTERNAL "") SET(HAVE_SCHED_YIELD CACHE INTERNAL "") SET(HAVE_SELECT 1 CACHE INTERNAL "") SET(HAVE_SELECT_H CACHE INTERNAL "") -SET(HAVE_SEMAPHORE_H CACHE INTERNAL "") SET(HAVE_SETENV CACHE INTERNAL "") -SET(HAVE_SETFD CACHE INTERNAL "") SET(HAVE_SETLOCALE 1 CACHE INTERNAL "") -SET(HAVE_SHMAT CACHE INTERNAL "") -SET(HAVE_SHMCTL CACHE INTERNAL "") -SET(HAVE_SHMDT CACHE INTERNAL "") -SET(HAVE_SHMGET CACHE INTERNAL "") SET(HAVE_SIGACTION CACHE INTERNAL "") -SET(HAVE_SIGADDSET CACHE INTERNAL "") -SET(HAVE_SIGEMPTYSET CACHE INTERNAL "") -SET(HAVE_SIGHOLD CACHE INTERNAL "") SET(HAVE_SIGINT 1 CACHE INTERNAL "") SET(HAVE_SIGPIPE CACHE INTERNAL "") SET(HAVE_SIGQUIT CACHE INTERNAL "") @@ -195,9 +158,6 @@ SET(HAVE_SIGSET CACHE INTERNAL "") SET(HAVE_SIGTERM 1 CACHE INTERNAL "") SET(HAVE_SIGTHREADMASK CACHE INTERNAL "") SET(HAVE_SIGWAIT CACHE INTERNAL "") -SET(HAVE_SIZEOF_BOOL FALSE CACHE INTERNAL "") -SET(HAVE_SIZEOF_CHAR TRUE CACHE INTERNAL "") -SET(SIZEOF_CHAR 1 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 "") @@ -214,13 +174,10 @@ SET(SIZEOF_LONG_LONG 8 CACHE INTERNAL "") SET(HAVE_SIZEOF_MODE_T FALSE CACHE INTERNAL "") SET(HAVE_SIZEOF_OFF_T TRUE CACHE INTERNAL "") SET(SIZEOF_OFF_T 4 CACHE INTERNAL "") -SET(HAVE_SIZEOF_SHORT TRUE CACHE INTERNAL "") -SET(SIZEOF_SHORT 2 CACHE INTERNAL "") SET(HAVE_SIZEOF_SIGSET_T FALSE CACHE INTERNAL "") SET(HAVE_SIZEOF_SIZE_T TRUE CACHE INTERNAL "") SET(SIZEOF_SIZE_T ${CMAKE_SIZEOF_VOID_P} CACHE INTERNAL "") SET(HAVE_SIZEOF_SOCKADDR_IN6 TRUE CACHE INTERNAL "") -SET(HAVE_SIZEOF_SOCKLEN_T FALSE CACHE INTERNAL "") SET(HAVE_SIZEOF_UCHAR FALSE CACHE INTERNAL "") SET(HAVE_SIZEOF_UINT FALSE CACHE INTERNAL "") SET(HAVE_SIZEOF_UINT16 FALSE CACHE INTERNAL "") @@ -228,7 +185,6 @@ SET(HAVE_SIZEOF_UINT32 FALSE CACHE INTERNAL "") SET(HAVE_SIZEOF_UINT64 FALSE CACHE INTERNAL "") SET(HAVE_SIZEOF_UINT8 FALSE CACHE INTERNAL "") SET(HAVE_SIZEOF_ULONG FALSE CACHE INTERNAL "") -SET(HAVE_SIZEOF_U_INT32_T FALSE CACHE INTERNAL "") SET(HAVE_SIZE_OF_SSIZE_T FALSE CACHE INTERNAL "") SET(HAVE_SLEEP CACHE INTERNAL "") SET(HAVE_SOCKADDR_STORAGE_SS_FAMILY 1 CACHE INTERNAL "") @@ -241,30 +197,20 @@ SET(HAVE_STDLIB_H 1 CACHE INTERNAL "") SET(HAVE_STPCPY CACHE INTERNAL "") SET(HAVE_STRCASECMP CACHE INTERNAL "") SET(HAVE_STRCOLL 1 CACHE INTERNAL "") -SET(HAVE_STRDUP 1 CACHE INTERNAL "") SET(HAVE_STRERROR 1 CACHE INTERNAL "") SET(HAVE_STRINGS_H CACHE INTERNAL "") SET(HAVE_STRING_H 1 CACHE INTERNAL "") -SET(HAVE_STRLCAT CACHE INTERNAL "") -SET(HAVE_STRLCPY CACHE INTERNAL "") -SET(HAVE_STRNCASECMP CACHE INTERNAL "") SET(HAVE_STRNDUP CACHE INTERNAL "") IF(MSVC_VERSION GREATER 1310) SET(HAVE_STRNLEN 1 CACHE INTERNAL "") ENDIF() SET(HAVE_STRPBRK 1 CACHE INTERNAL "") -SET(HAVE_STRSEP CACHE INTERNAL "") -SET(HAVE_STRSIGNAL CACHE INTERNAL "") -SET(HAVE_STRSTR 1 CACHE INTERNAL "") SET(HAVE_STRTOK_R CACHE INTERNAL "") -SET(HAVE_STRTOL 1 CACHE INTERNAL "") SET(HAVE_STRTOLL CACHE INTERNAL "") SET(HAVE_STRTOUL 1 CACHE INTERNAL "") SET(HAVE_STRTOULL CACHE INTERNAL "") -SET(HAVE_SVR3_SIGNALS CACHE INTERNAL "") SET(HAVE_SYNCH_H CACHE INTERNAL "") SET(HAVE_SYSENT_H CACHE INTERNAL "") -SET(HAVE_SYS_CDEFS_H CACHE INTERNAL "") SET(HAVE_SYS_DIR_H CACHE INTERNAL "") SET(HAVE_SYS_EVENT_H CACHE INTERNAL "") SET(HAVE_SYS_ERRLIST CACHE INTERNAL "") @@ -285,7 +231,6 @@ SET(HAVE_SYS_SOCKIO_H CACHE INTERNAL "") SET(HAVE_SYS_SOCKET_H CACHE INTERNAL "") SET(HAVE_SYS_STAT_H 1 CACHE INTERNAL "") SET(HAVE_SYS_STREAM_H CACHE INTERNAL "") -SET(HAVE_SYS_TERMCAP_H CACHE INTERNAL "") SET(HAVE_SYS_TIMEB_H 1 CACHE INTERNAL "") SET(HAVE_SYS_TIMES_H CACHE INTERNAL "") SET(HAVE_SYS_TIME_H CACHE INTERNAL "") @@ -310,10 +255,8 @@ SET(HAVE_TIME_H 1 CACHE INTERNAL "") SET(HAVE_TZNAME 1 CACHE INTERNAL "") SET(HAVE_UNISTD_H CACHE INTERNAL "") SET(HAVE_UTIME_H CACHE INTERNAL "") -SET(HAVE_VALLOC CACHE INTERNAL "") SET(HAVE_VARARGS_H 1 CACHE INTERNAL "") SET(HAVE_VASPRINTF CACHE INTERNAL "") -SET(HAVE_VPRINTF 1 CACHE INTERNAL "") IF(MSVC_VERSION GREATER 1310) SET(HAVE_VSNPRINTF 1 CACHE INTERNAL "") ENDIF() @@ -334,9 +277,6 @@ IF(MSVC_VERSION GREATER 1310) SET(HAVE_strtok_s 1 CACHE INTERNAL "") ENDIF() SET(STDC_HEADERS CACHE 1 INTERNAL "") -SET(STRUCT_DIRENT_HAS_D_INO CACHE INTERNAL "") -SET(STRUCT_DIRENT_HAS_D_INO CACHE INTERNAL "") -SET(STRUCT_DIRENT_HAS_D_NAMLEN CACHE INTERNAL "") SET(TIME_WITH_SYS_TIME CACHE INTERNAL "") SET(TIME_T_UNSIGNED 1 CACHE INTERNAL "") SET(TIOCSTAT_IN_SYS_IOCTL CACHE INTERNAL "") @@ -354,18 +294,16 @@ SET(HAVE_SYS_NDIR_H CACHE INTERNAL "") SET(HAVE_SYS_NDIR_H CACHE INTERNAL "") SET(HAVE_ASM_TERMBITS_H CACHE INTERNAL "") SET(HAVE_TERMBITS_H CACHE INTERNAL "") -SET(HAVE_VIS_H CACHE INTERNAL "") SET(HAVE_WCHAR_H 1 CACHE INTERNAL "") SET(HAVE_WCTYPE_H 1 CACHE INTERNAL "") SET(HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP CACHE INTERNAL "") SET(HAVE_SOCKADDR_IN_SIN_LEN CACHE INTERNAL "") SET(HAVE_SOCKADDR_IN6_SIN6_LEN CACHE INTERNAL "") -SET(HAVE_VALGRIND CACHE INTERNAL "") +SET(HAVE_VALGRIND_MEMCHECK_H CACHE INTERNAL "") SET(HAVE_EVENT_H CACHE INTERNAL "") SET(HAVE_LINUX_UNISTD_H CACHE INTERNAL "") SET(HAVE_SYS_UTSNAME_H CACHE INTERNAL "") SET(HAVE_PTHREAD_ATTR_GETGUARDSIZE CACHE INTERNAL "") -SET(HAVE_UCONTEXT_H CACHE INTERNAL "") SET(HAVE_SOCKPEERCRED CACHE INTERNAL "") SET(HAVE_ABI_CXA_DEMANGLE CACHE INTERNAL "") SET(HAVE_GCC_ATOMIC_BUILTINS CACHE INTERNAL "") diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index c9c18f7c079..68eb715eed9 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -1,5 +1,5 @@ # Copyright (c) 2009, 2018, Oracle and/or its affiliates. -# Copyright (c) 2011, 2018, MariaDB Corporation +# Copyright (c) 2011, 2019, 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 @@ -15,8 +15,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) -INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake) +INCLUDE(CMakeParseArguments) # MYSQL_ADD_PLUGIN(plugin_name source1...sourceN # [STORAGE_ENGINE] @@ -30,9 +29,10 @@ INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake) # [DEPENDENCIES target1...targetN] MACRO(MYSQL_ADD_PLUGIN) - MYSQL_PARSE_ARGUMENTS(ARG - "LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT;CONFIG" + CMAKE_PARSE_ARGUMENTS(ARG "STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED;CLIENT" + "MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT;CONFIG" + "LINK_LIBRARIES;DEPENDENCIES" ${ARGN} ) IF(NOT WITHOUT_SERVER OR ARG_CLIENT) @@ -44,8 +44,8 @@ MACRO(MYSQL_ADD_PLUGIN) ${SSL_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) - LIST(GET ARG_DEFAULT_ARGS 0 plugin) - SET(SOURCES ${ARG_DEFAULT_ARGS}) + LIST(GET ARG_UNPARSED_ARGUMENTS 0 plugin) + SET(SOURCES ${ARG_UNPARSED_ARGUMENTS}) LIST(REMOVE_AT SOURCES 0) STRING(TOUPPER ${plugin} plugin) STRING(TOLOWER ${plugin} target) @@ -209,13 +209,10 @@ MACRO(MYSQL_ADD_PLUGIN) ELSEIF(NOT CMAKE_SYSTEM_NAME STREQUAL "Linux") TARGET_LINK_LIBRARIES (${target} mysqld) ENDIF() - ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT WITH_ASAN AND NOT WITH_UBSAN) + ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT WITH_ASAN AND NOT WITH_TSAN AND NOT WITH_UBSAN AND NOT WITH_MSAN) TARGET_LINK_LIBRARIES (${target} "-Wl,--no-undefined") ENDIF() - IF(ARG_LINK_LIBRARIES) - TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES}) - ENDIF() ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES}) SET_TARGET_PROPERTIES(${target} PROPERTIES @@ -234,14 +231,18 @@ MACRO(MYSQL_ADD_PLUGIN) SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} PARENT_SCOPE) IF (NOT ARG_CLIENT) - SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_REQUIRES "MariaDB${ver}" PARENT_SCOPE) + SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_REQUIRES "MariaDB-server${ver}" PARENT_SCOPE) ENDIF() SET(CPACK_RPM_${ARG_COMPONENT}_USER_FILELIST ${ignored} PARENT_SCOPE) - IF(NOT ARG_CLIENT AND NOT ARG_CONFIG AND UNIX) - SET(ARG_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/${target}.cnf") - FILE(WRITE ${ARG_CONFIG} "[mariadb]\nplugin-load-add=${ARG_MODULE_OUTPUT_NAME}.so\n") + IF(NOT ARG_CLIENT AND UNIX) + IF (NOT ARG_CONFIG) + SET(ARG_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${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}) SET(CPACK_RPM_${ARG_COMPONENT}_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*" PARENT_SCOPE) + SET(CPACK_RPM_${ARG_COMPONENT}_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/plugin-postin.sh PARENT_SCOPE) + SET(CPACK_RPM_${ARG_COMPONENT}_POST_TRANS_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-posttrans.sh PARENT_SCOPE) ENDIF() ENDIF() ELSE() diff --git a/cmake/readline.cmake b/cmake/readline.cmake index 082dd04cf4a..f676aeb7838 100644 --- a/cmake/readline.cmake +++ b/cmake/readline.cmake @@ -27,25 +27,11 @@ MACRO (MYSQL_CHECK_MULTIBYTE) SET(HAVE_MBSTATE_T 1) ENDIF() ENDIF() - - CHECK_C_SOURCE_COMPILES(" - #include <langinfo.h> - int main(int ac, char **av) - { - char *cs = nl_langinfo(CODESET); - return 0; - }" - HAVE_LANGINFO_CODESET) CHECK_FUNCTION_EXISTS(mbrlen HAVE_MBRLEN) - CHECK_FUNCTION_EXISTS(mbscmp HAVE_MBSCMP) CHECK_FUNCTION_EXISTS(mbsrtowcs HAVE_MBSRTOWCS) - CHECK_FUNCTION_EXISTS(wcrtomb HAVE_WCRTOMB) CHECK_FUNCTION_EXISTS(mbrtowc HAVE_MBRTOWC) - CHECK_FUNCTION_EXISTS(wcscoll HAVE_WCSCOLL) - CHECK_FUNCTION_EXISTS(wcsdup HAVE_WCSDUP) CHECK_FUNCTION_EXISTS(wcwidth HAVE_WCWIDTH) - CHECK_FUNCTION_EXISTS(wctype HAVE_WCTYPE) CHECK_FUNCTION_EXISTS(iswlower HAVE_ISWLOWER) CHECK_FUNCTION_EXISTS(iswupper HAVE_ISWUPPER) CHECK_FUNCTION_EXISTS(towlower HAVE_TOWLOWER) @@ -60,13 +46,7 @@ MACRO (MYSQL_CHECK_MULTIBYTE) SET(CMAKE_EXTRA_INCLUDE_FILES wctype.h) CHECK_TYPE_SIZE(wctype_t SIZEOF_WCTYPE_T) - IF(SIZEOF_WCTYPE_T) - SET(HAVE_WCTYPE_T 1) - ENDIF() CHECK_TYPE_SIZE(wint_t SIZEOF_WINT_T) - IF(SIZEOF_WINT_T) - SET(HAVE_WINT_T 1) - ENDIF() SET(CMAKE_EXTRA_INCLUDE_FILES) ENDMACRO() @@ -87,15 +67,12 @@ MACRO (FIND_CURSES) IF(CURSES_HAVE_CURSES_H) SET(HAVE_CURSES_H 1 CACHE INTERNAL "") - ELSEIF(CURSES_HAVE_NCURSES_H) - SET(HAVE_NCURSES_H 1 CACHE INTERNAL "") ENDIF() IF(CMAKE_SYSTEM_NAME MATCHES "HP") # CMake uses full path to library /lib/libcurses.sl # On Itanium, it results into architecture mismatch+ # the library is for PA-RISC SET(CURSES_LIBRARY "curses" CACHE INTERNAL "" FORCE) - SET(CURSES_CURSES_LIBRARY "curses" CACHE INTERNAL "" FORCE) ENDIF() IF(CMAKE_SYSTEM_NAME MATCHES "Linux") diff --git a/cmake/sign.cmake.in b/cmake/sign.cmake.in index 61ae38d152d..50768a3dcc9 100644 --- a/cmake/sign.cmake.in +++ b/cmake/sign.cmake.in @@ -1,13 +1,31 @@ +# If timestamping is used, it can (rarely) fail, when public timestamping service has issues. +# +# To handle the error gracefully and tranparently, we'll retry the signtool command, +# second time without "/t URL" parameter +SET(SIGNTOOL_PARAMETERS_NO_TIMESTAMP "@SIGNTOOL_PARAMETERS@") +LIST(FIND SIGNTOOL_PARAMETERS_NO_TIMESTAMP /t idx) +IF(NOT(idx EQUAL -1)) + LIST(REMOVE_AT SIGNTOOL_PARAMETERS_NO_TIMESTAMP ${idx}) + #remove the URL following /t , as well + LIST(REMOVE_AT SIGNTOOL_PARAMETERS_NO_TIMESTAMP ${idx}) +ENDIF() + +GET_FILENAME_COMPONENT(SIGNTOOL_DIR "@SIGNTOOL_EXECUTABLE@" DIRECTORY) +GET_FILENAME_COMPONENT(SIGNTOOL_NAME "@SIGNTOOL_EXECUTABLE@" NAME) + FILE(GLOB_RECURSE files "@CMAKE_BINARY_DIR@/*.signme") MESSAGE(STATUS "signing files") + + FOREACH(f ${files}) STRING(REPLACE ".signme" "" exe_location "${f}") string (REPLACE ";" " " params "@SIGNTOOL_PARAMETERS@") - #MESSAGE("@SIGNTOOL_EXECUTABLE@" sign ${params} "${exe_location}") EXECUTE_PROCESS(COMMAND - "@SIGNTOOL_EXECUTABLE@" sign @SIGNTOOL_PARAMETERS@ "${exe_location}" + cmd /c "${SIGNTOOL_NAME}" sign @SIGNTOOL_PARAMETERS@ "${exe_location}" 2>NUL + || "${SIGNTOOL_NAME}" sign ${SIGNTOOL_PARAMETERS_NO_TIMESTAMP} "${exe_location}" + WORKING_DIRECTORY ${SIGNTOOL_DIR} RESULT_VARIABLE ERR) IF(NOT ${ERR} EQUAL 0) MESSAGE( "Error ${ERR} signing ${exe_location}") diff --git a/cmake/snappy.cmake b/cmake/snappy.cmake deleted file mode 100644 index 2810472cef6..00000000000 --- a/cmake/snappy.cmake +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (C) 2015, MariaDB Corporation. 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-1335 USA - -SET(WITH_INNODB_SNAPPY AUTO CACHE STRING - "Build with snappy. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'") - -MACRO (MYSQL_CHECK_SNAPPY) - IF (WITH_INNODB_SNAPPY STREQUAL "ON" OR WITH_INNODB_SNAPPY STREQUAL "AUTO") - CHECK_INCLUDE_FILES(snappy-c.h HAVE_SNAPPY_H) - CHECK_LIBRARY_EXISTS(snappy snappy_uncompress "" HAVE_SNAPPY_SHARED_LIB) - - IF(HAVE_SNAPPY_SHARED_LIB AND HAVE_SNAPPY_H) - ADD_DEFINITIONS(-DHAVE_SNAPPY=1) - LINK_LIBRARIES(snappy) - ELSE() - IF (WITH_INNODB_SNAPPY STREQUAL "ON") - MESSAGE(FATAL_ERROR "Required snappy library is not found") - ENDIF() - ENDIF() - ENDIF() -ENDMACRO() diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake index fef78600de2..d87d2c8fbd0 100644 --- a/cmake/ssl.cmake +++ b/cmake/ssl.cmake @@ -71,6 +71,7 @@ MACRO (MYSQL_USE_BUNDLED_SSL) SET(SSL_SOURCES ${SSL_SOURCES} ${CMAKE_SOURCE_DIR}/extra/yassl/taocrypt/${file}) ENDFOREACH() + MESSAGE_ONCE(SSL_LIBRARIES "SSL_LIBRARIES = ${SSL_LIBRARIES}") ENDMACRO() # MYSQL_CHECK_SSL @@ -111,90 +112,24 @@ MACRO (MYSQL_CHECK_SSL) UNSET(OPENSSL_APPLINK_C) UNSET(OPENSSL_APPLINK_C CACHE) ENDIF() - IF (OPENSSL_LIBRARIES) - UNSET(OPENSSL_LIBRARIES) - UNSET(OPENSSL_LIBRARIES CACHE) + IF (OPENSSL_SSL_LIBRARY) + UNSET(OPENSSL_SSL_LIBRARY) + UNSET(OPENSSL_SSL_LIBRARY 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() - 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) - MARK_AS_ADVANCED(CRYPTO_LIBRARY OPENSSL_LIBRARIES OPENSSL_ROOT_DIR - OPENSSL_INCLUDE_DIR) - IF (WITH_SSL_PATH) - LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES) - ENDIF() - - IF (OPENSSL_INCLUDE_DIR) - # 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 "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9].*" - ) - STRING(REGEX REPLACE - "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9][0-9][0-9]).*$" "\\1" - OPENSSL_MAJOR_VERSION "${OPENSSL_VERSION_NUMBER}" - ) - MESSAGE(STATUS "OPENSSL_MAJOR_VERSION = ${OPENSSL_MAJOR_VERSION}") + IF(NOT OPENSSL_ROOT_DIR) + IF(WITH_SSL_PATH) + SET(OPENSSL_ROOT_DIR ${WITH_SSL_PATH}) + ENDIF() ENDIF() - - INCLUDE(CheckSymbolExists) - INCLUDE(CheckCSourceCompiles) - SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) - CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h" - HAVE_SHA512_DIGEST_LENGTH) - CHECK_C_SOURCE_COMPILES(" - #include <openssl/dh.h> - int main() - { - DH dh; - return sizeof(dh.version); - }" OLD_OPENSSL_API) - SET(CMAKE_REQUIRED_INCLUDES) - IF(OPENSSL_INCLUDE_DIR AND OPENSSL_LIBRARIES AND - OLD_OPENSSL_API AND - CRYPTO_LIBRARY AND HAVE_SHA512_DIGEST_LENGTH) - + FIND_PACKAGE(OpenSSL) + IF(OPENSSL_FOUND) + SET(OPENSSL_LIBRARY ${OPENSSL_SSL_LIBRARY}) SET(SSL_SOURCES "") - SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARY}) + SET(SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY}) IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${LIBSOCKET}) ENDIF() @@ -202,15 +137,17 @@ MACRO (MYSQL_CHECK_SSL) SET(SSL_LIBRARIES ${SSL_LIBRARIES} ${LIBDL}) ENDIF() - MESSAGE(STATUS "OPENSSL_INCLUDE_DIR = ${OPENSSL_INCLUDE_DIR}") - MESSAGE(STATUS "OPENSSL_LIBRARIES = ${OPENSSL_LIBRARIES}") - MESSAGE(STATUS "CRYPTO_LIBRARY = ${CRYPTO_LIBRARY}") - MESSAGE(STATUS "SSL_LIBRARIES = ${SSL_LIBRARIES}") + MESSAGE_ONCE(OPENSSL_INCLUDE_DIR "OPENSSL_INCLUDE_DIR = ${OPENSSL_INCLUDE_DIR}") + MESSAGE_ONCE(OPENSSL_SSL_LIBRARY "OPENSSL_SSL_LIBRARY = ${OPENSSL_SSL_LIBRARY}") + MESSAGE_ONCE(OPENSSL_CRYPTO_LIBRARY "OPENSSL_CRYPTO_LIBRARY = ${OPENSSL_CRYPTO_LIBRARY}") + MESSAGE_ONCE(OPENSSL_VERSION "OPENSSL_VERSION = ${OPENSSL_VERSION}") + MESSAGE_ONCE(SSL_LIBRARIES "SSL_LIBRARIES = ${SSL_LIBRARIES}") SET(SSL_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR}) SET(SSL_INTERNAL_INCLUDE_DIRS "") SET(SSL_DEFINES "-DHAVE_OPENSSL") SET(CMAKE_REQUIRED_LIBRARIES ${SSL_LIBRARIES}) + SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) CHECK_SYMBOL_EXISTS(ERR_remove_thread_state "openssl/err.h" HAVE_ERR_remove_thread_state) CHECK_SYMBOL_EXISTS(EVP_aes_128_ctr "openssl/evp.h" @@ -238,8 +175,8 @@ ENDMACRO() # 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) + GET_FILENAME_COMPONENT(CRYPTO_NAME "${OPENSSL_CRYPTO_LIBRARY}" NAME_WE) + GET_FILENAME_COMPONENT(OPENSSL_NAME "${OPENSSL_SSL_LIBRARY}" 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) diff --git a/cmake/submodules.cmake b/cmake/submodules.cmake new file mode 100644 index 00000000000..6e039bfeae3 --- /dev/null +++ b/cmake/submodules.cmake @@ -0,0 +1,41 @@ +# update submodules automatically + +OPTION(UPDATE_SUBMODULES "Update submodules automatically" ON) +IF(NOT UPDATE_SUBMODULES) + RETURN() +ENDIF() + +IF(GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git") + EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" config --get cmake.update-submodules + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + OUTPUT_VARIABLE cmake_update_submodules + RESULT_VARIABLE git_config_get_result) + IF(cmake_update_submodules MATCHES no) + SET(update_result 0) + SET(SUBMODULE_UPDATE_CONFIG_MESSAGE +"\n\nTo update submodules automatically, set cmake.update-submodules to 'yes', or 'force' to update automatically: + ${GIT_EXECUTABLE} config cmake.update-submodules yes") + ELSEIF(git_config_get_result EQUAL 128) + SET(update_result 0) + ELSEIF (cmake_update_submodules MATCHES force) + MESSAGE(STATUS "Updating submodules (forced)") + EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --force --depth=1 + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE update_result) + ELSEIF (cmake_update_submodules MATCHES yes) + EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --depth=1 + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE update_result) + ELSE() + MESSAGE(STATUS "Updating submodules") + EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init + WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE update_result) + ENDIF() +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 +Then restart the build.${SUBMODULE_UPDATE_CONFIG_MESSAGE}") +ENDIF() diff --git a/cmake/systemd.cmake b/cmake/systemd.cmake index 23eb467f9b6..8a5695a246c 100644 --- a/cmake/systemd.cmake +++ b/cmake/systemd.cmake @@ -13,11 +13,10 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -INCLUDE(FindPkgConfig) -# http://www.cmake.org/cmake/help/v3.0/module/FindPkgConfig.html - MACRO(CHECK_SYSTEMD) IF(UNIX) + INCLUDE(FindPkgConfig) + # http://www.cmake.org/cmake/help/v3.0/module/FindPkgConfig.html SET(WITH_SYSTEMD "auto" CACHE STRING "Enable systemd scripts and notification support") IF(WITH_SYSTEMD STREQUAL "yes" OR WITH_SYSTEMD STREQUAL "auto") IF(PKG_CONFIG_FOUND) @@ -44,17 +43,11 @@ MACRO(CHECK_SYSTEMD) AND HAVE_SYSTEMD_SD_NOTIFY AND HAVE_SYSTEMD_SD_NOTIFYF) SET(HAVE_SYSTEMD TRUE) SET(SYSTEMD_SCRIPTS mariadb-service-convert galera_new_cluster galera_recovery) - SET(SYSTEMD_DEB_FILES "usr/bin/mariadb-service-convert - usr/bin/galera_new_cluster - usr/bin/galera_recovery - ${INSTALL_SYSTEMD_UNITDIR}/mariadb.service - ${INSTALL_SYSTEMD_UNITDIR}/mariadb@.service - ${INSTALL_SYSTEMD_UNITDIR}/mariadb@bootstrap.service.d/use_galera_new_cluster.conf") IF(DEB) SET(SYSTEMD_EXECSTARTPRE "ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld") SET(SYSTEMD_EXECSTARTPOST "ExecStartPost=/etc/mysql/debian-start") ENDIF() - MESSAGE(STATUS "Systemd features enabled") + MESSAGE_ONCE(systemd "Systemd features enabled") ELSE() UNSET(LIBSYSTEMD) UNSET(HAVE_SYSTEMD) @@ -62,7 +55,7 @@ MACRO(CHECK_SYSTEMD) UNSET(HAVE_SYSTEMD_SD_LISTEN_FDS) UNSET(HAVE_SYSTEMD_SD_NOTIFY) UNSET(HAVE_SYSTEMD_SD_NOTIFYF) - MESSAGE(STATUS "Systemd features not enabled") + MESSAGE_ONCE(systemd "Systemd features not enabled") IF(WITH_SYSTEMD STREQUAL "yes") MESSAGE(FATAL_ERROR "Requested WITH_SYSTEMD=yes however no dependencies installed/found") ENDIF() |