File tree Expand file tree Collapse file tree 4 files changed +72
-2
lines changed Expand file tree Collapse file tree 4 files changed +72
-2
lines changed Original file line number Diff line number Diff line change @@ -896,6 +896,33 @@ IF (WITH_SSL_PATH AND (APPLE OR WIN32 OR LINUX_STANDALONE))
896
896
MESSAGE (STATUS "CRYPTO_FULL_NAME ${CRYPTO_FULL_NAME} " )
897
897
MESSAGE (STATUS "OPENSSL_FULL_NAME ${OPENSSL_FULL_NAME} " )
898
898
ENDIF ()
899
+
900
+ FIND_PATH (OPENSSL_MODULES_DIR
901
+ NAMES ossl-modules
902
+ NO_CMAKE_PATH
903
+ NO_CMAKE_ENVIRONMENT_PATH
904
+ HINTS ${WITH_SSL_PATH}
905
+ PATH_SUFFIXES lib lib64
906
+ )
907
+
908
+ IF (OPENSSL_MODULES_DIR )
909
+ SET (OPENSSL_MODULES_DIR "${OPENSSL_MODULES_DIR} /ossl-modules" )
910
+ FILE (TO_CMAKE_PATH "${OPENSSL_MODULES_DIR} " OPENSSL_MODULES_DIR )
911
+ MESSAGE (STATUS "OPENSSL_MODULES_DIR ${OPENSSL_MODULES_DIR} " )
912
+
913
+ IF (WIN32 )
914
+ SET (_module_ext "dll" )
915
+ ELSEIF (APPLE )
916
+ SET (_module_ext "dylib" )
917
+ ELSE ()
918
+ SET (_module_ext "so" )
919
+ ENDIF ()
920
+
921
+ FILE (GLOB OPENSSL_MODULES_LIST "${OPENSSL_MODULES_DIR} /*.${_module_ext} " )
922
+ MESSAGE (STATUS "OPENSSL_MODULES_LIST ${OPENSSL_MODULES_LIST} " )
923
+
924
+ add_definitions (-DBUNDLE_OPENSSL_MODULES )
925
+ ENDIF ()
899
926
ENDIF ()
900
927
901
928
if (NOT BUILD_SOURCE_PACKAGE )
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright (c) 2018, 2020 Oracle and/or its affiliates. All rights reserved .
2
+ * Copyright (c) 2018, 2023 Oracle and/or its affiliates.
3
3
*
4
4
* This program is free software; you can redistribute it and/or modify
5
5
* it under the terms of the GNU General Public License, version 2.0,
22
22
*/
23
23
24
24
#include " shellcore/shell_init.h"
25
+
25
26
#include < curl/curl.h>
26
27
#include < mysql.h>
27
28
#include < stdlib.h>
28
29
#include < stdexcept>
29
30
31
+ #include " mysqlshdk/libs/utils/utils_file.h"
32
+ #include " mysqlshdk/libs/utils/utils_general.h"
33
+ #include " mysqlshdk/libs/utils/utils_path.h"
34
+
30
35
#ifdef HAVE_V8
31
36
namespace shcore {
32
37
extern void JScript_context_init ();
@@ -36,6 +41,23 @@ extern void JScript_context_fini();
36
41
37
42
namespace mysqlsh {
38
43
44
+ namespace {
45
+
46
+ void init_openssl_modules () {
47
+ #ifdef BUNDLE_OPENSSL_MODULES
48
+ constexpr auto k_env_var = " OPENSSL_MODULES" ;
49
+
50
+ // don't override path set by the user
51
+ if (!::getenv (k_env_var)) {
52
+ shcore::setenv (
53
+ k_env_var,
54
+ shcore::path::join_path (shcore::get_library_folder (), " ossl-modules" ));
55
+ }
56
+ #endif
57
+ }
58
+
59
+ } // namespace
60
+
39
61
void thread_init () { mysql_thread_init (); }
40
62
41
63
void thread_end () { mysql_thread_end (); }
@@ -51,6 +73,7 @@ void global_init() {
51
73
52
74
srand (time (0 ));
53
75
curl_global_init (CURL_GLOBAL_ALL);
76
+ init_openssl_modules ();
54
77
}
55
78
56
79
void global_end () {
Original file line number Diff line number Diff line change 1
1
2
- # Copyright (c) 2016, 2022 , Oracle and/or its affiliates.
2
+ # Copyright (c) 2016, 2023 , Oracle and/or its affiliates.
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
5
5
# it under the terms of the GNU General Public License, version 2.0,
@@ -277,6 +277,8 @@ rm -f %{buildroot}%{_datadir}/mysqlsh/{LICENSE,README}
277
277
%if 0%{?bundled_openssl:1}
278
278
%{_prefix}/lib/mysqlsh/libcrypto*
279
279
%{_prefix}/lib/mysqlsh/libssl*
280
+ # we assume OpenSSL3 is bundled and it has the modules
281
+ %{_prefix}/lib/mysqlsh/ossl-modules/*
280
282
%endif
281
283
%if 0%{?bundled_python:1}
282
284
%{_prefix}/lib/mysqlsh/include/python*
Original file line number Diff line number Diff line change @@ -157,6 +157,20 @@ if(BUNDLED_OPENSSL)
157
157
DESTINATION ${INSTALL_BINDIR}
158
158
COMPONENT main
159
159
)
160
+
161
+ IF (OPENSSL_MODULES_DIR )
162
+ # Copy the OpenSSL modules to the build dir (for running tests in build tree)
163
+ ADD_CUSTOM_COMMAND (TARGET mysqlsh POST_BUILD
164
+ COMMAND ${CMAKE_COMMAND} -E make_directory "${CONFIG_BINARY_DIR} /${INSTALL_LIBDIR} /ossl-modules"
165
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different ${OPENSSL_MODULES_LIST}
166
+ "${CONFIG_BINARY_DIR} /${INSTALL_LIBDIR} /ossl-modules" )
167
+
168
+ # Install/bundle the OpenSSL modules
169
+ INSTALL (PROGRAMS ${OPENSSL_MODULES_LIST}
170
+ DESTINATION "${INSTALL_LIBDIR} /ossl-modules"
171
+ COMPONENT main
172
+ )
173
+ ENDIF ()
160
174
ELSE ()
161
175
# Copy the OpenSSL libraries to the build dir (for running tests in build tree)
162
176
ADD_CUSTOM_COMMAND (TARGET mysqlsh POST_BUILD
@@ -204,6 +218,10 @@ if(BUNDLED_OPENSSL)
204
218
COMPONENT main
205
219
)
206
220
ENDIF ()
221
+
222
+ IF (OPENSSL_MODULES_DIR )
223
+ install_bundled_binaries (BINARIES ${OPENSSL_MODULES_LIST} DESTINATION "${INSTALL_LIBDIR} /ossl-modules" TARGET mysqlsh )
224
+ ENDIF ()
207
225
ENDIF ()
208
226
endif ()
209
227
You can’t perform that action at this time.
0 commit comments