[nginx] Win32: OpenSSL compilation for x64 targets with MSVC.
Sergey Kandaurov
pluknet at nginx.com
Fri Feb 24 10:32:45 UTC 2023
details: https://hg.nginx.org/nginx/rev/3c4d81ea1338
branches:
changeset: 8129:3c4d81ea1338
user: Maxim Dounin <mdounin at mdounin.ru>
date: Thu Feb 23 18:16:08 2023 +0300
description:
Win32: OpenSSL compilation for x64 targets with MSVC.
To ensure proper target selection the NGX_MACHINE variable is now set
based on the MSVC compiler output, and the OpenSSL target is set based
on it.
This is not important as long as "no-asm" is used (as in misc/GNUmakefile
and win32 build instructions), but might be beneficial if someone is trying
to build OpenSSL with assembler code.
diffstat:
auto/cc/msvc | 15 +++++++++++++++
auto/lib/openssl/make | 15 ++++++++++++++-
auto/lib/openssl/makefile.msvc | 2 +-
3 files changed, 30 insertions(+), 2 deletions(-)
diffs (66 lines):
diff -r 79c04253bc43 -r 3c4d81ea1338 auto/cc/msvc
--- a/auto/cc/msvc Thu Feb 23 18:15:59 2023 +0300
+++ b/auto/cc/msvc Thu Feb 23 18:16:08 2023 +0300
@@ -22,6 +22,21 @@ have=NGX_COMPILER value="\"cl $NGX_MSVC_
ngx_msvc_ver=`echo $NGX_MSVC_VER | sed -e 's/^\([0-9]*\).*/\1/'`
+# detect x64 builds
+
+case "$NGX_MSVC_VER" in
+
+ *x64)
+ NGX_MACHINE=amd64
+ ;;
+
+ *)
+ NGX_MACHINE=i386
+ ;;
+
+esac
+
+
# optimizations
# maximize speed, equivalent to -Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy
diff -r 79c04253bc43 -r 3c4d81ea1338 auto/lib/openssl/make
--- a/auto/lib/openssl/make Thu Feb 23 18:15:59 2023 +0300
+++ b/auto/lib/openssl/make Thu Feb 23 18:16:08 2023 +0300
@@ -7,11 +7,24 @@ case "$CC" in
cl)
+ case "$NGX_MACHINE" in
+
+ amd64)
+ OPENSSL_TARGET=VC-WIN64A
+ ;;
+
+ *)
+ OPENSSL_TARGET=VC-WIN32
+ ;;
+
+ esac
+
cat << END >> $NGX_MAKEFILE
$OPENSSL/openssl/include/openssl/ssl.h: $NGX_MAKEFILE
\$(MAKE) -f auto/lib/openssl/makefile.msvc \
- OPENSSL="$OPENSSL" OPENSSL_OPT="$OPENSSL_OPT"
+ OPENSSL="$OPENSSL" OPENSSL_OPT="$OPENSSL_OPT" \
+ OPENSSL_TARGET="$OPENSSL_TARGET"
END
diff -r 79c04253bc43 -r 3c4d81ea1338 auto/lib/openssl/makefile.msvc
--- a/auto/lib/openssl/makefile.msvc Thu Feb 23 18:15:59 2023 +0300
+++ b/auto/lib/openssl/makefile.msvc Thu Feb 23 18:16:08 2023 +0300
@@ -6,7 +6,7 @@
all:
cd $(OPENSSL)
- perl Configure VC-WIN32 no-shared no-threads \
+ perl Configure $(OPENSSL_TARGET) no-shared no-threads \
--prefix="%cd%/openssl" \
--openssldir="%cd%/openssl/ssl" \
$(OPENSSL_OPT)
More information about the nginx-devel
mailing list