Skip to content

Commit

Permalink
WL#10328 - mysql-trunk-meb-wl10183 changes in Server Trunk
Browse files Browse the repository at this point in the history
First push of MySQL Enterprise Backup (MEB).

(cherry picked from commit d2d5cc33e6d370b5df943e42ec0558cf3510bbd4)
  • Loading branch information
Ingo Struewing authored and Ingo Struewing committed Oct 20, 2017
1 parent dd53a7c commit 8ee4e8d
Show file tree
Hide file tree
Showing 318 changed files with 62,244 additions and 1,086 deletions.
14 changes: 14 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ INCLUDE(character_sets)
INCLUDE(cpu_info)
INCLUDE(zlib)
INCLUDE(lz4)
INCLUDE(lzma)
INCLUDE(re2)
INCLUDE(libevent)
INCLUDE(ssl)
INCLUDE(readline)
Expand Down Expand Up @@ -658,6 +660,10 @@ MYSQL_CHECK_EDITLINE()
MYSQL_CHECK_LIBEVENT()
# Add lz4 library
MYSQL_CHECK_LZ4()
# Add lzma library
MYSQL_CHECK_LZMA()
# Add re2 library
MYSQL_CHECK_RE2()
# Add protoc and libprotobuf
IF(NOT WITHOUT_SERVER)
MYSQL_CHECK_PROTOBUF()
Expand All @@ -682,6 +688,14 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
HAVE_PTHREAD_SETNAME_NP)
ENDIF()

IF (BUILD_BUNDLED_LZMA)
ADD_SUBDIRECTORY(extra/lzma)
ENDIF()

IF (BUILD_BUNDLED_RE2)
ADD_SUBDIRECTORY(extra/re2)
ENDIF()

#
# Setup maintainer mode options by the end. Platform checks are
# not run with the warning options as to not perturb fragile checks
Expand Down
91 changes: 70 additions & 21 deletions cmake/curl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,83 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

MACRO(GET_CURL_VERSION)
FILE(STRINGS "${CURL_INCLUDE_DIR}/curl/curlver.h"
CURL_VERSION_NUMBERS
REGEX "^#[ ]*define[\t ]+LIBCURL_VERSION_[A-Z]+[\t ]+[0-9].*"
)
STRING(REGEX REPLACE
"^.*LIBCURL_VERSION_MAJOR[\t ]+([0-9]+).*$" "\\1"
CURL_VERSION_MAJOR "${CURL_VERSION_NUMBERS}"
)
STRING(REGEX REPLACE
"^.*LIBCURL_VERSION_MINOR[\t ]+([0-9]+).*$" "\\1"
CURL_VERSION_MINOR "${CURL_VERSION_NUMBERS}"
)
MESSAGE(STATUS "CURL version: ${CURL_VERSION_MAJOR}.${CURL_VERSION_MINOR}")
ENDMACRO()

MACRO(MYSQL_CHECK_CURL)
IF(NOT WIN32)
IF(WITH_CURL STREQUAL "system")
# FindCURL.cmake will set
# CURL_INCLUDE_DIRS - where to find curl/curl.h, etc.
# CURL_LIBRARIES - List of libraries when using curl.
# CURL_FOUND - True if curl found.
# CURL_VERSION_STRING - the version of curl found (since CMake 2.8.8)
FIND_PACKAGE(CURL)
IF(CURL_FOUND)
SET(CURL_LIBRARY ${CURL_LIBRARIES} CACHE PATH "Curl library")
ENDIF()
MESSAGE(STATUS "CURL_LIBRARY = ${CURL_LIBRARY}")
ELSEIF(WITH_CURL)
IF(WITH_CURL STREQUAL "system")
# FindCURL.cmake will set
# CURL_INCLUDE_DIRS - where to find curl/curl.h, etc.
# CURL_LIBRARIES - List of libraries when using curl.
# CURL_FOUND - True if curl found.
# CURL_VERSION_STRING - the version of curl found (since CMake 2.8.8)
FIND_PACKAGE(CURL)
IF(CURL_FOUND AND
CURL_LIBRARIES AND
NOT CURL_LIBRARIES MATCHES "CURL_LIBRARY-NOTFOUND" AND
NOT CURL_INCLUDE_DIRS MATCHES "CURL_INCLUDE_DIR-NOTFOUND")
SET(CURL_LIBRARY ${CURL_LIBRARIES} CACHE FILEPATH "Curl library")
SET(CURL_INCLUDE_DIR ${CURL_INCLUDE_DIRS} CACHE PATH "Curl include")
GET_CURL_VERSION()
ELSE()
SET(CURL_LIBRARY "")
SET(CURL_INCLUDE_DIR "")
ENDIF()
MESSAGE(STATUS "CURL_LIBRARY = ${CURL_LIBRARY}")
MESSAGE(STATUS "CURL_INCLUDE_DIR = ${CURL_INCLUDE_DIR}")

