diff options
-rw-r--r-- | cmake/Makefile.am | 1 | ||||
-rw-r--r-- | cmake/mysql_version.cmake | 49 | ||||
-rw-r--r-- | cmake/os/Windows.cmake | 2 | ||||
-rw-r--r-- | cmake/package_name.cmake | 124 | ||||
-rw-r--r-- | include/my_atomic.h | 2 | ||||
-rwxr-xr-x | sql/CMakeLists.txt | 9 |
6 files changed, 134 insertions, 53 deletions
diff --git a/cmake/Makefile.am b/cmake/Makefile.am index e136ac89d69..f6172a62e1d 100644 --- a/cmake/Makefile.am +++ b/cmake/Makefile.am @@ -1,5 +1,6 @@ EXTRA_DIST = \ cmake_parse_arguments.cmake \ + package_name.cmake \ configurable_file_content.in \ check_minimal_version.cmake \ create_initial_db.cmake.in \ diff --git a/cmake/mysql_version.cmake b/cmake/mysql_version.cmake index c1eafd887c9..67288767d20 100644 --- a/cmake/mysql_version.cmake +++ b/cmake/mysql_version.cmake @@ -97,53 +97,8 @@ IF(NOT COMPILATION_COMMENT) ENDIF() - -# Use meaningful package name for the binary package -IF(NOT CPACK_PACKAGE_FILE_NAME) - IF( NOT SYSTEM_NAME_AND_PROCESSOR) - IF(WIN32) - # CMake does not set CMAKE_SYSTEM_PROCESSOR correctly on Win64 - # (uses x86). Besides, we try to be compatible with existing naming - IF(CMAKE_SIZEOF_VOID_P EQUAL 8) - SET(SYSTEM_NAME_AND_PROCESSOR "winx64") - ELSE() - SET(SYSTEM_NAME_AND_PROCESSOR "win32") - ENDIF() - ELSE() - IF(NOT PLATFORM) - SET(PLATFORM ${CMAKE_SYSTEM_NAME}) - ENDIF() - IF(NOT MACHINE) - SET(MACHINE ${CMAKE_SYSTEM_PROCESSOR}) - IF(CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT ${MACHINE} MATCHES "ia64") - # On almost every 64 bit machine (except IA64) it is possible - # to build 32 bit packages. Add -64bit suffix to differentiate - # between 32 and 64 bit packages. - SET(MACHINE ${MACHINE}-64bit) - ENDIF() - ENDIF() - SET(SYSTEM_NAME_AND_PROCESSOR "${PLATFORM}-${MACHINE}") - ENDIF() - ENDIF() - - IF(SHORT_PRODUCT_TAG) - SET(PRODUCT_TAG "-${SHORT_PRODUCT_TAG}") - ELSEIF(MYSQL_SERVER_SUFFIX) - SET(PRODUCT_TAG "${MYSQL_SERVER_SUFFIX}") # Already has a leading dash - ELSE() - SET(PRODUCT_TAG) - ENDIF() - - SET(package_name "mysql${PRODUCT_TAG}-${VERSION}-${SYSTEM_NAME_AND_PROCESSOR}") - - # Sometimes package suffix is added (something like "-icc-glibc23") - IF(PACKAGE_SUFFIX) - SET(package_name "${package_name}${PACKAGE_SUFFIX}") - ENDIF() - STRING(TOLOWER ${package_name} package_name) - SET(CPACK_PACKAGE_FILE_NAME ${package_name}) -ENDIF() - +INCLUDE(package_name) +GET_PACKAGE_FILE_NAME(CPACK_PACKAGE_FILE_NAME) IF(NOT CPACK_SOURCE_PACKAGE_FILE_NAME) SET(CPACK_SOURCE_PACKAGE_FILE_NAME "mysql-${VERSION}") diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index 5573ecf701e..ce82575ef76 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -102,14 +102,12 @@ IF(MSVC) ADD_DEFINITIONS(/wd4996) ENDIF() - SET (PLATFORM X86) IF(CMAKE_SIZEOF_VOID_P MATCHES 8) # _WIN64 is defined by the compiler itself. # Yet, we define it here again to work around a bug with Intellisense # described here: http://tinyurl.com/2cb428. # Syntax highlighting is important for proper debugger functionality. ADD_DEFINITIONS("-D_WIN64") - SET (PLATFORM X64) ENDIF() ENDIF() diff --git a/cmake/package_name.cmake b/cmake/package_name.cmake new file mode 100644 index 00000000000..5ae6fe5f7f0 --- /dev/null +++ b/cmake/package_name.cmake @@ -0,0 +1,124 @@ +# Copyright (C) 2010 Sun Microsystems, Inc +# +# 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 + +# Produce meaningful package name for the binary package +# The logic is rather involved with special cases for different OSes +MACRO(GET_PACKAGE_FILE_NAME Var) +IF(NOT VERSION) + MESSAGE(FATAL_ERROR + "Variable VERSION needs to be set prior to calling GET_PACKAGE_FILE_NAME") + ENDIF() + IF(NOT SYSTEM_NAME_AND_PROCESSOR) + SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 1) + SET(DEFAULT_PLATFORM ${CMAKE_SYSTEM_NAME}) + SET(DEFAULT_MACHINE ${CMAKE_SYSTEM_PROCESSOR}) + IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(64BIT 1) + ENDIF() + + IF(CMAKE_SYSTEM_NAME MATCHES "Windows") + SET(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE 0) + SET(DEFAULT_PLATFORM "win") + IF(64BIT) + SET(DEFAULT_MACHINE "x64") + ELSE() + SET(DEFAULT_MACHINE "32") + ENDIF() + ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Linux") + IF(NOT 64BIT AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") + SET(DEFAULT_MACHINE "i686") + ENDIF() + ELSEIF(CMAKE_SYSTEM_NAME MATCHES "SunOS") + # SunOS 5.10=> solaris10 + STRING(REPLACE "5." "" VER "${CMAKE_SYSTEM_VERSION}") + SET(DEFAULT_PLATFORM "solaris${VER}") + IF(64BIT) + IF(CMAKE_SYSTEM_PROCESSOR MATCHES "i386") + SET(DEFAULT_MACHINE "x86_64") + ELSE() + SET(DEFAULT_MACHINE "${CMAKE_SYSTEM_PROCESSOR}-64bit") + ENDIF() + ENDIF() + ELSEIF(CMAKE_SYSTEM_NAME MATCHES "HP-UX") + STRING(REPLACE "B." "" VER "${CMAKE_SYSTEM_VERSION}") + SET(DEFAULT_PLATFORM "hpux${VER}") + IF(64BIT) + SET(DEFAULT_MACHINE "${CMAKE_SYSTEM_PROCESSOR}-64bit") + ENDIF() + ELSEIF(CMAKE_SYSTEM_NAME MATCHES "AIX") + SET(DEFAULT_PLATFORM "${CMAKE_SYSTEM_NAME}5.${CMAKE_SYSTEM_VERSION}") + IF(64BIT) + SET(DEFAULT_MACHINE "${CMAKE_SYSTEM_PROCESSOR}-64bit") + ENDIF() + ELSEIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + STRING(REGEX MATCH "[0-9]+\\.[0-9]+" VER "${CMAKE_SYSTEM_VERSION}") + SET(DEFAULT_PLATFORM "${CMAKE_SYSTEM_NAME}${VER}") + IF(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64") + SET(DEFAULT_MACHINE "x86_64") + IF(NOT 64BIT) + SET(DEFAULT_MACHINE "i386") + ENDIF() + ENDIF() + ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Darwin") + IF(${CMAKE_OSX_DEPLOYMENT_TARGET}) + SET(VER "${CMAKE_OSX_DEPLOYMENT_TARGET}") + ELSE() + SET(VER "${CMAKE_SYSTEM_VERSION}") + ENDIF() + STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" VER "${VER}") + MATH(EXPR VER "${VER} -4") + SET(DEFAULT_PLATFORM "osx10.${VER}") + LIST(LENGTH CMAKE_OSX_ARCHITECTURES LEN) + IF(LEN GREATER 1) + SET(DEFAULT_MACHINE "universal") + ELSE() + SET(DEFAULT_MACHINE "${CMAKE_OSX_ARCHITECTURES}") + ENDIF() + IF(DEFAULT_MACHINE MATCHES "i386") + SET(DEFAULT_MACHINE "x86") + ENDIF() + ENDIF() + + IF(NOT PLATFORM) + SET(PLATFORM ${DEFAULT_PLATFORM}) + ENDIF() + IF(NOT MACHINE) + SET(MACHINE ${DEFAULT_MACHINE}) + ENDIF() + + IF(NEED_DASH_BETWEEN_PLATFORM_AND_MACHINE) + SET(SYSTEM_NAME_AND_PROCESSOR "${PLATFORM}-${MACHINE}") + ELSE() + SET(SYSTEM_NAME_AND_PROCESSOR "${PLATFORM}${MACHINE}") + ENDIF() + ENDIF() + + IF(SHORT_PRODUCT_TAG) + SET(PRODUCT_TAG "-${SHORT_PRODUCT_TAG}") + ELSEIF(MYSQL_SERVER_SUFFIX) + SET(PRODUCT_TAG "${MYSQL_SERVER_SUFFIX}") # Already has a leading dash + ELSE() + SET(PRODUCT_TAG) + ENDIF() + + SET(package_name "mysql${PRODUCT_TAG}-${VERSION}-${SYSTEM_NAME_AND_PROCESSOR}") + + # Sometimes package suffix is added (something like "-icc-glibc23") + IF(PACKAGE_SUFFIX) + SET(package_name "${package_name}${PACKAGE_SUFFIX}") + ENDIF() + STRING(TOLOWER ${package_name} package_name) + SET(${Var} ${package_name}) +ENDMACRO() diff --git a/include/my_atomic.h b/include/my_atomic.h index b506aa7d3d1..9914fd2428f 100644 --- a/include/my_atomic.h +++ b/include/my_atomic.h @@ -105,7 +105,7 @@ warning: 'transparent_union' attribute ignored */ #if defined(__GNUC__) && !defined(__cplusplus) && \ - ! (defined(__APPLE__) && defined(_ARCH_PPC64)) + ! (defined(__APPLE__) && (defined(_ARCH_PPC64) ||defined (_ARCH_PPC))) /* we want to be able to use my_atomic_xxx functions with both signed and unsigned integers. But gcc will issue a warning diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 4c7e16b802d..ee58c33c6f7 100755 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -121,10 +121,13 @@ IF(NOT WITHOUT_DYNAMIC_PLUGINS) FILE(TO_NATIVE_PATH ${LOC} LOC) SET (LIB_LOCATIONS ${LIB_LOCATIONS} ${LOC}) ENDFOREACH (CORELIB ${MYSQLD_CORE_LIBS}) - + SET(_PLATFORM x86) + IF(CMAKE_SIZEOF_VOID_P EQUAL 8) + SET(_PLATFORM x64) + ENDIF() ADD_CUSTOM_COMMAND(TARGET mysqld PRE_LINK - COMMAND echo ${PLATFORM} && cscript ARGS //nologo ${PROJECT_SOURCE_DIR}/win/create_def_file.js - ${PLATFORM} ${LIB_LOCATIONS} > mysqld.def + COMMAND echo ${_PLATFORM} && cscript ARGS //nologo ${PROJECT_SOURCE_DIR}/win/create_def_file.js + ${_PLATFORM} ${LIB_LOCATIONS} > mysqld.def WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) ADD_DEPENDENCIES(sql GenError) ENDIF() |