From 977b69ccb3bf9bdf1f09b560989dee56d4102048 Mon Sep 17 00:00:00 2001 From: Chan Lee Date: Tue, 31 Dec 2024 21:33:39 +0800 Subject: [PATCH] openssl: improve version checks --- packages/o/openssl/configure/patch.lua | 20 ++++++++++++-------- packages/o/openssl/xmake.lua | 10 +++++----- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/packages/o/openssl/configure/patch.lua b/packages/o/openssl/configure/patch.lua index 78bbde2d9a4..5070202c843 100644 --- a/packages/o/openssl/configure/patch.lua +++ b/packages/o/openssl/configure/patch.lua @@ -1,4 +1,4 @@ -function _fix_overlong_make_recipe() +function _fix_overlong_make_recipe(package) -- In the MSYS environment, the make recipe can be too long to execute. -- This patch is adapted from OpenSSL 3. -- For more details, see: https://github.com/openssl/openssl/issues/12116 @@ -144,23 +144,27 @@ function _fix_overlong_make_recipe() "EOF") end -function _remove_unused_pod_usage() +function _remove_unused_pod_usage(package) -- Perl in "Git for Windows" lacks Pod::Usage, which is only used for help messages in the Configure script. -- It is not needed for the build and can be safely removed to avoid errors from the missing module. + if package:version():le("1.1.0") then + return + end io.replace("Configure", "use Pod::Usage;", "", {plain = true}) io.replace("Configure", "pod2usage.-;", "") end -function _replace_NUL_with_null() +function _replace_NUL_with_null(package) -- The Configure script uses "NUL" to redirect output on Windows when checking NASM. -- Creating a file named "NUL" can cause issues because "NUL" is a reserved name in Windows. + if package:version():le("1.1.0") then + return + end io.replace("Configurations/10-main.conf", "NUL", "null", {plain = true}) end function main(package) - _remove_unused_pod_usage() - if not package:gitref() and package:version():ge("1.1.1") then - _replace_NUL_with_null() - _fix_overlong_make_recipe() - end + _remove_unused_pod_usage(package) + _replace_NUL_with_null(package) + _fix_overlong_make_recipe(package) end diff --git a/packages/o/openssl/xmake.lua b/packages/o/openssl/xmake.lua index ac178edca72..34a29bf0e02 100644 --- a/packages/o/openssl/xmake.lua +++ b/packages/o/openssl/xmake.lua @@ -76,7 +76,7 @@ package("openssl") "and it takes priority in your system.") end - if not package:gitref() and package:version():lt("1.1.1") then + if package:version():le("1.1.0") then wprint("package(openssl): Building OpenSSL versions earlier than 1.1.1 may fail due to unresolved bugs. If you encounter build issues, please consider using a newer version.") end end) @@ -86,7 +86,7 @@ package("openssl") import("package.tools.jom", {try = true}) import("package.tools.nmake") local configs = {"Configure"} - if not package:gitref() and package:version():ge("1.1.1") then + if not package:version():le("1.1.0") then table.insert(configs, "no-tests") end local target @@ -103,14 +103,14 @@ package("openssl") table.insert(configs, package:config("shared") and "shared" or "no-shared") table.insert(configs, "--prefix=" .. package:installdir()) table.insert(configs, "--openssldir=" .. package:installdir()) - if jom and (not package:gitref() and package:version():ge("1.1.1")) then + if jom and not package:version():le("1.1.0") then table.insert(configs, "no-makedepend") table.insert(configs, "/FS") end import("configure.patch")(package) os.vrunv("perl", configs) - if jom and (not package:gitref() and package:version():ge("1.1.1")) then + if jom and not package:version():le("1.1.0") then jom.build(package) jom.make(package, {"install_sw"}) else @@ -121,7 +121,7 @@ package("openssl") on_install("linux", "macosx", "bsd", "cross", "android", "iphoneos", "mingw", function (package) -- https://wiki.openssl.org/index.php/Compilation_and_Installation#PREFIX_and_OPENSSLDIR - local configs = (not package:gitref() and package:version():ge("1.1.1")) and {"no-tests"} or {} + local configs = (not package:version():le("1.1.0")) and {"no-tests"} or {} if package:is_cross() or package:is_plat("mingw") then local target_plat, target_arch if package:is_plat("macosx") then