diff options
author | Sergei Golubchik <serg@mariadb.org> | 2019-03-16 19:37:44 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2019-03-27 22:51:37 +0100 |
commit | b12f14965db9586e70109fe4cbf5dbd18bf2158d (patch) | |
tree | fb0cd937f5a4a45b41b1c8808dad5262ecb1935e /cmake | |
parent | ecc2711328e2e6e77758b9fe6c2a9892a2fe9192 (diff) | |
download | mariadb-git-b12f14965db9586e70109fe4cbf5dbd18bf2158d.tar.gz |
MDEV-7066 No Source RPMs ... (and so no "yum-builddep MariaDB-server" either)
automatic BuildRequires for source RPM: for every FILEPATH and
"Have library XXX" cached variable, detect what rpm package it comes from
and add it to the list of dependencies.
That is, the source RPM will BuildRequire all those packages that
were found by cmake when the source RPM was built. Presumably, our
CMakeLists.txt won't check for libraries that aren't needed for a build.
It supports libraries/executables/files found with
FIND_LIBRARY
FIND_FILE
FIND_PROGRAM
CHECK_LIBRARY_EXISTS
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/build_configurations/mysql_release.cmake | 4 | ||||
-rw-r--r-- | cmake/build_depends.cmake | 39 |
2 files changed, 41 insertions, 2 deletions
diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake index b73b44cddc3..709d97ec693 100644 --- a/cmake/build_configurations/mysql_release.cmake +++ b/cmake/build_configurations/mysql_release.cmake @@ -89,8 +89,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 "") SET(WITH_LIBARCHIVE ON CACHE STRING "") ELSEIF(DEB) SET(WITH_SSL 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) |