-
-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenSSL: improve MinGW support on Windows #6079
Changes from 2 commits
4a58502
4556226
17ea9ac
abe12e9
79e98d4
79c6f04
0e4066b
d5e12bc
661f083
2121619
2cf58d8
43c7fb9
0de6b83
aeecc86
a7144ca
409ef37
6d5fbd8
d6a3f76
c86fa6e
dbe0b01
977b69c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,15 +32,18 @@ package("openssl") | |
if package:is_plat("android") and is_subhost("windows") and os.arch() == "x64" then | ||
-- when building for android on windows, use msys2 perl instead of strawberry-perl to avoid configure issue | ||
package:add("deps", "msys2", {configs = {msystem = "MINGW64", base_devel = true}, private = true}) | ||
elseif is_subhost("windows") and not package:is_precompiled() then | ||
package:add("deps", "nasm", { private = true }) | ||
-- the perl executable found in GitForWindows will fail to build OpenSSL | ||
-- see https://github.com/openssl/openssl/blob/master/NOTES-PERL.md#perl-on-windows | ||
package:add("deps", "strawberry-perl", { system = false, private = true }) | ||
-- check xmake tool jom | ||
import("package.tools.jom", {try = true}) | ||
if jom then | ||
package:add("deps", "jom", {private = true}) | ||
elseif is_subhost("windows") then | ||
package:add("deps", "strawberry-perl", { private = true }) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please share more details about the scenarios where the system Perl might fail? There might be a workaround we can implement to address this issue. Using the system Perl helps save disk space. For your reference, I tested with Perl installed via There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can't reproduce it because I don't remember what happened before. But since there is a clear comment to fix this problem by passing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment indicated that Perl bundled with GitForWindows fails to build OpenSSL. I encountered this issue too at the beginning. The error message is as follows:
I looked into the config script and found that |
||
if package:is_plat("windows") then | ||
package:add("deps", "nasm", { private = true }) | ||
-- check xmake tool jom | ||
import("package.tools.jom", {try = true}) | ||
if jom then | ||
package:add("deps", "jom", {private = true}) | ||
end | ||
else | ||
wprint("package(openssl): OpenSSL should be built in a Unix-like shell (e.g., MSYS2, Git Bash) if not targeting MSVC. " .. | ||
"It seems you are not in such an environment. If you encounter build errors, please consider trying again in a Unix-like shell.") | ||
end | ||
end | ||
end | ||
|
@@ -118,6 +121,9 @@ package("openssl") | |
if package:config("shared") then | ||
os.mkdir("fuzz") | ||
end | ||
|
||
io.replace("Configure", "use Pod::Usage;", "", {plain = true}) | ||
io.replace("Configure", "pod2usage.-;", "") | ||
os.vrunv("perl", configs, {envs = buildenvs}) | ||
import("package.tools.make").build(package) | ||
import("package.tools.make").make(package, {"install_sw"}) | ||
|
@@ -173,6 +179,9 @@ package("openssl") | |
if package:debug() then | ||
table.insert(configs, "--debug") | ||
end | ||
|
||
io.replace("Configure", "use Pod::Usage;", "", {plain = true}) | ||
io.replace("Configure", "pod2usage.-;", "") | ||
local buildenvs = import("package.tools.autoconf").buildenvs(package) | ||
if package:is_cross() then | ||
if is_host("windows") and package:is_plat("android") then | ||
|
@@ -192,5 +201,27 @@ package("openssl") | |
end | ||
end) | ||
on_test(function (package) | ||
assert(package:has_cfuncs("SSL_new", {includes = "openssl/ssl.h"})) | ||
assert(package:check_csnippets({test = [[ | ||
#include <openssl/ssl.h> | ||
|
||
int test(){ | ||
SSL_library_init(); | ||
SSL_load_error_strings(); | ||
SSL_CTX *ctx = SSL_CTX_new(SSLv23_client_method()); | ||
if(ctx == NULL){ | ||
return 1; | ||
} | ||
|
||
SSL *ssl = SSL_new(ctx); | ||
if(ssl == NULL){ | ||
SSL_CTX_free(ctx); | ||
return 1; | ||
} | ||
|
||
SSL_free(ssl); | ||
SSL_CTX_free(ctx); | ||
|
||
return 0; | ||
} | ||
]]})) | ||
end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and why not remove
not package:is_precompiled()
?If you are using the build-artifacts binary, you do not need to compile openssl and install its build dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, there is no
is_precompiled
nowThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but we need is_precompiled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I misunderstood.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are downloading a precompiled binary, then all build dependencies do not need to be installed.
https://github.com/xmake-mirror/build-artifacts/releases?q=openssl&expanded=true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the outer
if not package:is_precompiled() then
might work .xmake-repo/packages/o/openssl/xmake.lua
Lines 30 to 31 in a7144ca