[mew-win32 03578] gnugp-1.0.7 patch for Mew

Eiji YAMAMOTO age at example.com
2002年 5月 23日 (木) 13:40:32 JST


山本と申します。
gnupg-1.0.7がリリースされたので,[mew-win32 03381]で紹介
されていた亀井さん(であってるのかな?)のWEBページ
http://www.pluto.dti.ne.jp/~mule/pgp.html
中のgnupg-1.0.4d-mew.lzhを基にmingw32版のgnupg-1.0.7への
パッチを作ってみました。
とりあえずmew2.2で動作することは確認しましたが,十分な動作
検証はしていないので叩き台にして完成度を高めて頂けると嬉し
いです。

[コンパイル環境]
> uname -a
CYGWIN_NT-4.0 FOO 1.3.10(0.51/3/2) 2002-02-25 11:14 i686 unknown
> gcc -v
gcc version 2.95.3-5 (cygwin special)

パッチをあて,
configure --target=i686--mingw32 --disable-asm
を実行後,po/Makefile.in を po/Makefile にコピーしてから,
make ⇒ (make check ⇒ ) make install してください。

[重要]
・gnupg-1.0.7からtrustdb.pgpが変わったようです。必ずバッ
クアップしてから試してみてください。
・trustdb.pgpのアップデートのため,最初に
gpg --update-trustdb をおこなう必要があります。
また,trustのレベルとしてfullの上のultimatelyが設定できる
ようになっており,自分のkeyに対して --edit ⇒ trustで
ultimateに設定しないとmew2.2ではまともに動作しませんでした。

[注意点]
・mingw32版でコンパイルすることしか考えていません。
・mingw32版ではtigerを使わなくしてあります。
・gnupg-1.0.7/po の下だけ Makefile.in.inからMakefile.inを
生成するようになっているため,configure後に手作業でMakefile.in
をMakefileにコピーする必要があります。(修正して頂けると嬉しいです)
・mingw32版では改行コードはCRLFではなくLFにしています。
・make installすると/usr/local/binには i686--mingw32-gpg.exe 等の
ファイル名でインストールされます。

-------------- next part --------------
diff -c -r gnupg-1.0.7_org/cipher/rndunix.c gnupg-1.0.7_mingw32forMew/cipher/rndunix.c
*** gnupg-1.0.7_org/cipher/rndunix.c	Fri Apr 19 03:41:27 2002
--- gnupg-1.0.7_mingw32forMew/cipher/rndunix.c	Tue May 21 15:21:30 2002
***************
*** 67,73 ****
  #include <unistd.h>
  #include <fcntl.h>
  #include <pwd.h>
! #ifndef __QNX__
  #include <sys/errno.h>
  #include <sys/ipc.h>
  #endif				/* __QNX__ */
--- 67,73 ----
  #include <unistd.h>
  #include <fcntl.h>
  #include <pwd.h>
! #if !defined( __CYGWIN__ ) && !defined( __QNX__ )
  #include <sys/errno.h>
  #include <sys/ipc.h>
  #endif				/* __QNX__ */
***************
*** 75,84 ****
  #ifndef __QNX__
  #include <sys/resource.h>
  #endif				/* __QNX__ */
! #if defined( _AIX ) || defined( __QNX__ )
  #include <sys/select.h>
  #endif				/* _AIX || __QNX__ */
! #ifndef __QNX__
  #include <sys/shm.h>
  #include <signal.h>
  #include <sys/signal.h>
--- 75,84 ----
  #ifndef __QNX__
  #include <sys/resource.h>
  #endif				/* __QNX__ */
! #if defined( __CYGWIN__ ) || defined( _AIX ) || defined( __QNX__ )
  #include <sys/select.h>
  #endif				/* _AIX || __QNX__ */
! #if !defined( __CYGWIN__ ) && !defined( __QNX__ )
  #include <sys/shm.h>
  #include <signal.h>
  #include <sys/signal.h>
***************
*** 90,96 ****
  #endif				/* __hpux 9.x, after that it's in unistd.h */
  #include <sys/wait.h>
  /* #include <kitchensink.h> */
! #ifdef __QNX__
  #include <signal.h>
  #include <process.h>
  #endif		      /* __QNX__ */
--- 90,96 ----
  #endif				/* __hpux 9.x, after that it's in unistd.h */
  #include <sys/wait.h>
  /* #include <kitchensink.h> */
! #if defined( __CYGWIN__ ) || defined( __QNX__ )
  #include <signal.h>
  #include <process.h>
  #endif		      /* __QNX__ */