ELSEIF(WITH_CURL STREQUAL "bundled")
MESSAGE(FATAL_ERROR "There is no bundled CURL library.")

ELSEIF(WITH_CURL)
# Explicit path given. Normalize path for the following regex replace.
FILE(TO_CMAKE_PATH "${WITH_CURL}" WITH_CURL)
# Pushbuild adds /lib to the CURL path
STRING(REGEX REPLACE "/lib$" "" WITH_CURL "${WITH_CURL}")
LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
FIND_LIBRARY(CURL_LIBRARY
NAMES curl
PATHS ${WITH_CURL}
NAMES curl libcurl
PATHS ${WITH_CURL} ${WITH_CURL}/lib
NO_DEFAULT_PATH
NO_CMAKE_ENVIRONMENT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
)
)
LIST(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
IF(CURL_LIBRARY MATCHES "CURL_LIBRARY-NOTFOUND")
MESSAGE(FATAL_ERROR "CURL library not found under '${WITH_CURL}'")
ENDIF()
FIND_PATH(CURL_INCLUDE_DIR
NAMES curl/curl.h
PATHS ${WITH_CURL} ${WITH_CURL}/include
NO_DEFAULT_PATH
NO_CMAKE_ENVIRONMENT_PATH
NO_SYSTEM_ENVIRONMENT_PATH
)
IF(CURL_INCLUDE_DIR MATCHES "CURL_INCLUDE_DIR-NOTFOUND")
MESSAGE(FATAL_ERROR "CURL include files not found under '${WITH_CURL}'")
ENDIF()
GET_CURL_VERSION()
MESSAGE(STATUS "CURL_LIBRARY = ${CURL_LIBRARY}")
MESSAGE(STATUS "CURL_INCLUDE_DIR = ${CURL_INCLUDE_DIR}")

ELSE()
MESSAGE(STATUS "No WITH_CURL has been set. Not using any curl library.")
SET(CURL_LIBRARY "")
SET(CURL_INCLUDE_DIR "")
MESSAGE(STATUS "CURL_LIBRARY = ${CURL_LIBRARY}")
ELSE()
MESSAGE(STATUS
"You need to set WITH_CURL. This"
" variable needs to point to curl library.")
ENDIF()
MESSAGE(STATUS "CURL_INCLUDE_DIR = ${CURL_INCLUDE_DIR}")
ENDIF()
ENDMACRO()
54 changes: 54 additions & 0 deletions cmake/lzma.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
#
# 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

# cmake -DWITH_LZMA=system|bundled
# bundled is the default

MACRO (FIND_SYSTEM_LZMA)
FIND_PATH(PATH_TO_LZMA NAMES lzma/lzma.h)
FIND_LIBRARY(LZMA_SYSTEM_LIBRARY NAMES lzma)
IF (PATH_TO_LZMA AND LZMA_SYSTEM_LIBRARY)
SET(SYSTEM_LZMA_FOUND 1)
SET(LZMA_INCLUDE_DIR ${PATH_TO_LZMA})
SET(LZMA_LIBRARY ${LZMA_SYSTEM_LIBRARY})
MESSAGE(STATUS "LZMA_INCLUDE_DIR ${LZMA_INCLUDE_DIR}")
MESSAGE(STATUS "LZMA_LIBRARY ${LZMA_LIBRARY}")
ENDIF()
ENDMACRO()

MACRO (MYSQL_USE_BUNDLED_LZMA)
SET(BUILD_BUNDLED_LZMA 1)
SET(LZMA_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/extra/lzma)
SET(LZMA_LIBRARY lzma_lib)
MESSAGE(STATUS "LZMA_INCLUDE_DIR ${LZMA_INCLUDE_DIR}")
MESSAGE(STATUS "LZMA_LIBRARY ${LZMA_LIBRARY}")
ENDMACRO()

IF (NOT WITH_LZMA)
SET(WITH_LZMA "bundled" CACHE STRING "By default use bundled lzma library")
ENDIF()

MACRO (MYSQL_CHECK_LZMA)
IF (WITH_LZMA STREQUAL "bundled")
MYSQL_USE_BUNDLED_LZMA()
ELSEIF(WITH_LZMA STREQUAL "system")
FIND_SYSTEM_LZMA()
IF (NOT SYSTEM_LZMA_FOUND)
MESSAGE(FATAL_ERROR "Cannot find system lzma libraries.")
ENDIF()
ELSE()
MESSAGE(FATAL_ERROR "WITH_LZMA must be bundled or system")
ENDIF()
ENDMACRO()
52 changes: 52 additions & 0 deletions cmake/re2.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
#
# 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

# cmake -DWITH_RE2=system|bundled
# bundled is the default

MACRO (FIND_SYSTEM_RE2)
FIND_PATH(PATH_TO_RE2 NAMES re2/re2.h)
FIND_LIBRARY(RE2_SYSTEM_LIBRARY NAMES re2)
IF (PATH_TO_RE2 AND RE2_SYSTEM_LIBRARY)
SET(SYSTEM_RE2_FOUND 1)
SET(RE2_INCLUDE_DIR ${PATH_TO_RE2})
SET(RE2_LIBRARY ${RE2_SYSTEM_LIBRARY})
MESSAGE(STATUS "RE2_INCLUDE_DIR ${RE2_INCLUDE_DIR}")
MESSAGE(STATUS "RE2_LIBRARY ${RE2_LIBRARY}")
ENDIF()
ENDMACRO()

MACRO (MYSQL_USE_BUNDLED_RE2)
SET(BUILD_BUNDLED_RE2 1)
SET(RE2_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/extra/re2)
SET(RE2_LIBRARY re2_lib)
ENDMACRO()

IF (NOT WITH_RE2)
SET(WITH_RE2 "bundled" CACHE STRING "By default use bundled re2 library")
ENDIF()

MACRO (MYSQL_CHECK_RE2)
IF (WITH_RE2 STREQUAL "bundled")
MYSQL_USE_BUNDLED_RE2()
ELSEIF(WITH_RE2 STREQUAL "system")
FIND_SYSTEM_RE2()
IF (NOT SYSTEM_RE2_FOUND)
MESSAGE(FATAL_ERROR "Cannot find system re2 libraries.")
ENDIF()
ELSE()
MESSAGE(FATAL_ERROR "WITH_RE2 must be bundled or system")
ENDIF()
ENDMACRO()
55 changes: 55 additions & 0 deletions cmake/sasl.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
#
# 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

# cmake -DWITH_SASL=system|path
# system is the default
#
# Sets SASL_LIBRARY. If not found, SASL_LIBRARY="".

MACRO (FIND_SYSTEM_SASL)
FIND_LIBRARY(SASL_SYSTEM_LIBRARY NAMES "sasl2" "sasl")
IF (SASL_SYSTEM_LIBRARY)
SET(SYSTEM_SASL_FOUND 1)
SET(SASL_LIBRARY ${SASL_SYSTEM_LIBRARY})
MESSAGE(STATUS "SASL_LIBRARY ${SASL_LIBRARY}")
ENDIF()
ENDMACRO()

IF (NOT WITH_SASL)
SET(WITH_SASL "system" CACHE STRING "By default use system sasl library")
ENDIF()

MACRO (MYSQL_CHECK_SASL)
IF (NOT WITH_SASL OR WITH_SASL STREQUAL "system")
FIND_SYSTEM_SASL()
IF (NOT SYSTEM_SASL_FOUND)
MESSAGE(STATUS "Cannot find system sasl libraries.")
SET(SASL_LIBRARY "")
ENDIF()
ELSE()
FIND_LIBRARY(SASL_LIBRARY
NAMES "sasl2" "sasl"
PATHS ${WITH_SASL} ${WITH_SASL}/lib
NO_DEFAULT_PATH
NO_CMAKE_ENVIRONMENT_PATH
NO_SYSTEM_ENVIRONMENT_PATH)
IF (NOT SASL_LIBRARY)
MESSAGE(STATUS "Cannot find sasl libraries in ${WITH_SASL}.")
SET(SASL_LIBRARY "")
ELSE()
MESSAGE(STATUS "SASL_LIBRARY ${SASL_LIBRARY}")
ENDIF()
ENDIF()
ENDMACRO()
5 changes: 5 additions & 0 deletions configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,11 @@ set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}

SET(CMAKE_EXTRA_INCLUDE_FILES stdint.h stdio.h sys/types.h time.h)

CHECK_TYPE_SIZE(uint8_t HAVE_UINT8_T)
CHECK_TYPE_SIZE(uint16_t HAVE_UINT16_T)
CHECK_TYPE_SIZE(uint32_t HAVE_UINT32_T)
CHECK_TYPE_SIZE(uint64_t HAVE_UINT64_T)

CHECK_TYPE_SIZE("void *" SIZEOF_VOIDP)
CHECK_TYPE_SIZE("char *" SIZEOF_CHARP)
CHECK_TYPE_SIZE("long" SIZEOF_LONG)
Expand Down
Loading

0 comments on commit 8ee4e8d

Please sign in to comment.