Skip to content

Commit 7036ee0

Browse files
author
Paweł Andruszkiewicz
committed
Write RPATH to mysql_config_editor only if OpenSSL is bundled
Change-Id: I7e698ef555cb3640526583dd01a83f40abcd4c40 (cherry picked from commit 5e7ac5fcca76266c879d16916f3efa7034807287)
1 parent 7d964fe commit 7036ee0

File tree

2 files changed

+19
-6
lines changed

2 files changed

+19
-6
lines changed

cmake/exeutils.cmake

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,15 @@ endfunction()
126126

127127
function(install_bundled_binaries)
128128
set(options)
129-
set(oneValueArgs DESTINATION TARGET)
129+
set(oneValueArgs DESTINATION TARGET WRITE_RPATH)
130130
set(multiValueArgs BINARIES)
131131
cmake_parse_arguments(INSTALL_BUNDLED "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
132132

133+
if(NOT DEFINED INSTALL_BUNDLED_WRITE_RPATH)
134+
# if not explicitly specified, we always add an RPATH
135+
set(INSTALL_BUNDLED_WRITE_RPATH TRUE)
136+
endif()
137+
133138
if(WIN32 AND (INSTALL_BUNDLED_DESTINATION STREQUAL INSTALL_LIBDIR OR INSTALL_BUNDLED_DESTINATION MATCHES "^${INSTALL_LIBDIR}/.*"))
134139
# on Windows, if files should be installed in the 'lib' directory, we install them in the 'bin' directory instead
135140
set(INSTALL_BUNDLED_DESTINATION "${INSTALL_BINDIR}")
@@ -141,8 +146,9 @@ function(install_bundled_binaries)
141146
if(NOT IS_SYMLINK "${SOURCE_BINARY}")
142147
message(STATUS "Bundling binary: ${SOURCE_BINARY}, installation directory: ${INSTALL_BUNDLED_DESTINATION}")
143148
if(LINUX)
144-
# we always add an RPATH, if we bundle a binary, then for sure it is going to use one of the other libraries
145-
write_rpath(BINARY "${SOURCE_BINARY}" DESTINATION "${INSTALL_BUNDLED_DESTINATION}" TARGET ${INSTALL_BUNDLED_TARGET})
149+
if(INSTALL_BUNDLED_WRITE_RPATH)
150+
write_rpath(BINARY "${SOURCE_BINARY}" DESTINATION "${INSTALL_BUNDLED_DESTINATION}" TARGET ${INSTALL_BUNDLED_TARGET})
151+
endif()
146152
elseif(APPLE)
147153
# if we bundle OpenSSL, then we want the bundled binary to use it instead of the system one
148154
if(BUNDLED_OPENSSL)

mysql-secret-store/login-path/CMakeLists.txt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2018, 2022, Oracle and/or its affiliates.
1+
# Copyright (c) 2018, 2023, Oracle and/or its affiliates.
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, version 2.0,
@@ -45,6 +45,13 @@ set(helper_libs
4545
add_helper_executable()
4646

4747
# If defined, installs the mysql_config_editor binary into the shell bundle
48-
IF (BUNDLED_MYSQL_CONFIG_EDITOR)
49-
install_bundled_binaries(BINARIES "${BUNDLED_MYSQL_CONFIG_EDITOR}" DESTINATION "${INSTALL_LIBEXECDIR}" TARGET mysql-secret-store-login-path)
48+
IF(BUNDLED_MYSQL_CONFIG_EDITOR)
49+
# there are some issues in case of RPM builds if an ELF is patched with patchelf < 0.16.0 and then binary is stripped;
50+
# we don't bundle OpenSSL there, so we make patching conditional
51+
IF(BUNDLED_OPENSSL)
52+
SET(WRITE_RPATH TRUE)
53+
ELSE()
54+
SET(WRITE_RPATH FALSE)
55+
ENDIF()
56+
install_bundled_binaries(BINARIES "${BUNDLED_MYSQL_CONFIG_EDITOR}" DESTINATION "${INSTALL_LIBEXECDIR}" TARGET mysql-secret-store-login-path WRITE_RPATH ${WRITE_RPATH})
5057
ENDIF()

0 commit comments

Comments
 (0)