You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
7.0 KiB

  1. IF(RPM)
  2. SET(CPACK_GENERATOR "RPM")
  3. SET(CPACK_RPM_PACKAGE_DEBUG 1)
  4. SET(CPACK_PACKAGING_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
  5. CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)
  6. SET(CPACK_RPM_COMPONENT_INSTALL ON)
  7. SET(CPACK_COMPONENT_SERVER_GROUP "server")
  8. SET(CPACK_COMPONENT_MANPAGESSERVER_GROUP "server")
  9. SET(CPACK_COMPONENT_INIFILES_GROUP "server")
  10. SET(CPACK_COMPONENT_SERVER_SCRIPTS_GROUP "server")
  11. SET(CPACK_COMPONENT_SUPPORTFILES_GROUP "server")
  12. SET(CPACK_COMPONENT_DEVELOPMENT_GROUP "devel")
  13. SET(CPACK_COMPONENT_MANPAGESDEVELOPMENT_GROUP "devel")
  14. SET(CPACK_COMPONENT_TEST_GROUP "test")
  15. SET(CPACK_COMPONENT_MANPAGESTEST_GROUP "test")
  16. SET(CPACK_COMPONENT_CLIENT_GROUP "client")
  17. SET(CPACK_COMPONENT_MANPAGESCLIENT_GROUP "client")
  18. SET(CPACK_COMPONENT_README_GROUP "server")
  19. SET(CPACK_COMPONENT_SHAREDLIBRARIES_GROUP "shared")
  20. SET(CPACK_COMPONENT_COMMON_GROUP "common")
  21. SET(CPACK_COMPONENT_COMPAT_GROUP "compat")
  22. SET(CPACK_COMPONENTS_ALL Server ManPagesServer IniFiles Server_Scripts
  23. SupportFiles Readme)
  24. SET(CPACK_RPM_PACKAGE_NAME "MariaDB-Galera")
  25. SET(CPACK_PACKAGE_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${VERSION}-${RPM}-${CMAKE_SYSTEM_PROCESSOR}")
  26. SET(CPACK_RPM_PACKAGE_RELEASE 1) # FIX: add distribution name here
  27. SET(CPACK_RPM_PACKAGE_LICENSE "GPL")
  28. SET(CPACK_RPM_PACKAGE_RELOCATABLE FALSE)
  29. SET(CPACK_RPM_PACKAGE_GROUP "Applications/Databases")
  30. SET(CPACK_RPM_PACKAGE_URL "http://mariadb.org")
  31. SET(CPACK_RPM_PACKAGE_SUMMARY "MariaDB: a very fast and robust SQL database server")
  32. SET(CPACK_RPM_PACKAGE_DESCRIPTION "${CPACK_RPM_PACKAGE_SUMMARY}
  33. It is GPL v2 licensed, which means you can use the it free of charge under the
  34. conditions of the GNU General Public License Version 2 (http://www.gnu.org/licenses/).
  35. MariaDB documentation can be found at http://kb.askmonty.org/
  36. MariaDB bug reports should be submitted through https://mariadb.atlassian.net/
  37. ")
  38. SET(CPACK_RPM_SPEC_MORE_DEFINE "
  39. %define mysql_vendor ${CPACK_PACKAGE_VENDOR}
  40. %define mysqlversion ${MYSQL_NO_DASH_VERSION}
  41. %define mysqlbasedir ${CMAKE_INSTALL_PREFIX}
  42. %define mysqldatadir ${INSTALL_MYSQLDATADIR}
  43. %define mysqld_user mysql
  44. %define mysqld_group mysql
  45. %define _bindir ${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}
  46. %define _sbindir ${CMAKE_INSTALL_PREFIX}/${INSTALL_SBINDIR}
  47. %define _sysconfdir ${INSTALL_SYSCONFDIR}
  48. ")
  49. # this creative hack is described here: http://www.cmake.org/pipermail/cmake/2012-January/048416.html
  50. # both /etc and /etc/init.d should be ignored as of 2.8.7
  51. # only /etc/init.d as of 2.8.8
  52. # and eventually this hack should go away completely
  53. SET(CPACK_RPM_SPEC_MORE_DEFINE "${CPACK_RPM_SPEC_MORE_DEFINE}
  54. %define ignore \#
  55. ")
  56. SET(CPACK_RPM_PACKAGE_REQUIRES "MariaDB-common")
  57. SET(ignored
  58. "%ignore /etc"
  59. "%ignore /etc/init.d"
  60. "%ignore /etc/logrotate.d"
  61. "%ignore ${CMAKE_INSTALL_PREFIX}"
  62. "%ignore ${CMAKE_INSTALL_PREFIX}/bin"
  63. "%ignore ${CMAKE_INSTALL_PREFIX}/include"
  64. "%ignore ${CMAKE_INSTALL_PREFIX}/lib"
  65. "%ignore ${CMAKE_INSTALL_PREFIX}/lib64"
  66. "%ignore ${CMAKE_INSTALL_PREFIX}/sbin"
  67. "%ignore ${CMAKE_INSTALL_PREFIX}/share"
  68. "%ignore ${CMAKE_INSTALL_PREFIX}/share/aclocal"
  69. "%ignore ${CMAKE_INSTALL_PREFIX}/share/doc"
  70. "%ignore ${CMAKE_INSTALL_PREFIX}/share/man"
  71. "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man1*"
  72. "%ignore ${CMAKE_INSTALL_PREFIX}/share/man/man8*"
  73. )
  74. SET(CPACK_RPM_server_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*")
  75. SET(CPACK_RPM_common_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf")
  76. SET(CPACK_RPM_shared_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*")
  77. SET(CPACK_RPM_client_USER_FILELIST ${ignored} "%config(noreplace) /etc/my.cnf.d/*")
  78. SET(CPACK_RPM_compat_USER_FILELIST ${ignored})
  79. SET(CPACK_RPM_devel_USER_FILELIST ${ignored})
  80. SET(CPACK_RPM_test_USER_FILELIST ${ignored})
  81. SET(CPACK_RPM_client_PACKAGE_OBSOLETES "mysql-client MySQL-client MySQL-OurDelta-client")
  82. SET(CPACK_RPM_client_PACKAGE_PROVIDES "MySQL-client mysql-client")
  83. # this is a workaround for CPackRPM.cmake (as of 2.8.8) bug.
  84. # If a package group does not specify OBSOLETES/REQUIRES the values of the
  85. # previous (alphabetically) group will apply.
  86. SET(CPACK_RPM_common_PACKAGE_OBSOLETES "MySQL-common")
  87. SET(CPACK_RPM_common_PACKAGE_PROVIDES "MariaDB-common")
  88. SET(CPACK_RPM_devel_PACKAGE_OBSOLETES "mysql-devel MySQL-devel MySQL-OurDelta-devel")
  89. SET(CPACK_RPM_devel_PACKAGE_PROVIDES "MySQL-devel mysql-devel")
  90. SET(CPACK_RPM_server_PACKAGE_OBSOLETES "MariaDB MySQL mysql-server MySQL-server MySQL-OurDelta-server")
  91. SET(CPACK_RPM_server_PACKAGE_PROVIDES "MariaDB MySQL MySQL-server msqlormysql mysql-server")
  92. SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-prein.sh)
  93. SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-preun.sh)
  94. SET(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postin.sh)
  95. SET(CPACK_RPM_server_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postun.sh)
  96. 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")
  97. SET(CPACK_RPM_shared_PACKAGE_PROVIDES "MySQL-shared mysql-shared")
  98. SET(CPACK_RPM_shared_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh)
  99. SET(CPACK_RPM_shared_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh)
  100. SET(CPACK_RPM_test_PACKAGE_OBSOLETES "mysql-test MySQL-test MySQL-OurDelta-test")
  101. SET(CPACK_RPM_test_PACKAGE_PROVIDES "MySQL-test mysql-test")
  102. # Argh! Different distributions call packages differently, to be a drop-in replacement
  103. # we have to fake distribution-speficic dependencies
  104. MACRO(ALTERNATIVE_NAME real alt)
  105. SET(p "CPACK_RPM_${real}_PACKAGE_PROVIDES")
  106. SET(${p} "${${p}} ${alt} ${alt}(x86-32) ${alt}(x86-64) config(${alt})")
  107. ENDMACRO(ALTERNATIVE_NAME)
  108. IF(RPM MATCHES "(rhel|centos)5")
  109. ALTERNATIVE_NAME("shared" "mysql")
  110. ELSEIF(RPM MATCHES "(rhel|centos)6")
  111. ALTERNATIVE_NAME("client" "mysql")
  112. ALTERNATIVE_NAME("shared" "mysql-libs")
  113. ELSEIF(RPM MATCHES "fedora")
  114. ALTERNATIVE_NAME("client" "mysql")
  115. ALTERNATIVE_NAME("shared" "mysql-libs")
  116. ENDIF()
  117. # workaround for lots of perl dependencies added by rpmbuild
  118. 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)")
  119. SET(CPACK_RPM_compat_PACKAGE_REQUIRES "/bin/sh") # to mask CPACK_RPM_PACKAGE_REQUIRES
  120. SET(CPACK_RPM_compat_PACKAGE_PROVIDES "mysql-libs = 5.3.5") # exact version doesn't matter as long as it greater than 5.1
  121. SET(CPACK_RPM_compat_PACKAGE_OBSOLETES "mysql-libs < 5.3.5")
  122. ENDIF(RPM)