diff options
author | Sergei Golubchik <sergii@pisem.net> | 2012-05-22 11:04:32 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2012-05-22 11:04:32 +0200 |
commit | ec586f529c871ec39556ded59206bdb813387130 (patch) | |
tree | f6121386b8b032c912bfdc30af858b3f04678f75 | |
parent | 329daad2d32730c1aade8134d1709383fe072309 (diff) | |
download | mariadb-git-ec586f529c871ec39556ded59206bdb813387130.tar.gz |
Building RPMs with CPack
configure with cmake -DRPM=distro
-rw-r--r-- | .bzrignore | 3 | ||||
-rw-r--r-- | CMakeLists.txt | 74 | ||||
-rw-r--r-- | client/CMakeLists.txt | 2 | ||||
-rw-r--r-- | cmake/cpack_rpm.cmake | 88 | ||||
-rw-r--r-- | cmake/install_layout.cmake | 30 | ||||
-rw-r--r-- | cmake/mysql_version.cmake | 6 | ||||
-rw-r--r-- | extra/CMakeLists.txt | 4 | ||||
-rw-r--r-- | include/CMakeLists.txt | 2 | ||||
-rw-r--r-- | libmysqld/CMakeLists.txt | 4 | ||||
-rw-r--r-- | libmysqld/examples/CMakeLists.txt | 2 | ||||
-rw-r--r-- | man/CMakeLists.txt | 48 | ||||
-rw-r--r-- | plugin/auth_dialog/CMakeLists.txt | 2 | ||||
-rw-r--r-- | scripts/CMakeLists.txt | 4 | ||||
-rw-r--r-- | sql/CMakeLists.txt | 6 | ||||
-rw-r--r-- | storage/maria/CMakeLists.txt | 10 | ||||
-rw-r--r-- | storage/myisam/CMakeLists.txt | 8 | ||||
-rw-r--r-- | support-files/CMakeLists.txt | 20 | ||||
-rw-r--r-- | support-files/rpm-ldconfig.sh | 1 | ||||
-rw-r--r-- | support-files/rpm-postin.sh | 77 | ||||
-rw-r--r-- | support-files/rpm-prein.sh | 73 | ||||
-rw-r--r-- | support-files/rpm-preun.sh | 14 |
21 files changed, 369 insertions, 109 deletions
diff --git a/.bzrignore b/.bzrignore index f2b28d74d64..409b6148125 100644 --- a/.bzrignore +++ b/.bzrignore @@ -1141,3 +1141,6 @@ sql/share/errmsg.sys sql/share/mysql install_manifest.txt sql/db.opt +./_CPack_Packages +./install_manifest_*.txt +typescript diff --git a/CMakeLists.txt b/CMakeLists.txt index 79de29ee61b..8b0c4898785 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,8 +39,6 @@ ENDIF() SET(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel") - - IF(UNIX AND NOT APPLE) # Note, that generally one should not change settings depending # on CMAKE_BUILD_TYPE, because VS and Xcode configure once (with @@ -124,18 +122,30 @@ IF(CMAKE_CXX_COMPILER_ID MATCHES "Intel") SET_MYSQL_MAINTAINER_INTEL_CXX_OPTIONS() ENDIF() +# Packaging +IF (NOT CPACK_GENERATOR) + IF(WIN32) + SET(CPACK_GENERATOR "ZIP") + ELSE() + SET(CPACK_GENERATOR "TGZ") + ENDIF(WIN32) +ENDIF(NOT CPACK_GENERATOR) + +INCLUDE(mysql_version) +INCLUDE(cpack_rpm) +INCLUDE(cpack_source_ignore_files) +INCLUDE(install_layout) + # Add macros INCLUDE(character_sets) INCLUDE(zlib) INCLUDE(ssl) INCLUDE(readline) -INCLUDE(mysql_version) INCLUDE(libutils) INCLUDE(dtrace) INCLUDE(ctest) INCLUDE(plugin) INCLUDE(install_macros) -INCLUDE(install_layout) INCLUDE(mysql_add_executable) # Handle options @@ -231,8 +241,8 @@ ELSE() ENDIF() SET(DEFAULT_CHARSET_HOME "${DEFAULT_MYSQL_HOME}") SET(PLUGINDIR "${DEFAULT_MYSQL_HOME}/${INSTALL_PLUGINDIR}") -IF(SYSCONFDIR) - SET(DEFAULT_SYSCONFDIR "${SYSCONFDIR}") +IF(INSTALL_SYSCONFDIR) + SET(DEFAULT_SYSCONFDIR "${INSTALL_SYSCONFDIR}") ENDIF() @@ -341,51 +351,19 @@ ADD_CUSTOM_TARGET(INFO_BIN ALL WORKING_DIRECTORY ${CMAKE_BINARY_DIR} ) -# Packaging -IF(WIN32) - SET(CPACK_GENERATOR "ZIP") -ELSE() - SET(CPACK_GENERATOR "TGZ") -ENDIF() - - -# Create a single package with "make package" -# (see http://public.kitware.com/Bug/view.php?id=11452) -SET(CPACK_MONOLITHIC_INSTALL 1 CACHE INTERNAL "") - -INCLUDE(CPack) +INSTALL(FILES COPYING COPYING.LESSER LICENSE.mysql +DESTINATION ${INSTALL_DOCREADMEDIR} +COMPONENT Readme +OPTIONAL +) +INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) +INSTALL(FILES ${CMAKE_BINARY_DIR}/Docs/INFO_SRC ${CMAKE_BINARY_DIR}/Docs/INFO_BIN DESTINATION ${INSTALL_DOCDIR}) IF(UNIX) - INSTALL(FILES Docs/mysql.info DESTINATION ${INSTALL_INFODIR} OPTIONAL COMPONENT Info) -ENDIF() -# -# RPM installs documentation directly from the source tree -# -IF(NOT INSTALL_LAYOUT MATCHES "RPM") - INSTALL(FILES COPYING COPYING.LESSER LICENSE.mysql - DESTINATION ${INSTALL_DOCREADMEDIR} - COMPONENT Readme - OPTIONAL - ) - INSTALL(FILES README DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) - INSTALL(FILES ${CMAKE_BINARY_DIR}/Docs/INFO_SRC ${CMAKE_BINARY_DIR}/Docs/INFO_BIN DESTINATION ${INSTALL_DOCDIR}) - IF(UNIX) - INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) - ENDIF() - # MYSQL_DOCS_LOCATON is used in "make dist", points to the documentation directory - SET(MYSQL_DOCS_LOCATION "" CACHE PATH "Location from where documentation is copied") - MARK_AS_ADVANCED(MYSQL_DOCS_LOCATION) - INSTALL(DIRECTORY Docs/ DESTINATION ${INSTALL_DOCDIR} - COMPONENT Documentation - PATTERN "INSTALL-BINARY" EXCLUDE - PATTERN "Makefile.*" EXCLUDE - PATTERN "glibc*" EXCLUDE - PATTERN "linuxthreads.txt" EXCLUDE - PATTERN "myisam.txt" EXCLUDE - PATTERN "mysql.info" EXCLUDE - PATTERN "sp-imp-spec.txt" EXCLUDE - ) + INSTALL(FILES Docs/INSTALL-BINARY DESTINATION ${INSTALL_DOCREADMEDIR} COMPONENT Readme) ENDIF() +INCLUDE(CPack) + IF(NON_DISTRIBUTABLE_WARNING) MESSAGE(WARNING " You have linked MariaDB with GPLv3 libraries! You may not distribute the resulting binary. If you do, you will put yourself into a legal problem with Free Software Foundation.") diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 3f53158572f..e4507f9c8ba 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -49,7 +49,7 @@ TARGET_LINK_LIBRARIES(mysqldump mysqlclient) MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c) TARGET_LINK_LIBRARIES(mysqlimport mysqlclient) -MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c) +MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c COMPONENT Server) TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient) ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs) 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") diff --git a/extra/CMakeLists.txt b/extra/CMakeLists.txt index d7e6cf61983..f8f71b00743 100644 --- a/extra/CMakeLists.txt +++ b/extra/CMakeLists.txt @@ -72,7 +72,7 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "SunOS") ENDIF() ENDIF() -MYSQL_ADD_EXECUTABLE(replace replace.c COMPONENT Junk) +MYSQL_ADD_EXECUTABLE(replace replace.c COMPONENT Server) TARGET_LINK_LIBRARIES(replace mysys) IF(UNIX) MYSQL_ADD_EXECUTABLE(innochecksum innochecksum.c) @@ -80,6 +80,6 @@ IF(UNIX) MYSQL_ADD_EXECUTABLE(resolve_stack_dump resolve_stack_dump.c) TARGET_LINK_LIBRARIES(resolve_stack_dump mysys) - MYSQL_ADD_EXECUTABLE(mysql_waitpid mysql_waitpid.c) + MYSQL_ADD_EXECUTABLE(mysql_waitpid mysql_waitpid.c COMPONENT Client) TARGET_LINK_LIBRARIES(mysql_waitpid mysys) ENDIF() diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 6404074c8c9..a90238dbd42 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -25,6 +25,7 @@ SET(HEADERS mysql.h mysql_com.h mysql_time.h + ma_dyncol.h my_list.h my_alloc.h typelib.h @@ -33,6 +34,7 @@ SET(HEADERS my_sys.h my_xml.h mysql_embed.h + my_decimal_limits.h my_pthread.h decimal.h errmsg.h diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index f08159da20a..c40beb5f9a1 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -134,7 +134,7 @@ FOREACH(LIB ${LIBS}) ENDFOREACH() MERGE_LIBRARIES(mysqlserver STATIC ${EMBEDDED_LIBS} - OUTPUT_NAME ${MYSQLSERVER_OUTPUT_NAME} COMPONENT Embedded) + OUTPUT_NAME ${MYSQLSERVER_OUTPUT_NAME} COMPONENT Development) # Visual Studio users need debug static library IF(MSVC) @@ -148,7 +148,7 @@ ENDIF() IF(NOT DISABLE_SHARED) MERGE_LIBRARIES(libmysqld SHARED mysqlserver EXPORTS ${CLIENT_API_FUNCTIONS} - COMPONENT Embedded) + COMPONENT Server) IF(UNIX) # Name the shared library, handle versioning (provides same api as client # library hence the same version) diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt index e607f3c685a..146e51d79c7 100644 --- a/libmysqld/examples/CMakeLists.txt +++ b/libmysqld/examples/CMakeLists.txt @@ -26,7 +26,7 @@ ADD_DEFINITIONS(-DEMBEDDED_LIBRARY -UMYSQL_CLIENT) MYSQL_ADD_EXECUTABLE(mysql_embedded ../../client/completion_hash.cc ../../client/mysql.cc ../../client/readline.cc - COMPONENT Test) + COMPONENT Client) TARGET_LINK_LIBRARIES(mysql_embedded mysqlserver) IF(UNIX) TARGET_LINK_LIBRARIES(mysql_embedded ${MY_READLINE_LIBRARY}) diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt index 4987a5bee61..d7ef1fae0bf 100644 --- a/man/CMakeLists.txt +++ b/man/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2012, Monty Program Ab # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -13,26 +13,26 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -# Copy man pages -FILE(GLOB MAN1_FILES *.1) -FILE(GLOB MAN1_EXCLUDE make_win_bin_dist.1) -FILE(GLOB MAN1_NDB ndb*.1) -FILE(GLOB MAN8_FILES *.8) -FILE(GLOB MAN8_NDB ndb*.8) -IF(MAN1_FILES) - IF(MAN1_EXCLUDE) - LIST(REMOVE_ITEM MAN1_FILES ${MAN1_EXCLUDE}) - ENDIF() - IF(MAN1_NDB) - LIST(REMOVE_ITEM MAN1_FILES ${MAN1_NDB}) - ENDIF() - INSTALL(FILES ${MAN1_FILES} DESTINATION ${INSTALL_MANDIR}/man1 - COMPONENT ManPages) -ENDIF() -IF(MAN8_FILES) - IF(MAN8_NDB) - LIST(REMOVE_ITEM MAN8_FILES ${MAN8_NDB}) - ENDIF() - INSTALL(FILES ${MAN8_FILES} DESTINATION ${INSTALL_MANDIR}/man8 - COMPONENT ManPages) -ENDIF() +SET(MAN1_SERVER innochecksum.1 my_print_defaults.1 myisam_ftdump.1 myisamchk.1 + myisamlog.1 myisampack.1 mysql.server.1 + mysql_convert_table_format.1 mysql_fix_extensions.1 + mysql_fix_privilege_tables.1 mysql_install_db.1 + mysql_secure_installation.1 mysql_setpermission.1 + mysql_tzinfo_to_sql.1 mysql_upgrade.1 mysql_zap.1 + mysqld_multi.1 mysqld_safe.1 mysqldumpslow.1 mysqlhotcopy.1 + mysqlman.1 mysqltest.1 perror.1 replace.1 resolve_stack_dump.1 + resolveip.1) +SET(MAN8_SERVER mysqld.8 mysqlmanager.8) +SET(MAN1_CLIENT msql2mysql.1 mysql.1 mysql_find_rows.1 mysql_waitpid.1 + mysqlaccess.1 mysqladmin.1 mysqlbinlog.1 mysqlcheck.1 + mysqldump.1 mysqlimport.1 mysqlshow.1 mysqlslap.1) +SET(MAN1_DEVEL mysql_config.1) +SET(MAN1_TEST mysql-stress-test.pl.1 mysql-test-run.pl.1 mysql_client_test.1 + mysqltest_embedded.1 mysql_client_test_embedded.1) + +INSTALL(FILES ${MAN1_SERVER} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT ManPagesServer) +INSTALL(FILES ${MAN8_SERVER} DESTINATION ${INSTALL_MANDIR}/man8 COMPONENT ManPagesServer) +INSTALL(FILES ${MAN1_CLIENT} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT ManPagesClient) +INSTALL(FILES ${MAN1_DEVEL} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT ManPagesDevelopment) +INSTALL(FILES ${MAN1_TEST} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT ManPagesTest) + diff --git a/plugin/auth_dialog/CMakeLists.txt b/plugin/auth_dialog/CMakeLists.txt index a6f6ee9b173..9b4dcfd99bf 100644 --- a/plugin/auth_dialog/CMakeLists.txt +++ b/plugin/auth_dialog/CMakeLists.txt @@ -15,4 +15,4 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA MYSQL_ADD_PLUGIN(dialog dialog.c ${CMAKE_SOURCE_DIR}/libmysql/get_password.c - MODULE_ONLY) + MODULE_ONLY COMPONENT SharedLibraries) diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index a454313d966..a0a2e446609 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -280,6 +280,9 @@ SET(LIBDL) SET(NON_THREADED_LIBS ${CLIENT_LIBS}) SET(mysql_config_COMPONENT COMPONENT Development) +SET(msql2mysql_COMPONENT COMPONENT Client) +SET(mysqlaccess_COMPONENT COMPONENT Client) +SET(mysql_find_rows_COMPONENT COMPONENT Client) IF(WIN32) # On Windows, some .sh and some .pl.in files are configured @@ -317,7 +320,6 @@ ELSE() mysql_secure_installation mysql_zap mysqlaccess - mysqlaccess.conf mysql_convert_table_format mysql_find_rows mysqlhotcopy diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index f57addbc117..ecf91fcf043 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -216,7 +216,7 @@ ADD_CUSTOM_COMMAND( DEPENDS gen_lex_hash ) -MYSQL_ADD_EXECUTABLE(mysql_tzinfo_to_sql tztime.cc) +MYSQL_ADD_EXECUTABLE(mysql_tzinfo_to_sql tztime.cc COMPONENT Server) SET_TARGET_PROPERTIES(mysql_tzinfo_to_sql PROPERTIES COMPILE_FLAGS "-DTZINFO2SQL") TARGET_LINK_LIBRARIES(mysql_tzinfo_to_sql mysys) @@ -311,8 +311,8 @@ IF(WIN32 AND MYSQLD_EXECUTABLE) ELSE() # Not windows or cross compiling, just install an empty directory INSTALL(FILES ${DUMMY_FILE} DESTINATION data/mysql COMPONENT DataFiles) -ENDIF() -ENDIF() +ENDIF(WIN32 AND MYSQLD_EXECUTABLE) +ENDIF(INSTALL_LAYOUT STREQUAL "STANDALONE") IF(WIN32) SET(my_bootstrap_sql ${CMAKE_CURRENT_BINARY_DIR}/my_bootstrap.sql) diff --git a/storage/maria/CMakeLists.txt b/storage/maria/CMakeLists.txt index bd6c200be90..2817e11681c 100644 --- a/storage/maria/CMakeLists.txt +++ b/storage/maria/CMakeLists.txt @@ -52,20 +52,20 @@ MYSQL_ADD_PLUGIN(aria ${ARIA_SOURCES} TARGET_LINK_LIBRARIES(aria myisam) -MYSQL_ADD_EXECUTABLE(aria_ftdump maria_ftdump.c) +MYSQL_ADD_EXECUTABLE(aria_ftdump maria_ftdump.c COMPONENT Server) TARGET_LINK_LIBRARIES(aria_ftdump aria) -MYSQL_ADD_EXECUTABLE(aria_chk maria_chk.c) +MYSQL_ADD_EXECUTABLE(aria_chk maria_chk.c COMPONENT Server) TARGET_LINK_LIBRARIES(aria_chk aria) -MYSQL_ADD_EXECUTABLE(aria_read_log maria_read_log.c) +MYSQL_ADD_EXECUTABLE(aria_read_log maria_read_log.c COMPONENT Server) TARGET_LINK_LIBRARIES(aria_read_log aria) -MYSQL_ADD_EXECUTABLE(aria_dump_log maria_dump_log.c unittest/ma_loghandler_examples.c) +MYSQL_ADD_EXECUTABLE(aria_dump_log maria_dump_log.c unittest/ma_loghandler_examples.c COMPONENT Server) TARGET_LINK_LIBRARIES(aria_dump_log aria) SET_TARGET_PROPERTIES(aria_dump_log PROPERTIES COMPILE_FLAGS "-DMARIA_DUMP_LOG") -MYSQL_ADD_EXECUTABLE(aria_pack maria_pack.c) +MYSQL_ADD_EXECUTABLE(aria_pack maria_pack.c COMPONENT Server) TARGET_LINK_LIBRARIES(aria_pack aria) IF(WITH_UNIT_TESTS AND FALSE) diff --git a/storage/myisam/CMakeLists.txt b/storage/myisam/CMakeLists.txt index 5abd8c29e64..97c1bc78d95 100644 --- a/storage/myisam/CMakeLists.txt +++ b/storage/myisam/CMakeLists.txt @@ -34,16 +34,16 @@ MYSQL_ADD_PLUGIN(myisam ${MYISAM_SOURCES} TARGET_LINK_LIBRARIES(myisam mysys) -MYSQL_ADD_EXECUTABLE(myisam_ftdump myisam_ftdump.c) +MYSQL_ADD_EXECUTABLE(myisam_ftdump myisam_ftdump.c COMPONENT Server) TARGET_LINK_LIBRARIES(myisam_ftdump myisam) -MYSQL_ADD_EXECUTABLE(myisamchk myisamchk.c) +MYSQL_ADD_EXECUTABLE(myisamchk myisamchk.c COMPONENT Server) TARGET_LINK_LIBRARIES(myisamchk myisam) -MYSQL_ADD_EXECUTABLE(myisamlog myisamlog.c) +MYSQL_ADD_EXECUTABLE(myisamlog myisamlog.c COMPONENT Server) TARGET_LINK_LIBRARIES(myisamlog myisam) -MYSQL_ADD_EXECUTABLE(myisampack myisampack.c) +MYSQL_ADD_EXECUTABLE(myisampack myisampack.c COMPONENT Server) TARGET_LINK_LIBRARIES(myisampack myisam) IF(WITH_UNIT_TESTS AND FALSE) diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt index 3ad48520dfb..177980414ca 100644 --- a/support-files/CMakeLists.txt +++ b/support-files/CMakeLists.txt @@ -1,4 +1,5 @@ -# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2006, 2010, Oracle and/or its affiliates. +# Copyright (c) 2012, Monty Program Ab # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -65,6 +66,7 @@ IF(UNIX) ENDFOREACH() IF(INSTALL_SUPPORTFILESDIR) INSTALL(FILES magic DESTINATION ${inst_location} COMPONENT SupportFiles) + INSTALL(DIRECTORY RHEL4-SElinux/ DESTINATION ${inst_location}/SELinux/RHEL4 COMPONENT SupportFiles) ENDIF() INSTALL(FILES mysql.m4 DESTINATION ${INSTALL_SHAREDIR}/aclocal COMPONENT Development) @@ -91,4 +93,20 @@ IF(UNIX) DESTINATION ${inst_location} COMPONENT SupportFiles PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + + IF (INSTALL_SYSCONFDIR) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql-log-rotate DESTINATION ${INSTALL_SYSCONFDIR}/logrotate.d + RENAME mysql COMPONENT SupportFiles) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql.server + DESTINATION ${INSTALL_SYSCONFDIR}/init.d + RENAME mysql COMPONENT SupportFiles + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ + GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + # This is for SuSE: + INSTALL(CODE "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink + ${INSTALL_SYSCONFDIR}/init.d/mysql + ${INSTALL_SBINDIR}/rcmysql + WORKING_DIRECTORY \$ENV{DESTDIR}${prefix})" + COMPONENT SupportFiles) + ENDIF(INSTALL_SYSCONFDIR) ENDIF() diff --git a/support-files/rpm-ldconfig.sh b/support-files/rpm-ldconfig.sh new file mode 100644 index 00000000000..8b0c822426a --- /dev/null +++ b/support-files/rpm-ldconfig.sh @@ -0,0 +1 @@ +/sbin/ldconfig diff --git a/support-files/rpm-postin.sh b/support-files/rpm-postin.sh new file mode 100644 index 00000000000..49a8253ceef --- /dev/null +++ b/support-files/rpm-postin.sh @@ -0,0 +1,77 @@ +mysql_datadir=%{mysqldatadir} + +# Create data directory +mkdir -p $mysql_datadir/{mysql,test} + +# Make MySQL start/shutdown automatically when the machine does it. +if [ -x /sbin/chkconfig ] ; then + /sbin/chkconfig --add mysql +fi + +# Create a MySQL user and group. Do not report any problems if it already +# exists. +groupadd -r %{mysqld_group} 2> /dev/null || true +useradd -M -r -d $mysql_datadir -s /bin/bash -c "MySQL server" -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true +# The user may already exist, make sure it has the proper group nevertheless (BUG#12823) +usermod -g %{mysqld_group} %{mysqld_user} 2> /dev/null || true + +# Change permissions so that the user that will run the MySQL daemon +# owns all database files. +chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir + +# Initiate databases +%{_bindir}/mysql_install_db --rpm --user=%{mysqld_user} + +# Upgrade databases if needed would go here - but it cannot be automated yet + +# Change permissions again to fix any new files. +chown -R %{mysqld_user}:%{mysqld_group} $mysql_datadir + +# Fix permissions for the permission database so that only the user +# can read them. +chmod -R og-rw $mysql_datadir/mysql + +# install SELinux files - but don't override existing ones +SETARGETDIR=/etc/selinux/targeted/src/policy +SEDOMPROG=$SETARGETDIR/domains/program +SECONPROG=$SETARGETDIR/file_contexts/program +if [ -f /etc/redhat-release ] \ + && grep -q "Red Hat Enterprise Linux .. release 4" /etc/redhat-release \ + || grep -q "CentOS release 4" /etc/redhat-release ; then + echo + echo + echo 'Notes regarding SELinux on this platform:' + echo '=========================================' + echo + echo 'The default policy might cause server startup to fail because it is ' + echo 'not allowed to access critical files. In this case, please update ' + echo 'your installation. ' + echo + echo 'The default policy might also cause inavailability of SSL related ' + echo 'features because the server is not allowed to access /dev/random ' + echo 'and /dev/urandom. If this is a problem, please do the following: ' + echo + echo ' 1) install selinux-policy-targeted-sources from your OS vendor' + echo ' 2) add the following two lines to '$SEDOMPROG/mysqld.te':' + echo ' allow mysqld_t random_device_t:chr_file read;' + echo ' allow mysqld_t urandom_device_t:chr_file read;' + echo ' 3) cd to '$SETARGETDIR' and issue the following command:' + echo ' make load' + echo + echo +fi + +if [ -x sbin/restorecon ] ; then + sbin/restorecon -R var/lib/mysql +fi + +# Restart in the same way that mysqld will be started normally. +if [ -x %{_sysconfdir}/init.d/mysql ] ; then + %{_sysconfdir}/init.d/mysql start + echo "Giving mysqld 2 seconds to start" + sleep 2 +fi + +# Allow safe_mysqld to start mysqld and print a message before we exit +sleep 2 + diff --git a/support-files/rpm-prein.sh b/support-files/rpm-prein.sh new file mode 100644 index 00000000000..0a8ac0c5f97 --- /dev/null +++ b/support-files/rpm-prein.sh @@ -0,0 +1,73 @@ +# Check if we can safely upgrade. An upgrade is only safe if it's from one +# of our RPMs in the same version family. + +installed=`rpm -q --whatprovides mysql-server 2> /dev/null` +if [ $? -eq 0 -a -n "$installed" ]; then + vendor=`rpm -q --queryformat='%{VENDOR}' "$installed" 2>&1` + version=`rpm -q --queryformat='%{VERSION}' "$installed" 2>&1` + myvendor='%{mysql_vendor}' + myversion='%{mysqlversion}' + + old_family=`echo $version | sed -n -e 's,^\([1-9][0-9]*\.[0-9][0-9]*\)\..*$,\1,p'` + new_family=`echo $myversion | sed -n -e 's,^\([1-9][0-9]*\.[0-9][0-9]*\)\..*$,\1,p'` + + [ -z "$vendor" ] && vendor='<unknown>' + [ -z "$old_family" ] && old_family="<unrecognized version $version>" + [ -z "$new_family" ] && new_family="<bad package specification: version $myversion>" + + error_text= + if [ "$vendor" != "$myvendor" ]; then + error_text="$error_text +The current MariaDB server package is provided by a different +vendor ($vendor) than $myvendor. Some files may be installed +to different locations, including log files and the service +startup script in %{_sysconfdir}/init.d/. +" + fi + + if [ "$old_family" != "$new_family" ]; then + error_text="$error_text +Upgrading directly from MySQL $old_family to MariaDB $new_family may not +be safe in all cases. A manual dump and restore using mysqldump is +recommended. It is important to review the MariaDB manual's Upgrading +section for version-specific incompatibilities. +" + fi + + if [ -n "$error_text" ]; then + cat <<HERE >&2 + +****************************************************************** +A MySQL or MariaDB server package ($installed) is installed. +$error_text +A manual upgrade is required. + +- Ensure that you have a complete, working backup of your data and my.cnf + files +- Shut down the MySQL server cleanly +- Remove the existing MySQL packages. Usually this command will + list the packages you should remove: + rpm -qa | grep -i '^mysql-' + + You may choose to use 'rpm --nodeps -ev <package-name>' to remove + the package which contains the mysqlclient shared library. The + library will be reinstalled by the MariaDB-shared package. +- Install the new MariaDB packages supplied by $myvendor +- Ensure that the MariaDB server is started +- Run the 'mysql_upgrade' program + +This is a brief description of the upgrade process. Important details +can be found in the MariaDB manual, in the Upgrading section. +****************************************************************** +HERE + exit 1 + fi +fi + +# Shut down a previously installed server first +if [ -x %{_sysconfdir}/init.d/mysql ] ; then + %{_sysconfdir}/init.d/mysql stop > /dev/null 2>&1 + echo "Giving mysqld 5 seconds to exit nicely" + sleep 5 +fi + diff --git a/support-files/rpm-preun.sh b/support-files/rpm-preun.sh new file mode 100644 index 00000000000..182be27f1ec --- /dev/null +++ b/support-files/rpm-preun.sh @@ -0,0 +1,14 @@ +if [ $1 = 0 ] ; then + # Stop MySQL before uninstalling it + if [ -x %{_sysconfdir}/init.d/mysql ] ; then + %{_sysconfdir}/init.d/mysql stop > /dev/null + # Don't start it automatically anymore + if [ -x /sbin/chkconfig ] ; then + /sbin/chkconfig --del mysql + fi + fi +fi + +# We do not remove the mysql user since it may still own a lot of +# database files. + |