| 1 |
# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. |
| 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-1335 USA |
| 15 |
|
| 16 |
# The purpose of this file is to set the default installation layout. |
| 17 |
# |
| 18 |
# The current choices of installation layout are: |
| 19 |
# |
| 20 |
# STANDALONE |
| 21 |
# Build with prefix=/usr/local/mysql, create tarball with install prefix="." |
| 22 |
# and relative links. Windows zip uses the same tarball layout but without |
| 23 |
# the build prefix. |
| 24 |
# |
| 25 |
# RPM |
| 26 |
# Build as per default RPM layout, with prefix=/usr |
| 27 |
# |
| 28 |
# DEB |
| 29 |
# Build as per STANDALONE, prefix=/opt/mysql/server-$major.$minor |
| 30 |
# |
| 31 |
# SVR4 |
| 32 |
# Solaris package layout suitable for pkg* tools, prefix=/opt/mysql/mysql |
| 33 |
# |
| 34 |
# To force a directory layout, use -DINSTALL_LAYOUT=<layout>. |
| 35 |
# |
| 36 |
# The default is STANDALONE. |
| 37 |
# |
| 38 |
# There is the possibility to further fine-tune installation directories. |
| 39 |
# Several variables can be overwritten: |
| 40 |
# |
| 41 |
# - INSTALL_BINDIR (directory with client executables and scripts) |
| 42 |
# - INSTALL_SBINDIR (directory with mysqld) |
| 43 |
# - INSTALL_SCRIPTDIR (several scripts, rarely used) |
| 44 |
# - INSTALL_SYSCONFDIR (my.cnf config file. Usually /etc or nothing) |
| 45 |
# - INSTALL_SYSCONF2DIR (additional config files, e.g. /etc/mysql/conf.d) |
| 46 |
# |
| 47 |
# - INSTALL_LIBDIR (directory with client end embedded libraries) |
| 48 |
# - INSTALL_PLUGINDIR (directory for plugins) |
| 49 |
# |
| 50 |
# - INSTALL_INCLUDEDIR (directory for MySQL headers) |
| 51 |
# |
| 52 |
# - INSTALL_DOCDIR (documentation) |
| 53 |
# - INSTALL_DOCREADMEDIR (readme and similar) |
| 54 |
# - INSTALL_MANDIR (man pages) |
| 55 |
# - INSTALL_INFODIR (info pages) |
| 56 |
# |
| 57 |
# - INSTALL_SHAREDIR (location of aclocal/mysql.m4) |
| 58 |
# - INSTALL_MYSQLSHAREDIR (MySQL character sets and localized error messages) |
| 59 |
# - INSTALL_MYSQLTESTDIR (mysql-test) |
| 60 |
# - INSTALL_SQLBENCHDIR (sql-bench) |
| 61 |
# - INSTALL_SUPPORTFILESDIR (various extra support files) |
| 62 |
# |
| 63 |
# - INSTALL_MYSQLDATADIR (data directory) |
| 64 |
# |
| 65 |
# - INSTALL_UNIX_ADDRDIR (path to mysql.sock) |
| 66 |
# |
| 67 |
|
| 68 |
IF(NOT INSTALL_LAYOUT) |
| 69 |
IF(DEB) |
| 70 |
SET(INSTALL_LAYOUT "DEB") |
| 71 |
ELSEIF(RPM) |
| 72 |
SET(INSTALL_LAYOUT "RPM") |
| 73 |
ELSE() |
| 74 |
SET(INSTALL_LAYOUT "STANDALONE") |
| 75 |
ENDIF() |
| 76 |
ENDIF() |
| 77 |
|
| 78 |
SET(INSTALL_LAYOUT "${INSTALL_LAYOUT}" |
| 79 |
CACHE STRING "Installation directory layout. Options are: STANDALONE (as in zip or tar.gz installer) RPM DEB SVR4") |
| 80 |
|
| 81 |
IF(UNIX) |
| 82 |
IF(INSTALL_LAYOUT MATCHES "RPM") |
| 83 |
SET(default_prefix "/usr") |
| 84 |
ELSEIF(INSTALL_LAYOUT MATCHES "DEB") |
| 85 |
SET(default_prefix "/usr") |
| 86 |
ELSEIF(INSTALL_LAYOUT MATCHES "SVR4") |
| 87 |
SET(default_prefix "/opt/mysql/mysql") |
| 88 |
ELSE() |
| 89 |
SET(default_prefix "/usr/local/mysql") |
| 90 |
ENDIF() |
| 91 |
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) |
| 92 |
SET(CMAKE_INSTALL_PREFIX ${default_prefix} |
| 93 |
CACHE PATH "install prefix" FORCE) |
| 94 |
ENDIF() |
| 95 |
SET(VALID_INSTALL_LAYOUTS "RPM" "STANDALONE" "DEB" "SVR4") |
| 96 |
LIST(FIND VALID_INSTALL_LAYOUTS "${INSTALL_LAYOUT}" ind) |
| 97 |
IF(ind EQUAL -1) |
| 98 |
MESSAGE(FATAL_ERROR "Invalid INSTALL_LAYOUT parameter:${INSTALL_LAYOUT}." |
| 99 |
" Choose between ${VALID_INSTALL_LAYOUTS}" ) |
| 100 |
ENDIF() |
| 101 |
ENDIF() |
| 102 |
|
| 103 |
# |
| 104 |
# STANDALONE layout |
| 105 |
# |
| 106 |
SET(INSTALL_BINDIR_STANDALONE "bin") |
| 107 |
SET(INSTALL_SBINDIR_STANDALONE "bin") |
| 108 |
SET(INSTALL_SCRIPTDIR_STANDALONE "scripts") |
| 109 |
# |
| 110 |
SET(INSTALL_LIBDIR_STANDALONE "lib") |
| 111 |
SET(INSTALL_PLUGINDIR_STANDALONE "lib/plugin") |
| 112 |
# |
| 113 |
SET(INSTALL_INCLUDEDIR_STANDALONE "include/mysql") |
| 114 |
# |
| 115 |
SET(INSTALL_DOCDIR_STANDALONE "docs") |
| 116 |
SET(INSTALL_DOCREADMEDIR_STANDALONE ".") |
| 117 |
SET(INSTALL_MANDIR_STANDALONE "man") |
| 118 |
SET(INSTALL_INFODIR_STANDALONE "docs") |
| 119 |
# |
| 120 |
SET(INSTALL_SHAREDIR_STANDALONE "share") |
| 121 |
SET(INSTALL_MYSQLSHAREDIR_STANDALONE "share") |
| 122 |
SET(INSTALL_MYSQLTESTDIR_STANDALONE "mariadb-test") |
| 123 |
SET(INSTALL_SQLBENCHDIR_STANDALONE ".") |
| 124 |
SET(INSTALL_SUPPORTFILESDIR_STANDALONE "support-files") |
| 125 |
# |
| 126 |
SET(INSTALL_MYSQLDATADIR_STANDALONE "data") |
| 127 |
|
| 128 |
SET(INSTALL_UNIX_ADDRDIR_STANDALONE "/tmp/mysql.sock") |
| 129 |
SET(INSTALL_PAMDIR_STANDALONE "share") |
| 130 |
SET(INSTALL_PAMDATADIR_STANDALONE "share") |
| 131 |
# |
| 132 |
# RPM layout |
| 133 |
# |
| 134 |
SET(INSTALL_BINDIR_RPM "bin") |
| 135 |
SET(INSTALL_SBINDIR_RPM "sbin") |
| 136 |
SET(INSTALL_SCRIPTDIR_RPM "bin") |
| 137 |
SET(INSTALL_SYSCONFDIR_RPM "/etc") |
| 138 |
SET(INSTALL_SYSCONF2DIR_RPM "/etc/my.cnf.d") |
| 139 |
# |
| 140 |
IF(CMAKE_SIZEOF_VOID_P EQUAL 8) |
| 141 |
SET(INSTALL_LIBDIR_RPM "lib64") |
| 142 |
ELSE() |
| 143 |
SET(INSTALL_LIBDIR_RPM "lib") |
| 144 |
ENDIF() |
| 145 |
SET(INSTALL_PLUGINDIR_RPM "${INSTALL_LIBDIR_RPM}/mysql/plugin") |
| 146 |
# |
| 147 |
SET(INSTALL_INCLUDEDIR_RPM "include/mysql") |
| 148 |
# |
| 149 |
SET(INSTALL_DOCDIR_RPM "share/doc") |
| 150 |
SET(INSTALL_DOCREADMEDIR_RPM "share/doc") |
| 151 |
SET(INSTALL_INFODIR_RPM "share/info") |
| 152 |
SET(INSTALL_MANDIR_RPM "share/man") |
| 153 |
# |
| 154 |
SET(INSTALL_SHAREDIR_RPM "share") |
| 155 |
SET(INSTALL_MYSQLSHAREDIR_RPM "share/mariadb") |
| 156 |
SET(INSTALL_MYSQLTESTDIR_RPM "share/mariadb-test") |
| 157 |
SET(INSTALL_SQLBENCHDIR_RPM "") |
| 158 |
SET(INSTALL_SUPPORTFILESDIR_RPM "share/mariadb") |
| 159 |
# |
| 160 |
SET(INSTALL_MYSQLDATADIR_RPM "/var/lib/mysql") |
| 161 |
|
| 162 |
SET(INSTALL_UNIX_ADDRDIR_RPM "${INSTALL_MYSQLDATADIR_RPM}/mysql.sock") |
| 163 |
SET(INSTALL_SYSTEMD_UNITDIR_RPM "/usr/lib/systemd/system") |
| 164 |
SET(INSTALL_SYSTEMD_SYSUSERSDIR_RPM "/usr/lib/sysusers.d") |
| 165 |
SET(INSTALL_SYSTEMD_TMPFILESDIR_RPM "/usr/lib/tmpfiles.d") |
| 166 |
SET(INSTALL_RUNDATADIR_RPM "/run/mariadb") |
| 167 |
SET(INSTALL_PAMDIR_RPM "/${INSTALL_LIBDIR_RPM}/security") |
| 168 |
SET(INSTALL_PAMDATADIR_RPM "/etc/security") |
| 169 |
|
| 170 |
# |
| 171 |
# DEB layout |
| 172 |
# |
| 173 |
SET(INSTALL_BINDIR_DEB "bin") |
| 174 |
SET(INSTALL_SBINDIR_DEB "sbin") |
| 175 |
SET(INSTALL_SCRIPTDIR_DEB "bin") |
| 176 |
SET(INSTALL_SYSCONFDIR_DEB "/etc") |
| 177 |
SET(INSTALL_SYSCONF2DIR_DEB "/etc/mysql/mariadb.conf.d") |
| 178 |
# |
| 179 |
SET(INSTALL_LIBDIR_DEB "lib/${CMAKE_CXX_LIBRARY_ARCHITECTURE}") |
| 180 |
SET(INSTALL_PLUGINDIR_DEB "lib/mysql/plugin") |
| 181 |
# |
| 182 |
SET(INSTALL_INCLUDEDIR_DEB "include/mariadb") |
| 183 |
# |
| 184 |
SET(INSTALL_DOCDIR_DEB "share/doc") |
| 185 |
SET(INSTALL_DOCREADMEDIR_DEB "share/doc") |
| 186 |
SET(INSTALL_MANDIR_DEB "share/man") |
| 187 |
SET(INSTALL_INFODIR_DEB "share/info") |
| 188 |
# |
| 189 |
SET(INSTALL_SHAREDIR_DEB "share") |
| 190 |
SET(INSTALL_MYSQLSHAREDIR_DEB "share/mariadb") |
| 191 |
SET(INSTALL_MYSQLTESTDIR_DEB "share/mariadb/mariadb-test") |
| 192 |
SET(INSTALL_SQLBENCHDIR_DEB ".") |
| 193 |
SET(INSTALL_SUPPORTFILESDIR_DEB "share/mariadb") |
| 194 |
# |
| 195 |
SET(INSTALL_MYSQLDATADIR_DEB "/var/lib/mysql") |
| 196 |
|
| 197 |
SET(INSTALL_RUNDATADIR_DEB "/run/mysqld") |
| 198 |
SET(INSTALL_UNIX_ADDRDIR_DEB "${INSTALL_RUNDATADIR_DEB}/mysqld.sock") |
| 199 |
SET(INSTALL_SYSTEMD_UNITDIR_DEB "/lib/systemd/system") |
| 200 |
SET(INSTALL_SYSTEMD_SYSUSERSDIR_DEB "/usr/lib/sysusers.d") |
| 201 |
SET(INSTALL_SYSTEMD_TMPFILESDIR_DEB "/usr/lib/tmpfiles.d") |
| 202 |
SET(INSTALL_PAMDIR_DEB "/lib/${CMAKE_CXX_LIBRARY_ARCHITECTURE}/security") |
| 203 |
SET(INSTALL_PAMDATADIR_DEB "/etc/security") |
| 204 |
|
| 205 |
# |
| 206 |
# SVR4 layout |
| 207 |
# |
| 208 |
SET(INSTALL_BINDIR_SVR4 "bin") |
| 209 |
SET(INSTALL_SBINDIR_SVR4 "bin") |
| 210 |
SET(INSTALL_SCRIPTDIR_SVR4 "scripts") |
| 211 |
# |
| 212 |
SET(INSTALL_LIBDIR_SVR4 "lib") |
| 213 |
SET(INSTALL_PLUGINDIR_SVR4 "lib/plugin") |
| 214 |
# |
| 215 |
SET(INSTALL_INCLUDEDIR_SVR4 "include/mysql") |
| 216 |
# |
| 217 |
SET(INSTALL_DOCDIR_SVR4 "docs") |
| 218 |
SET(INSTALL_DOCREADMEDIR_SVR4 ".") |
| 219 |
SET(INSTALL_MANDIR_SVR4 "man") |
| 220 |
SET(INSTALL_INFODIR_SVR4 "docs") |
| 221 |
# |
| 222 |
SET(INSTALL_SHAREDIR_SVR4 "share") |
| 223 |
SET(INSTALL_MYSQLSHAREDIR_SVR4 "share") |
| 224 |
SET(INSTALL_MYSQLTESTDIR_SVR4 "mariadb-test") |
| 225 |
SET(INSTALL_SQLBENCHDIR_SVR4 ".") |
| 226 |
SET(INSTALL_SUPPORTFILESDIR_SVR4 "support-files") |
| 227 |
# |
| 228 |
SET(INSTALL_MYSQLDATADIR_SVR4 "/var/lib/mysql") |
| 229 |
|
| 230 |
SET(INSTALL_UNIX_ADDRDIR_SVR "/tmp/mysql.sock") |
| 231 |
|
| 232 |
# Clear cached variables if install layout was changed |
| 233 |
IF(OLD_INSTALL_LAYOUT) |
| 234 |
IF(NOT OLD_INSTALL_LAYOUT STREQUAL INSTALL_LAYOUT) |
| 235 |
SET(FORCE FORCE) |
| 236 |
ENDIF() |
| 237 |
ENDIF() |
| 238 |
SET(OLD_INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE INTERNAL "") |
| 239 |
|
| 240 |
# Set INSTALL_FOODIR variables for chosen layout (for example, INSTALL_BINDIR |
| 241 |
# will be defined as ${INSTALL_BINDIR_STANDALONE} by default if STANDALONE |
| 242 |
# layout is chosen) |
| 243 |
GET_CMAKE_PROPERTY(ALL_VARS VARIABLES) |
| 244 |
FOREACH (V ${ALL_VARS}) |
| 245 |
IF (V MATCHES "^(INSTALL_([A-Z_0-9]+)DIR)_${INSTALL_LAYOUT}$") |
| 246 |
SET(var ${CMAKE_MATCH_1}) |
| 247 |
SET(${var} "${${V}}" CACHE STRING "${CMAKE_MATCH_2} installation directory" ${FORCE}) |
| 248 |
MARK_AS_ADVANCED(${var}) |
| 249 |
|
| 250 |
IF(IS_ABSOLUTE "${${var}}") |
| 251 |
SET(${var}ABS "${${var}}") |
| 252 |
ELSE() |
| 253 |
SET(${var}ABS "${CMAKE_INSTALL_PREFIX}/${${var}}") |
| 254 |
ENDIF() |
| 255 |
ENDIF() |
| 256 |
ENDFOREACH() |
| 257 |
|
| 258 |
IF(NOT MYSQL_UNIX_ADDR) |
| 259 |
SET(MYSQL_UNIX_ADDR ${INSTALL_UNIX_ADDRDIR}) |
| 260 |
ENDIF() |
| 261 |
|
| 262 |
IF(NOT INSTALL_RUNDATADIR) |
| 263 |
get_filename_component(MYSQL_UNIX_DIR ${MYSQL_UNIX_ADDR} DIRECTORY) |
| 264 |
SET(INSTALL_RUNDATADIR "${MYSQL_UNIX_DIR}" CACHE FILEPATH "Rundata installation directory" ${FORCE}) |
| 265 |
ENDIF() |