1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188
|
# Copyright (c) 2009, 2025, Oracle and/or its affiliates.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is designed to work with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation. The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have either included with
# the program or referenced in the documentation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Global constants, only to be changed between major releases.
#
SET(SHARED_LIB_MAJOR_VERSION "21")
SET(SHARED_LIB_MINOR_VERSION "2")
SET(PROTOCOL_VERSION "10")
# Generate "something" to trigger cmake rerun when MYSQL_VERSION changes
CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/MYSQL_VERSION
${CMAKE_BINARY_DIR}/VERSION.dep
)
# Read value for a variable from MYSQL_VERSION.
MACRO(MYSQL_GET_CONFIG_VALUE keyword var)
IF(NOT ${var})
FILE (STRINGS ${CMAKE_SOURCE_DIR}/MYSQL_VERSION str REGEX "^[ ]*${keyword}=")
IF(str)
STRING(REPLACE "${keyword}=" "" str ${str})
STRING(REGEX REPLACE "[ ].*" "" str "${str}")
SET(${var} ${str})
ENDIF()
ENDIF()
ENDMACRO()
# Read mysql version for configure script
MACRO(GET_MYSQL_VERSION)
MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_MAJOR" MAJOR_VERSION)
MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_MINOR" MINOR_VERSION)
MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_PATCH" PATCH_VERSION)
MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_EXTRA" EXTRA_VERSION)
IF(NOT DEFINED MAJOR_VERSION OR
NOT DEFINED MINOR_VERSION OR
NOT DEFINED PATCH_VERSION)
MESSAGE(FATAL_ERROR "MYSQL_VERSION file cannot be parsed.")
ENDIF()
MYSQL_GET_CONFIG_VALUE("MYSQL_VERSION_STABILITY" MYSQL_VERSION_STABILITY)
IF(NOT DEFINED MYSQL_VERSION_STABILITY)
MESSAGE(FATAL_ERROR "MYSQL_VERSION file cannot be parsed, missing version attributes.")
ENDIF()
IF(NOT MYSQL_VERSION_STABILITY STREQUAL "\"LTS\"" AND
NOT MYSQL_VERSION_STABILITY STREQUAL "\"INNOVATION\"")
MESSAGE(FATAL_ERROR "MYSQL_VERSION_STABILITY can be set to INNOVATION or LTS.")
ENDIF()
# Versions like 8.0.x, 8.4.x, and x.7.y (x > 8) should be LTS
IF ((MAJOR_VERSION EQUAL "8" AND MINOR_VERSION EQUAL "0" AND PATCH_VERSION GREATER "34") OR
(MAJOR_VERSION EQUAL "8" AND MINOR_VERSION EQUAL "4") OR
(MAJOR_VERSION GREATER "8" AND MINOR_VERSION EQUAL "7"))
IF (NOT MYSQL_VERSION_STABILITY STREQUAL "\"LTS\"")
MESSAGE(FATAL_ERROR "Version ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION} should "
"be an LTS release.")
ENDIF()
ELSE()
IF (NOT MYSQL_VERSION_STABILITY STREQUAL "\"INNOVATION\"")
MESSAGE(FATAL_ERROR "Version ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION} should "
"be an innovation release.")
ENDIF()
ENDIF()
SET(VERSION
"${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}${EXTRA_VERSION}")
MESSAGE(STATUS "MySQL ${VERSION}")
SET(MYSQL_BASE_VERSION
"${MAJOR_VERSION}.${MINOR_VERSION}" CACHE INTERNAL "MySQL Base version")
SET(MYSQL_NO_DASH_VERSION
"${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}")
STRING(REGEX REPLACE "^-" "." MYSQL_VERSION_EXTRA_DOT "${EXTRA_VERSION}")
SET(VERSION_SRC "${VERSION}")
MATH(EXPR MYSQL_VERSION_ID
"10000*${MAJOR_VERSION} + 100*${MINOR_VERSION} + ${PATCH_VERSION}")
MARK_AS_ADVANCED(VERSION MYSQL_VERSION_ID MYSQL_BASE_VERSION)
SET(CPACK_PACKAGE_VERSION_MAJOR ${MAJOR_VERSION})
SET(CPACK_PACKAGE_VERSION_MINOR ${MINOR_VERSION})
SET(CPACK_PACKAGE_VERSION_PATCH ${PATCH_VERSION})
# Read MySQL Cluster version values from MYSQL_VERSION, these are optional
# as by default MySQL Cluster is using the MySQL Server version
MYSQL_GET_CONFIG_VALUE("MYSQL_CLUSTER_VERSION_MAJOR" CLUSTER_MAJOR_VERSION)
MYSQL_GET_CONFIG_VALUE("MYSQL_CLUSTER_VERSION_MINOR" CLUSTER_MINOR_VERSION)
MYSQL_GET_CONFIG_VALUE("MYSQL_CLUSTER_VERSION_PATCH" CLUSTER_PATCH_VERSION)
MYSQL_GET_CONFIG_VALUE("MYSQL_CLUSTER_VERSION_EXTRA" CLUSTER_EXTRA_VERSION)
# Set MySQL Cluster version same as the MySQL Server version
# unless a specific MySQL Cluster version has been specified
# in the MYSQL_VERSION file. This is the version used when creating
# the cluster package names as well as by all the NDB binaries.
IF(DEFINED CLUSTER_MAJOR_VERSION AND
DEFINED CLUSTER_MINOR_VERSION AND
DEFINED CLUSTER_PATCH_VERSION)
# Set MySQL Cluster version to the specific version defined in MYSQL_VERSION
SET(MYSQL_CLUSTER_VERSION "${CLUSTER_MAJOR_VERSION}")
SET(MYSQL_CLUSTER_VERSION
"${MYSQL_CLUSTER_VERSION}.${CLUSTER_MINOR_VERSION}")
SET(MYSQL_CLUSTER_VERSION
"${MYSQL_CLUSTER_VERSION}.${CLUSTER_PATCH_VERSION}")
IF(DEFINED CLUSTER_EXTRA_VERSION)
SET(MYSQL_CLUSTER_VERSION
"${MYSQL_CLUSTER_VERSION}${CLUSTER_EXTRA_VERSION}")
ENDIF()
ELSE()
# Set MySQL Cluster version to the same as MySQL Server, possibly
# overriding the extra version with value specified in MYSQL_VERSION
# This might be used when MySQL Cluster is still released as DMR
# while MySQL Server is already GA.
SET(MYSQL_CLUSTER_VERSION
"${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}")
IF(DEFINED CLUSTER_EXTRA_VERSION)
# Using specific MySQL Cluster extra version
SET(MYSQL_CLUSTER_VERSION
"${MYSQL_CLUSTER_VERSION}${CLUSTER_EXTRA_VERSION}")
# Override the extra version for rpm packages
STRING(REGEX REPLACE "^-" "." MYSQL_VERSION_EXTRA_DOT
"${CLUSTER_EXTRA_VERSION}")
ELSE()
SET(MYSQL_CLUSTER_VERSION
"${MYSQL_CLUSTER_VERSION}${EXTRA_VERSION}")
ENDIF()
ENDIF()
IF(WITH_NDB)
MESSAGE(STATUS "MySQL Cluster version: ${MYSQL_CLUSTER_VERSION}")
SET(VERSION_SRC "${MYSQL_CLUSTER_VERSION}")
# Set suffix to indicate that this is MySQL Server built for MySQL Cluster
SET(MYSQL_SERVER_SUFFIX "-cluster")
ENDIF()
ENDMACRO()
# Get mysql version and other interesting variables
GET_MYSQL_VERSION()
SET(SHARED_LIB_PATCH_VERSION ${PATCH_VERSION})
SET(MYSQL_TCP_PORT_DEFAULT "3306")
IF(NOT MYSQL_TCP_PORT)
SET(MYSQL_TCP_PORT ${MYSQL_TCP_PORT_DEFAULT})
SET(MYSQL_TCP_PORT_DEFAULT "0")
ELSEIF(MYSQL_TCP_PORT EQUAL MYSQL_TCP_PORT_DEFAULT)
SET(MYSQL_TCP_PORT_DEFAULT "0")
ENDIF()
IF(NOT MYSQL_ADMIN_TCP_PORT)
SET(MYSQL_ADMIN_TCP_PORT 33062)
ENDIF(NOT MYSQL_ADMIN_TCP_PORT)
IF(NOT MYSQL_UNIX_ADDR)
SET(MYSQL_UNIX_ADDR "/tmp/mysql.sock")
ENDIF()
IF(NOT COMPILATION_COMMENT)
SET(COMPILATION_COMMENT "Source distribution")
ENDIF()
IF(NOT COMPILATION_COMMENT_SERVER)
SET(COMPILATION_COMMENT_SERVER ${COMPILATION_COMMENT})
ENDIF()
|