]> git.kaiwu.me - nginx.git/commitdiff
Win32: OpenSSL compilation for x64 targets with MSVC.
authorMaxim Dounin <mdounin@mdounin.ru>
Thu, 23 Feb 2023 15:16:08 +0000 (18:16 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Thu, 23 Feb 2023 15:16:08 +0000 (18:16 +0300)
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.

auto/cc/msvc
auto/lib/openssl/make
auto/lib/openssl/makefile.msvc

index d4c0be4c3f272da2caf2617fa0bab6f712d586a6..567bac7bcd22208215d984953c19910bcb0b4bcb 100644 (file)
@@ -22,6 +22,21 @@ have=NGX_COMPILER value="\"cl $NGX_MSVC_VER\"" . auto/define
 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
index 126a23875995253f01539962b333eed3a5aec83a..a7e9369e7d08c99e7ac82df646464953c958935b 100644 (file)
@@ -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
 
index a30b28669004584a7a794ad8d842ec63cbf7a0c7..ed17cde08fad748787b662dfcf3287dd748cbbb8 100644 (file)
@@ -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)