diff -c -r gnupg-1.0.7_org/cipher/rndw32.c gnupg-1.0.7_mingw32forMew/cipher/rndw32.c
*** gnupg-1.0.7_org/cipher/rndw32.c	Thu Dec 20 03:05:04 2001
--- gnupg-1.0.7_mingw32forMew/cipher/rndw32.c	Tue May 21 15:21:30 2002
***************
*** 67,73 ****
  #include <string.h>
  
  #include <windows.h>
! #ifdef __CYGWIN32__
  # include <winioctl.h>
  #endif
  
--- 67,74 ----
  #include <string.h>
  
  #include <windows.h>
! 
! #if defined( __MINGW32__ ) || defined( __CYGWIN32__ )
  # include <winioctl.h>
  #endif
  
diff -c -r gnupg-1.0.7_org/configure gnupg-1.0.7_mingw32forMew/configure
*** gnupg-1.0.7_org/configure	Mon Apr 29 23:59:16 2002
--- gnupg-1.0.7_mingw32forMew/configure	Tue May 21 15:21:30 2002
***************
*** 1621,1627 ****
  
  case "${target}" in
      *-*-mingw32*)
!         disallowed_modules="rndunix rndlinux rndegd"
          ;;
      *-*-cygwin*)
          disallowed_modules="rndunix rndlinux rndegd tiger"
--- 1621,1627 ----
  
  case "${target}" in
      *-*-mingw32*)
!         disallowed_modules="rndunix rndlinux rndegd tiger"
          ;;
      *-*-cygwin*)
          disallowed_modules="rndunix rndlinux rndegd tiger"
***************
*** 3320,3329 ****
  case "${target}" in
      *-*-mingw32*|*-*-cygwin*)
          # special stuff for Windoze NT
!         ac_cv_have_dev_random=no
  
  cat >>confdefs.h <<\EOF
! #define USE_ONLY_8DOT3 1
  EOF
  
  cat >>confdefs.h <<\EOF
--- 3320,3336 ----
  case "${target}" in
      *-*-mingw32*|*-*-cygwin*)
          # special stuff for Windoze NT
! 	CC="gcc -mno-cygwin"
! 	CPP="gcc -mno-cygwin -E"
! 	RANLIB="ranlib"
!     ac_cv_have_dev_random=no
! 
! # cat >>confdefs.h <<\EOF
! # #define USE_ONLY_8DOT3 1
! # EOF
  
  cat >>confdefs.h <<\EOF
! #define HAVE_STRCASECMP 1
  EOF
  
  cat >>confdefs.h <<\EOF
diff -c -r gnupg-1.0.7_org/configure.ac gnupg-1.0.7_mingw32forMew/configure.ac
*** gnupg-1.0.7_org/configure.ac	Mon Apr 29 23:56:08 2002
--- gnupg-1.0.7_mingw32forMew/configure.ac	Tue May 21 15:21:30 2002
***************
*** 164,170 ****
  dnl
  case "${target}" in
      *-*-mingw32*)
!         disallowed_modules="rndunix rndlinux rndegd"
          ;;
      *-*-cygwin*)
          disallowed_modules="rndunix rndlinux rndegd tiger"
--- 164,170 ----
  dnl
  case "${target}" in
      *-*-mingw32*)
!         disallowed_modules="rndunix rndlinux rndegd tiger"
          ;;
      *-*-cygwin*)
          disallowed_modules="rndunix rndlinux rndegd tiger"
***************
*** 202,209 ****
      *-*-mingw32*|*-*-cygwin*)
          # special stuff for Windoze NT
          ac_cv_have_dev_random=no
!         AC_DEFINE(USE_ONLY_8DOT3,1,
!                   [set this to limit filenames to the 8.3 format])
          AC_DEFINE(HAVE_DRIVE_LETTERS,1,
                    [defined if we must run on a stupid file system])
          AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
--- 202,209 ----
      *-*-mingw32*|*-*-cygwin*)
          # special stuff for Windoze NT
          ac_cv_have_dev_random=no
