|
| 1 | +# Copyright (C) 2010 Sun Microsystems, Inc |
| 2 | +# |
| 3 | +# This program is free software; you can redistribute it and/or modify |
| 4 | +# it under the terms of the GNU General Public License as published by |
| 5 | +# the Free Software Foundation; version 2 of the License. |
| 6 | +# |
| 7 | +# This program is distributed in the hope that it will be useful, |
| 8 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | +# GNU General Public License for more details. |
| 11 | +# |
| 12 | +# You should have received a copy of the GNU General Public License |
| 13 | +# along with this program; if not, write to the Free Software |
| 14 | +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 15 | + |
| 16 | +# The purpose of this file is to set the default installation layout. |
| 17 | +# Currently, there are 2 different installation layouts , |
| 18 | +# one is used in tar.gz packages (Windows zip is about the same), another one |
| 19 | +# in RPMs. |
| 20 | + |
| 21 | +# There are currently 2 layouts defines, named STANDALONE (tar.gz layout) |
| 22 | +# and UNIX (rpm layout). To force a directory layout when invoking cmake use |
| 23 | +# -DINSTALL_LAYOUT=[STANDALONE|UNIX]. |
| 24 | +# This wil use a predefined layout. There is a possibility to further fine-tune |
| 25 | +# installation directories. Several variables are can be overwritten |
| 26 | +# |
| 27 | +# - INSTALL_BINDIR (directory with client executables and Unix shell scripts) |
| 28 | +# - INSTALL_SBINDIR (directory with mysqld) |
| 29 | +# - INSTALL_LIBDIR (directory with client end embedded libraries) |
| 30 | +# - INSTALL_PLUGINDIR (directory for plugins) |
| 31 | +# - INSTALL_INCLUDEDIR (directory for MySQL headers) |
| 32 | +# - INSTALL_DOCDIR (documentation) |
| 33 | +# - INSTALL_MANDIR (man pages) |
| 34 | +# - INSTALL_SCRIPTDIR (several scripts, rarely used) |
| 35 | +# - INSTALL_MYSQLSHAREDIR (MySQL character sets and localized error messages) |
| 36 | +# - INSTALL_SHAREDIR (location of aclocal/mysql.m4) |
| 37 | +# - INSTALL_SQLBENCHDIR (sql-bench) |
| 38 | +# - INSTALL_MYSQLTESTDIR (mysql-test) |
| 39 | +# - INSTALL_DOCREADMEDIR (readme and similar) |
| 40 | +# - INSTALL_SUPPORTFILESDIR (used only in standalone installer) |
| 41 | + |
| 42 | +# Default installation layout on Unix is UNIX (kent wants it so) |
| 43 | +IF(NOT INSTALL_LAYOUT) |
| 44 | + IF(WIN32) |
| 45 | + SET(DEFAULT_INSTALL_LAYOUT "STANDALONE") |
| 46 | + ELSE() |
| 47 | + SET(DEFAULT_INSTALL_LAYOUT "UNIX") |
| 48 | + ENDIF() |
| 49 | +ENDIF() |
| 50 | + |
| 51 | +SET(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}" |
| 52 | +CACHE STRING "Installation directory layout. Options are: STANDALONE (as in zip or tar.gz installer) or UNIX") |
| 53 | + |
| 54 | +IF(NOT INSTALL_LAYOUT MATCHES "STANDALONE") |
| 55 | + IF(NOT INSTALL_LAYOUT MATCHES "UNIX") |
| 56 | + SET(INSTALL_LAYOUT "${DEFAULT_INSTALL_LAYOUT}") |
| 57 | + ENDIF() |
| 58 | +ENDIF() |
| 59 | + |
| 60 | +IF(UNIX) |
| 61 | + IF(INSTALL_LAYOUT MATCHES "UNIX") |
| 62 | + SET(default_prefix "/usr") |
| 63 | + ELSE() |
| 64 | + SET(default_prefix "/usr/local/mysql") |
| 65 | + ENDIF() |
| 66 | + IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 67 | + SET(CMAKE_INSTALL_PREFIX ${default_prefix} |
| 68 | + CACHE PATH "install prefix" FORCE) |
| 69 | + ENDIF() |
| 70 | + SET(SYSCONFDIR "${CMAKE_INSTALL_PREFIX}/etc" |
| 71 | + CACHE PATH "config directory (for my.cnf)") |
| 72 | + MARK_AS_ADVANCED(SYSCONFDIR) |
| 73 | +ENDIF() |
| 74 | + |
| 75 | + |
| 76 | + |
| 77 | + # STANDALONE layout |
| 78 | + SET(INSTALL_BINDIR_STANDALONE "bin") |
| 79 | + SET(INSTALL_SBINDIR_STANDALONE "bin") |
| 80 | + SET(INSTALL_LIBDIR_STANDALONE "lib") |
| 81 | + SET(INSTALL_INCLUDEDIR_STANDALONE "include") |
| 82 | + SET(INSTALL_PLUGINDIR_STANDALONE "lib/plugin") |
| 83 | + SET(INSTALL_DOCDIR_STANDALONE "doc") |
| 84 | + SET(INSTALL_MANDIR_STANDALONE "man") |
| 85 | + SET(INSTALL_MYSQLSHAREDIR_STANDALONE "share") |
| 86 | + SET(INSTALL_SHAREDIR_STANDALONE "share") |
| 87 | + SET(INSTALL_SCRIPTDIR_STANDALONE "scripts") |
| 88 | + SET(INSTALL_MYSQLTESTDIR_STANDALONE "mysql-test") |
| 89 | + SET(INSTALL_SQLBENCHROOTDIR_STANDALONE ".") |
| 90 | + SET(INSTALL_DOCREADMEDIR_STANDALONE ".") |
| 91 | + SET(INSTALL_SUPPORTFILESDIR_STANDALONE "support-files") |
| 92 | + SET(INSTALL_MYSQLDATADIR_STANDALONE "data") |
| 93 | + |
| 94 | + # UNIX layout |
| 95 | + SET(INSTALL_BINDIR_UNIX "bin") |
| 96 | + SET(INSTALL_SBINDIR_UNIX "sbin") |
| 97 | + SET(INSTALL_LIBDIR_UNIX "lib/mysql") |
| 98 | + SET(INSTALL_PLUGINDIR_UNIX "lib/mysql/plugin") |
| 99 | + SET(INSTALL_DOCDIR_UNIX "share/mysql/doc/MySQL-server-${MYSQL_NO_DASH_VERSION}") |
| 100 | + SET(INSTALL_MANDIR_UNIX "share/mysql/man") |
| 101 | + SET(INSTALL_INCLUDEDIR_UNIX "include/mysql") |
| 102 | + SET(INSTALL_MYSQLSHAREDIR_UNIX "share/mysql") |
| 103 | + SET(INSTALL_SHAREDIR_UNIX "share") |
| 104 | + SET(INSTALL_SCRIPTDIR_UNIX "bin") |
| 105 | + SET(INSTALL_MYSQLTESTDIR_UNIX "mysql-test") |
| 106 | + SET(INSTALL_SQLBENCHROOTDIR_UNIX "") |
| 107 | + SET(INSTALL_DOCREADMEDIR_UNIX "share/mysql/doc/MySQL-server-${MYSQL_NO_DASH_VERSION}") |
| 108 | + SET(INSTALL_SUPPORTFILESDIR_UNIX "") |
| 109 | + SET(INSTALL_MYSQLDATADIR_STANDALONE "var") |
| 110 | + |
| 111 | + |
| 112 | +# Clear cached variables if install layout was changed |
| 113 | +IF(OLD_INSTALL_LAYOUT) |
| 114 | + IF(NOT OLD_INSTALL_LAYOUT STREQUAL INSTALL_LAYOUR) |
| 115 | + SET(FORCE FORCE) |
| 116 | + ENDIF() |
| 117 | +ENDIF() |
| 118 | +SET(OLD_INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE INTERNAL "") |
| 119 | + |
| 120 | +# Set INSTALL_FOODIR variables for chosen layout |
| 121 | +# (for example, INSTALL_BINDIR will be defined as |
| 122 | +# ${INSTALL_BINDIR_STANDALONE} by default if STANDALONE layout is chosen) |
| 123 | +FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN |
| 124 | + MYSQLTEST SQLBENCHROOT DOCREADME SUPPORTFILES MYSQLDATA) |
| 125 | + SET(INSTALL_${var}DIR ${INSTALL_${var}DIR_${INSTALL_LAYOUT}} |
| 126 | + CACHE STRING "${var} installation directory" ${FORCE}) |
| 127 | + MARK_AS_ADVANCED(INSTALL_${var}DIR) |
| 128 | +ENDFOREACH() |
0 commit comments