Fix messy code for openssl-1.1.1wa version

(cherry picked from commit 09dedd8c9820bb369b2d722505659f379c6d2c70)
This commit is contained in:
wk333 2024-04-28 15:42:50 +08:00 committed by openeuler-sync-bot
parent f863a0185b
commit a724163170
2 changed files with 37 additions and 1 deletions

View File

@ -11,7 +11,7 @@
Name: cmake
Version: 3.22.0
Release: 8
Release: 9
Summary: Cross-platform make system
License: BSD and MIT and zlib
URL: http://www.cmake.org
@ -27,6 +27,7 @@ Patch2: cmake-mingw-dl.patch
%ifarch sw_64
Patch3: cmake-3.22.0-sw.patch
%endif
Patch4: fix-messy-code-for-openssl-1.1.1wa-version.patch
BuildRequires: coreutils findutils gcc-c++ gcc-gfortran sed
BuildRequires: emacs python3-devel pkgconfig(Qt5Widgets) desktop-file-utils
@ -237,6 +238,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%exclude %{_pkgdocdir}/Copyright.txt
%changelog
* Sun Apr 28 2024 wangkai <13474090681@163.com> - 3.22.0-9
- Fix messy code for openssl-1.1.1wa version
* Fri Feb 2 2024 liyanan <liyanan61@h-partners.com> - 3.22.0-8
- Remove Windows_TemporaryKey.pfx

View File

@ -0,0 +1,32 @@
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index 8474e05c..ac742855 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -520,7 +520,6 @@ if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
from_hex("${OPENSSL_VERSION_PATCH}" _tmp)
# 96 is the ASCII code of 'a' minus 1
math(EXPR OPENSSL_VERSION_PATCH_ASCII "${_tmp} + 96")
- unset(_tmp)
# Once anyone knows how OpenSSL would call the patch versions beyond 'z'
# this should be updated to handle that, too. This has not happened yet
# so it is simply ignored here for now.
@@ -528,6 +527,16 @@ if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
endif ()
set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}")
+
+ if ("${_tmp}" GREATER 26)
+ # openssl version 1.1.1wa get text directly
+ file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_text
+ REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_TEXT[\t ]+\"OpenSSL[^\"]*\".*")
+ string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+[a-zA-Z]+" version_number ${openssl_version_text})
+ set(OPENSSL_VERSION "${version_number}")
+ endif ()
+ unset(_tmp)
+
else ()
# Since OpenSSL 3.0.0, the new version format is MAJOR.MINOR.PATCH and
# a new OPENSSL_VERSION_STR macro contains exactly that
--
2.33.0