! #       AC_DEFINE(USE_ONLY_8DOT3,1,
! #                 [set this to limit filenames to the 8.3 format])
          AC_DEFINE(HAVE_DRIVE_LETTERS,1,
                    [defined if we must run on a stupid file system])
          AC_DEFINE(HAVE_DOSISH_SYSTEM,1,
diff -c -r gnupg-1.0.7_org/g10/armor.c gnupg-1.0.7_mingw32forMew/g10/armor.c
*** gnupg-1.0.7_org/g10/armor.c	Mon Apr 29 23:28:21 2002
--- gnupg-1.0.7_mingw32forMew/g10/armor.c	Tue May 21 15:21:30 2002
***************
*** 37,43 ****
  #include "status.h"
  #include "i18n.h"
  
! #ifdef HAVE_DOSISH_SYSTEM
    #define LF "\r\n"
  #else
    #define LF "\n"
--- 37,43 ----
  #include "status.h"
  #include "i18n.h"
  
! #if defined( HAVE_DOSISH_SYSTEM ) && !defined( __MINGW32__ )
    #define LF "\r\n"
  #else
    #define LF "\n"
***************
*** 944,953 ****
  
  	    if ( afx->hdrlines ) {
                  for ( s = afx->hdrlines; *s; s++ ) {
!                   #ifdef HAVE_DOSISH_SYSTEM
                      if ( *s == '\n' )
                          iobuf_put( a, '\r');
!                   #endif
                      iobuf_put(a, *s );
                  }
              }
--- 944,953 ----
  
  	    if ( afx->hdrlines ) {
                  for ( s = afx->hdrlines; *s; s++ ) {
! #if defined( HAVE_DOSISH_SYSTEM ) && !defined( __MINGW32__ )
                      if ( *s == '\n' )
                          iobuf_put( a, '\r');
! #endif
                      iobuf_put(a, *s );
                  }
              }
diff -c -r gnupg-1.0.7_org/g10/plaintext.c gnupg-1.0.7_mingw32forMew/g10/plaintext.c
*** gnupg-1.0.7_org/g10/plaintext.c	Mon Apr 29 23:37:27 2002
--- gnupg-1.0.7_mingw32forMew/g10/plaintext.c	Tue May 21 15:21:30 2002
***************
*** 127,136 ****
  		}
  		if( mfx->md )
  		    md_putc(mfx->md, c );
! 	      #ifndef HAVE_DOSISH_SYSTEM
  		if( c == '\r' )  /* convert to native line ending */
  		    continue;	 /* fixme: this hack might be too simple */
