|
| 1 | +# ************************************************************************************ |
| 2 | +# Copyright (C) 2014 MariaDB Corporation Ab |
| 3 | +# |
| 4 | +# This library is free software#; you can redistribute it and/or |
| 5 | +# modify it under the terms of the GNU Library General Public |
| 6 | +# License as published by the Free Software Foundation; either |
| 7 | +# version 2 of the License, or (at your option) any later version. |
| 8 | +# |
| 9 | +# This library is distributed in the hope that it will be useful, |
| 10 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 | +# Library General Public License for more details. |
| 13 | +# |
| 14 | +# You should have received a copy of the GNU Library General Public |
| 15 | +# License along with this library; if not see <http://www.gnu.org/licenses> |
| 16 | +# or write to the Free Software Foundation, Inc., |
| 17 | +# 51 Franklin St., Fifth Floor, Boston, MA 02110, USA |
| 18 | +# |
| 19 | +# ************************************************************************************* |
| 20 | + |
| 21 | +# |
| 22 | +# This file contains settings for the following layouts: |
| 23 | +# |
| 24 | +# - RPM |
| 25 | +# Built with default prefix=/usr |
| 26 | +# |
| 27 | +# |
| 28 | +# The following va+riables are used and can be overwritten |
| 29 | +# |
| 30 | +# INSTALL_LAYOUT installation layout (DEFAULT = standard for tar.gz and zip packages |
| 31 | +# RPM packages |
| 32 | +# |
| 33 | +# BIN_INSTALL_DIR location of binaries (mariadb_config) |
| 34 | +# LIB_INSTALL_DIR location of libraries |
| 35 | +# PLUGIN_INSTALL_DIR location of plugins |
| 36 | + |
| 37 | +IF(NOT INSTALL_LAYOUT) |
| 38 | + SET(INSTALL_LAYOUT "DEFAULT") |
| 39 | +ENDIF() |
| 40 | + |
| 41 | +SET(INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE |
| 42 | + STRING "Installation layout. Currently supported options are DEFAULT (tar.gz and zip) and RPM") |
| 43 | + |
| 44 | +# On Windows we only provide zip and .msi. Latter one uses a different packager. |
| 45 | +IF(UNIX) |
| 46 | + IF(INSTALL_LAYOUT MATCHES "RPM") |
| 47 | + SET(libmariadb_prefix "/usr") |
| 48 | + ELSE() |
| 49 | + SET(libmariadb_prefix "/usr/local") |
| 50 | + ENDIF() |
| 51 | +ENDIF() |
| 52 | + |
| 53 | +IF(CMAKE_DEFAULT_PREFIX_INITIALIZED_BY_DEFAULT) |
| 54 | + SET(CMAKE_DEFAULT_PREFIX ${libmariadb_prefix} CACHE PATH "Installation prefix" FORCE) |
| 55 | +ENDIF() |
| 56 | + |
| 57 | +# check if the specified installation layout is valid |
| 58 | +SET(VALID_INSTALL_LAYOUTS "DEFAULT" "RPM") |
| 59 | +LIST(FIND VALID_INSTALL_LAYOUTS "${INSTALL_LAYOUT}" layout_no) |
| 60 | +IF(layout_no EQUAL -1) |
| 61 | + MESSAGE(FATAL_ERROR "Invalid installation layout. Please specify one of the following layouts: ${VALID_INSTALL_LAYOUTS}") |
| 62 | +ENDIF() |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | +# |
| 67 | +# Todo: We don't generate man pages yet, will fix it |
| 68 | +# later (webhelp to man transformation) |
| 69 | +# |
| 70 | + |
| 71 | +# |
| 72 | +# DEFAULT layout |
| 73 | +# |
| 74 | +SET(SUFFIX_INSTALL_DIR_DEFAULT "mariadb") |
| 75 | +SET(BIN_INSTALL_DIR_DEFAULT "bin") |
| 76 | +SET(LIB_INSTALL_DIR_DEFAULT "lib") |
| 77 | +SET(INCLUDE_INSTALL_DIR_DEFAULT "include") |
| 78 | +SET(DOCS_INSTALL_DIR_DEFAULT "docs") |
| 79 | +SET(LIB_INSTALL_PLUGIN_DIR_DEFAULT "lib/plugins") |
| 80 | + |
| 81 | +# |
| 82 | +# RPM layout |
| 83 | +# |
| 84 | +SET(SUFFIX_INSTALL_DIR_RPM "mariadb") |
| 85 | +SET(BIN_INSTALL_DIR_RPM "bin") |
| 86 | +IF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") |
| 87 | + SET(LIB_INSTALL_DIR_RPM "lib64") |
| 88 | + SET(LIB_INSTALL_PLUGINDIR_RPM "lib64/plugins") |
| 89 | +ELSE() |
| 90 | + SET(LIB_INSTALL_DIR_RPM "lib") |
| 91 | + SET(LIB_INSTALL_PLUGINDIR_RPM "lib/plugins") |
| 92 | +ENDIF() |
| 93 | + |
| 94 | +SET(INCLUDE_INSTALL_DIR_RPM "include") |
| 95 | +SET(DOCS_INSTALL_DIR_RPM "docs") |
| 96 | +SET(LIB_INSTALL_PLUGIN_DIR_RPM "lib/plugins") |
| 97 | + |
| 98 | +# |
| 99 | +# Overwrite defaults |
| 100 | +# |
| 101 | +IF(LIB_INSTALL_DIR) |
| 102 | + SET(LIB_INSTALL_DIR_${INSTALL_LAYOUT} ${LIB_INSTALL_DIR}) |
| 103 | +ENDIF() |
| 104 | + |
| 105 | +IF(INCLUDE_INSTALL_DIR) |
| 106 | + SET(INCLUDE_INSTALL_DIR_${INSTALL_LAYOUT} ${INCLUDE_INSTALL_DIR}) |
| 107 | +ENDIF() |
| 108 | + |
| 109 | +IF(BIN_INSTALL_DIR) |
| 110 | + SET(BIN_INSTALL_DIR_${INSTALL_LAYOUT} ${BIN_INSTALL_DIR}) |
| 111 | +ENDIF() |
| 112 | + |
| 113 | +IF(NOT PREFIX_INSTALL_DIR) |
| 114 | + SET(PREFIX_INSTALL_DIR_${INSTALL_LAYOUT} ${libmariadb_prefix}) |
| 115 | +ENDIF() |
| 116 | + |
| 117 | +IF(NOT SUFFIX_INSTALL_DIR) |
| 118 | + SET(SUFFIX_INSTALL_DIR_${INSTALL_LAYOUT} "mariadb") |
| 119 | +ENDIF() |
| 120 | + |
| 121 | +FOREACH(dir "BIN" "LIB" "INCLUDE" "DOCS" "PREFIX" "SUFFIX") |
| 122 | + SET(${dir}_INSTALL_DIR ${${dir}_INSTALL_DIR_${INSTALL_LAYOUT}}) |
| 123 | + MARK_AS_ADVANCED(${dir}_INSTALL_DIR) |
| 124 | +ENDFOREACH() |
0 commit comments