Skip to content

Commit

Permalink
openssl: improve version checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Doekin committed Dec 31, 2024
1 parent dbe0b01 commit 977b69c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
20 changes: 12 additions & 8 deletions packages/o/openssl/configure/patch.lua
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
10 changes: 5 additions & 5 deletions packages/o/openssl/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 977b69c

Please sign in to comment.