Hello,

Succeeded in making openssl cross compile correctly!

./Configure --prefix=// --cross-compile-prefix=mingw32- shared mingw

Please also notice that --prefix must receive TWO slashes in order
to install to root (make install INSTALL_PREFIX=/tmp/w32)... Maybe
this also can be corrected.

The major problem is in OPENSSL_IMPLEMENT_GLOBAL macro.

The following code does not compile under gcc:

extern int aaa;
static int aaa = 0;
int main () { return 0; }

You cannot define a variable as static and external at the same time:
> a.c:2: error: static declaration of ‘aaa’ follows non-static declaration
> a.c:1: error: previous declaration of ‘aaa’ was here

So I removed the static from the macro.
I had to do some more modifications.
Please review.

Best Regards,
Alon Bar-Lev.

---

diff -urNp openssl-SNAP-20061228.org/engines/ccgost/Makefile 
openssl-SNAP-20061228/engines/ccgost/Makefile
--- openssl-SNAP-20061228.org/engines/ccgost/Makefile   2006-11-30 
16:00:52.000000000 +0200
+++ openssl-SNAP-20061228/engines/ccgost/Makefile       2006-12-28 
20:30:12.000000000 +0200
@@ -44,7 +44,13 @@ install:     
        if [ -n "$(SHARED_LIBS)" ]; then \
                set -e; \
                echo installing $(LIBNAME); \
-               if [ "$(PLATFORM)" != "Cygwin" ]; then \
+               if [ "$(PLATFORM)" = "Cygwin" ]; then \
+                       sfx="so"; \
+                       cp cyg$(LIBNAME).dll 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$(LIBNAME).$$sfx.new; \
+               elif [ "$(PLATFORM)" = "mingw" ]; then \
+                       sfx="so"; \
+                       cp $(LIBNAME).dll 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$(LIBNAME).$$sfx.new; \
+               else \
                        case "$(CFLAGS)" in \
                        *DSO_BEOS*) sfx="so";; \
                        *DSO_DLFCN*) sfx="so";; \
@@ -52,9 +58,6 @@ install:      
                        *) sfx="bad";; \
                        esac; \
                        cp lib$(LIBNAME).$$sfx 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$(LIBNAME).$$sfx.new; \
-               else \
-                       sfx="so"; \
-                       cp cyg$(LIBNAME).dll 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$(LIBNAME).$$sfx.new; \
                fi; \
                chmod 555 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$(LIBNAME).$$sfx.new; \
                mv -f 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$(LIBNAME).$$sfx.new 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$(LIBNAME).$$sfx; \
diff -urNp openssl-SNAP-20061228.org/engines/Makefile 
openssl-SNAP-20061228/engines/Makefile
--- openssl-SNAP-20061228.org/engines/Makefile  2006-10-20 14:00:59.000000000 
+0200
+++ openssl-SNAP-20061228/engines/Makefile      2006-12-28 20:30:12.000000000 
+0200
@@ -103,7 +103,13 @@ install:
                set -e; \
                for l in $(LIBNAMES); do \
                        ( echo installing $$l; \
-                         if [ "$(PLATFORM)" != "Cygwin" ]; then \
+                         if [ "$(PLATFORM)" = "Cygwin" ]; then \
+                               sfx="so"; \
+                               cp cyg$$l.dll 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new; \
+                         elif [ "$(PLATFORM)" = "mingw" ]; then \
+                               sfx="so"; \
+                               cp $$l.dll 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new; \
+                         else \
                                case "$(CFLAGS)" in \
                                *DSO_BEOS*)     sfx="so";;      \
                                *DSO_DLFCN*)    sfx="so";;      \
@@ -111,9 +117,6 @@ install:
                                *)              sfx="bad";;     \
                                esac; \
                                cp lib$$l.$$sfx 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new; \
-                         else \
-                               sfx="so"; \
-                               cp cyg$$l.dll 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new; \
                          fi; \
                          chmod 555 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new; \
                          mv -f 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx.new 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/engines/lib$$l.$$sfx ); \
diff -urNp openssl-SNAP-20061228.org/e_os2.h openssl-SNAP-20061228/e_os2.h
--- openssl-SNAP-20061228.org/e_os2.h   2006-04-12 01:00:21.000000000 +0300
+++ openssl-SNAP-20061228/e_os2.h       2006-12-28 20:30:12.000000000 +0200
@@ -275,7 +275,7 @@ extern "C" {
 # define OPENSSL_IMPLEMENT_GLOBAL(type,name)                        \
        extern type _hide_##name;                                    \
        type *_shadow_##name(void) { return &_hide_##name; }         \
-       static type _hide_##name
+       type _hide_##name
 # define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)
 # define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))
 #else
diff -urNp openssl-SNAP-20061228.org/Makefile.org 
openssl-SNAP-20061228/Makefile.org
--- openssl-SNAP-20061228.org/Makefile.org      2006-10-25 01:00:12.000000000 
+0200
+++ openssl-SNAP-20061228/Makefile.org  2006-12-28 20:30:12.000000000 +0200
@@ -278,6 +278,8 @@ clean-shared:
                ( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
                if [ "$(PLATFORM)" = "Cygwin" ]; then \
                        ( set -x; rm -f cyg$$i$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a 
); \
+               elif [ "$(PLATFORM)" = "mingw" ]; then \
+                       ( set -x; rm -f $$i32$(SHLIB_EXT) lib$$i$(SHLIB_EXT).a 
); \
                fi; \
        done
 
@@ -518,18 +520,26 @@ install_sw:
                do \
                        if [ -f "$$i" -o -f "$$i.a" ]; then \
                        (       echo installing $$i; \
-                               if [ "$(PLATFORM)" != "Cygwin" ]; then \
+                               if [ "$(PLATFORM)" = "Cygwin" ]; then \
+                                       c=`echo $$i | sed 
's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
+                                       cp $$c 
$(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
+                                       chmod 755 
$(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
+                                       mv -f 
$(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new 
$(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
                                        cp $$i 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
-                                       chmod 555 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
+                                       chmod 644 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
                                        mv -f 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
-                               else \
-                                       c=`echo $$i | sed 
's/^lib\(.*\)\.dll\.a/cyg\1-$(SHLIB_VERSION_NUMBER).dll/'`; \
+                               elif [ "$(PLATFORM)" = "mingw" ]; then \
+                                       c=`echo $$i | sed 
's/^lib\(.*\)\.dll\.a/\132.dll/'`; \
                                        cp $$c 
$(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
                                        chmod 755 
$(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new; \
                                        mv -f 
$(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c.new 
$(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
                                        cp $$i 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
                                        chmod 644 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
                                        mv -f 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
+                               else \
+                                       cp $$i 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
+                                       chmod 555 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new; \
+                                       mv -f 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.new 
$(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
                                fi ); \
                        fi; \
                done; \
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to