Hi,

I'm the OpenSSL maintainer for the Cygwin net distribution.

A few weeks ago I began to change the toplevel configure and
Makefiles to allow creating shared libs (here better: DLLs)
even under Cygwin.  Now, after 0.9.6c has been released, I have
applied my patches to this new version and I'd like to
contribute them so that further official versions of OpenSSL
can participate.

Basically the patch consists of three changes:

- Configure is patched in the CygWin32 line so that creating
  shared libraries is supported.

- Makefile.org contains some changes to allow creating DLLs
  under Cygwin.  The main change is adding a new target
  `do_cygwin-shared' which creates the cygcrypto.dll and cygssl.dll
  files as well as the corresponding link libraries libcrypto.dll.a
  and libssl.dll.a.
  Other changes are just to allow clean installation and
  cleaning.

- config is cleaned by setting the wrong options for a Cygwin
  build.  It sets the `no-threads no-asm' by default.  Neither
  of these options is needed.  Especially the no-threads isn't
  correct since Cygwin is thread-safe since months now.

If you agree with these patches I would be very glad.  As a side
not, the current Cygwin OpenSSH-3.0.2p1 is already linked against
the OpenSSL DLLs, version 0.9.6b, which is currently still part
of the Cygwin net distribution.  I'm going to release 0.9.6c
pretty soon.

Corinna

Index: Configure
===================================================================
RCS file: /home/cvs/cvsroot/src/openssl096c/Configure,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Configure
--- Configure   2002/01/11 16:52:01     1.1.1.1
+++ Configure   2002/01/11 21:47:09
@@ -459,7 +459,7 @@ my %table=(
 "Mingw32", "gcc:-DL_ENDIAN -fomit-frame-pointer -O3 -m486 -Wall::::BN_LLONG 
${x86_gcc_des} ${x86_gcc_opts}::::::::::win32",
 
 # CygWin32
-"CygWin32", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O3 -m486 
-Wall::::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::win32",
+"CygWin32", "gcc:-DTERMIOS -DL_ENDIAN -fomit-frame-pointer -O2 -m486 
+-Wall::::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}::::::::::win32:cygwin-shared::.dll",
 
 # Ultrix from Bernhard Simon <[EMAIL PROTECTED]>
 "ultrix-cc","cc:-std1 -O -Olimit 1000 -DL_ENDIAN::(unknown)::::::",
Index: Makefile.org
===================================================================
RCS file: /home/cvs/cvsroot/src/openssl096c/Makefile.org,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile.org
--- Makefile.org        2002/01/11 16:52:01     1.1.1.1
+++ Makefile.org        2002/01/11 21:47:09
@@ -234,11 +234,12 @@ clean-shared:
                                ( set -x; rm -f lib$$i$$j ); \
                        done; \
                fi; \
-               ( set -x; rm -f lib$$i$(SHLIB_EXT) ); \
+               ( set -x; rm -f lib$$i$(SHLIB_EXT) cyg$$i$(SHLIB_EXT) 
+lib$$i$(SHLIB_EXT).a ); \
        done
 
 link-shared:
-       @for i in $(SHLIBDIRS); do \
+       @if [ "$(SHLIB_EXT)" != ".dll" ]; then \
+       for i in $(SHLIBDIRS); do \
                prev=lib$$i$(SHLIB_EXT); \
                if [ -n "$(SHARED_LIBS_LINK_EXTS)" ]; then \
                        tmp="$(SHARED_LIBS_LINK_EXTS)"; \
@@ -247,7 +248,8 @@ link-shared:
                                prev=lib$$i$$j; \
                        done; \
                fi; \
-       done
+       done \
+       fi
 
 build-shared: clean-shared do_$(SHLIB_TARGET) link-shared
 
@@ -269,6 +271,15 @@ DETECT_GNU_LD=${CC} -v 2>&1 | grep '^gcc
        [ -n "$$my_ld" ] && \
        $$my_ld -v 2>&1 | grep 'GNU ld' >/dev/null 2>&1
 
+do_cygwin-shared:
+       libs='-L. ${SHLIBDEPS}'; for i in ${SHLIBDIRS}; do \
+       ( set -x; ${CC}  -shared -o cyg$$i.dll \
+               -Wl,--whole-archive lib$$i.a \
+               -Wl,--out-implib,lib$$i.dll.a \
+               -Wl,--no-whole-archive $$libs ) || exit 1; \
+       libs="$$libs -l$$i"; \
+       done
+
 # This assumes that GNU utilities are *not* used
 do_alpha-osf1-shared:
        if ${DETECT_GNU_LD}; then \
@@ -598,10 +609,18 @@ install: all install_docs
                tmp="$(SHARED_LIBS)"; \
                for i in $${tmp:-x}; \
                do \
-                       if [ -f "$$i" ]; then \
+                       if [ -f "$$i" -o -f "$$i.a" ]; then \
                        (       echo installing $$i; \
-                               cp -f $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
-                               chmod 555 $(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i ); \
+                               if [ "$(SHLIB_EXT)" != ".dll" ]; then \
+                                       cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/lib; \
+                                       chmod 644 
+$(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i; \
+                               else \
+                                       c=`echo $$i | sed 's/^lib/cyg/'`; \
+                                       cp $$c $(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; 
+\
+                                       chmod 755 
+$(INSTALL_PREFIX)$(INSTALLTOP)/bin/$$c; \
+                                       cp $$i.a 
+$(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a; \
+                                       chmod 644 
+$(INSTALL_PREFIX)$(INSTALLTOP)/lib/$$i.a; \
+                               fi ); \
                        fi \
                done; \
                (       here="`pwd`"; \
Index: config
===================================================================
RCS file: /home/cvs/cvsroot/src/openssl096c/config,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 config
--- config      2002/01/11 16:52:01     1.1.1.1
+++ config      2002/01/11 21:47:09
@@ -560,8 +560,7 @@ EOF
   # *-aix) OUT="aix-$CC" ;;
   # *-dgux) OUT="dgux" ;;
   mips-sony-newsos4) OUT="newsos4-gcc" ;;
-  *-*-cygwin32) OUT="CygWin32"
-               options="$options no-threads no-asm" ;;
+  *-*-cygwin32) OUT="CygWin32" ;;
   *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
 esac
 

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:[EMAIL PROTECTED]
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to