Skip to content

Commit a6acb35

Browse files
author
Tor Didriksen
committed
Bug#16809055 MYSQL 5.6 AND 5.7 STILL USE LIBMYSQLCLIENT.SO.18
With this patch, the libmysql/ directory contains: libmysqlclient.a libmysqlclient_r.a -> libmysqlclient.a libmysqlclient_r.so -> libmysqlclient.so* libmysqlclient_r.so.18 -> libmysqlclient.so.18* libmysqlclient_r.so.18.1.0 -> libmysqlclient.so.18.1.0* libmysqlclient.so -> libmysqlclient.so.18* libmysqlclient.so.18 -> libmysqlclient.so.18.1.0* libmysqlclient.so.18.1.0*
1 parent dc7ea33 commit a6acb35

3 files changed

Lines changed: 45 additions & 19 deletions

File tree

cmake/install_macros.cmake

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -111,28 +111,33 @@ FUNCTION(INSTALL_SCRIPT)
111111
ENDFUNCTION()
112112

113113
# Install symbolic link to CMake target.
114-
# the link is created in the same directory as target
115-
# and extension will be the same as for target file.
116-
MACRO(INSTALL_SYMLINK linkname target destination component)
114+
# We do 'cd path; ln -s target_name link_name'
115+
# We also add an INSTALL target for "${path}/${link_name}"
116+
MACRO(INSTALL_SYMLINK target target_name link_name destination component)
117117
IF(UNIX)
118118
GET_TARGET_PROPERTY(location ${target} LOCATION)
119119
GET_FILENAME_COMPONENT(path ${location} PATH)
120-
GET_FILENAME_COMPONENT(name ${location} NAME)
121-
SET(output ${path}/${linkname})
120+
MESSAGE(STATUS "target ${target}")
121+
MESSAGE(STATUS "link_name ${link_name}")
122+
MESSAGE(STATUS "target_name ${target_name}")
123+
MESSAGE(STATUS "path ${path}")
124+
MESSAGE(STATUS "")
125+
126+
SET(output ${path}/${link_name})
122127
ADD_CUSTOM_COMMAND(
123128
OUTPUT ${output}
124129
COMMAND ${CMAKE_COMMAND} ARGS -E remove -f ${output}
125130
COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink
126-
${name}
127-
${linkname}
131+
${target_name}
132+
${link_name}
128133
WORKING_DIRECTORY ${path}
129134
DEPENDS ${target}
130135
)
131136

132-
ADD_CUSTOM_TARGET(symlink_${linkname}
137+
ADD_CUSTOM_TARGET(symlink_${link_name}
133138
ALL
134139
DEPENDS ${output})
135-
SET_TARGET_PROPERTIES(symlink_${linkname} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
140+
SET_TARGET_PROPERTIES(symlink_${link_name} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
136141
IF(CMAKE_GENERATOR MATCHES "Xcode")
137142
# For Xcode, replace project config with install config
138143
STRING(REPLACE "${CMAKE_CFG_INTDIR}"

cmake/mysql_version.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -18,6 +18,7 @@
1818
#
1919

2020
SET(SHARED_LIB_MAJOR_VERSION "18")
21+
SET(SHARED_LIB_MINOR_VERSION "1")
2122
SET(PROTOCOL_VERSION "10")
2223
SET(DOT_FRM_VERSION "6")
2324

libmysql/CMakeLists.txt

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
22
#
33
# This program is free software; you can redistribute it and/or modify
44
# it under the terms of the GNU General Public License as published by
@@ -180,6 +180,12 @@ IF(MSVC)
180180
INSTALL_DEBUG_TARGET(mysqlclient DESTINATION ${INSTALL_LIBDIR}/debug)
181181
ENDIF()
182182

183+
MACRO(GET_TARGET_NAME target out_name)
184+
GET_TARGET_PROPERTY(location ${target} LOCATION)
185+
GET_FILENAME_COMPONENT(name ${location} NAME)
186+
SET(${out_name} ${name})
187+
ENDMACRO()
188+
183189
IF(UNIX)
184190
MACRO(GET_VERSIONED_LIBNAME LIBNAME EXTENSION VERSION OUTNAME)
185191
SET(DOT_VERSION ".${VERSION}")
@@ -192,7 +198,13 @@ IF(UNIX)
192198
SET(${OUTNAME} ${LIBNAME}${EXTENSION}${DOT_VERSION})
193199
ENDIF()
194200
ENDMACRO()
195-
INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a mysqlclient ${INSTALL_LIBDIR} Development)
201+
ENDIF()
202+
203+
IF(UNIX)
204+
GET_TARGET_NAME(mysqlclient lib_name)
205+
INSTALL_SYMLINK(mysqlclient
206+
${lib_name} ${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a
207+
${INSTALL_LIBDIR} Development)
196208
ENDIF()
197209

198210
IF(NOT DISABLE_SHARED)
@@ -205,10 +217,9 @@ IF(NOT DISABLE_SHARED)
205217
# libtool compatability
206218
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE)
207219
SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}")
208-
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "HP-UX")
209-
SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}.0")
210220
ELSE()
211-
SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}.0.0")
221+
SET(OS_SHARED_LIB_VERSION
222+
"${SHARED_LIB_MAJOR_VERSION}.${SHARED_LIB_MINOR_VERSION}.0")
212223
ENDIF()
213224
# Name of shared library is mysqlclient on Unix
214225
SET_TARGET_PROPERTIES(libmysql PROPERTIES
@@ -239,16 +250,25 @@ IF(NOT DISABLE_SHARED)
239250
"${CMAKE_SHARED_LIBRARY_SUFFIX}"
240251
""
241252
linkname)
242-
INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} SharedLibraries)
243-
SET(OS_SHARED_LIB_SYMLINKS "${SHARED_LIB_MAJOR_VERSION}" "${OS_SHARED_LIB_VERSION}")
253+
GET_TARGET_NAME(libmysql lib_name)
254+
GET_FILENAME_COMPONENT(lib_name_we ${lib_name} NAME_WE)
255+
INSTALL_SYMLINK(libmysql
256+
${lib_name} ${linkname}
257+
${INSTALL_LIBDIR} SharedLibraries)
258+
SET(OS_SHARED_LIB_SYMLINKS
259+
"${SHARED_LIB_MAJOR_VERSION}" "${OS_SHARED_LIB_VERSION}")
244260
LIST(REMOVE_DUPLICATES OS_SHARED_LIB_SYMLINKS)
245261
FOREACH(ver ${OS_SHARED_LIB_SYMLINKS})
246262
GET_VERSIONED_LIBNAME(
247263
"${CMAKE_SHARED_LIBRARY_PREFIX}mysqlclient_r"
248264
"${CMAKE_SHARED_LIBRARY_SUFFIX}"
249265
"${ver}"
250266
linkname)
251-
INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} SharedLibraries)
267+
GET_VERSIONED_LIBNAME(
268+
${lib_name_we} "${CMAKE_SHARED_LIBRARY_SUFFIX}" "${ver}" lib_name_ver)
269+
INSTALL_SYMLINK(libmysql
270+
${lib_name_ver} ${linkname}
271+
${INSTALL_LIBDIR} SharedLibraries)
252272
ENDFOREACH()
253273
ENDIF()
254274
ENDIF()

0 commit comments

Comments
 (0)