Patches for gnupg 1.0.7 / cygwin 1.3.10

Volker Quetschke quetschke@scytek.de
Tue Jun 4 17:53:02 2002


This is a multi-part message in MIME format.
--------------000601080300020402090707
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

as I tried to compile gnupg 1.0.7 with cygwin I recognized that the 
build stopped due to a not set $(RANLIB).

As I had a look into this problem I realized that it was easy to fix 
configure.ac to make gnupg compile OOB. Then I removed the special cases 
with __CYGWIN__ for the file handling to use its own (standard posix) 
file handling. Cygwin does have a /dev/random, therefore I changed from 
rndw32 to rndlinux.

I found a makefile problem for mingw32/cygwin which chaused the build
of additional shared modules to fail. After I fixed it I realized that 
the shared modules do not work with cygwin, therefore I removed the 
tiger module again for cygwin (The only shared module).

(If one wants to have dlls as shared modules this has to be implemented 
with a special case for cygwin. Maybe later ;-))

With the attached patch it builds OOB. The patch is against the 
gnupg-1.0.7 sources, If you have problems applying it I can also create 
a patch against the current cvs.

Please review the patch and implement if possible. It mainly removes 
special cases for cygwin.

I attached a Changelog and a diff file. ( They should be POSIX file 
format, but sometimes the mail program changes the 0A to 0D 0A ). Grr.

Bye
    Volker


--------------000601080300020402090707
Content-Type: text/plain;
 name="ChangeLog"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="ChangeLog"

2002-06-01  Volker Quetschke  <quetschke@scytek.de>

	* configure.ac: Remove unnecessary cases for cygwin. Cygwin (Version
	1.3.10 and up) doesn't need the AC_DEFINE()s for USE_ONLY_8DOT3,
	HAVE_DRIVE_LETTERS, HAVE_DOSISH_SYSTEM, USE_SIMPLE_GETTEXT and does
	have a /dev/random. This repairs also the $(RANLIB) variable for
	cygwin, it wasn't set for cygwin and try_gettext="no" and the build
	stopped. Also added $(EXEEXT) for the files in DYNAMIC_CIPHER_MODS
	to help automake. 

	* g10/exec.c: Use cygwin fileaccess instead of windows fileaccess for
	cygwin. ATTENTION! Gnupg now uses the mount table of cygwin. You can
	still use drive letters but use "/" instead of "\".
	E.g: gnupg -e c:/temp/important.doc

	* g10/passphrase: Use cygwin fileaccess instead of windows fileaccess
	for cygwin. Use the POSIX variant of gpg agent for cygwin not the
	windows registry. See warning above.

	* g10/g10.c: Use env. variable GNUPGHOME instead of windows registry
	for cygwin.

	* g10/gpgv.c: Use env. variable GNUPGHOME instead of windows registry
	for cygwin.


--------------000601080300020402090707
Content-Type: text/plain;
 name="gnupg_v2.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="gnupg_v2.diff"

? gnupg_v2.diff
Index: configure.ac
===================================================================
RCS file: /cvs/gnupg/gnupg/Attic/configure.ac,v
retrieving revision 1.1.2.29
diff -u -r1.1.2.29 configure.ac
--- configure.ac	29 Apr 2002 14:56:08 -0000	1.1.2.29
+++ configure.ac	1 Jun 2002 23:46:52 -0000
@@ -167,7 +167,7 @@
         disallowed_modules="rndunix rndlinux rndegd"
         ;;
     *-*-cygwin*)
-        disallowed_modules="rndunix rndlinux rndegd tiger"
+        disallowed_modules="rndw32 rndunix rndegd tiger"
         ;;
     *)
         disallowed_modules="rndw32"
@@ -199,7 +199,7 @@
 
 try_gettext=yes
 case "${target}" in
