summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2019-03-29 10:58:20 +0100
committerSergei Golubchik <serg@mariadb.org>2019-03-29 10:58:20 +0100
commitf2a0c758da3d9f0fa42c96114b453cf4835bcbab (patch)
treed51cdc29774cfc04f522e2253542d73c94a9728b /cmake
parentfc168c3a5e58d8b364a2e87e0d876a261ec7fced (diff)
parentd0116e10a5da52503a89a413e481996ce3f65e63 (diff)
downloadmariadb-git-f2a0c758da3d9f0fa42c96114b453cf4835bcbab.tar.gz
Merge branch '10.1' into 10.2
Diffstat (limited to 'cmake')
-rw-r--r--cmake/build_configurations/mysql_release.cmake4
-rw-r--r--cmake/build_depends.cmake39
-rw-r--r--cmake/cpack_rpm.cmake57
-rw-r--r--cmake/cpack_source_ignore_files.cmake20
-rw-r--r--cmake/maintainer.cmake9
-rw-r--r--cmake/plugin.cmake3
-rw-r--r--cmake/systemd.cmake14
7 files changed, 88 insertions, 58 deletions
diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake
index 7753366add3..97e9768964e 100644
--- a/cmake/build_configurations/mysql_release.cmake
+++ b/cmake/build_configurations/mysql_release.cmake
@@ -95,8 +95,8 @@ IF(WIN32)
ELSEIF(RPM)
SET(WITH_SSL system CACHE STRING "")
SET(WITH_ZLIB system CACHE STRING "")
- SET(CHECKMODULE /usr/bin/checkmodule CACHE STRING "")
- SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE STRING "")
+ SET(CHECKMODULE /usr/bin/checkmodule CACHE FILEPATH "")
+ SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE FILEPATH "")
ELSEIF(DEB)
SET(WITH_SSL system CACHE STRING "")
SET(WITH_ZLIB system CACHE STRING "")
diff --git a/cmake/build_depends.cmake b/cmake/build_depends.cmake
new file mode 100644
index 00000000000..0d17c22cf98
--- /dev/null
+++ b/cmake/build_depends.cmake
@@ -0,0 +1,39 @@
+IF(RPM)
+ MACRO(FIND_DEP V)
+ SET(out ${V}_DEP)
+ IF (NOT DEFINED ${out})
+ IF(EXISTS ${${V}} AND NOT IS_DIRECTORY ${${V}})
+ EXECUTE_PROCESS(COMMAND ${ARGN} RESULT_VARIABLE res OUTPUT_VARIABLE O OUTPUT_STRIP_TRAILING_WHITESPACE)
+ ELSE()
+ SET(res 1)
+ ENDIF()
+ IF (res)
+ SET(O)
+ ELSE()
+ MESSAGE(STATUS "Need ${O} for ${${V}}")
+ ENDIF()
+ SET(${out} ${O} CACHE INTERNAL "Package that contains ${${V}}" FORCE)
+ ENDIF()
+ ENDMACRO()
+
+ GET_CMAKE_PROPERTY(ALL_VARS CACHE_VARIABLES)
+ FOREACH (V ${ALL_VARS})
+ GET_PROPERTY(H CACHE ${V} PROPERTY HELPSTRING)
+ IF (H MATCHES "^Have library [^/]" AND ${V})
+ STRING(REGEX REPLACE "^Have library " "" L ${H})
+ SET(V ${L}_LIBRARY)
+ FIND_LIBRARY(${V} ${L})
+ ENDIF()
+ GET_PROPERTY(T CACHE ${V} PROPERTY TYPE)
+ IF ((T STREQUAL FILEPATH OR V MATCHES "^CMAKE_COMMAND$") AND ${V} MATCHES "^/")
+ IF (RPM)
+ FIND_DEP(${V} rpm -q --qf "%{NAME}" -f ${${V}})
+ ELSE() # must be DEB
+ MESSAGE(FATAL_ERROR "Not implemented")
+ ENDIF ()
+ SET(BUILD_DEPS ${BUILD_DEPS} ${${V}_DEP})
+ ENDIF()
+ ENDFOREACH()
+ LIST(REMOVE_DUPLICATES BUILD_DEPS)
+ STRING(REPLACE ";" " " CPACK_RPM_BUILDREQUIRES "${BUILD_DEPS}")
+ENDIF(RPM)
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
index 6bc0cc81ada..7aefdce9bf0 100644
--- a/cmake/cpack_rpm.cmake
+++ b/cmake/cpack_rpm.cmake
@@ -83,6 +83,12 @@ SET(CPACK_RPM_SPEC_MORE_DEFINE "
%define _sysconfdir ${INSTALL_SYSCONFDIR}
%define restart_flag_dir %{_localstatedir}/lib/rpm-state/mariadb
%define restart_flag %{restart_flag_dir}/need-restart
+
+%{?filter_setup:
+%filter_from_provides /perl(\\\\(mtr\\\\|My::\\\\)/d
+%filter_from_requires /\\\\(lib\\\\(ft\\\\|lzma\\\\|tokuportability\\\\)\\\\)\\\\|\\\\(perl(\\\\(.*mtr\\\\|My::\\\\|.*HandlerSocket\\\\|Mysql\\\\)\\\\)/d
+%filter_setup
+}
")
# this creative hack is described here: http://www.cmake.org/pipermail/cmake/2012-January/048416.html
@@ -223,36 +229,6 @@ ELSEIF(RPM MATCHES "(rhel|centos)8")
SET(PYTHON_SHEBANG "/usr/bin/python3")
ENDIF()
-# workaround for lots of perl dependencies added by rpmbuild
-SETA(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_gcov.pl)"
- "perl(mtr_gprof.pl)"
- "perl(mtr_process.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 compat53 RELATIVE ${CMAKE_SOURCE_DIR}
@@ -299,5 +275,24 @@ IF(compat53 AND compat101)
ENDIF()
ENDIF()
-ENDIF(RPM)
+################
+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)
+ IF(DEFINED ${var})
+ SETA(CPACK_RPM_SOURCE_PKG_BUILD_PARAMS "-D${var}=${${var}}")
+ ENDIF()
+ENDMACRO()
+
+ADDIF(BUILD_CONFIG)
+ADDIF(WITH_SSL)
+
+ENDIF()
+ENDIF(RPM)
diff --git a/cmake/cpack_source_ignore_files.cmake b/cmake/cpack_source_ignore_files.cmake
index 2627e6cb697..fbd6ea6963d 100644
--- a/cmake/cpack_source_ignore_files.cmake
+++ b/cmake/cpack_source_ignore_files.cmake
@@ -15,18 +15,19 @@
SET(CPACK_SOURCE_IGNORE_FILES
\\\\.git/
-\\\\.gitignore
-CMakeCache\\\\.txt
-cmake_dist\\\\.cmake
-CPackSourceConfig\\\\.cmake
-CPackConfig.cmake
-/cmake_install\\\\.cmake
-/CTestTestfile\\\\.cmake
+\\\\.gitignore$
+\\\\.gitattributes$
+CMakeCache\\\\.txt$
+cmake_dist\\\\.cmake$
+CPackSourceConfig\\\\.cmake$
+CPackConfig.cmake$
+/cmake_install\\\\.cmake$
+/CTestTestfile\\\\.cmake$
/CMakeFiles/
/version_resources/
/_CPack_Packages/
-$\\\\.gz
-$\\\\.zip
+\\\\.gz$
+\\\\.zip$
/CMakeFiles/
/version_resources/
/_CPack_Packages/
@@ -49,5 +50,6 @@ include/config\\\\.h$
include/my_config\\\\.h$
/autom4te\\\\.cache/
errmsg\\\\.sys$
+\\\\.rpm$
#
)
diff --git a/cmake/maintainer.cmake b/cmake/maintainer.cmake
index 4e902d7fed8..caba370c4ae 100644
--- a/cmake/maintainer.cmake
+++ b/cmake/maintainer.cmake
@@ -28,10 +28,15 @@ SET(MY_WARNING_FLAGS
-Woverloaded-virtual
-Wvla
-Wwrite-strings
+ -Werror
)
-IF(MYSQL_MAINTAINER_MODE MATCHES "ON")
- SET(WHERE)
+IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0")
+ SET(MY_WARNING_FLAGS ${MY_WARNING_FLAGS} -Wno-error=maybe-uninitialized)
+ENDIF()
+
+IF(MYSQL_MAINTAINER_MODE MATCHES "OFF")
+ RETURN()
ELSEIF(MYSQL_MAINTAINER_MODE MATCHES "AUTO")
SET(WHERE DEBUG)
ENDIF()
diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake
index 65e85983d68..268bc6e4a63 100644
--- a/cmake/plugin.cmake
+++ b/cmake/plugin.cmake
@@ -233,9 +233,6 @@ MACRO(MYSQL_ADD_PLUGIN)
IF (NOT ARG_CLIENT)
SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_REQUIRES "MariaDB-server${ver}" PARENT_SCOPE)
ENDIF()
- # workarounds for cmake issues #13248 and #12864:
- SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_PROVIDES "cmake_bug_13248" PARENT_SCOPE)
- SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_OBSOLETES "cmake_bug_13248" PARENT_SCOPE)
SET(CPACK_RPM_${ARG_COMPONENT}_USER_FILELIST ${ignored} PARENT_SCOPE)
IF(NOT ARG_CLIENT AND UNIX)
IF (NOT ARG_CONFIG)
diff --git a/cmake/systemd.cmake b/cmake/systemd.cmake
index f7365066ef6..627c3a00279 100644
--- a/cmake/systemd.cmake
+++ b/cmake/systemd.cmake
@@ -38,22 +38,14 @@ MACRO(CHECK_SYSTEMD)
SET(LIBSYSTEMD systemd)
ENDIF()
SET(CMAKE_REQUIRED_LIBRARIES ${LIBSYSTEMD})
- CHECK_C_SOURCE_COMPILES(
- "
- #include <systemd/sd-daemon.h>
- int main()
- {
- sd_listen_fds(0);
- }"
- HAVE_SYSTEMD)
+ CHECK_LIBRARY_EXISTS(systemd sd_listen_fds "" HAVE_SYSTEMD_SD_LISTEN_FDS)
CHECK_INCLUDE_FILES(systemd/sd-daemon.h HAVE_SYSTEMD_SD_DAEMON_H)
- CHECK_FUNCTION_EXISTS(sd_listen_fds HAVE_SYSTEMD_SD_LISTEN_FDS)
CHECK_FUNCTION_EXISTS(sd_notify HAVE_SYSTEMD_SD_NOTIFY)
CHECK_FUNCTION_EXISTS(sd_notifyf HAVE_SYSTEMD_SD_NOTIFYF)
SET(CMAKE_REQUIRED_LIBRARIES)
- IF(HAVE_SYSTEMD AND HAVE_SYSTEMD_SD_DAEMON_H AND HAVE_SYSTEMD_SD_LISTEN_FDS
+ IF(HAVE_SYSTEMD_SD_DAEMON_H AND HAVE_SYSTEMD_SD_LISTEN_FDS
AND HAVE_SYSTEMD_SD_NOTIFY AND HAVE_SYSTEMD_SD_NOTIFYF)
- ADD_DEFINITIONS(-DHAVE_SYSTEMD)
+ SET(HAVE_SYSTEMD TRUE)
SET(SYSTEMD_SCRIPTS mariadb-service-convert galera_new_cluster galera_recovery)
IF(DEB)
SET(SYSTEMD_EXECSTARTPRE "ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld")