--NzB8fVQJ5HfG6fxh
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline

Now I've managed to cross-compile current CVS tree with
Mingw32 crosscompiler both in static and shared version.
Following changes are needed to the source tree:

1. Configure
1.1. Add -Wl,--export-all to the shared library linker command line
1.2. Add -lws2_32 to list of libraries to link IPV6 stuff (not
compatible with old versions of windows, but my MingW32 runtime
doesn't have libwship6.a). I've found that on our test Win2000
system WINNT/System32 folder contains ws2_32.dll which was brought
by some service pack
1.3. Remove setting of IsMK1MF variable to 1 in case of mingw build
(as suggested by Andy Polyakov above in the thread)
2. Makefile.shared
Define NM variable to hold name of nm program (which also differs
from just nm when cross-compiling)
Replace explicit call to nm by reference to this variable.

3. ssl/ssl_sess.c
Move #include "ssl_locl.h" above
#include
because ssl_locl.h includes e_os.h, which includes winsock2 and
ws2tcp.h, and rand.h includes windows.h, which includes winsock.h if
winsock2.h wasn't previously included

4. crypto/bio/b_sock.c
add #include "e_os.h" to provide neccessary definitions for IPV6
stuff
5. engines/ccgost/gost_eng.c
Remove __declspec(dllexport) before IMPLEMENT_DYNAMIC_CHECK_FN
and IMPLEMENT_DYNAMIC_BIND_FN macros. These macros now include
OPENSSL_EXPORT which expands to appropriate declspec under Win32.




--NzB8fVQJ5HfG6fxh
Content-Type: text/plain; charset=koi8-r
Content-Disposition: attachment; filename="mingw32.patch"

Index: Configure
================================================== =================
RCS file: /cvs-openssl/openssl/Configure,v
retrieving revision 1.541
diff -u -r1.541 Configure
--- Configure 17 Oct 2006 13:38:08 -0000 1.541
+++ Configure 20 Oct 2006 11:37:38 -0000
@@ -475,7 +475,7 @@
"BC-32","bcc32::::WIN32::BN_LLONG DES_PTR RC4_INDEX EXPORT_VAR_AS_FN:${no_asm}:win32",

# MinGW
-"mingw", "gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall -D_WIN32_WINNT=0x333:::MINGW32:-lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-mno-cygwin -shared:.dll.a",
+"mingw", "gcc:-mno-cygwin -DL_ENDIAN -fomit-frame-pointer -O3 -march=i486 -Wall -D_WIN32_WINNT=0x333:::MINGW32:-lws2_32 -lwsock32 -lgdi32:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts} EXPORT_VAR_AS_FN:${x86_coff_asm}:win32:cygwin-shared:-D_WINDLL -DOPENSSL_USE_APPLINK:-Wl,--export-all -mno-cygwin -shared:.dll.a",

# UWIN
"UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
@@ -930,7 +930,6 @@

my $IsMK1MF=scalar grep /^$target$/,@MK1MF_Builds;

-$IsMK1MF=1 if ($target eq "mingw" && $^O ne "cygwin" && !is_msys());

$exe_ext=".exe" if ($target eq "Cygwin" || $target eq "DJGPP" || $target eq "mingw");
$exe_ext=".pm" if ($target =~ /vos/);
@@ -1832,10 +1831,4 @@
return $errorcnt;
}

-# Attempt to detect MSYS environment

-sub is_msys
- {
- return 1 if (exists $ENV{"TERM"} && $ENV{"TERM"} eq "msys");
- return 0;
- }
Index: Makefile.shared
================================================== =================
RCS file: /cvs-openssl/openssl/Makefile.shared,v
retrieving revision 1.57
diff -u -r1.57 Makefile.shared
--- Makefile.shared 20 May 2006 08:52:34 -0000 1.57
+++ Makefile.shared 20 Oct 2006 11:37:38 -0000
@@ -7,6 +7,7 @@

# CC contains the current compiler. This one MUST be defined
CC=cc
+NM=nm
CFLAGS=$(CFLAG)
# LDFLAGS contains flags to be used when temporary object files (when building
# shared libraries) are created, or when an application is linked.
@@ -101,7 +102,7 @@
LIBDEPS="$${LIBDEPS:-$(LIBDEPS)}"; \
SHAREDCMD="$${SHAREDCMD:-$(CC)}"; \
SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
- nm -Pg $$SHOBJECTS | grep ' [BDT] ' | cut -f1 -d' ' > lib$(LIBNAME).exp; \
+ $(NM) -Pg $$SHOBJECTS | grep ' [BDT] ' | cut -f1 -d' ' > lib$(LIBNAME).exp; \
LIBPATH=`for x in $$LIBDEPS; do if echo $$x | grep '^ *-L' > /dev/null 2>&1; then echo $$x | sed -e 's/^ *-L//'; fi; done | uniq`; \
LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
Index: crypto/bio/b_sock.c
================================================== =================
RCS file: /cvs-openssl/openssl/crypto/bio/b_sock.c,v
retrieving revision 1.46
diff -u -r1.46 b_sock.c
--- crypto/bio/b_sock.c 11 Apr 2006 21:34:18 -0000 1.46
+++ crypto/bio/b_sock.c 20 Oct 2006 11:37:38 -0000
@@ -60,6 +60,7 @@
#include
#include
#define USE_SOCKETS
+#include "e_os.h"
#include "cryptlib.h"
#include
#if defined(OPENSSL_SYS_NETWARE) && defined(NETWARE_BSDSOCK)
Index: ssl/ssl_sess.c
================================================== =================
RCS file: /cvs-openssl/openssl/ssl/ssl_sess.c,v
retrieving revision 1.62
diff -u -r1.62 ssl_sess.c
--- ssl/ssl_sess.c 30 Mar 2006 02:44:56 -0000 1.62
+++ ssl/ssl_sess.c 20 Oct 2006 11:37:38 -0000
@@ -136,9 +136,9 @@
*/

#include
+#include "ssl_locl.h"
#include
#include
-#include "ssl_locl.h"

static void SSL_SESSION_list_remove(SSL_CTX *ctx, SSL_SESSION *s);
static void SSL_SESSION_list_add(SSL_CTX *ctx,SSL_SESSION *s);
Index: engines/ccgost/gost_eng.c
================================================== =================
RCS file: /cvs-openssl/openssl/engines/ccgost/gost_eng.c,v
retrieving revision 1.2
diff -u -r1.2 gost_eng.c
--- engines/ccgost/gost_eng.c 21 Sep 2006 13:24:46 -0000 1.2
+++ engines/ccgost/gost_eng.c 20 Oct 2006 11:37:38 -0000
@@ -141,20 +141,11 @@
return ret;
}

-#ifdef _WIN32
-extern __declspec( dllexport )
-#endif

-/*#ifndef OPENSSL_NO_DYNAMIC_ENGINE*/
IMPLEMENT_DYNAMIC_BIND_FN(bind_gost)

-#ifdef _WIN32
-extern __declspec( dllexport )
-#endif

IMPLEMENT_DYNAMIC_CHECK_FN()
-/*#else*/
-/*#endif OPENSSL_NO_DYNAMIC_ENGINE */

static int gost_digests(ENGINE *e, const EVP_MD **digest,
const int **nids, int nid)

--NzB8fVQJ5HfG6fxh--
__________________________________________________ ____________________
OpenSSL Project http://www.openssl.org
Development Mailing List openssl-dev@openssl.org
Automated List Manager majordomo@openssl.org