! 	      #endif
  		if( fp ) {
  		    if( putc( c, fp ) == EOF ) {
  			log_error("Error writing to `%s': %s\n",
--- 127,136 ----
  		}
  		if( mfx->md )
  		    md_putc(mfx->md, c );
! #if !defined( HAVE_DOSISH_SYSTEM ) || defined( __MINGW32__ )
  		if( c == '\r' )  /* convert to native line ending */
  		    continue;	 /* fixme: this hack might be too simple */
! #endif
  		if( fp ) {
  		    if( putc( c, fp ) == EOF ) {
  			log_error("Error writing to `%s': %s\n",
***************
*** 174,183 ****
  	    while( (c = iobuf_get(pt->buf)) != -1 ) {
  		if( mfx->md )
  		    md_putc(mfx->md, c );
! 	      #ifndef HAVE_DOSISH_SYSTEM
  		if( convert && c == '\r' )
  		    continue; /* fixme: this hack might be too simple */
! 	      #endif
  		if( fp ) {
  		    if( putc( c, fp ) == EOF ) {
  			log_error("Error writing to `%s': %s\n",
--- 174,183 ----
  	    while( (c = iobuf_get(pt->buf)) != -1 ) {
  		if( mfx->md )
  		    md_putc(mfx->md, c );
! #if !defined( HAVE_DOSISH_SYSTEM ) || defined( __MINGW32__ )
  		if( convert && c == '\r' )
  		    continue; /* fixme: this hack might be too simple */
! #endif
  		if( fp ) {
  		    if( putc( c, fp ) == EOF ) {
  			log_error("Error writing to `%s': %s\n",
diff -c -r gnupg-1.0.7_org/g10/sign.c gnupg-1.0.7_mingw32forMew/g10/sign.c
*** gnupg-1.0.7_org/g10/sign.c	Mon Apr 29 23:39:24 2002
--- gnupg-1.0.7_mingw32forMew/g10/sign.c	Tue May 21 15:21:30 2002
***************
*** 40,48 ****
  #include "status.h"
  #include "i18n.h"
  
! 
! #ifdef HAVE_DOSISH_SYSTEM
!   #define LF "\r\n"
    void __stdcall Sleep(ulong);
    #define sleep(a)  Sleep((a)*1000)
  #else
--- 40,51 ----
  #include "status.h"
  #include "i18n.h"
  
! #if defined( HAVE_DOSISH_SYSTEM )
!   #if defined( __MINGW32__ )
!     #define LF "\n"
!   #else
!     #define LF "\r\n"
!   #endif
    void __stdcall Sleep(ulong);
    #define sleep(a)  Sleep((a)*1000)
  #else
diff -c -r gnupg-1.0.7_org/g10/textfilter.c gnupg-1.0.7_mingw32forMew/g10/textfilter.c
*** gnupg-1.0.7_org/g10/textfilter.c	Sun Sep  9 04:21:13 2001
--- gnupg-1.0.7_mingw32forMew/g10/textfilter.c	Tue May 21 15:21:30 2002
***************
*** 33,39 ****
  #include "i18n.h"
  #include "options.h"
  
! #ifdef HAVE_DOSISH_SYSTEM
    #define LF "\r\n"
  #else
    #define LF "\n"
--- 33,39 ----
  #include "i18n.h"
  #include "options.h"
  
! #if defined( HAVE_DOSISH_SYSTEM ) && !defined ( __MINGW32__ )
    #define LF "\r\n"
  #else
    #define LF "\n"
diff -c -r gnupg-1.0.7_org/util/http.c gnupg-1.0.7_mingw32forMew/util/http.c
*** gnupg-1.0.7_org/util/http.c	Sun Mar  3 22:56:15 2002
--- gnupg-1.0.7_mingw32forMew/util/http.c	Tue May 21 18:57:40 2002
***************
*** 789,795 ****
          unsigned long nwritten;
          HANDLE sock_fd = (HANDLE)sock;
  
!         if ( !WriteFile ( sock_fd, data, nleft, &nwritten, NULL)) {
  	    log_info ("write failed: ec=%d\n", (int)GetLastError ());
  	    return G10ERR_NETWORK;
          }
--- 789,795 ----
          unsigned long nwritten;
          HANDLE sock_fd = (HANDLE)sock;
  
!         if ( ( nwritten = send( sock, data, nleft, 0 ) ) == -1 ) {
  	    log_info ("write failed: ec=%d\n", (int)GetLastError ());
  	    return G10ERR_NETWORK;
          }
diff -c -r gnupg-1.0.7_org/util/ttyio.c gnupg-1.0.7_mingw32forMew/util/ttyio.c
*** gnupg-1.0.7_org/util/ttyio.c	Sun Jan  6 03:05:20 2002
--- gnupg-1.0.7_mingw32forMew/util/ttyio.c	Tue May 21 15:21:30 2002
***************
*** 109,115 ****
  	return;
  
    #if defined(__MINGW32__)
!     {
  	SECURITY_ATTRIBUTES sa;
  
  	memset(&sa, 0, sizeof(sa));
--- 109,115 ----
  	return;
  
    #if defined(__MINGW32__)
!     if(isatty(fileno(stdin))) {
  	SECURITY_ATTRIBUTES sa;
  
  	memset(&sa, 0, sizeof(sa));
***************
*** 129,134 ****
--- 129,138 ----
  	if( con.in == INVALID_HANDLE_VALUE )
  	    log_fatal("open(CONIN$) failed: rc=%d", (int)GetLastError() );
      }
+     else {
+ 	    con.out = GetStdHandle(STD_OUTPUT_HANDLE);
+ 	    con.in  = GetStdHandle(STD_INPUT_HANDLE);
+     }
      SetConsoleMode(con.in, DEF_INPMODE );
      SetConsoleMode(con.out, DEF_OUTMODE );
  
***************
*** 186,192 ****
  	if( !buf )
  	    log_bug("vasprintf() failed\n");
          
! 	if( !WriteConsoleA( con.out, buf, n, &nwritten, NULL ) )
  	    log_fatal("WriteConsole failed: rc=%d", (int)GetLastError() );
  	if( n != nwritten )
  	    log_fatal("WriteConsole failed: %d != %d\n", n, (int)nwritten );
--- 190,196 ----
  	if( !buf )
  	    log_bug("vasprintf() failed\n");
          
! 	if( !WriteFile( con.out, buf, n, &nwritten, NULL ) )
  	    log_fatal("WriteConsole failed: rc=%d", (int)GetLastError() );
  	if( n != nwritten )
  	    log_fatal("WriteConsole failed: %d != %d\n", n, (int)nwritten );
***************
*** 317,323 ****
      for(;;) {
  	DWORD nread;
  
! 	if( !ReadConsoleA( con.in, cbuf, 1, &nread, NULL ) )
  	    log_fatal("ReadConsole failed: rc=%d", (int)GetLastError() );
  	if( !nread )
  	    continue;
--- 321,327 ----
      for(;;) {
  	DWORD nread;
  
! 	if( !ReadFile( con.in, cbuf, 1, &nread, NULL ) )
  	    log_fatal("ReadConsole failed: rc=%d", (int)GetLastError() );
  	if( !nread )
  	    continue;
***************
*** 470,476 ****
      if( !last_prompt_len )
  	return;
    #ifdef __MINGW32__
!     tty_printf("\r%*s\r", last_prompt_len, "");
    #else
      {
  	int i;
--- 474,481 ----
      if( !last_prompt_len )
  	return;
    #ifdef __MINGW32__
!     if(isatty(fileno(stdin)))
!         tty_printf("\r%*s\r", last_prompt_len, "");
    #else
      {
  	int i;


Mew-win32 メーリングリストの案内