Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 1 | From 6db2a606196fb38a6d106dc409eee1cb9a40a440 Mon Sep 17 00:00:00 2001 |
| 2 | From: Tor Didriksen <tor.didriksen@oracle.com> |
| 3 | Date: Mon, 24 Jun 2013 17:15:35 +0200 |
| 4 | Subject: [PATCH] Bug#16809055 MYSQL 5.6 AND 5.7 STILL USE LIBMYSQLCLIENT.SO.18 |
| 5 | |
| 6 | With this patch, the libmysql/ directory contains: |
| 7 | libmysqlclient.a |
| 8 | libmysqlclient_r.a -> libmysqlclient.a |
| 9 | libmysqlclient_r.so -> libmysqlclient.so* |
| 10 | libmysqlclient_r.so.18 -> libmysqlclient.so.18* |
| 11 | libmysqlclient_r.so.18.1.0 -> libmysqlclient.so.18.1.0* |
| 12 | libmysqlclient.so -> libmysqlclient.so.18* |
| 13 | libmysqlclient.so.18 -> libmysqlclient.so.18.1.0* |
| 14 | libmysqlclient.so.18.1.0* |
| 15 | |
| 16 | This fixes libmysqlclient_r symlinks pointing to the unversioned |
| 17 | libmysqlclient.so symlink (leading to package QA errors since the |
| 18 | libmysqlclient-r package ends up depending on libmysqlclient-dev). |
| 19 | |
| 20 | Borrowed from MySQL 5.6 tree at https://github.com/percona/mysql/ |
| 21 | |
| 22 | Upstream-Status: Pending |
| 23 | |
| 24 | Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> |
| 25 | |
| 26 | --- |
| 27 | cmake/install_macros.cmake | 25 +++++++++++++++---------- |
| 28 | libmysql/CMakeLists.txt | 34 +++++++++++++++++++++++++++------- |
| 29 | 2 files changed, 42 insertions(+), 17 deletions(-) |
| 30 | |
| 31 | diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake |
| 32 | index b8efdf8..a0d0e68 100644 |
| 33 | --- a/cmake/install_macros.cmake |
| 34 | +++ b/cmake/install_macros.cmake |
| 35 | @@ -1,4 +1,4 @@ |
| 36 | -# Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. |
| 37 | +# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. |
| 38 | # |
| 39 | # This program is free software; you can redistribute it and/or modify |
| 40 | # it under the terms of the GNU General Public License as published by |
| 41 | @@ -167,28 +167,33 @@ ENDFUNCTION() |
| 42 | |
| 43 | |
| 44 | # Install symbolic link to CMake target. |
| 45 | -# the link is created in the same directory as target |
| 46 | -# and extension will be the same as for target file. |
| 47 | -MACRO(INSTALL_SYMLINK linkname target destination component) |
| 48 | +# We do 'cd path; ln -s target_name link_name' |
| 49 | +# We also add an INSTALL target for "${path}/${link_name}" |
| 50 | +MACRO(INSTALL_SYMLINK target target_name link_name destination component) |
| 51 | IF(UNIX) |
| 52 | GET_TARGET_PROPERTY(location ${target} LOCATION) |
| 53 | GET_FILENAME_COMPONENT(path ${location} PATH) |
| 54 | - GET_FILENAME_COMPONENT(name ${location} NAME) |
| 55 | - SET(output ${path}/${linkname}) |
| 56 | + MESSAGE(STATUS "target ${target}") |
| 57 | + MESSAGE(STATUS "link_name ${link_name}") |
| 58 | + MESSAGE(STATUS "target_name ${target_name}") |
| 59 | + MESSAGE(STATUS "path ${path}") |
| 60 | + MESSAGE(STATUS "") |
| 61 | + |
| 62 | + SET(output ${path}/${link_name}) |
| 63 | ADD_CUSTOM_COMMAND( |
| 64 | OUTPUT ${output} |
| 65 | COMMAND ${CMAKE_COMMAND} ARGS -E remove -f ${output} |
| 66 | COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink |
| 67 | - ${name} |
| 68 | - ${linkname} |
| 69 | + ${target_name} |
| 70 | + ${link_name} |
| 71 | WORKING_DIRECTORY ${path} |
| 72 | DEPENDS ${target} |
| 73 | ) |
| 74 | |
| 75 | - ADD_CUSTOM_TARGET(symlink_${linkname} |
| 76 | + ADD_CUSTOM_TARGET(symlink_${link_name} |
| 77 | ALL |
| 78 | DEPENDS ${output}) |
| 79 | - SET_TARGET_PROPERTIES(symlink_${linkname} PROPERTIES CLEAN_DIRECT_OUTPUT 1) |
| 80 | + SET_TARGET_PROPERTIES(symlink_${link_name} PROPERTIES CLEAN_DIRECT_OUTPUT 1) |
| 81 | IF(CMAKE_GENERATOR MATCHES "Xcode") |
| 82 | # For Xcode, replace project config with install config |
| 83 | STRING(REPLACE "${CMAKE_CFG_INTDIR}" |
| 84 | diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt |
| 85 | index be5760f..96286ff 100644 |
| 86 | --- a/libmysql/CMakeLists.txt |
| 87 | +++ b/libmysql/CMakeLists.txt |
| 88 | @@ -433,6 +433,12 @@ IF(MSVC) |
| 89 | INSTALL_DEBUG_TARGET(clientlib DESTINATION ${INSTALL_LIBDIR}/debug) |
| 90 | ENDIF() |
| 91 | |
| 92 | +MACRO(GET_TARGET_NAME target out_name) |
| 93 | + GET_TARGET_PROPERTY(location ${target} LOCATION) |
| 94 | + GET_FILENAME_COMPONENT(name ${location} NAME) |
| 95 | + SET(${out_name} ${name}) |
| 96 | +ENDMACRO() |
| 97 | + |
| 98 | IF(UNIX) |
| 99 | MACRO(GET_VERSIONED_LIBNAME LIBNAME EXTENSION VERSION OUTNAME) |
| 100 | SET(DOT_VERSION ".${VERSION}") |
| 101 | @@ -445,7 +451,13 @@ IF(UNIX) |
| 102 | SET(${OUTNAME} ${LIBNAME}${EXTENSION}${DOT_VERSION}) |
| 103 | ENDIF() |
| 104 | ENDMACRO() |
| 105 | - INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a mysqlclient ${INSTALL_LIBDIR} Development) |
| 106 | +ENDIF() |
| 107 | + |
| 108 | +IF(UNIX) |
| 109 | + GET_TARGET_NAME(mysqlclient lib_name) |
| 110 | + INSTALL_SYMLINK(mysqlclient |
| 111 | + ${lib_name} ${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a |
| 112 | + ${INSTALL_LIBDIR} Development) |
| 113 | ENDIF() |
| 114 | |
| 115 | IF(NOT DISABLE_SHARED) |
| 116 | @@ -456,10 +468,9 @@ IF(NOT DISABLE_SHARED) |
| 117 | # libtool compatability |
| 118 | IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE) |
| 119 | SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}") |
| 120 | - ELSEIF(CMAKE_SYSTEM_NAME MATCHES "HP-UX") |
| 121 | - SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}.0") |
| 122 | ELSE() |
| 123 | - SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}.0.0") |
| 124 | + SET(OS_SHARED_LIB_VERSION |
| 125 | + "${SHARED_LIB_MAJOR_VERSION}.${SHARED_LIB_MINOR_VERSION}.0") |
| 126 | ENDIF() |
| 127 | # Name of shared library is mysqlclient on Unix |
| 128 | SET_TARGET_PROPERTIES(libmysql PROPERTIES |
| 129 | @@ -482,8 +493,13 @@ IF(NOT DISABLE_SHARED) |
| 130 | "${CMAKE_SHARED_LIBRARY_SUFFIX}" |
| 131 | "" |
| 132 | linkname) |
| 133 | - INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} SharedLibraries) |
| 134 | - SET(OS_SHARED_LIB_SYMLINKS "${SHARED_LIB_MAJOR_VERSION}" "${OS_SHARED_LIB_VERSION}") |
| 135 | + GET_TARGET_NAME(libmysql lib_name) |
| 136 | + GET_FILENAME_COMPONENT(lib_name_we ${lib_name} NAME_WE) |
| 137 | + INSTALL_SYMLINK(libmysql |
| 138 | + ${lib_name} ${linkname} |
| 139 | + ${INSTALL_LIBDIR} SharedLibraries) |
| 140 | + SET(OS_SHARED_LIB_SYMLINKS |
| 141 | + "${SHARED_LIB_MAJOR_VERSION}" "${OS_SHARED_LIB_VERSION}") |
| 142 | LIST(REMOVE_DUPLICATES OS_SHARED_LIB_SYMLINKS) |
| 143 | FOREACH(ver ${OS_SHARED_LIB_SYMLINKS}) |
| 144 | GET_VERSIONED_LIBNAME( |
| 145 | @@ -491,7 +507,11 @@ IF(NOT DISABLE_SHARED) |
| 146 | "${CMAKE_SHARED_LIBRARY_SUFFIX}" |
| 147 | "${ver}" |
| 148 | linkname) |
| 149 | - INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} SharedLibraries) |
| 150 | + GET_VERSIONED_LIBNAME( |
| 151 | + ${lib_name_we} "${CMAKE_SHARED_LIBRARY_SUFFIX}" "${ver}" lib_name_ver) |
| 152 | + INSTALL_SYMLINK(libmysql |
| 153 | + ${lib_name_ver} ${linkname} |
| 154 | + ${INSTALL_LIBDIR} SharedLibraries) |
| 155 | ENDFOREACH() |
| 156 | ENDIF() |
| 157 | ENDIF() |
| 158 | -- |
| 159 | 2.0.3 |
| 160 | |