diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/abi_check.cmake | 11 | ||||
-rw-r--r-- | cmake/build_configurations/mysql_release.cmake | 34 | ||||
-rw-r--r-- | cmake/character_sets.cmake | 2 | ||||
-rw-r--r-- | cmake/configure.pl | 17 | ||||
-rw-r--r-- | cmake/cpack_deb.cmake | 9 | ||||
-rw-r--r-- | cmake/cpack_rpm.cmake | 178 | ||||
-rw-r--r-- | cmake/create_initial_db.cmake.in | 2 | ||||
-rw-r--r-- | cmake/ctest.cmake | 24 | ||||
-rw-r--r-- | cmake/do_abi_check.cmake | 8 | ||||
-rw-r--r-- | cmake/dtrace.cmake | 8 | ||||
-rw-r--r-- | cmake/install_layout.cmake | 76 | ||||
-rw-r--r-- | cmake/install_macros.cmake | 179 | ||||
-rw-r--r-- | cmake/jemalloc.cmake | 65 | ||||
-rw-r--r-- | cmake/libutils.cmake | 45 | ||||
-rw-r--r-- | cmake/maintainer.cmake | 19 | ||||
-rw-r--r-- | cmake/mysql_version.cmake | 28 | ||||
-rw-r--r-- | cmake/os/FreeBSD.cmake | 11 | ||||
-rw-r--r-- | cmake/os/Linux.cmake | 2 | ||||
-rw-r--r-- | cmake/os/SunOS.cmake | 5 | ||||
-rw-r--r-- | cmake/os/Windows.cmake | 4 | ||||
-rw-r--r-- | cmake/os/WindowsCache.cmake | 15 | ||||
-rw-r--r-- | cmake/package_name.cmake | 4 | ||||
-rw-r--r-- | cmake/plugin.cmake | 83 | ||||
-rw-r--r-- | cmake/readline.cmake | 142 | ||||
-rw-r--r-- | cmake/ssl.cmake | 4 | ||||
-rw-r--r-- | cmake/versioninfo.rc.in | 8 |
26 files changed, 743 insertions, 240 deletions
diff --git a/cmake/abi_check.cmake b/cmake/abi_check.cmake index 9948f526b7a..cca595c5635 100644 --- a/cmake/abi_check.cmake +++ b/cmake/abi_check.cmake @@ -55,6 +55,17 @@ IF(CMAKE_COMPILER_IS_GNUCC AND RUN_ABI_CHECK) VERBATIM ) + ADD_CUSTOM_TARGET(abi_update + COMMAND ${CMAKE_COMMAND} + -DCOMPILER=${COMPILER} + -DABI_UPDATE=1 + -DSOURCE_DIR=${CMAKE_SOURCE_DIR} + -DBINARY_DIR=${CMAKE_BINARY_DIR} + "-DABI_HEADERS=${API_PREPROCESSOR_HEADER}" + -P ${CMAKE_SOURCE_DIR}/cmake/do_abi_check.cmake + VERBATIM + ) + ADD_CUSTOM_TARGET(abi_check_all COMMAND ${CMAKE_COMMAND} -DCOMPILER=${COMPILER} diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index e2b815ef830..2c225c75ce2 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -65,7 +65,8 @@ IF(FEATURE_SET) IF(num GREATER FEATURE_SET_small) SET(WITH_ARCHIVE_STORAGE_ENGINE ON) SET(WITH_BLACKHOLE_STORAGE_ENGINE ON) - SET(WITH_FEDERATED_STORAGE_ENGINE ON) + SET(WITH_FEDERATEDX_STORAGE_ENGINE ON) + SET(WITH_PLUGIN_FEEDBACK ON) ENDIF() IF(num GREATER FEATURE_SET_classic) SET(WITH_INNOBASE_STORAGE_ENGINE ON) @@ -93,11 +94,22 @@ IF(FEATURE_SET) ENDIF() OPTION(ENABLED_LOCAL_INFILE "" ON) -SET(WITH_SSL bundled CACHE STRING "") -SET(WITH_ZLIB bundled CACHE STRING "") +IF(RPM) + SET(WITH_SSL system CACHE STRING "") + SET(WITH_ZLIB system CACHE STRING "") +ELSEIF(DEB) + SET(WITH_SSL system CACHE STRING "") + SET(WITH_ZLIB system CACHE STRING "") + SET(WITH_LIBWRAP ON) + SET(WITH_MAX ON) + SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON) +ELSE() + SET(WITH_SSL bundled CACHE STRING "") + SET(WITH_ZLIB bundled CACHE STRING "") +ENDIF() IF(NOT COMPILATION_COMMENT) - SET(COMPILATION_COMMENT "MySQL Community Server (GPL)") + SET(COMPILATION_COMMENT "MariaDB Server") ENDIF() IF(WIN32) @@ -115,9 +127,9 @@ IF(UNIX) OPTION(WITH_LIBEDIT "" ON) ENDIF() - OPTION(WITH_PIC "" ON) # Why? IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") + IF(NOT IGNORE_AIO_CHECK) # Ensure aio is available on Linux (required by InnoDB) CHECK_INCLUDE_FILES(libaio.h HAVE_LIBAIO_H) @@ -133,6 +145,14 @@ IF(UNIX) If you really do not want it, pass -DIGNORE_AIO_CHECK to cmake. ") ENDIF() + + # Remove libaio dependency from mysqld + SET(XTRADB_PREFER_STATIC_LIBAIO 1) + + # Unfortunately, linking shared libmysqld with static aio + # does not work, unless we add also dynamic one. This also means + # libmysqld.so will depend on libaio.so + SET(LIBMYSQLD_SO_EXTRA_LIBS aio) ENDIF() # Enable fast mutexes on Linux @@ -146,12 +166,12 @@ IF(UNIX) # Default GCC flags IF(CMAKE_COMPILER_IS_GNUCC) - SET(COMMON_C_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing") + SET(COMMON_C_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized") SET(CMAKE_C_FLAGS_DEBUG "-O ${COMMON_C_FLAGS}") SET(CMAKE_C_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_C_FLAGS}") ENDIF() IF(CMAKE_COMPILER_IS_GNUCXX) - SET(COMMON_CXX_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing") + SET(COMMON_CXX_FLAGS "-g -static-libgcc -fno-omit-frame-pointer -fno-strict-aliasing -Wno-uninitialized") SET(CMAKE_CXX_FLAGS_DEBUG "-O ${COMMON_CXX_FLAGS}") SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 ${COMMON_CXX_FLAGS}") ENDIF() diff --git a/cmake/character_sets.cmake b/cmake/character_sets.cmake index 1cf63ed1462..74a39e09cac 100644 --- a/cmake/character_sets.cmake +++ b/cmake/character_sets.cmake @@ -37,7 +37,7 @@ sjis swe7 tis620 ucs2 ujis utf8 utf8mb4 utf16 utf32) SET (EXTRA_CHARSETS "all") SET(WITH_EXTRA_CHARSETS ${EXTRA_CHARSETS} CACHE - STRING "Options are: none, complex, all") + STRING "Options are: none complex all") IF(WITH_EXTRA_CHARSETS MATCHES "complex") diff --git a/cmake/configure.pl b/cmake/configure.pl index 76a5a8994ee..d5c0b9b061a 100644 --- a/cmake/configure.pl +++ b/cmake/configure.pl @@ -25,6 +25,7 @@ my $cmakeargs = ""; # Assume this script is in <srcroot>/cmake my $srcdir = dirname(dirname(abs_path($0))); my $cmake_install_prefix=""; +my $just_print= 0; # Sets installation directory, bindir, libdir, libexecdir etc # the equivalent CMake variables are given without prefix @@ -113,6 +114,11 @@ foreach my $option (@ARGV) system("cmake ${srcdir} -LH"); exit(0); } + if ($option =~ /print/) + { + $just_print=1; + next; + } if($option =~ /with-plugins=/) { my @plugins= split(/,/, substr($option,13)); @@ -149,6 +155,11 @@ foreach my $option (@ARGV) $cmakeargs = $cmakeargs." -DWITH_SSL=yes"; next; } + if($option =~ /with-debug/) + { + $cmakeargs = $cmakeargs." -DCMAKE_BUILD_TYPE=Debug"; + next; + } if($option =~ /with-ssl/) { $cmakeargs = $cmakeargs." -DWITH_SSL=bundled"; @@ -211,6 +222,11 @@ foreach my $option (@ARGV) $cmakeargs = $cmakeargs." -DENABLE_GCOV=ON"; next; } + if ($option =~ /verbose/) + { + $cmakeargs = $cmakeargs." -DCMAKE_VERBOSE_MAKEFILE=1"; + next; + } if ($option =~ /with-client-ldflags/) { print("configure.pl : ignoring $option\n"); @@ -228,6 +244,7 @@ foreach my $option (@ARGV) } print("configure.pl : calling cmake $srcdir $cmakeargs\n"); +exit(0) if ($just_print); unlink("CMakeCache.txt"); my $rc = system("cmake $srcdir $cmakeargs"); exit($rc); diff --git a/cmake/cpack_deb.cmake b/cmake/cpack_deb.cmake new file mode 100644 index 00000000000..5fb9db1f07f --- /dev/null +++ b/cmake/cpack_deb.cmake @@ -0,0 +1,9 @@ +# +# One day it'll be a complete solution for building deb packages with CPack +# But for now it's only to make INSTALL_DOCUMENTATION function happy +# +IF(DEB) +SET(CPACK_COMPONENT_SERVER_GROUP "server") +SET(CPACK_COMPONENT_README_GROUP "server") +ENDIF(DEB) + diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake new file mode 100644 index 00000000000..a8439fcab00 --- /dev/null +++ b/cmake/cpack_rpm.cmake @@ -0,0 +1,178 @@ +IF(RPM) + +SET(CPACK_GENERATOR "RPM") +SET(CPACK_RPM_PACKAGE_DEBUG 1) +SET(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}) +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7) + +SET(CPACK_RPM_COMPONENT_INSTALL ON) + +SET(CPACK_COMPONENT_SERVER_GROUP "server") +SET(CPACK_COMPONENT_MANPAGESSERVER_GROUP "server") +SET(CPACK_COMPONENT_INIFILES_GROUP "server") +SET(CPACK_COMPONENT_SERVER_SCRIPTS_GROUP "server") +SET(CPACK_COMPONENT_SUPPORTFILES_GROUP "server") +SET(CPACK_COMPONENT_DEVELOPMENT_GROUP "devel") +SET(CPACK_COMPONENT_MANPAGESDEVELOPMENT_GROUP "devel") +SET(CPACK_COMPONENT_TEST_GROUP "test") +SET(CPACK_COMPONENT_MANPAGESTEST_GROUP "test") +SET(CPACK_COMPONENT_CLIENT_GROUP "client") +SET(CPACK_COMPONENT_MANPAGESCLIENT_GROUP "client") +SET(CPACK_COMPONENT_README_GROUP "server") +SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "shared") +SET(CPACK_COMPONENT_COMMON_GROUP "common") +SET(CPACK_COMPONENT_COMPAT_GROUP "compat") +SET(CPACK_COMPONENTS_ALL Server ManPagesServer IniFiles Server_Scripts + SupportFiles Development ManPagesDevelopment + ManPagesTest Readme ManPagesClient Test + Common Client SharedLibraries) + +SET(CPACK_RPM_PACKAGE_NAME "MariaDB") +SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}") + +SET(CPACK_RPM_PACKAGE_RELEASE 1) # FIX: add distribution name here +SET(CPACK_RPM_PACKAGE_LICENSE "GPL") +SET(CPACK_RPM_PACKAGE_RELOCATABLE FALSE) +SET(CPACK_RPM_PACKAGE_GROUP "Applications/Databases") +SET(CPACK_RPM_PACKAGE_URL "http://mariadb.org") +SET(CPACK_RPM_PACKAGE_SUMMARY "MariaDB: a very fast and robust SQL database server") +SET(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_RPM_PACKAGE_SUMMARY} + +It is GPL v2 licensed, which means you can use the it free of charge under the +conditions of the GNU General Public License Version 2 (http://www.gnu.org/licenses/). + +MariaDB documentation can be found at http://kb.askmonty.org/ +MariaDB bug reports should be submitted through https://mariadb.atlassian.net/ + +") + +SET(CPACK_RPM_SPEC_MORE_DEFINE " +%define mysql_vendor ${CPACK_PACKAGE_VENDOR} +%define mysqlversion ${MYSQL_NO_DASH_VERSION} +%define mysqlbasedir ${CMAKE_INSTALL_PREFIX} +%define mysqldatadir ${INSTALL_MYSQLDATADIR} +%define mysqld_user mysql +%define mysqld_group mysql +%define _bindir ${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR} +%define _sbindir ${CMAKE_INSTALL_PREFIX}/${INSTALL_SBINDIR} +%define _sysconfdir ${INSTALL_SYSCONFDIR} +") + +# this creative hack is described here: http://www.cmake.org/pipermail/cmake/2012-January/048416.html +# both /etc and /etc/init.d should be ignored as of 2.8.7 +# only /etc/init.d as of 2.8.8 +# and eventually this hack should go away completely +SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE} +%define ignore \# +") + +SET(CPACK_RPM_PACKAGE_REQUIRES "MariaDB-common") + +SET(ignored + "%ignore /etc" + "%ignore /etc/init.d" + "%ignore /etc/logrotate.d" + "%ignore ${CMAKE_INSTALL_PREFIX}" + "%ignore ${CMAKE_INSTALL_PREFIX}/bin" + "%ignore ${CMAKE_INSTALL_PREFIX}/include" + "%ignore ${CMAKE_INSTALL_PREFIX}/lib" + "%ignore ${CMAKE_INSTALL_PREFIX}/lib64" + "%ignore ${CMAKE_INSTALL_PREFIX}/sbin" + "%ignore ${CMAKE_INSTALL_PREFIX}/share" + "%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*" + ) + +SET(CPACK_RPM_server_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*") +SET(CPACK_RPM_common_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONFDIR}/my.cnf") +SET(CPACK_RPM_shared_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*") +SET(CPACK_RPM_client_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*") +SET(CPACK_RPM_compat_USER_FILELIST ${ignored}) +SET(CPACK_RPM_devel_USER_FILELIST ${ignored}) +SET(CPACK_RPM_test_USER_FILELIST ${ignored}) + +SET(CPACK_RPM_client_PACKAGE_OBSOLETES "mysql-client MySQL-client MySQL-OurDelta-client") +SET(CPACK_RPM_client_PACKAGE_PROVIDES "MySQL-client mysql-client") + +# this is a workaround for CPackRPM.cmake (as of 2.8.8) bug. +# If a package group does not specify OBSOLETES/REQUIRES the values of the +# previous (alphabetically) group will apply. +SET(CPACK_RPM_common_PACKAGE_OBSOLETES "MySQL-common") +SET(CPACK_RPM_common_PACKAGE_PROVIDES "MariaDB-common") + +SET(CPACK_RPM_devel_PACKAGE_OBSOLETES "mysql-devel MySQL-devel MySQL-OurDelta-devel") +SET(CPACK_RPM_devel_PACKAGE_PROVIDES "MySQL-devel mysql-devel") + +SET(CPACK_RPM_server_PACKAGE_OBSOLETES "MariaDB MySQL mysql-server MySQL-server MySQL-OurDelta-server") +SET(CPACK_RPM_server_PACKAGE_PROVIDES "MariaDB MySQL MySQL-server msqlormysql mysql-server") +SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh) +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_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 mysql-libs") +SET(CPACK_RPM_shared_PACKAGE_PROVIDES "MySQL-shared mysql-shared") + +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_test_PACKAGE_OBSOLETES "mysql-test MySQL-test MySQL-OurDelta-test") +SET(CPACK_RPM_test_PACKAGE_PROVIDES "MySQL-test mysql-test") + +# Argh! Different distributions call packages differently, to be a drop-in replacement +# we have to fake distribution-speficic dependencies +MACRO(ALTERNATIVE_NAME real alt) + SET(p "CPACK_RPM_${real}_PACKAGE_PROVIDES") + SET(${p} "${${p}} ${alt} ${alt}(x86-32) ${alt}(x86-64) config(${alt})") + SET(o "CPACK_RPM_${real}_PACKAGE_OBSOLETES") + SET(${o} "${${o}} ${alt}") +ENDMACRO(ALTERNATIVE_NAME) + +IF(RPM MATCHES "(rhel|centos)5") + ALTERNATIVE_NAME("shared" "mysql") +ELSEIF(RPM MATCHES "(rhel|centos)6") + ALTERNATIVE_NAME("client" "mysql") + ALTERNATIVE_NAME("shared" "mysql-libs") +ELSEIF(RPM MATCHES "fedora") + ALTERNATIVE_NAME("client" "mysql") + ALTERNATIVE_NAME("shared" "mysql-libs") +ENDIF() + +# workaround for lots of perl dependencies added by rpmbuild +SET(CPACK_RPM_test_PACKAGE_PROVIDES "${CPACK_RPM_test_PACKAGE_PROVIDES} perl(lib::mtr_gcov.pl) perl(lib::mtr_gprof.pl) perl(lib::mtr_io.pl) perl(lib::mtr_misc.pl) perl(lib::mtr_process.pl) perl(lib::v1/mtr_cases.pl) perl(lib::v1/mtr_gcov.pl) perl(lib::v1/mtr_gprof.pl) perl(lib::v1/mtr_im.pl) perl(lib::v1/mtr_io.pl) perl(lib::v1/mtr_match.pl) perl(lib::v1/mtr_misc.pl) perl(lib::v1/mtr_process.pl) perl(lib::v1/mtr_report.pl) perl(lib::v1/mtr_stress.pl) perl(lib::v1/mtr_timer.pl) perl(lib::v1/mtr_unique.pl) perl(mtr_cases) perl(mtr_io.pl) perl(mtr_match) perl(mtr_misc.pl) perl(mtr_report) perl(mtr_results) perl(mtr_unique)") + +# 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} + "${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) + SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} Compat) + + # RHEL6/CentOS6 install Postfix by default, and it requires + # libmysqlclient.so.16 that pulls in mysql-libs-5.1.x + # 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") + SET(CPACK_RPM_common_PACKAGE_REQUIRES "MariaDB-compat") + ENDIF() +ENDIF(compat_rpm) + +SET(CPACK_RPM_compat_PACKAGE_REQUIRES "/bin/sh") # to mask CPACK_RPM_PACKAGE_REQUIRES +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(RPM) + diff --git a/cmake/create_initial_db.cmake.in b/cmake/create_initial_db.cmake.in index a7b725a07f1..ce638b14e39 100644 --- a/cmake/create_initial_db.cmake.in +++ b/cmake/create_initial_db.cmake.in @@ -31,7 +31,7 @@ ENDIF() # Create bootstrapper SQL script FILE(WRITE bootstrap.sql "use mysql;\n" ) -FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql) +FOREACH(FILENAME mysql_system_tables.sql mysql_system_tables_data.sql mysql_performance_tables.sql) FILE(STRINGS ${CMAKE_SOURCE_DIR}/scripts/${FILENAME} CONTENTS) FOREACH(STR ${CONTENTS}) IF(NOT STR MATCHES "@current_hostname") diff --git a/cmake/ctest.cmake b/cmake/ctest.cmake new file mode 100644 index 00000000000..08852a366f6 --- /dev/null +++ b/cmake/ctest.cmake @@ -0,0 +1,24 @@ + +INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake) + +MACRO(MY_ADD_TEST name) + ADD_TEST(${name} ${name}-t) +ENDMACRO() + +MACRO (MY_ADD_TESTS) + MYSQL_PARSE_ARGUMENTS(ARG "LINK_LIBRARIES;EXT" "" ${ARGN}) + + INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/unittest/mytap) + + IF (NOT ARG_EXT) + SET(ARG_EXT "c") + ENDIF() + + FOREACH(name ${ARG_DEFAULT_ARGS}) + ADD_EXECUTABLE(${name}-t "${name}-t.${ARG_EXT}") + TARGET_LINK_LIBRARIES(${name}-t mytap ${ARG_LINK_LIBRARIES}) + MY_ADD_TEST(${name}) + ENDFOREACH() +ENDMACRO() + diff --git a/cmake/do_abi_check.cmake b/cmake/do_abi_check.cmake index e42f11abde2..c831aaf8b52 100644 --- a/cmake/do_abi_check.cmake +++ b/cmake/do_abi_check.cmake @@ -75,8 +75,12 @@ FOREACH(file ${ABI_HEADERS}) EXECUTE_PROCESS( COMMAND diff -w ${file}.pp ${abi_check_out} RESULT_VARIABLE result) IF(NOT ${result} EQUAL 0) - MESSAGE(FATAL_ERROR - "ABI check found difference between ${file}.pp and ${abi_check_out}") + IF(ABI_UPDATE) + EXECUTE_PROCESS(COMMAND mv -v ${abi_check_out} ${file}.pp) + ELSE(ABI_UPDATE) + MESSAGE(FATAL_ERROR + "ABI check found difference between ${file}.pp and ${abi_check_out}") + ENDIF(ABI_UPDATE) ENDIF() FILE(REMOVE ${abi_check_out}) ENDFOREACH() diff --git a/cmake/dtrace.cmake b/cmake/dtrace.cmake index 36d948a417a..1fc87cfcbef 100644 --- a/cmake/dtrace.cmake +++ b/cmake/dtrace.cmake @@ -34,9 +34,15 @@ MACRO(CHECK_DTRACE) FIND_PROGRAM(DTRACE dtrace) MARK_AS_ADVANCED(DTRACE) + IF(CMAKE_C_COMPILER MATCHES "ccache" AND CMAKE_SYSTEM_NAME MATCHES "Linux") + # dtrace fails on fedora if CC='ccache gcc' is used + SET(BUGGY_LINUX_DTRACE 1) + ENDIF() + # On FreeBSD, dtrace does not handle userland tracing yet IF(DTRACE AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD" - AND NOT BUGGY_GCC_NO_DTRACE_MODULES) + AND NOT BUGGY_GCC_NO_DTRACE_MODULES + AND NOT BUGGY_LINUX_DTRACE) SET(ENABLE_DTRACE ON CACHE BOOL "Enable dtrace") ENDIF() SET(HAVE_DTRACE ${ENABLE_DTRACE}) diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake index 4adda0b6eac..d5f60832884 100644 --- a/cmake/install_layout.cmake +++ b/cmake/install_layout.cmake @@ -24,7 +24,6 @@ # # RPM # Build as per default RPM layout, with prefix=/usr -# Note: The layout for ULN RPMs differs, see the "RPM" section. # # DEB # Build as per STANDALONE, prefix=/opt/mysql/server-$major.$minor @@ -42,6 +41,8 @@ # - INSTALL_BINDIR (directory with client executables and scripts) # - INSTALL_SBINDIR (directory with mysqld) # - INSTALL_SCRIPTDIR (several scripts, rarely used) +# - INSTALL_SYSCONFDIR (my.cnf config file. Usually /etc or nothing) +# - INSTALL_SYSCONF2DIR (additional config files, e.g. /etc/mysql/conf.d) # # - INSTALL_LIBDIR (directory with client end embedded libraries) # - INSTALL_PLUGINDIR (directory for plugins) @@ -61,23 +62,29 @@ # # - INSTALL_MYSQLDATADIR (data directory) # +# - INSTALL_UNIX_ADDRDIR (path to mysql.sock) +# # When changing this page, _please_ do not forget to update public Wiki # http://forge.mysql.com/wiki/CMake#Fine-tuning_installation_paths IF(NOT INSTALL_LAYOUT) - SET(DEFAULT_INSTALL_LAYOUT "STANDALONE") + IF(DEB) + SET(INSTALL_LAYOUT "DEB") + ELSEIF(RPM) + SET(INSTALL_LAYOUT "RPM") + ELSE() + SET(INSTALL_LAYOUT "STANDALONE") + ENDIF() ENDIF() -SET(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}" -CACHE STRING "Installation directory layout. Options are: STANDALONE (as in zip or tar.gz installer), RPM, DEB, SVR4") +SET(INSTALL_LAYOUT "${INSTALL_LAYOUT}" +CACHE STRING "Installation directory layout. Options are: STANDALONE (as in zip or tar.gz installer) RPM DEB SVR4") IF(UNIX) IF(INSTALL_LAYOUT MATCHES "RPM") SET(default_prefix "/usr") ELSEIF(INSTALL_LAYOUT MATCHES "DEB") - SET(default_prefix "/opt/mysql/server-${MYSQL_BASE_VERSION}") - # This is required to avoid "cpack -GDEB" default of prefix=/usr - SET(CPACK_SET_DESTDIR ON) + SET(default_prefix "/usr") ELSEIF(INSTALL_LAYOUT MATCHES "SVR4") SET(default_prefix "/opt/mysql/mysql") ELSE() @@ -93,10 +100,6 @@ IF(UNIX) MESSAGE(FATAL_ERROR "Invalid INSTALL_LAYOUT parameter:${INSTALL_LAYOUT}." " Choose between ${VALID_INSTALL_LAYOUTS}" ) ENDIF() - - SET(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc" - CACHE PATH "config directory (for my.cnf)") - MARK_AS_ADVANCED(SYSCONFDIR) ENDIF() # @@ -119,7 +122,7 @@ SET(INSTALL_SCRIPTDIR_STANDALONE "scripts") SET(INSTALL_LIBDIR_STANDALONE "lib") SET(INSTALL_PLUGINDIR_STANDALONE "lib/plugin") # -SET(INSTALL_INCLUDEDIR_STANDALONE "include") +SET(INSTALL_INCLUDEDIR_STANDALONE "include/mysql") # SET(INSTALL_DOCDIR_STANDALONE "docs") SET(INSTALL_DOCREADMEDIR_STANDALONE ".") @@ -135,16 +138,15 @@ SET(INSTALL_SUPPORTFILESDIR_STANDALONE "support-files") SET(INSTALL_MYSQLDATADIR_STANDALONE "data") SET(INSTALL_PLUGINTESTDIR_STANDALONE ${plugin_tests}) +SET(INSTALL_UNIX_ADDRDIR_STANDALONE "/tmp/mysql.sock") # # RPM layout # -# See "packaging/rpm-uln/mysql-5.5-libdir.patch" for the differences -# which apply to RPMs in ULN (Oracle Linux), that patch file will -# be applied at build time via "rpmbuild". -# SET(INSTALL_BINDIR_RPM "bin") SET(INSTALL_SBINDIR_RPM "sbin") SET(INSTALL_SCRIPTDIR_RPM "bin") +SET(INSTALL_SYSCONFDIR_RPM "/etc") +SET(INSTALL_SYSCONF2DIR_RPM "/etc/my.cnf.d") # IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") SET(INSTALL_LIBDIR_RPM "lib64") @@ -156,8 +158,8 @@ ENDIF() # SET(INSTALL_INCLUDEDIR_RPM "include/mysql") # -#SET(INSTALL_DOCDIR_RPM unset - installed directly by RPM) -#SET(INSTALL_DOCREADMEDIR_RPM unset - installed directly by RPM) +SET(INSTALL_DOCDIR_RPM "share/doc") +SET(INSTALL_DOCREADMEDIR_RPM "share/doc") SET(INSTALL_INFODIR_RPM "share/info") SET(INSTALL_MANDIR_RPM "share/man") # @@ -170,32 +172,36 @@ SET(INSTALL_SUPPORTFILESDIR_RPM "share/mysql") SET(INSTALL_MYSQLDATADIR_RPM "/var/lib/mysql") SET(INSTALL_PLUGINTESTDIR_RPM ${plugin_tests}) +SET(INSTALL_UNIX_ADDRDIR_RPM "${INSTALL_MYSQLDATADIR_RPM}/mysql.sock") + # # DEB layout # SET(INSTALL_BINDIR_DEB "bin") -SET(INSTALL_SBINDIR_DEB "bin") -SET(INSTALL_SCRIPTDIR_DEB "scripts") +SET(INSTALL_SBINDIR_DEB "sbin") +SET(INSTALL_SCRIPTDIR_DEB "bin") +SET(INSTALL_SYSCONF2DIR_DEB "/etc/mysql/conf.d") # SET(INSTALL_LIBDIR_DEB "lib") -SET(INSTALL_PLUGINDIR_DEB "lib/plugin") +SET(INSTALL_PLUGINDIR_DEB "lib/mysql/plugin") # -SET(INSTALL_INCLUDEDIR_DEB "include") +SET(INSTALL_INCLUDEDIR_DEB "include/mysql") # -SET(INSTALL_DOCDIR_DEB "docs") -SET(INSTALL_DOCREADMEDIR_DEB ".") -SET(INSTALL_MANDIR_DEB "man") -SET(INSTALL_INFODIR_DEB "docs") +SET(INSTALL_DOCDIR_DEB "share/doc") +SET(INSTALL_DOCREADMEDIR_DEB "share/doc") +SET(INSTALL_MANDIR_DEB "share/man") +SET(INSTALL_INFODIR_DEB "share/info") # SET(INSTALL_SHAREDIR_DEB "share") -SET(INSTALL_MYSQLSHAREDIR_DEB "share") +SET(INSTALL_MYSQLSHAREDIR_DEB "share/mysql") SET(INSTALL_MYSQLTESTDIR_DEB "mysql-test") SET(INSTALL_SQLBENCHDIR_DEB ".") -SET(INSTALL_SUPPORTFILESDIR_DEB "support-files") +SET(INSTALL_SUPPORTFILESDIR_DEB "share/mysql") # -SET(INSTALL_MYSQLDATADIR_DEB "data") +SET(INSTALL_MYSQLDATADIR_DEB "/var/lib/mysql") SET(INSTALL_PLUGINTESTDIR_DEB ${plugin_tests}) +SET(INSTALL_UNIX_ADDRDIR_DEB "/var/run/mysqld/mysqld.sock") # # SVR4 layout # @@ -206,7 +212,7 @@ SET(INSTALL_SCRIPTDIR_SVR4 "scripts") SET(INSTALL_LIBDIR_SVR4 "lib") SET(INSTALL_PLUGINDIR_SVR4 "lib/plugin") # -SET(INSTALL_INCLUDEDIR_SVR4 "include") +SET(INSTALL_INCLUDEDIR_SVR4 "include/mysql") # SET(INSTALL_DOCDIR_SVR4 "docs") SET(INSTALL_DOCREADMEDIR_SVR4 ".") @@ -222,6 +228,7 @@ SET(INSTALL_SUPPORTFILESDIR_SVR4 "support-files") SET(INSTALL_MYSQLDATADIR_SVR4 "/var/lib/mysql") SET(INSTALL_PLUGINTESTDIR_SVR4 ${plugin_tests}) +SET(INSTALL_UNIX_ADDRDIR_SVR "/tmp/mysql.sock") # Clear cached variables if install layout was changed IF(OLD_INSTALL_LAYOUT) @@ -234,9 +241,14 @@ 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 - INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA PLUGINTEST) +FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN SYSCONF SYSCONF2 + INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA PLUGINTEST UNIX_ADDR) SET(INSTALL_${var}DIR ${INSTALL_${var}DIR_${INSTALL_LAYOUT}} CACHE STRING "${var} installation directory" ${FORCE}) MARK_AS_ADVANCED(INSTALL_${var}DIR) ENDFOREACH() + +IF(NOT MYSQL_UNIX_ADDR) + SET(MYSQL_UNIX_ADDR ${INSTALL_UNIX_ADDRDIR}) +ENDIF() + diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index 35cd53aafd6..7feba109296 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -15,35 +15,55 @@ GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake) -MACRO (INSTALL_DEBUG_SYMBOLS targets) - IF(MSVC) + +FUNCTION (INSTALL_DEBUG_SYMBOLS) + IF(MSVC) + MYSQL_PARSE_ARGUMENTS(ARG + "COMPONENT;INSTALL_LOCATION" + "" + ${ARGN} + ) + + IF(NOT ARG_COMPONENT) + SET(ARG_COMPONENT DebugBinaries) + ENDIF() + IF(NOT ARG_INSTALL_LOCATION) + SET(ARG_INSTALL_LOCATION lib) + ENDIF() + SET(targets ${ARG_DEFAULT_ARGS}) FOREACH(target ${targets}) - GET_TARGET_PROPERTY(location ${target} LOCATION) GET_TARGET_PROPERTY(type ${target} TYPE) - IF(NOT INSTALL_LOCATION) - IF(type MATCHES "STATIC_LIBRARY" OR type MATCHES "MODULE_LIBRARY" OR type MATCHES "SHARED_LIBRARY") - SET(INSTALL_LOCATION "lib") - ELSEIF(type MATCHES "EXECUTABLE") - SET(INSTALL_LOCATION "bin") - ELSE() - MESSAGE(FATAL_ERROR "cannot determine type of ${target}. Don't now where to install") - ENDIF() - ENDIF() + GET_TARGET_PROPERTY(location ${target} LOCATION) STRING(REPLACE ".exe" ".pdb" pdb_location ${location}) STRING(REPLACE ".dll" ".pdb" pdb_location ${pdb_location}) STRING(REPLACE ".lib" ".pdb" pdb_location ${pdb_location}) IF(CMAKE_GENERATOR MATCHES "Visual Studio") STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" pdb_location ${pdb_location}) ENDIF() - IF(target STREQUAL "mysqld") - SET(comp Server) - ELSE() - SET(comp Debuginfo) - ENDIF() - INSTALL(FILES ${pdb_location} DESTINATION ${INSTALL_LOCATION} COMPONENT ${comp}) + + set(comp "") + IF(ARG_COMPONENT STREQUAL "Server") + IF(target MATCHES "mysqld" OR type MATCHES "MODULE") + #MESSAGE("PDB: ${targets}") + SET(comp Server) + ENDIF() + 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() + INSTALL(FILES ${pdb_location} DESTINATION ${ARG_INSTALL_LOCATION} COMPONENT ${comp}) ENDFOREACH() ENDIF() -ENDMACRO() +ENDFUNCTION() # Installs manpage for given file (either script or executable) # @@ -110,6 +130,36 @@ FUNCTION(INSTALL_SCRIPT) INSTALL_MANPAGE(${script}) ENDFUNCTION() + +FUNCTION(INSTALL_DOCUMENTATION) + MYSQL_PARSE_ARGUMENTS(ARG "COMPONENT" "" ${ARGN}) + SET(files ${ARG_DEFAULT_ARGS}) + IF(NOT ARG_COMPONENT) + SET(ARG_COMPONENT Server) + ENDIF() + IF (ARG_COMPONENT MATCHES "Readme") + SET(destination ${INSTALL_DOCREADMEDIR}) + ELSE() + SET(destination ${INSTALL_DOCDIR}) + ENDIF() + + STRING(TOUPPER ${ARG_COMPONENT} COMPUP) + IF(CPACK_COMPONENT_${COMPUP}_GROUP) + SET(group ${CPACK_COMPONENT_${COMPUP}_GROUP}) + ELSE() + SET(group ${ARG_COMPONENT}) + ENDIF() + + IF(RPM) + SET(destination "${destination}/MariaDB-${group}-${VERSION}") + ELSEIF(DEB) + SET(destination "${destination}/mariadb-${group}-${MAJOR_VERSION}.${MINOR_VERSION}") + ENDIF() + + INSTALL(FILES ${files} DESTINATION ${destination} COMPONENT ${ARG_COMPONENT}) +ENDFUNCTION() + + # Install symbolic link to CMake target. # the link is created in the same directory as target # and extension will be the same as for target file. @@ -149,34 +199,26 @@ IF(WIN32) SET(SIGNTOOL_PARAMETERS /a /t http://timestamp.verisign.com/scripts/timstamp.dll CACHE STRING "parameters for signtool (list)") - FIND_PROGRAM(SIGNTOOL_EXECUTABLE signtool) + FIND_PROGRAM(SIGNTOOL_EXECUTABLE signtool + PATHS "$ENV{ProgramFiles}/Microsoft SDKs/Windows/v7.0A/bin" + "$ENV{ProgramFiles}/Windows Kits/8.0/bin/x86" + ) IF(NOT SIGNTOOL_EXECUTABLE) MESSAGE(FATAL_ERROR "signtool is not found. Signing executables not possible") ENDIF() - IF(NOT DEFINED SIGNCODE_ENABLED) - FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/testsign.c "int main(){return 0;}") - MAKE_DIRECTORY(${CMAKE_CURRENT_BINARY_DIR}/testsign) - TRY_COMPILE(RESULT ${CMAKE_CURRENT_BINARY_DIR}/testsign ${CMAKE_CURRENT_BINARY_DIR}/testsign.c - COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/testsign.exe - ) - - EXECUTE_PROCESS(COMMAND - ${SIGNTOOL_EXECUTABLE} sign ${SIGNTOOL_PARAMETERS} ${CMAKE_CURRENT_BINARY_DIR}/testsign.exe - RESULT_VARIABLE ERR ERROR_QUIET OUTPUT_QUIET - ) - IF(ERR EQUAL 0) - SET(SIGNCODE_ENABLED 1 CACHE INTERNAL "Can sign executables") - ELSE() - MESSAGE(STATUS "Disable authenticode signing for executables") - SET(SIGNCODE_ENABLED 0 CACHE INTERNAL "Invalid or missing certificate") - ENDIF() - ENDIF() MARK_AS_ADVANCED(SIGNTOOL_EXECUTABLE SIGNTOOL_PARAMETERS) ENDIF() ENDIF() -MACRO(SIGN_TARGET target) +MACRO(SIGN_TARGET) + MYSQL_PARSE_ARGUMENTS(ARG "COMPONENT" "" ${ARGN}) + SET(target ${ARG_DEFAULT_ARGS}) + IF(ARG_COMPONENT) + SET(comp COMPONENT ${ARG_COMPONENT}) + ELSE() + SET(comp) + ENDIF() GET_TARGET_PROPERTY(target_type ${target} TYPE) IF(target_type AND NOT target_type MATCHES "STATIC") GET_TARGET_PROPERTY(target_location ${target} LOCATION) @@ -186,12 +228,17 @@ MACRO(SIGN_TARGET target) ENDIF() INSTALL(CODE "EXECUTE_PROCESS(COMMAND - ${SIGNTOOL_EXECUTABLE} sign ${SIGNTOOL_PARAMETERS} ${target_location} + \"${SIGNTOOL_EXECUTABLE}\" verify /pa /q \"${target_location}\" + RESULT_VARIABLE ERR) + IF(NOT \${ERR} EQUAL 0) + EXECUTE_PROCESS(COMMAND + \"${SIGNTOOL_EXECUTABLE}\" sign ${SIGNTOOL_PARAMETERS} \"${target_location}\" RESULT_VARIABLE ERR) - IF(NOT \${ERR} EQUAL 0) - MESSAGE(FATAL_ERROR \"Error signing ${target_location}\") - ENDIF() - ") + ENDIF() + IF(NOT \${ERR} EQUAL 0) + MESSAGE(FATAL_ERROR \"Error signing '${target_location}'\") + ENDIF() + " ${comp}) ENDIF() ENDMACRO() @@ -206,6 +253,12 @@ FUNCTION(MYSQL_INSTALL_TARGETS) "" ${ARGN} ) + IF(ARG_COMPONENT) + SET(COMP COMPONENT ${ARG_COMPONENT}) + ELSE() + MESSAGE(FATAL_ERROR "COMPONENT argument required") + ENDIF() + SET(TARGETS ${ARG_DEFAULT_ARGS}) IF(NOT TARGETS) MESSAGE(FATAL_ERROR "Need target list for MYSQL_INSTALL_TARGETS") @@ -217,8 +270,8 @@ FUNCTION(MYSQL_INSTALL_TARGETS) FOREACH(target ${TARGETS}) # If signing is required, sign executables before installing - IF(SIGNCODE AND SIGNCODE_ENABLED) - SIGN_TARGET(${target}) + IF(SIGNCODE) + SIGN_TARGET(${target} ${COMP}) ENDIF() # Install man pages on Unix IF(UNIX) @@ -226,13 +279,10 @@ FUNCTION(MYSQL_INSTALL_TARGETS) INSTALL_MANPAGE(${target_location}) ENDIF() ENDFOREACH() - IF(ARG_COMPONENT) - SET(COMP COMPONENT ${ARG_COMPONENT}) - ENDIF() + INSTALL(TARGETS ${TARGETS} DESTINATION ${ARG_DESTINATION} ${COMP}) - SET(INSTALL_LOCATION ${ARG_DESTINATION} ) - INSTALL_DEBUG_SYMBOLS("${TARGETS}") - SET(INSTALL_LOCATION) + INSTALL_DEBUG_SYMBOLS(${TARGETS} ${COMP} INSTALL_LOCATION ${ARG_DESTINATION}) + ENDFUNCTION() # Optionally install mysqld/client/embedded from debug build run. outside of the current build dir @@ -326,3 +376,28 @@ FUNCTION(INSTALL_DEBUG_TARGET target) ENDIF() ENDFUNCTION() + +FUNCTION(INSTALL_MYSQL_TEST from to) + IF(INSTALL_MYSQLTESTDIR) + INSTALL( + DIRECTORY ${from} + DESTINATION "${INSTALL_MYSQLTESTDIR}/${to}" + USE_SOURCE_PERMISSIONS + COMPONENT Test + PATTERN "var/" EXCLUDE + PATTERN "lib/My/SafeProcess" EXCLUDE + PATTERN "lib/t*" EXCLUDE + PATTERN "CPack" EXCLUDE + PATTERN "CMake*" EXCLUDE + PATTERN "mtr.out*" EXCLUDE + PATTERN ".cvsignore" EXCLUDE + PATTERN "*.am" EXCLUDE + PATTERN "*.in" EXCLUDE + PATTERN "*.vcxproj" EXCLUDE + PATTERN "*.vcxproj.filters" EXCLUDE + PATTERN "*.vcxproj.user" EXCLUDE + PATTERN "CTest" EXCLUDE + PATTERN "*~" EXCLUDE + ) + ENDIF() +ENDFUNCTION() diff --git a/cmake/jemalloc.cmake b/cmake/jemalloc.cmake new file mode 100644 index 00000000000..bc6bf60781d --- /dev/null +++ b/cmake/jemalloc.cmake @@ -0,0 +1,65 @@ +# old cmake does not have ExternalProject file +IF(CMAKE_VERSION VERSION_LESS "2.8.6") + MACRO (CHECK_JEMALLOC) + ENDMACRO() + RETURN() +ENDIF() + +INCLUDE(ExternalProject) + +MACRO (USE_BUNDLED_JEMALLOC) + SET(SOURCE_DIR "${CMAKE_SOURCE_DIR}/extra/jemalloc") + SET(BINARY_DIR "${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/extra/jemalloc/build") + SET(LIBJEMALLOC "libjemalloc") + SET(JEMALLOC_CONFIGURE_OPTS "CC=${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}" "--with-private-namespace=jemalloc_internal_" "--enable-cc-silence") + IF (CMAKE_BUILD_TYPE MATCHES "Debug" AND NOT APPLE) # see the comment in CMakeLists.txt + LIST(APPEND JEMALLOC_CONFIGURE_OPTS --enable-debug) + ENDIF() + + IF(CMAKE_GENERATOR MATCHES "Makefiles") + SET(MAKE_COMMAND ${CMAKE_MAKE_PROGRAM}) + ELSE() # Xcode/Ninja generators + SET(MAKE_COMMAND make) + ENDIF() + + ExternalProject_Add(jemalloc + PREFIX extra/jemalloc + SOURCE_DIR ${SOURCE_DIR} + BINARY_DIR ${BINARY_DIR} + STAMP_DIR ${BINARY_DIR} + CONFIGURE_COMMAND "${SOURCE_DIR}/configure" ${JEMALLOC_CONFIGURE_OPTS} + BUILD_COMMAND ${MAKE_COMMAND} "build_lib_static" + INSTALL_COMMAND "" + ) + ADD_LIBRARY(libjemalloc STATIC IMPORTED) + SET_TARGET_PROPERTIES(libjemalloc PROPERTIES IMPORTED_LOCATION "${BINARY_DIR}/lib/libjemalloc_pic.a") + ADD_DEPENDENCIES(libjemalloc jemalloc) +ENDMACRO() + +IF(CMAKE_SYSTEM_NAME MATCHES "Linux" OR APPLE) + # Linux and OSX are the only systems where bundled jemalloc can be built without problems, + # as they both have GNU make and jemalloc actually compiles. + # Also, BSDs use jemalloc as malloc already + SET(WITH_JEMALLOC_DEFAULT "yes") +ELSE() + SET(WITH_JEMALLOC_DEFAULT "no") +ENDIF() + +SET(WITH_JEMALLOC ${WITH_JEMALLOC_DEFAULT} CACHE STRING + "Which jemalloc to use (possible values are 'no', 'bundled', 'system', 'yes' (system if possible, otherwise bundled)") + +MACRO (CHECK_JEMALLOC) + IF(WITH_JEMALLOC STREQUAL "system" OR WITH_JEMALLOC STREQUAL "yes") + CHECK_LIBRARY_EXISTS(jemalloc malloc_stats_print "" HAVE_JEMALLOC) + IF (HAVE_JEMALLOC) + SET(LIBJEMALLOC jemalloc) + ELSEIF (WITH_JEMALLOC STREQUAL "system") + MESSAGE(FATAL_ERROR "system jemalloc is not found") + ELSEIF (WITH_JEMALLOC STREQUAL "yes") + SET(trybundled 1) + ENDIF() + ENDIF() + IF(WITH_JEMALLOC STREQUAL "bundled" OR trybundled) + USE_BUNDLED_JEMALLOC() + ENDIF() +ENDMACRO() diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake index 89a9de9b322..7c13df05ca4 100644 --- a/cmake/libutils.cmake +++ b/cmake/libutils.cmake @@ -214,7 +214,7 @@ ENDMACRO() #) MACRO(MERGE_LIBRARIES) MYSQL_PARSE_ARGUMENTS(ARG - "EXPORTS;OUTPUT_NAME;COMPONENT" + "EXPORTS;OUTPUT_NAME;COMPONENT;VERSION;SOVERSION" "STATIC;SHARED;MODULE;NOINSTALL" ${ARGN} ) @@ -253,7 +253,16 @@ MACRO(MERGE_LIBRARIES) IF(NOT ARG_NOINSTALL) ADD_VERSION_INFO(${TARGET} SHARED SRC) ENDIF() + IF(ARG_VERSION) + SET(VERS VERSION ${ARG_VERSION}) + ENDIF() ADD_LIBRARY(${TARGET} ${LIBTYPE} ${SRC}) + IF (ARG_VERSION) + SET_TARGET_PROPERTIES(${TARGET} PROPERTIES VERSION ${ARG_VERSION}) + ENDIF() + IF (ARG_SOVERSION) + SET_TARGET_PROPERTIES(${TARGET} PROPERTIES SOVERSION ${ARG_VERSION}) + ENDIF() TARGET_LINK_LIBRARIES(${TARGET} ${LIBS}) IF(ARG_OUTPUT_NAME) SET_TARGET_PROPERTIES(${TARGET} PROPERTIES OUTPUT_NAME "${ARG_OUTPUT_NAME}") @@ -268,6 +277,15 @@ MACRO(MERGE_LIBRARIES) MYSQL_INSTALL_TARGETS(${TARGET} DESTINATION "${INSTALL_LIBDIR}" ${COMP}) ENDIF() SET_TARGET_PROPERTIES(${TARGET} PROPERTIES LINK_INTERFACE_LIBRARIES "") + IF(ARG_SHARED AND LINK_FLAG_NO_UNDEFINED) + # Do not allow undefined symbols in shared libraries + GET_TARGET_PROPERTY(TARGET_LINK_FLAGS ${TARGET} LINK_FLAGS) + IF(NOT TARGET_LINK_FLAGS) + SET(TARGET_LINK_FLAGS) + ENDIF() + SET_TARGET_PROPERTIES(${TARGET} PROPERTIES LINK_FLAGS + "${TARGET_LINK_FLAGS} ${LINK_FLAG_NO_UNDEFINED}") + ENDIF() ENDMACRO() FUNCTION(GET_DEPENDEND_OS_LIBS target result) @@ -287,16 +305,27 @@ FUNCTION(GET_DEPENDEND_OS_LIBS target result) ENDFUNCTION() MACRO(RESTRICT_SYMBOL_EXPORTS target) + SET(VISIBILITY_HIDDEN_FLAG) + IF(CMAKE_COMPILER_IS_GNUCXX AND UNIX) CHECK_C_COMPILER_FLAG("-fvisibility=hidden" HAVE_VISIBILITY_HIDDEN) IF(HAVE_VISIBILITY_HIDDEN) - GET_TARGET_PROPERTY(COMPILE_FLAGS ${target} COMPILE_FLAGS) - IF(NOT COMPILE_FLAGS) - # Avoid COMPILE_FLAGS-NOTFOUND - SET(COMPILE_FLAGS) - ENDIF() - SET_TARGET_PROPERTIES(${target} PROPERTIES - COMPILE_FLAGS "${COMPILE_FLAGS} -fvisibility=hidden") + SET(VISIBILITY_HIDDEN_FLAG "-fvisibility=hidden") ENDIF() ENDIF() + + IF(CMAKE_C_COMPILER_ID MATCHES "SunPro") + SET(VISIBILITY_HIDDEN_FLAG "-xldscope=hidden") + ENDIF() + + IF(VISIBILITY_HIDDEN_FLAG) + GET_TARGET_PROPERTY(COMPILE_FLAGS ${target} COMPILE_FLAGS) + IF(NOT COMPILE_FLAGS) + # Avoid COMPILE_FLAGS-NOTFOUND + SET(COMPILE_FLAGS) + ENDIF() + SET_TARGET_PROPERTIES(${target} PROPERTIES + COMPILE_FLAGS "${COMPILE_FLAGS} ${VISIBILITY_HIDDEN_FLAG}") + ENDIF() + ENDMACRO() diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake index a91905a281b..9c9ab8cca3b 100644 --- a/cmake/maintainer.cmake +++ b/cmake/maintainer.cmake @@ -18,7 +18,16 @@ INCLUDE(CheckCCompilerFlag) # Setup GCC (GNU C compiler) warning options. MACRO(SET_MYSQL_MAINTAINER_GNU_C_OPTIONS) SET(MY_MAINTAINER_WARNINGS - "-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Werror") + "-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing") + + CHECK_C_COMPILER_FLAG("-Wno-missing-field-initializers" + HAVE_NO_MISSING_FIELD_INITIALIZERS) + + IF (HAVE_NO_MISSING_FIELD_INITIALIZERS) + SET(MY_MAINTAINER_WARNINGS + "${MY_MAINTAINER_WARNINGS} -Wno-missing-field-initializers") + ENDIF() + CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement" HAVE_DECLARATION_AFTER_STATEMENT) IF(HAVE_DECLARATION_AFTER_STATEMENT) @@ -27,7 +36,7 @@ MACRO(SET_MYSQL_MAINTAINER_GNU_C_OPTIONS) ENDIF() SET(MY_MAINTAINER_C_WARNINGS "${MY_MAINTAINER_WARNINGS} ${MY_MAINTAINER_DECLARATION_AFTER_STATEMENT}" - CACHE STRING "C warning options used in maintainer builds.") + CACHE INTERNAL "C warning options used in maintainer builds.") # Do not make warnings in checks into errors. SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Wno-error") ENDMACRO() @@ -36,19 +45,19 @@ ENDMACRO() MACRO(SET_MYSQL_MAINTAINER_GNU_CXX_OPTIONS) SET(MY_MAINTAINER_CXX_WARNINGS "${MY_MAINTAINER_WARNINGS} -Wno-unused-parameter -Woverloaded-virtual" - CACHE STRING "C++ warning options used in maintainer builds.") + CACHE INTERNAL "C++ warning options used in maintainer builds.") ENDMACRO() # Setup ICC (Intel C Compiler) warning options. MACRO(SET_MYSQL_MAINTAINER_INTEL_C_OPTIONS) SET(MY_MAINTAINER_WARNINGS "-Wcheck") SET(MY_MAINTAINER_C_WARNINGS "${MY_MAINTAINER_WARNINGS}" - CACHE STRING "C warning options used in maintainer builds.") + CACHE INTERNAL "C warning options used in maintainer builds.") ENDMACRO() # Setup ICPC (Intel C++ Compiler) warning options. MACRO(SET_MYSQL_MAINTAINER_INTEL_CXX_OPTIONS) SET(MY_MAINTAINER_CXX_WARNINGS "${MY_MAINTAINER_WARNINGS}" - CACHE STRING "C++ warning options used in maintainer builds.") + CACHE INTERNAL "C++ warning options used in maintainer builds.") ENDMACRO() diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake index 14b1279c09a..1d49db07df2 100644 --- a/cmake/mysql_version.cmake +++ b/cmake/mysql_version.cmake @@ -54,7 +54,7 @@ MACRO(GET_MYSQL_VERSION) ENDIF() SET(VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${EXTRA_VERSION}") - MESSAGE(STATUS "MySQL ${VERSION}") + MESSAGE(STATUS "MariaDB ${VERSION}") SET(MYSQL_BASE_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version") SET(MYSQL_NO_DASH_VERSION "${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}") # Use NDBVERSION irregardless of whether this is Cluster or not, if not @@ -65,7 +65,7 @@ MACRO(GET_MYSQL_VERSION) MARK_AS_ADVANCED(VERSION MYSQL_VERSION_ID MYSQL_BASE_VERSION) SET(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION}) SET(CPACK_PACKAGE_VERSION_MINOR ${MINOR_VERSION}) - SET(CPACK_PACKAGE_VERSION_PATCH ${PATCH_VERSION}) + SET(CPACK_PACKAGE_VERSION_PATCH ${PATCH_VERSION}${EXTRA_VERSION}) ENDMACRO() # Get mysql version and other interesting variables @@ -80,34 +80,28 @@ ELSEIF(MYSQL_TCP_PORT EQUAL MYSQL_TCP_PORT_DEFAULT) SET(MYSQL_TCP_PORT_DEFAULT "0") ENDIF() - -IF(NOT MYSQL_UNIX_ADDR) - SET(MYSQL_UNIX_ADDR "/tmp/mysql.sock") -ENDIF() IF(NOT COMPILATION_COMMENT) SET(COMPILATION_COMMENT "Source distribution") ENDIF() - 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 "mysql-${VERSION}") + SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mariadb-${VERSION}") IF("${VERSION}" MATCHES "-ndb-") STRING(REGEX REPLACE "^.*-ndb-" "" NDBVERSION "${VERSION}") SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mysql-cluster-gpl-${NDBVERSION}") ENDIF() ENDIF() -SET(CPACK_PACKAGE_CONTACT "MySQL Release Engineering <mysql-build@oss.oracle.com>") -SET(CPACK_PACKAGE_VENDOR "Oracle Corporation") +SET(CPACK_PACKAGE_CONTACT "MariaDB team <info@montyprogram.com>") +SET(CPACK_PACKAGE_VENDOR "Monty Program AB") SET(CPACK_SOURCE_GENERATOR "TGZ") -INCLUDE(cpack_source_ignore_files) # Defintions for windows version resources -SET(PRODUCTNAME "MySQL Server") +SET(PRODUCTNAME "MariaDB Server") SET(COMPANYNAME ${CPACK_PACKAGE_VENDOR}) # Windows 'date' command has unpredictable output, so cannot rely on it to @@ -124,8 +118,14 @@ ENDIF() # Refer to http://msdn.microsoft.com/en-us/library/aa381058(VS.85).aspx # for more info. IF(MSVC) + # Tiny version is used to identify the build, it can be set with cmake -DTINY_VERSION=<number> + # to bzr revno for example (in the CI builds) + IF(NOT TINY_VERSION) + SET(TINY_VERSION "0") + ENDIF() + GET_FILENAME_COMPONENT(MYSQL_CMAKE_SCRIPT_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) - + SET(FILETYPE VFT_APP) CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in ${CMAKE_BINARY_DIR}/versioninfo_exe.rc) @@ -133,7 +133,7 @@ IF(MSVC) SET(FILETYPE VFT_DLL) CONFIGURE_FILE(${MYSQL_CMAKE_SCRIPT_DIR}/versioninfo.rc.in ${CMAKE_BINARY_DIR}/versioninfo_dll.rc) - + FUNCTION(ADD_VERSION_INFO target target_type sources_var) IF("${target_type}" MATCHES "SHARED" OR "${target_type}" MATCHES "MODULE") SET(rcfile ${CMAKE_BINARY_DIR}/versioninfo_dll.rc) diff --git a/cmake/os/FreeBSD.cmake b/cmake/os/FreeBSD.cmake index e09592942c1..ffb89c81206 100644 --- a/cmake/os/FreeBSD.cmake +++ b/cmake/os/FreeBSD.cmake @@ -22,3 +22,14 @@ # The below was used for really old versions of FreeBSD, roughly: before 5.1.9 # ADD_DEFINITIONS(-DHAVE_BROKEN_REALPATH) + +# Find libexecinfo (library that contains backtrace_symbols etc) +SET(EXECINFO_ROOT /usr/local CACHE INTERNAL "Where to find execinfo library and header") +INCLUDE_DIRECTORIES(${EXECINFO_ROOT}/include) +SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${EXECINFO_ROOT}/include) +SET(ENV{LIB} "$ENV{LIB}:${EXECINFO_ROOT}/lib") +FIND_LIBRARY(EXECINFO NAMES execinfo) +IF(EXECINFO) + SET(LIBEXECINFO ${EXECINFO}) +ENDIF() + diff --git a/cmake/os/Linux.cmake b/cmake/os/Linux.cmake index 5a1bd2f2d0d..b0680d92a1b 100644 --- a/cmake/os/Linux.cmake +++ b/cmake/os/Linux.cmake @@ -22,6 +22,7 @@ INCLUDE(CheckSymbolExists) SET(TARGET_OS_LINUX 1) SET(HAVE_NPTL 1) SET(_GNU_SOURCE 1) +SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE=1) # Fix CMake (< 2.8) flags. -rdynamic exports too many symbols. FOREACH(LANG C CXX) @@ -48,3 +49,4 @@ IF(HAVE_DECL_SHM_HUGETLB) SET(HUGETLB_USE_PROC_MEMINFO 1) SET(HAVE_LARGE_PAGE_OPTION 1) ENDIF() + diff --git a/cmake/os/SunOS.cmake b/cmake/os/SunOS.cmake index 3d2b4b8949a..d5a4b5c96b0 100644 --- a/cmake/os/SunOS.cmake +++ b/cmake/os/SunOS.cmake @@ -93,3 +93,8 @@ IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_SIZEOF_VOID_P EQUAL 4 ENDIF() ENDIF() ENDIF() + +IF(CMAKE_CXX_COMPILER_ID MATCHES "SunPro") + # Unnamed structs and unions + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -features=extensions") +ENDIF() diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index c3809d2e6c2..42ddb12bf37 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -88,7 +88,9 @@ IF(MSVC) # Fix CMake's predefined huge stack size FOREACH(type EXE SHARED MODULE) STRING(REGEX REPLACE "/STACK:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS "${CMAKE_${type}_LINKER_FLAGS}") - STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}") + STRING(REGEX REPLACE "/INCREMENTAL:([^ ]+)" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}") + STRING(REGEX REPLACE "/INCREMENTAL$" "/INCREMENTAL:NO" CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO}") + SET(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF /release") ENDFOREACH() # Mark 32 bit executables large address aware so they can diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index 897012896c8..2a6fb5ae31f 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -20,6 +20,7 @@ # different results. 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 "") @@ -58,6 +59,7 @@ 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 "") @@ -126,6 +128,7 @@ SET(HAVE_MLOCK CACHE INTERNAL "") SET(HAVE_MLOCKALL CACHE INTERNAL "") SET(HAVE_MMAP CACHE INTERNAL "") SET(HAVE_MMAP64 CACHE INTERNAL "") +SET(HAVE_NETDB_H CACHE INTERNAL "") SET(HAVE_NETINET_IN6_H CACHE INTERNAL "") SET(HAVE_NETINET_IN_H CACHE INTERNAL "") SET(HAVE_NL_LANGINFO CACHE INTERNAL "") @@ -134,6 +137,7 @@ SET(HAVE_PATHS_H CACHE INTERNAL "") SET(HAVE_PCLOSE CACHE INTERNAL "") SET(HAVE_PERROR 1 CACHE INTERNAL "") SET(HAVE_PEERCRED CACHE INTERNAL "") +SET(HAVE_PAM_APPL_H CACHE INTERNAL "") SET(HAVE_POLL_H CACHE INTERNAL "") SET(HAVE_POPEN CACHE INTERNAL "") SET(HAVE_POLL CACHE INTERNAL "") @@ -245,6 +249,7 @@ 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() @@ -262,6 +267,7 @@ 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 "") SET(HAVE_SYS_FILE_H CACHE INTERNAL "") SET(HAVE_SYS_FPU_H CACHE INTERNAL "") @@ -276,6 +282,7 @@ SET(HAVE_SYS_PTE_H CACHE INTERNAL "") SET(HAVE_SYS_RESOURCE_H CACHE INTERNAL "") SET(HAVE_SYS_SELECT_H CACHE INTERNAL "") SET(HAVE_SYS_SHM_H CACHE INTERNAL "") +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 "") @@ -333,6 +340,7 @@ 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 "") SET(HAVE_S_IROTH CACHE INTERNAL "") SET(HAVE_S_IFIFO CACHE INTERNAL "") @@ -355,4 +363,11 @@ 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_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 "") ENDIF() diff --git a/cmake/package_name.cmake b/cmake/package_name.cmake index 1566117cb60..4ba8fc18e3f 100644 --- a/cmake/package_name.cmake +++ b/cmake/package_name.cmake @@ -94,6 +94,8 @@ IF(NOT VERSION) ELSE() IF(64BIT) SET(DEFAULT_MACHINE "x86_64") + ELSE() + SET(DEFAULT_MACHINE "i386") ENDIF() ENDIF() @@ -128,7 +130,7 @@ IF(NOT VERSION) STRING(REGEX REPLACE "^.*-ndb-" "" NDBVERSION "${VERSION}") SET(package_name "mysql-cluster${PRODUCT_TAG}-${NDBVERSION}-${SYSTEM_NAME_AND_PROCESSOR}") ELSE() - SET(package_name "mysql${PRODUCT_TAG}-${VERSION}-${SYSTEM_NAME_AND_PROCESSOR}") + SET(package_name "mariadb${PRODUCT_TAG}-${VERSION}-${SYSTEM_NAME_AND_PROCESSOR}") ENDIF() MESSAGE(STATUS "Packaging as: ${package_name}") diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index 2d70245d02a..83f819836f8 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -27,26 +27,9 @@ INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/cmake_parse_arguments.cmake) # [LINK_LIBRARIES lib1...libN] # [DEPENDENCIES target1...targetN] -# Append collections files for the plugin to the common files -# Make sure we don't copy twice if running cmake again - -MACRO(PLUGIN_APPEND_COLLECTIONS plugin) - SET(fcopied "${CMAKE_CURRENT_SOURCE_DIR}/tests/collections/FilesCopied") - IF(NOT EXISTS ${fcopied}) - FILE(GLOB collections ${CMAKE_CURRENT_SOURCE_DIR}/tests/collections/*) - FOREACH(cfile ${collections}) - FILE(READ ${cfile} contents) - GET_FILENAME_COMPONENT(fname ${cfile} NAME) - FILE(APPEND ${CMAKE_SOURCE_DIR}/mysql-test/collections/${fname} "${contents}") - FILE(APPEND ${fcopied} "${fname}\n") - MESSAGE(STATUS "Appended ${cfile}") - ENDFOREACH() - ENDIF() -ENDMACRO() - MACRO(MYSQL_ADD_PLUGIN) MYSQL_PARSE_ARGUMENTS(ARG - "LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME" + "LINK_LIBRARIES;DEPENDENCIES;MODULE_OUTPUT_NAME;STATIC_OUTPUT_NAME;COMPONENT" "STORAGE_ENGINE;STATIC_ONLY;MODULE_ONLY;MANDATORY;DEFAULT;DISABLED;RECOMPILE_FOR_EMBEDDED" ${ARGN} ) @@ -112,12 +95,31 @@ MACRO(MYSQL_ADD_PLUGIN) SET(ARG_DEPENDENCIES) ENDIF() SET(BUILD_PLUGIN 1) + + IF(NOT ARG_MODULE_OUTPUT_NAME) + IF(ARG_STORAGE_ENGINE) + SET(ARG_MODULE_OUTPUT_NAME "ha_${target}") + ELSE() + SET(ARG_MODULE_OUTPUT_NAME "${target}") + ENDIF() + ENDIF() + # Build either static library or module IF (WITH_${plugin} AND NOT ARG_MODULE_ONLY) + + IF(CMAKE_GENERATOR MATCHES "Makefiles") + # If there is a shared library from previous shared build, + # remove it. This is done just for mysql-test-run.pl + # so it does not try to use stale shared lib as plugin + # in test. + FILE(REMOVE + ${CMAKE_CURRENT_BINARY_DIR}/${ARG_MODULE_OUTPUT_NAME}${CMAKE_SHARED_MODULE_SUFFIX}) + ENDIF() + ADD_LIBRARY(${target} STATIC ${SOURCES}) - SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_DEFINITONS "MYSQL_SERVER") DTRACE_INSTRUMENT(${target}) ADD_DEPENDENCIES(${target} GenError ${ARG_DEPENDENCIES}) + RESTRICT_SYMBOL_EXPORTS(${target}) IF(WITH_EMBEDDED_SERVER) # Embedded library should contain PIC code and be linkable # to shared libraries (on systems that need PIC) @@ -127,7 +129,7 @@ MACRO(MYSQL_ADD_PLUGIN) DTRACE_INSTRUMENT(${target}_embedded) IF(ARG_RECOMPILE_FOR_EMBEDDED) SET_TARGET_PROPERTIES(${target}_embedded - PROPERTIES COMPILE_DEFINITIONS "MYSQL_SERVER;EMBEDDED_LIBRARY") + PROPERTIES COMPILE_DEFINITIONS "EMBEDDED_LIBRARY") ENDIF() ADD_DEPENDENCIES(${target}_embedded GenError) ENDIF() @@ -152,22 +154,15 @@ MACRO(MYSQL_ADD_PLUGIN) IF(ARG_MANDATORY) SET (mysql_mandatory_plugins - "${mysql_mandatory_plugins} builtin_${target}_plugin," + "${mysql_mandatory_plugins} builtin_maria_${target}_plugin," PARENT_SCOPE) ELSE() SET (mysql_optional_plugins - "${mysql_optional_plugins} builtin_${target}_plugin," + "${mysql_optional_plugins} builtin_maria_${target}_plugin," PARENT_SCOPE) ENDIF() ELSEIF(NOT WITHOUT_${plugin} AND NOT ARG_STATIC_ONLY AND NOT WITHOUT_DYNAMIC_PLUGINS) - IF(NOT ARG_MODULE_OUTPUT_NAME) - IF(ARG_STORAGE_ENGINE) - SET(ARG_MODULE_OUTPUT_NAME "ha_${target}") - ELSE() - SET(ARG_MODULE_OUTPUT_NAME "${target}") - ENDIF() - ENDIF() - + ADD_VERSION_INFO(${target} MODULE SOURCES) ADD_LIBRARY(${target} MODULE ${SOURCES}) DTRACE_INSTRUMENT(${target}) @@ -195,16 +190,21 @@ MACRO(MYSQL_ADD_PLUGIN) SET_TARGET_PROPERTIES(${target} PROPERTIES OUTPUT_NAME "${ARG_MODULE_OUTPUT_NAME}") # Install dynamic library - MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR} COMPONENT Server) - INSTALL_DEBUG_TARGET(${target} DESTINATION ${INSTALL_PLUGINDIR}/debug) - # Add installed files to list for RPMs - FILE(APPEND ${CMAKE_BINARY_DIR}/support-files/plugins.files - "%attr(755, root, root) %{_prefix}/${INSTALL_PLUGINDIR}/${ARG_MODULE_OUTPUT_NAME}.so\n" - "%attr(755, root, root) %{_prefix}/${INSTALL_PLUGINDIR}/debug/${ARG_MODULE_OUTPUT_NAME}.so\n") - # For internal testing in PB2, append collections files - IF(DEFINED ENV{PB2WORKDIR}) - PLUGIN_APPEND_COLLECTIONS(${plugin}) + IF(ARG_COMPONENT) + IF(RPM AND NOT CPACK_COMPONENTS_ALL MATCHES ${ARG_COMPONENT}) + SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} ${ARG_COMPONENT} PARENT_SCOPE) + SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_REQUIRES "MariaDB-server" PARENT_SCOPE) + + # workarounds for cmake issues #13248 and #12864: + SET(CPACK_RPM_${ARG_COMPONENT}_USER_FILELIST ${ignored} PARENT_SCOPE) + SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_PROVIDES "cmake_bug_13248" PARENT_SCOPE) + SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_OBSOLETES "cmake_bug_13248" PARENT_SCOPE) + ENDIF() + ELSE() + SET(ARG_COMPONENT Server) ENDIF() + MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR} COMPONENT ${ARG_COMPONENT}) + #INSTALL_DEBUG_TARGET(${target} DESTINATION ${INSTALL_PLUGINDIR}/debug COMPONENT ${ARG_COMPONENT}) ELSE() IF(WITHOUT_${plugin}) # Update cache variable @@ -219,6 +219,11 @@ MACRO(MYSQL_ADD_PLUGIN) TARGET_LINK_LIBRARIES (${target} ${ARG_LINK_LIBRARIES}) ENDIF() + GET_FILENAME_COMPONENT(subpath ${CMAKE_CURRENT_SOURCE_DIR} NAME) + IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/mysql-test") + INSTALL_MYSQL_TEST("${CMAKE_CURRENT_SOURCE_DIR}/mysql-test/" "plugin/${subpath}") + ENDIF() + ENDMACRO() diff --git a/cmake/readline.cmake b/cmake/readline.cmake index 4840229a82e..c99557683a6 100644 --- a/cmake/readline.cmake +++ b/cmake/readline.cmake @@ -14,6 +14,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +INCLUDE(CheckCXXSourceCompiles) + MACRO (MYSQL_CHECK_MULTIBYTE) CHECK_INCLUDE_FILE(wctype.h HAVE_WCTYPE_H) CHECK_INCLUDE_FILE(wchar.h HAVE_WCHAR_H) @@ -107,40 +109,38 @@ MACRO (FIND_CURSES) ENDIF() ENDIF() ENDIF() + CHECK_LIBRARY_EXISTS(${CURSES_LIBRARY} setupterm "" HAVE_SETUPTERM) + CHECK_LIBRARY_EXISTS(${CURSES_LIBRARY} vidattr "" HAVE_VIDATTR) ENDMACRO() MACRO (MYSQL_USE_BUNDLED_READLINE) SET(USE_NEW_READLINE_INTERFACE 1) - SET(HAVE_HIST_ENTRY) - SET(USE_LIBEDIT_INTERFACE) + SET(HAVE_HIST_ENTRY 0 CACHE INTERNAL "" FORCE) SET(READLINE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/cmd-line-utils) SET(READLINE_LIBRARY readline) - FIND_CURSES() ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/cmd-line-utils/readline) ENDMACRO() -MACRO (MYSQL_USE_BUNDLED_LIBEDIT) - SET(USE_LIBEDIT_INTERFACE 1) - SET(HAVE_HIST_ENTRY 1) - SET(READLINE_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/cmd-line-utils/libedit) - SET(READLINE_LIBRARY edit) - FIND_CURSES() - ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/cmd-line-utils/libedit) -ENDMACRO() - - -MACRO (MYSQL_FIND_SYSTEM_READLINE name) +MACRO (MYSQL_FIND_SYSTEM_READLINE) - FIND_PATH(${name}_INCLUDE_DIR readline/readline.h ) - FIND_LIBRARY(${name}_LIBRARY NAMES ${name}) - MARK_AS_ADVANCED(${name}_INCLUDE_DIR ${name}_LIBRARY) + FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h ) + FIND_LIBRARY(READLINE_LIBRARY NAMES readline) + MARK_AS_ADVANCED(READLINE_INCLUDE_DIR READLINE_LIBRARY) - INCLUDE(CheckCXXSourceCompiles) - SET(CMAKE_REQUIRES_LIBRARIES ${${name}_LIBRARY}) + SET(CMAKE_REQUIRES_LIBRARIES ${READLINE_LIBRARY} ${CURSES_LIBRARY}) + + IF(READLINE_LIBRARY AND READLINE_INCLUDE_DIR) + SET(CMAKE_REQUIRED_LIBRARIES ${READLINE_LIBRARY} ${CURSES_LIBRARY}) + CHECK_CXX_SOURCE_COMPILES(" + #include <stdio.h> + #include <readline/readline.h> + int main(int argc, char **argv) + { + rl_completion_func_t *func1= (rl_completion_func_t*)0; + rl_compentry_func_t *func2= (rl_compentry_func_t*)0; + }" + NEW_READLINE_INTERFACE) - IF(${name}_LIBRARY AND ${name}_INCLUDE_DIR) - SET(SYSTEM_READLINE_FOUND 1) - SET(CMAKE_REQUIRED_LIBRARIES ${${name}_LIBRARY}) CHECK_CXX_SOURCE_COMPILES(" #include <stdio.h> #include <readline/readline.h> @@ -149,82 +149,82 @@ MACRO (MYSQL_FIND_SYSTEM_READLINE name) HIST_ENTRY entry; return 0; }" - ${name}_HAVE_HIST_ENTRY) + HAVE_HIST_ENTRY) - CHECK_CXX_SOURCE_COMPILES(" + CHECK_C_SOURCE_COMPILES(" #include <stdio.h> #include <readline/readline.h> + #if RL_VERSION_MAJOR > 5 + #error + #endif int main(int argc, char **argv) { - char res= *(*rl_completion_entry_function)(0,0); - completion_matches(0,0); + return 0; }" - ${name}_USE_LIBEDIT_INTERFACE) + READLINE_V5) + + IF(NEW_READLINE_INTERFACE) + IF (READLINE_V5) + SET(USE_NEW_READLINE_INTERFACE 1) + ELSE() + IF(NOT_FOR_DISTRIBUTION) + SET(NON_DISTRIBUTABLE_WARNING 1) + SET(USE_NEW_READLINE_INTERFACE 1) + ELSE() + SET(USE_NEW_READLINE_INTERFACE 0) + ENDIF(NOT_FOR_DISTRIBUTION) + ENDIF(READLINE_V5) + ENDIF(NEW_READLINE_INTERFACE) + ENDIF() + SET(CMAKE_REQUIRES_LIBRARIES ) +ENDMACRO() + +MACRO (MYSQL_FIND_SYSTEM_LIBEDIT) + + FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h ) + FIND_LIBRARY(READLINE_LIBRARY NAMES readline) + MARK_AS_ADVANCED(READLINE_INCLUDE_DIR READLINE_LIBRARY) + SET(CMAKE_REQUIRES_LIBRARIES ${READLINE_LIBRARY}) + IF(READLINE_LIBRARY AND READLINE_INCLUDE_DIR) CHECK_CXX_SOURCE_COMPILES(" #include <stdio.h> #include <readline/readline.h> int main(int argc, char **argv) { - rl_completion_func_t *func1= (rl_completion_func_t*)0; - rl_compentry_func_t *func2= (rl_compentry_func_t*)0; + char res= *(*rl_completion_entry_function)(0,0); + completion_matches(0,0); }" - ${name}_USE_NEW_READLINE_INTERFACE) - - IF(${name}_USE_LIBEDIT_INTERFACE OR ${name}_USE_NEW_READLINE_INTERFACE) - SET(READLINE_LIBRARY ${${name}_LIBRARY}) - SET(READLINE_INCLUDE_DIR ${${name}_INCLUDE_DIR}) - SET(HAVE_HIST_ENTRY ${${name}_HAVE_HIST_ENTRY}) - SET(USE_LIBEDIT_INTERFACE ${${name}_USE_LIBEDIT_INTERFACE}) - SET(USE_NEW_READLINE_INTERFACE ${${name}_USE_NEW_READLINE_INTERFACE}) - SET(READLINE_FOUND 1) - ENDIF() + LIBEDIT_INTERFACE) + SET(USE_LIBEDIT_INTERFACE ${LIBEDIT_INTERFACE}) ENDIF() + SET(CMAKE_REQUIRES_LIBRARIES) ENDMACRO() MACRO (MYSQL_CHECK_READLINE) IF (NOT WIN32) MYSQL_CHECK_MULTIBYTE() - IF(NOT CYGWIN) - SET(WITH_LIBEDIT ON CACHE BOOL "Use bundled libedit") - SET(WITH_READLINE OFF CACHE BOOL "Use bundled readline") - ELSE() - # Bundled libedit does not compile on cygwin, only readline - SET(WITH_READLINE OFF CACHE BOOL "Use bundled readline") - ENDIF() - - # Handle mutual exclusion of WITH_READLINE/WITH_LIBEDIT variables - # We save current setting to recognize when user switched between - # WITH_READLINE and WITH_LIBEDIT - IF(WITH_READLINE) - IF(NOT SAVE_READLINE_SETTING OR SAVE_READLINE_SETTING MATCHES - "WITH_LIBEDIT") - SET(WITH_LIBEDIT OFF CACHE BOOL "Use bundled libedit" FORCE) - ENDIF() - ELSEIF(WITH_LIBEDIT) - IF(NOT SAVE_READLINE_SETTING OR SAVE_READLINE_SETTING MATCHES - "WITH_READLINE") - SET(WITH_READLINE OFF CACHE BOOL "Use bundled readline" FORCE) - ENDIF() - ENDIF() + SET(WITH_READLINE OFF CACHE BOOL "Use bundled readline") + FIND_CURSES() IF(WITH_READLINE) - MYSQL_USE_BUNDLED_READLINE() - SET(SAVE_READLINE_SETTING WITH_READLINE CACHE INTERNAL "" FORCE) - ELSEIF(WITH_LIBEDIT) - MYSQL_USE_BUNDLED_LIBEDIT() - SET(SAVE_READLINE_SETTING WITH_LIBEDIT CACHE INTERNAL "" FORCE) + MYSQL_USE_BUNDLED_READLINE() ELSE() - MYSQL_FIND_SYSTEM_READLINE(readline) - IF(NOT READLINE_FOUND) - MYSQL_FIND_SYSTEM_READLINE(edit) - IF(NOT READLINE_FOUND) - MESSAGE(FATAL_ERROR "Cannot find system readline or libedit libraries.Use WITH_READLINE or WITH_LIBEDIT") + # OSX includes incompatible readline lib + IF (NOT APPLE) + MYSQL_FIND_SYSTEM_READLINE() + ENDIF() + IF(NOT USE_NEW_READLINE_INTERFACE) + MYSQL_FIND_SYSTEM_LIBEDIT() + IF(NOT USE_LIBEDIT_INTERFACE) + MYSQL_USE_BUNDLED_READLINE() ENDIF() ENDIF() ENDIF() + SET(MY_READLINE_INCLUDE_DIR ${READLINE_INCLUDE_DIR}) + SET(MY_READLINE_LIBRARY ${READLINE_LIBRARY} ${CURSES_LIBRARY}) ENDIF(NOT WIN32) ENDMACRO() diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake index 32b735410b7..ca950229129 100644 --- a/cmake/ssl.cmake +++ b/cmake/ssl.cmake @@ -14,7 +14,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA MACRO (CHANGE_SSL_SETTINGS string) - SET(WITH_SSL ${string} CACHE STRING "Options are : no, bundled, yes (prefer os library if present otherwise use bundled), system (use os library)" FORCE) + SET(WITH_SSL ${string} CACHE STRING "Options are: no bundled yes(prefer os library if present otherwise use bundled) system(use os library)" FORCE) ENDMACRO() MACRO (MYSQL_USE_BUNDLED_SSL) @@ -69,8 +69,10 @@ MACRO (MYSQL_CHECK_SSL) FIND_LIBRARY(CRYPTO_LIBRARY crypto) MARK_AS_ADVANCED(CRYPTO_LIBRARY) INCLUDE(CheckSymbolExists) + SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) CHECK_SYMBOL_EXISTS(SHA512_DIGEST_LENGTH "openssl/sha.h" HAVE_SHA512_DIGEST_LENGTH) + SET(CMAKE_REQUIRED_INCLUDES) IF(OPENSSL_FOUND AND CRYPTO_LIBRARY AND HAVE_SHA512_DIGEST_LENGTH) SET(SSL_SOURCES "") SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES} ${CRYPTO_LIBRARY}) diff --git a/cmake/versioninfo.rc.in b/cmake/versioninfo.rc.in index f849a9fcb59..6eb853936d2 100644 --- a/cmake/versioninfo.rc.in +++ b/cmake/versioninfo.rc.in @@ -15,8 +15,8 @@ #include <windows.h>
VS_VERSION_INFO VERSIONINFO
-FILEVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH_VERSION@,0
-PRODUCTVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH_VERSION@,0
+FILEVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH_VERSION@,@TINY_VERSION@
+PRODUCTVERSION @MAJOR_VERSION@,@MINOR_VERSION@,@PATCH_VERSION@,@TINY_VERSION@
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
FILEOS VOS__WINDOWS32
@@ -27,8 +27,8 @@ BEGIN BEGIN
BLOCK "040904E4"
BEGIN
- VALUE "FileVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.0\0"
- VALUE "ProductVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.0\0"
+ VALUE "FileVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.@TINY_VERSION@\0"
+ VALUE "ProductVersion", "@MAJOR_VERSION@.@MINOR_VERSION@.@PATCH_VERSION@.@TINY_VERSION@\0"
END
END
BLOCK "VarFileInfo"
|