-    *-*-mingw32*|*-*-cygwin*)
+    *-*-mingw32*)
         # special stuff for Windoze NT
         ac_cv_have_dev_random=no
         AC_DEFINE(USE_ONLY_8DOT3,1,
@@ -610,7 +610,7 @@
       static_random_module="rndlinux"
   else
       case "${target}" in
-          *-*-mingw32*|*-*-cygwin*)
+          *-*-mingw32*)
               static_random_module="rndw32"
               AC_DEFINE(USE_STATIC_RNDW32,1,
                        [At some point in the code we need to know that
@@ -690,7 +690,8 @@
             STATIC_CIPHER_NAMES="$STATIC_CIPHER_NAMES $name"
             STATIC_CIPHER_OBJS="$STATIC_CIPHER_OBJS $name.o"
         else
-            DYNAMIC_CIPHER_MODS="$DYNAMIC_CIPHER_MODS $name"
+            DYNAMIC_CIPHER_MODS="$DYNAMIC_CIPHER_MODS $name\$(EXEEXT)"
+			# The $(EXEEXT) is needed to help automake
             show_dynlink="$show_dynlink $name"
         fi
     fi
Index: g10/exec.c
===================================================================
RCS file: /cvs/gnupg/gnupg/g10/Attic/exec.c,v
retrieving revision 1.1.2.12
diff -u -r1.1.2.12 exec.c
--- g10/exec.c	29 Apr 2002 14:42:33 -0000	1.1.2.12
+++ g10/exec.c	1 Jun 2002 23:46:53 -0000
@@ -62,7 +62,7 @@
 #ifdef __riscos__
 	      tmp="<Wimp$ScrapDir>.GnuPG";
 	      mkdir(tmp,0700); /* Error checks occur later on */
-#elif defined (__MINGW32__) || defined (__CYGWIN32__)
+#elif defined (__MINGW32__)
 	      tmp=m_alloc(256);
 	      if(GetTempPath(256,tmp)==0)
 		strcpy(tmp,"c:\\temp");
@@ -88,7 +88,7 @@
 
   sprintf(info->tempdir,"%s" DIRSEP_S "gpg-XXXXXX",tmp);
 
-#if defined (__MINGW32__) || defined (__CYGWIN32__)
+#if defined (__MINGW32__)
   m_free(tmp);
 #endif
 
Index: g10/g10.c
===================================================================
RCS file: /cvs/gnupg/gnupg/g10/Attic/g10.c,v
retrieving revision 1.129.2.103
diff -u -r1.129.2.103 g10.c
--- g10/g10.c	25 Apr 2002 08:30:35 -0000	1.129.2.103
+++ g10/g10.c	1 Jun 2002 23:46:58 -0000
@@ -807,7 +807,7 @@
     opt.pgp2_workarounds = 1;
     opt.force_v3_sigs = 1;
     opt.escape_from = 1;
-#if defined (__MINGW32__) || defined (__CYGWIN32__)
+#if defined (__MINGW32__)
     opt.homedir = read_w32_registry_string( NULL, "Software\\GNU\\GnuPG", "HomeDir" );
 #else
     opt.homedir = getenv("GNUPGHOME");
Index: g10/gpgv.c
===================================================================
RCS file: /cvs/gnupg/gnupg/g10/Attic/gpgv.c,v
retrieving revision 1.1.2.17
diff -u -r1.1.2.17 gpgv.c
--- g10/gpgv.c	29 Apr 2002 14:42:34 -0000	1.1.2.17
+++ g10/gpgv.c	1 Jun 2002 23:46:58 -0000
@@ -151,7 +151,7 @@
     opt.always_trust = 1;
     opt.batch = 1;
 
-  #if defined (__MINGW32__) || defined (__CYGWIN32__)
+  #if defined (__MINGW32__)
     opt.homedir = read_w32_registry_string( NULL, "Software\\GNU\\GnuPG", "HomeDir" );
   #else
     opt.homedir = getenv("GNUPGHOME");
Index: g10/passphrase.c
===================================================================
RCS file: /cvs/gnupg/gnupg/g10/passphrase.c,v
retrieving revision 1.33.2.24
diff -u -r1.33.2.24 passphrase.c
--- g10/passphrase.c	29 Apr 2002 14:42:34 -0000	1.33.2.24
+++ g10/passphrase.c	1 Jun 2002 23:47:00 -0000
@@ -97,7 +97,7 @@
 static char *next_pw = NULL;
 static char *last_pw = NULL;
 
-#if defined (__MINGW32__) || defined (__CYGWIN32__)
+#if defined (__MINGW32__)
 static int read_fd = 0;
 static int write_fd = 0;
 #endif
@@ -176,7 +176,7 @@
 static int
 writen ( int fd, const void *buf, size_t nbytes )
 {
-#if defined (__MINGW32__) || defined (__CYGWIN32__)
+#if defined (__MINGW32__)
     DWORD nwritten, nleft = nbytes;
     
     while (nleft > 0) {
@@ -219,7 +219,7 @@
 static int
 readn ( int fd, void *buf, size_t buflen, size_t *ret_nread )
 {
-#if defined (__MINGW32__) || defined (__CYGWIN32__)
+#if defined (__MINGW32__)
     DWORD nread, nleft = buflen;
     
     while (nleft > 0) {
@@ -313,7 +313,7 @@
 
 #if !defined (__riscos__)
 
-#if !defined (__MINGW32__) && !defined (__CYGWIN32__)
+#if !defined (__MINGW32__)
 /* For the new Assuan protocol we may have to send options */
 static int
 agent_send_option (int fd, const char *name, const char *value)
@@ -418,7 +418,7 @@
 #endif
   return rc;
 }
-#endif /*!__MINGW32__ && !__CYGWIN32__*/
+#endif /*!__MINGW32__ */
 
 
 /*
@@ -429,7 +429,7 @@
 static int
 agent_open (int *ret_prot)
 {
-#if defined (__MINGW32__) || defined (__CYGWIN32__)
+#if defined (__MINGW32__)
     int fd;
     char *infostr, *p;
     HANDLE h;
@@ -574,7 +574,7 @@
 static void
 agent_close ( int fd )
 {
-#if defined (__MINGW32__) || defined (__CYGWIN32__)
+#if defined (__MINGW32__)
     HANDLE h = OpenEvent(EVENT_ALL_ACCESS, FALSE, "gpg_agent");
     ResetEvent(h);
 #else

--------------000601080300020402090707--