summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-05-22 11:04:32 +0200
committerSergei Golubchik <sergii@pisem.net>2012-05-22 11:04:32 +0200
commitdda2713318d816c613f892db461c192d4cdab445 (patch)
treef6121386b8b032c912bfdc30af858b3f04678f75 /cmake
parent9346dc83154e3b23baa2f67df3e6a30e4a943d11 (diff)
downloadmariadb-git-dda2713318d816c613f892db461c192d4cdab445.tar.gz
Building RPMs with CPack
configure with cmake -DRPM=distro
Diffstat (limited to 'cmake')
-rw-r--r--cmake/cpack_rpm.cmake88
-rw-r--r--cmake/install_layout.cmake30
-rw-r--r--cmake/mysql_version.cmake6
3 files changed, 108 insertions, 16 deletions
diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake
new file mode 100644
index 00000000000..e8d3bacb82f
--- /dev/null
+++ b/cmake/cpack_rpm.cmake
@@ -0,0 +1,88 @@
+IF(RPM)
+
+SET(CPACK_GENERATOR "RPM")
+SET(CPACK_RPM_PACKAGE_DEBUG 1)
+SET(INSTALL_LAYOUT "RPM")
+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_COMPONENTS_ALL Server ManPagesServer IniFiles Server_Scripts
+ SupportFiles Development ManPagesDevelopment
+ Test ManPagesTest Readme ManPagesClient
+ 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 mysqldatadir /var/lib/mysql
+%define mysqld_user mysql
+%define mysqld_group mysql
+")
+
+# 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_server_USER_FILELIST "%ignore /etc" "%ignore /etc/init.d")
+
+SET(CPACK_RPM_client_PACKAGE_OBSOLETES "mysql-client MariaDB-client MySQL-client MySQL-OurDelta-client")
+SET(CPACK_RPM_client_PACKAGE_PROVIDES "MariaDB-client MySQL-client mysql-client")
+
+SET(CPACK_RPM_devel_PACKAGE_OBSOLETES "mysql-devel MariaDB-devel MySQL-devel MySQL-OurDelta-devel")
+SET(CPACK_RPM_devel_PACKAGE_PROVIDES "MariaDB-devel MySQL-devel mysql-devel")
+
+SET(CPACK_RPM_server_PACKAGE_OBSOLETES "MariaDB mysql mysql-server MariaDB-server MySQL-server MySQL-OurDelta-server")
+SET(CPACK_RPM_server_PACKAGE_PROVIDES "MariaDB MariaDB-server MySQL-server config(MariaDB-server) msqlormysql mysql mysql-server")
+SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm-prein.sh)
+SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm-preun.sh)
+SET(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm-postin.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 MariaDB-shared MySQL-shared MySQL-OurDelta-shared")
+SET(CPACK_RPM_shared_PACKAGE_PROVIDES "MariaDB-shared MySQL-shared mysql-shared mysql-libs libmysqlclient.so.${SHARED_LIB_MAJOR_VERSION} libmysqlclient.so.${SHARED_LIB_MAJOR_VERSION}(libmysqlclient_${SHARED_LIB_MAJOR_VERSION}) libmysqlclient_r.so.${SHARED_LIB_MAJOR_VERSION} libmysqlclient_r.so.${SHARED_LIB_MAJOR_VERSION}(libmysqlclient_${SHARED_LIB_MAJOR_VERSION})")
+SET(CPACK_RPM_shared_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm-ldconfig.sh)
+SET(CPACK_RPM_shared_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm-ldconfig.sh)
+
+SET(CPACK_RPM_test_PACKAGE_OBSOLETES "mysql-test MariaDB-test MySQL-test MySQL-OurDelta-test")
+SET(CPACK_RPM_test_PACKAGE_PROVIDES "MariaDB-test MySQL-test mysql-test")
+
+# 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_misc.pl)")
+
+ENDIF(RPM)
+
diff --git a/cmake/install_layout.cmake b/cmake/install_layout.cmake
index 76e78e8b72f..1210c50d6cf 100644
--- a/cmake/install_layout.cmake
+++ b/cmake/install_layout.cmake
@@ -41,6 +41,7 @@
# - INSTALL_BINDIR (directory with client executables and scripts)
# - INSTALL_SBINDIR (directory with mysqld)
# - INSTALL_SCRIPTDIR (several scripts, rarely used)
+# - INSTALL_SYSCONFDIR (config files. Usually /etc or nothing)
#
# - INSTALL_LIBDIR (directory with client end embedded libraries)
# - INSTALL_PLUGINDIR (directory for plugins)
@@ -60,14 +61,16 @@
#
# - 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")
+ SET(INSTALL_LAYOUT "STANDALONE")
ENDIF()
-SET(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}"
+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)
@@ -92,10 +95,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()
#
@@ -131,12 +130,14 @@ 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
#
SET(INSTALL_BINDIR_RPM "bin")
SET(INSTALL_SBINDIR_RPM "sbin")
SET(INSTALL_SCRIPTDIR_RPM "bin")
+SET(INSTALL_SYSCONFDIR_RPM "/etc")
#
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
SET(INSTALL_LIBDIR_RPM "lib64")
@@ -148,8 +149,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/${CPACK_SOURCE_PACKAGE_FILE_NAME}")
+SET(INSTALL_DOCREADMEDIR_RPM "share/doc/${CPACK_SOURCE_PACKAGE_FILE_NAME}")
SET(INSTALL_INFODIR_RPM "share/info")
SET(INSTALL_MANDIR_RPM "share/man")
#
@@ -162,6 +163,8 @@ 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
#
@@ -188,6 +191,7 @@ SET(INSTALL_SUPPORTFILESDIR_DEB "support-files")
SET(INSTALL_MYSQLDATADIR_DEB "/var/lib/mysql")
SET(INSTALL_PLUGINTESTDIR_DEB ${plugin_tests})
+SET(INSTALL_UNIX_ADDRDIR_DEB "/tmp/mysql.sock")
#
# SVR4 layout
#
@@ -214,6 +218,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)
@@ -226,9 +231,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
+ 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/mysql_version.cmake b/cmake/mysql_version.cmake
index 76cd7995ed1..e6b9d3e7edf 100644
--- a/cmake/mysql_version.cmake
+++ b/cmake/mysql_version.cmake
@@ -80,15 +80,10 @@ 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)
@@ -104,7 +99,6 @@ ENDIF()
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 "MariaDB Server")