2014-11-11 14:14:53 +01:00
|
|
|
# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
Fix bug#42969 Please add a MANIFEST to each build
With this change, there will be new files "INFO_SRC"
and "INFO_BIN", which describe the source and the
binaries.
They will be contained in all packages:
- in "tar.gz" and derived packages, in "docs/",
- in RPMs, in "/usr/share/doc/packages/MySQL-server".
"INFO_SRC" is also part of a source tarball.
It gives the version as exact as possible, preferably
by calling "bzr version-info" on the source tree.
If that is not possible, it just contains the three
level version number.
"INFO_BIN" contains some info when and where the
binaries were built, the options given to the compiler,
and the flags controlling the included features.
The tests (test "mysql" in the main suite) are extended
to verify the existence of both "INFO_SRC" and "INFO_BIN",
as well as some of the expected contents.
2011-02-11 15:55:25 +01:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
# the Free Software Foundation; version 2 of the License.
|
|
|
|
#
|
|
|
|
# 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 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
|
|
|
|
|
|
|
|
|
|
|
|
# Handle/create the "INFO_*" files describing a MySQL (server) binary.
|
|
|
|
# This is part of the fix for bug#42969.
|
|
|
|
|
|
|
|
|
|
|
|
# Several of cmake's variables need to be translated from '@' notation
|
|
|
|
# to '${}', this is done by the "configure" call in top level "CMakeLists.txt".
|
|
|
|
# If further variables are used in this file, add them to this list.
|
|
|
|
|
|
|
|
SET(VERSION "@VERSION@")
|
2014-11-17 15:26:33 +01:00
|
|
|
SET(MAJOR_VERSION "@MAJOR_VERSION@")
|
|
|
|
SET(MINOR_VERSION "@MINOR_VERSION@")
|
|
|
|
SET(PATCH_VERSION "@PATCH_VERSION@")
|
Fix bug#42969 Please add a MANIFEST to each build
With this change, there will be new files "INFO_SRC"
and "INFO_BIN", which describe the source and the
binaries.
They will be contained in all packages:
- in "tar.gz" and derived packages, in "docs/",
- in RPMs, in "/usr/share/doc/packages/MySQL-server".
"INFO_SRC" is also part of a source tarball.
It gives the version as exact as possible, preferably
by calling "bzr version-info" on the source tree.
If that is not possible, it just contains the three
level version number.
"INFO_BIN" contains some info when and where the
binaries were built, the options given to the compiler,
and the flags controlling the included features.
The tests (test "mysql" in the main suite) are extended
to verify the existence of both "INFO_SRC" and "INFO_BIN",
as well as some of the expected contents.
2011-02-11 15:55:25 +01:00
|
|
|
SET(CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@")
|
|
|
|
SET(CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@")
|
|
|
|
SET(CMAKE_GENERATOR "@CMAKE_GENERATOR@")
|
|
|
|
SET(CMAKE_SIZEOF_VOID_P "@CMAKE_SIZEOF_VOID_P@")
|
2014-11-11 14:14:53 +01:00
|
|
|
SET(GIT_EXECUTABLE "@GIT_EXECUTABLE@")
|
Fix bug#42969 Please add a MANIFEST to each build
With this change, there will be new files "INFO_SRC"
and "INFO_BIN", which describe the source and the
binaries.
They will be contained in all packages:
- in "tar.gz" and derived packages, in "docs/",
- in RPMs, in "/usr/share/doc/packages/MySQL-server".
"INFO_SRC" is also part of a source tarball.
It gives the version as exact as possible, preferably
by calling "bzr version-info" on the source tree.
If that is not possible, it just contains the three
level version number.
"INFO_BIN" contains some info when and where the
binaries were built, the options given to the compiler,
and the flags controlling the included features.
The tests (test "mysql" in the main suite) are extended
to verify the existence of both "INFO_SRC" and "INFO_BIN",
as well as some of the expected contents.
2011-02-11 15:55:25 +01:00
|
|
|
SET(CMAKE_CROSSCOMPILING "@CMAKE_CROSSCOMPILING@")
|
|
|
|
SET(CMAKE_HOST_SYSTEM "@CMAKE_HOST_SYSTEM@")
|
|
|
|
SET(CMAKE_HOST_SYSTEM_PROCESSOR "@CMAKE_HOST_SYSTEM_PROCESSOR@")
|
|
|
|
SET(CMAKE_SYSTEM "@CMAKE_SYSTEM@")
|
|
|
|
SET(CMAKE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@")
|
|
|
|
|
|
|
|
|
|
|
|
# Create an "INFO_SRC" file with information about the source (only).
|
2014-12-03 14:50:29 +01:00
|
|
|
# We use "git log", if possible, and the "VERSION" contents.
|
Fix bug#42969 Please add a MANIFEST to each build
With this change, there will be new files "INFO_SRC"
and "INFO_BIN", which describe the source and the
binaries.
They will be contained in all packages:
- in "tar.gz" and derived packages, in "docs/",
- in RPMs, in "/usr/share/doc/packages/MySQL-server".
"INFO_SRC" is also part of a source tarball.
It gives the version as exact as possible, preferably
by calling "bzr version-info" on the source tree.
If that is not possible, it just contains the three
level version number.
"INFO_BIN" contains some info when and where the
binaries were built, the options given to the compiler,
and the flags controlling the included features.
The tests (test "mysql" in the main suite) are extended
to verify the existence of both "INFO_SRC" and "INFO_BIN",
as well as some of the expected contents.
2011-02-11 15:55:25 +01:00
|
|
|
#
|
2014-12-03 14:50:29 +01:00
|
|
|
# Outside development (git tree), the "INFO_SRC" file will not be modified
|
Fix bug#42969 Please add a MANIFEST to each build
With this change, there will be new files "INFO_SRC"
and "INFO_BIN", which describe the source and the
binaries.
They will be contained in all packages:
- in "tar.gz" and derived packages, in "docs/",
- in RPMs, in "/usr/share/doc/packages/MySQL-server".
"INFO_SRC" is also part of a source tarball.
It gives the version as exact as possible, preferably
by calling "bzr version-info" on the source tree.
If that is not possible, it just contains the three
level version number.
"INFO_BIN" contains some info when and where the
binaries were built, the options given to the compiler,
and the flags controlling the included features.
The tests (test "mysql" in the main suite) are extended
to verify the existence of both "INFO_SRC" and "INFO_BIN",
as well as some of the expected contents.
2011-02-11 15:55:25 +01:00
|
|
|
# provided it exists (from "make dist" or a source tarball creation).
|
|
|
|
|
|
|
|
MACRO(CREATE_INFO_SRC target_dir)
|
|
|
|
SET(INFO_SRC "${target_dir}/INFO_SRC")
|
|
|
|
|
2014-11-17 15:26:33 +01:00
|
|
|
SET(PERLSCRIPT
|
|
|
|
"use warnings; use POSIX qw(strftime); "
|
|
|
|
"print strftime \"%F %T %z\", localtime;")
|
|
|
|
EXECUTE_PROCESS(
|
|
|
|
COMMAND perl -e "${PERLSCRIPT}"
|
|
|
|
RESULT_VARIABLE result
|
|
|
|
OUTPUT_VARIABLE bdate
|
|
|
|
ERROR_VARIABLE error
|
|
|
|
)
|
|
|
|
IF(error)
|
|
|
|
MESSAGE(STATUS "Could not determine build-date: <${error}>")
|
|
|
|
ENDIF()
|
|
|
|
|
2014-11-11 14:14:53 +01:00
|
|
|
IF(GIT_EXECUTABLE AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
|
|
|
|
# Sources are in a GIT repository: Always update.
|
|
|
|
EXECUTE_PROCESS(
|
2014-11-17 15:26:33 +01:00
|
|
|
COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
|
2014-11-11 14:14:53 +01:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
2014-11-17 15:26:33 +01:00
|
|
|
OUTPUT_VARIABLE bname
|
2014-11-11 14:14:53 +01:00
|
|
|
)
|
2014-11-17 15:26:33 +01:00
|
|
|
|
2014-11-11 14:14:53 +01:00
|
|
|
EXECUTE_PROCESS(
|
2014-11-17 15:26:33 +01:00
|
|
|
COMMAND ${GIT_EXECUTABLE} log -1
|
|
|
|
--pretty="commit: %H%ndate: %ci%nbuild-date: ${bdate} %nshort: %h%nbranch: ${bname}"
|
2014-11-11 14:14:53 +01:00
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
OUTPUT_VARIABLE VERSION_INFO
|
Fix bug#42969 Please add a MANIFEST to each build
With this change, there will be new files "INFO_SRC"
and "INFO_BIN", which describe the source and the
binaries.
They will be contained in all packages:
- in "tar.gz" and derived packages, in "docs/",
- in RPMs, in "/usr/share/doc/packages/MySQL-server".
"INFO_SRC" is also part of a source tarball.
It gives the version as exact as possible, preferably
by calling "bzr version-info" on the source tree.
If that is not possible, it just contains the three
level version number.
"INFO_BIN" contains some info when and where the
binaries were built, the options given to the compiler,
and the flags controlling the included features.
The tests (test "mysql" in the main suite) are extended
to verify the existence of both "INFO_SRC" and "INFO_BIN",
as well as some of the expected contents.
2011-02-11 15:55:25 +01:00
|
|
|
)
|
2014-11-17 15:26:33 +01:00
|
|
|
|
|
|
|
## Output from git is quoted with "", remove them.
|
|
|
|
STRING(REPLACE "\"" "" VERSION_INFO "${VERSION_INFO}")
|
Fix bug#42969 Please add a MANIFEST to each build
With this change, there will be new files "INFO_SRC"
and "INFO_BIN", which describe the source and the
binaries.
They will be contained in all packages:
- in "tar.gz" and derived packages, in "docs/",
- in RPMs, in "/usr/share/doc/packages/MySQL-server".
"INFO_SRC" is also part of a source tarball.
It gives the version as exact as possible, preferably
by calling "bzr version-info" on the source tree.
If that is not possible, it just contains the three
level version number.
"INFO_BIN" contains some info when and where the
binaries were built, the options given to the compiler,
and the flags controlling the included features.
The tests (test "mysql" in the main suite) are extended
to verify the existence of both "INFO_SRC" and "INFO_BIN",
as well as some of the expected contents.
2011-02-11 15:55:25 +01:00
|
|
|
FILE(WRITE ${INFO_SRC} "${VERSION_INFO}\n")
|
|
|
|
# to debug, add: FILE(APPEND ${INFO_SRC} "\nResult ${RESULT}\n")
|
|
|
|
# For better readability ...
|
2014-11-17 15:26:33 +01:00
|
|
|
FILE(APPEND ${INFO_SRC}
|
|
|
|
"MySQL source ${MAJOR_VERSION}.${MINOR_VERSION}.${PATCH_VERSION}\n")
|
Fix bug#42969 Please add a MANIFEST to each build
With this change, there will be new files "INFO_SRC"
and "INFO_BIN", which describe the source and the
binaries.
They will be contained in all packages:
- in "tar.gz" and derived packages, in "docs/",
- in RPMs, in "/usr/share/doc/packages/MySQL-server".
"INFO_SRC" is also part of a source tarball.
It gives the version as exact as possible, preferably
by calling "bzr version-info" on the source tree.
If that is not possible, it just contains the three
level version number.
"INFO_BIN" contains some info when and where the
binaries were built, the options given to the compiler,
and the flags controlling the included features.
The tests (test "mysql" in the main suite) are extended
to verify the existence of both "INFO_SRC" and "INFO_BIN",
as well as some of the expected contents.
2011-02-11 15:55:25 +01:00
|
|
|
ELSEIF(EXISTS ${INFO_SRC})
|
2014-12-03 14:50:29 +01:00
|
|
|
# Outside a git tree, there is no need to change an existing "INFO_SRC",
|
Fix bug#42969 Please add a MANIFEST to each build
With this change, there will be new files "INFO_SRC"
and "INFO_BIN", which describe the source and the
binaries.
They will be contained in all packages:
- in "tar.gz" and derived packages, in "docs/",
- in RPMs, in "/usr/share/doc/packages/MySQL-server".
"INFO_SRC" is also part of a source tarball.
It gives the version as exact as possible, preferably
by calling "bzr version-info" on the source tree.
If that is not possible, it just contains the three
level version number.
"INFO_BIN" contains some info when and where the
binaries were built, the options given to the compiler,
and the flags controlling the included features.
The tests (test "mysql" in the main suite) are extended
to verify the existence of both "INFO_SRC" and "INFO_BIN",
as well as some of the expected contents.
2011-02-11 15:55:25 +01:00
|
|
|
# it cannot be improved.
|
|
|
|
ELSEIF(EXISTS ${CMAKE_SOURCE_DIR}/Docs/INFO_SRC)
|
|
|
|
# If we are building from a source distribution, it also contains "INFO_SRC".
|
|
|
|
# Similar, the export used for a release build already has the file.
|
|
|
|
FILE(READ ${CMAKE_SOURCE_DIR}/Docs/INFO_SRC SOURCE_INFO)
|
|
|
|
FILE(WRITE ${INFO_SRC} "${SOURCE_INFO}\n")
|
|
|
|
ELSEIF(EXISTS ${CMAKE_SOURCE_DIR}/INFO_SRC)
|
|
|
|
# This is not the proper location, but who knows ...
|
|
|
|
FILE(READ ${CMAKE_SOURCE_DIR}/INFO_SRC SOURCE_INFO)
|
|
|
|
FILE(WRITE ${INFO_SRC} "${SOURCE_INFO}\n")
|
|
|
|
ELSE()
|
|
|
|
# This is a fall-back.
|
|
|
|
FILE(WRITE ${INFO_SRC} "\nMySQL source ${VERSION}\n")
|
|
|
|
ENDIF()
|
|
|
|
ENDMACRO(CREATE_INFO_SRC)
|
|
|
|
|
|
|
|
|
|
|
|
# This is for the "real" build, must be run again with each cmake run
|
|
|
|
# to make sure we report the current flags (not those of some previous run).
|
|
|
|
|
|
|
|
MACRO(CREATE_INFO_BIN)
|
|
|
|
SET(INFO_BIN "Docs/INFO_BIN")
|
|
|
|
|
|
|
|
FILE(WRITE ${INFO_BIN} "===== Information about the build process: =====\n")
|
|
|
|
IF (WIN32)
|
2012-10-19 20:31:22 +02:00
|
|
|
EXECUTE_PROCESS(COMMAND cmd /c date /T
|
|
|
|
OUTPUT_VARIABLE TMP_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
Fix bug#42969 Please add a MANIFEST to each build
With this change, there will be new files "INFO_SRC"
and "INFO_BIN", which describe the source and the
binaries.
They will be contained in all packages:
- in "tar.gz" and derived packages, in "docs/",
- in RPMs, in "/usr/share/doc/packages/MySQL-server".
"INFO_SRC" is also part of a source tarball.
It gives the version as exact as possible, preferably
by calling "bzr version-info" on the source tree.
If that is not possible, it just contains the three
level version number.
"INFO_BIN" contains some info when and where the
binaries were built, the options given to the compiler,
and the flags controlling the included features.
The tests (test "mysql" in the main suite) are extended
to verify the existence of both "INFO_SRC" and "INFO_BIN",
as well as some of the expected contents.
2011-02-11 15:55:25 +01:00
|
|
|
ELSEIF(UNIX)
|
2012-10-19 20:31:22 +02:00
|
|
|
EXECUTE_PROCESS(COMMAND date "+%Y-%m-%d %H:%M:%S"
|
|
|
|
OUTPUT_VARIABLE TMP_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
|
Fix bug#42969 Please add a MANIFEST to each build
With this change, there will be new files "INFO_SRC"
and "INFO_BIN", which describe the source and the
binaries.
They will be contained in all packages:
- in "tar.gz" and derived packages, in "docs/",
- in RPMs, in "/usr/share/doc/packages/MySQL-server".
"INFO_SRC" is also part of a source tarball.
It gives the version as exact as possible, preferably
by calling "bzr version-info" on the source tree.
If that is not possible, it just contains the three
level version number.
"INFO_BIN" contains some info when and where the
binaries were built, the options given to the compiler,
and the flags controlling the included features.
The tests (test "mysql" in the main suite) are extended
to verify the existence of both "INFO_SRC" and "INFO_BIN",
as well as some of the expected contents.
2011-02-11 15:55:25 +01:00
|
|
|
ELSE()
|
|
|
|
SET(TMP_DATE "(no date command known for this platform)")
|
|
|
|
ENDIF()
|
|
|
|
SITE_NAME(HOSTNAME)
|
|
|
|
FILE(APPEND ${INFO_BIN} "Build was run at ${TMP_DATE} on host '${HOSTNAME}'\n\n")
|
|
|
|
|
|
|
|
# According to the cmake docs, these variables should always be set.
|
|
|
|
# However, they are empty in my tests, using cmake 2.6.4 on Linux, various Unix, and Windows.
|
|
|
|
# Still, include this code, so we will profit if a build environment does provide that info.
|
|
|
|
IF(CMAKE_HOST_SYSTEM)
|
|
|
|
FILE(APPEND ${INFO_BIN} "Build was done on ${CMAKE_HOST_SYSTEM} using ${CMAKE_HOST_SYSTEM_PROCESSOR}\n")
|
|
|
|
ENDIF()
|
|
|
|
IF(CMAKE_CROSSCOMPILING)
|
|
|
|
FILE(APPEND ${INFO_BIN} "Build was done for ${CMAKE_SYSTEM} using ${CMAKE_SYSTEM_PROCESSOR}\n")
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
# ${CMAKE_VERSION} doesn't work in 2.6.0, use the separate components.
|
|
|
|
FILE(APPEND ${INFO_BIN} "Build was done using cmake ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} \n\n")
|
|
|
|
|
|
|
|
IF (WIN32)
|
|
|
|
FILE(APPEND ${INFO_BIN} "===== Compiler / generator used: =====\n")
|
|
|
|
FILE(APPEND ${INFO_BIN} ${CMAKE_GENERATOR} "\n\n")
|
|
|
|
ELSEIF(UNIX)
|
|
|
|
FILE(APPEND ${INFO_BIN} "===== Compiler flags used (from the 'sql/' subdirectory): =====\n")
|
|
|
|
IF(EXISTS sql/CMakeFiles/sql.dir/flags.make)
|
|
|
|
EXECUTE_PROCESS(COMMAND egrep "^# compile|^C_|^CXX_" sql/CMakeFiles/sql.dir/flags.make OUTPUT_VARIABLE COMPILE_FLAGS)
|
|
|
|
FILE(APPEND ${INFO_BIN} ${COMPILE_FLAGS} "\n")
|
|
|
|
ELSE()
|
|
|
|
FILE(APPEND ${INFO_BIN} "File 'sql/CMakeFiles/sql.dir/flags.make' is not yet found.\n\n")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
|
|
|
FILE(APPEND ${INFO_BIN} "Pointer size: ${CMAKE_SIZEOF_VOID_P}\n\n")
|
|
|
|
|
|
|
|
FILE(APPEND ${INFO_BIN} "===== Feature flags used: =====\n")
|
|
|
|
IF(EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
|
|
|
|
# Attention: "-N" prevents cmake from entering a recursion, and it must be a separate flag from "-L".
|
|
|
|
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -N -L ${CMAKE_BINARY_DIR} OUTPUT_VARIABLE FEATURE_FLAGS)
|
|
|
|
FILE(APPEND ${INFO_BIN} ${FEATURE_FLAGS} "\n")
|
|
|
|
ELSE()
|
|
|
|
FILE(APPEND ${INFO_BIN} "File 'CMakeCache.txt' is not yet found.\n\n")
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
FILE(APPEND ${INFO_BIN} "===== EOF =====\n")
|
|
|
|
ENDMACRO(CREATE_INFO_BIN)
|
|
|
|
|