From b067390d9f75187144b137e886029262cde5828e Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Mon, 4 Apr 2022 17:33:08 +0200 Subject: [PATCH] - fix building with OpenSSL 3.0, no R(triggerpostun) in rpm.org --- mysql-versioning.patch | 12 +++---- mysql.spec | 28 ++++++++-------- openssl-3.patch | 76 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 19 deletions(-) create mode 100644 openssl-3.patch diff --git a/mysql-versioning.patch b/mysql-versioning.patch index 7847a70..325bd46 100644 --- a/mysql-versioning.patch +++ b/mysql-versioning.patch @@ -1,7 +1,7 @@ -diff -ur percona-server-5.7.35-38.orig/libmysql/libmysql.map percona-server-5.7.35-38/libmysql/libmysql.map ---- percona-server-5.7.35-38.orig/libmysql/libmysql.map 2021-11-24 19:40:24.831614501 +0100 -+++ percona-server-5.7.35-38/libmysql/libmysql.map 2021-11-24 19:41:42.172797763 +0100 -@@ -145,6 +145,7 @@ +diff -urNp -x '*.orig' percona-server-5.7.37-40.org/libmysql/libmysql.map percona-server-5.7.37-40/libmysql/libmysql.map +--- percona-server-5.7.37-40.org/libmysql/libmysql.map 2022-04-04 12:10:54.703864495 +0200 ++++ percona-server-5.7.37-40/libmysql/libmysql.map 2022-04-04 12:11:12.985905674 +0200 +@@ -145,6 +145,7 @@ libmysqlclient_18 { mysql_net_realloc; # PHP's mysqli.so requires this (via the ER() macro) mysql_client_errors; @@ -9,8 +9,8 @@ diff -ur percona-server-5.7.35-38.orig/libmysql/libmysql.map percona-server-5.7. # mydumper requires this (added by remi) my_net_read; }; -@@ -152,4 +153,6 @@ - libperconaserverclient_18_1 { +@@ -152,4 +153,6 @@ libmysqlclient_18 { + libmysqlclient_18_1 { global: get_tty_password; +# for mysql-workbench 6.1 diff --git a/mysql.spec b/mysql.spec index 910bdb0..a73f76b 100644 --- a/mysql.spec +++ b/mysql.spec @@ -44,7 +44,7 @@ %undefine with_tokudb %endif -%define rel 1 +%define rel 2 %define percona_rel 40 Summary: MySQL: a very fast and reliable SQL database engine Summary(de.UTF-8): MySQL: ist eine SQL-Datenbank @@ -84,11 +84,12 @@ Patch0: mysql-opt.patch Patch1: mysql-versioning.patch Patch2: mysql-protobuf.patch Patch3: build.patch -Patch17: mysql-sphinx.patch -Patch18: mysql-5.7-sphinx.patch -Patch19: mysql-chain-certs.patch -Patch20: mysql-dubious-exports.patch -Patch24: mysql-cmake.patch +Patch4: mysql-sphinx.patch +Patch5: mysql-5.7-sphinx.patch +Patch6: mysql-chain-certs.patch +Patch7: mysql-dubious-exports.patch +Patch8: mysql-cmake.patch +Patch9: openssl-3.patch URL: https://www.percona.com/software/mysql-database/percona-server BuildRequires: bison >= 1.875 BuildRequires: cmake >= 2.8.2 @@ -107,7 +108,7 @@ BuildRequires: pam-devel %{?with_autodeps:BuildRequires: perl-DBI} BuildRequires: perl-devel >= 1:5.6.1 BuildRequires: protobuf-devel -BuildRequires: python-modules +BuildRequires: python3-modules BuildRequires: rpcsvc-proto BuildRequires: rpm-perlprov >= 4.1-13 BuildRequires: rpmbuild(macros) >= 1.597 @@ -121,7 +122,7 @@ Requires(pre): /bin/id Requires(pre): /usr/bin/getgid Requires(pre): /usr/sbin/groupadd Requires(pre): /usr/sbin/useradd -Requires(triggerpostun): sed >= 4.0 +Requires(post): sed >= 4.0 Requires: %{name}-charsets = %{version}-%{release} Requires: %{name}-libs = %{version}-%{release} Requires: /usr/bin/setsid @@ -502,12 +503,13 @@ sed -i -e 's#perconaserverclient#mysqlclient#g' libmysql/libmysql.{ver.in,map} s %if %{with sphinx} # http://www.sphinxsearch.com/docs/manual-0.9.9.html#sphinxse-mysql51 %{__mv} sphinx-*/mysqlse storage/sphinx -%patch17 -p1 -%patch18 -p1 +%patch4 -p1 +%patch5 -p1 %endif -%patch19 -p1 -%patch20 -p1 -%patch24 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 # to get these files rebuild [ -f sql/sql_yacc.cc ] && %{__rm} sql/sql_yacc.cc diff --git a/openssl-3.patch b/openssl-3.patch new file mode 100644 index 0000000..79f2f4d --- /dev/null +++ b/openssl-3.patch @@ -0,0 +1,76 @@ +--- mysql-5.7.31/cmake/ssl.cmake.orig 2020-06-02 13:05:42.000000000 +0200 ++++ mysql-5.7.31/cmake/ssl.cmake 2021-09-26 10:27:27.431001078 +0200 +@@ -172,20 +172,28 @@ + # #define OPENSSL_VERSION_NUMBER 0x1000103fL + # Encoded as MNNFFPPS: major minor fix patch status + FILE(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" +- OPENSSL_VERSION_NUMBER +- REGEX "^#[ ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9].*" ++ OPENSSL_VERSION_MAJOR ++ REGEX "^#[ ]*define[\t ]+OPENSSL_VERSION_MAJOR[\t ]+([0-9]+).*" + ) + STRING(REGEX REPLACE +- "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9]).*$" "\\1" +- OPENSSL_MAJOR_VERSION "${OPENSSL_VERSION_NUMBER}" ++ "^#[ ]*define[\t ]+OPENSSL_VERSION_MAJOR[\t ]+([0-9]+).*" "\\1" ++ OPENSSL_MAJOR_VERSION ${OPENSSL_VERSION_MAJOR} ++ ) ++ FILE(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" ++ OPENSSL_VERSION_MINOR ++ REGEX "^#[ ]*define[\t ]+OPENSSL_VERSION_MINOR[\t ]+([0-9]+).*" + ) + STRING(REGEX REPLACE +- "^.*OPENSSL_VERSION_NUMBER[\t ]+0x[0-9]([0-9][0-9]).*$" "\\1" +- OPENSSL_MINOR_VERSION "${OPENSSL_VERSION_NUMBER}" ++ "^#[ ]*define[\t ]+OPENSSL_VERSION_MINOR[\t ]+([0-9]+).*" "\\1" ++ OPENSSL_MINOR_VERSION ${OPENSSL_VERSION_MINOR} ++ ) ++ FILE(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" ++ OPENSSL_VERSION_PATCH ++ REGEX "^#[ ]*define[\t ]+OPENSSL_VERSION_PATCH[\t ]+([0-9]+).*" + ) + STRING(REGEX REPLACE +- "^.*OPENSSL_VERSION_NUMBER[\t ]+0x[0-9][0-9][0-9]([0-9][0-9]).*$" "\\1" +- OPENSSL_FIX_VERSION "${OPENSSL_VERSION_NUMBER}" ++ "^#[ ]*define[\t ]+OPENSSL_VERSION_PATCH[\t ]+([0-9]+).*" "\\1" ++ OPENSSL_FIX_VERSION ${OPENSSL_VERSION_PATCH} + ) + ENDIF() + SET(OPENSSL_VERSION +@@ -203,7 +211,7 @@ + IF(OPENSSL_INCLUDE_DIR AND + OPENSSL_LIBRARY AND + CRYPTO_LIBRARY AND +- OPENSSL_MAJOR_VERSION STREQUAL "1" ++ (OPENSSL_MAJOR_VERSION STREQUAL "1" OR OPENSSL_MAJOR_VERSION STREQUAL "3") + ) + SET(OPENSSL_FOUND TRUE) + ELSE() +--- percona-server-5.7.31-34/sql/mysqld.cc~ 2020-08-15 11:23:18.000000000 +0200 ++++ percona-server-5.7.31-34/sql/mysqld.cc 2021-09-26 16:17:42.275241856 +0200 +@@ -161,6 +161,7 @@ + + #if defined(HAVE_OPENSSL) + #include ++#include + #endif + + #ifndef EMBEDDED_LIBRARY +@@ -3689,15 +3689,15 @@ + static int init_ssl() + { + #ifdef HAVE_OPENSSL +- int fips_mode= FIPS_mode(); ++ int fips_mode = EVP_default_properties_is_fips_enabled(NULL); + if (fips_mode != 0) + { + /* FIPS is enabled, Log warning and Disable it now */ + sql_print_warning( + "Percona Server cannot operate under OpenSSL FIPS mode." + " Disabling FIPS."); +- FIPS_mode_set(0); ++ EVP_set_default_properties(NULL, "fips=no"); + } + #if OPENSSL_VERSION_NUMBER < 0x10100000L + CRYPTO_malloc_init(); + #else /* OPENSSL_VERSION_NUMBER < 0x10100000L */ -- 2.46.0