GnuPG for Win32
Soh Kok Hong
kokhong@post1.com
Wed May 22 20:21:04 2002
Dear all,
The patch that I am suggesting builds a Win32 executable (ie. no cygwin
DLLs needed) using the CYGWIN's mingw32 tools. I did not use the mingw32-cpd
stuff because it is rather old and does not include winsock2 - winsock2 is
required in building gnupg for Win32.
You need to run autoconf (by running "scripts/missing --run autoconf") to
rebuild the configure script first.
The changes are as follows:
1. acinclude.m4 & aclocal.m4
- patch to set ac_cv_sys_symbol_underscore to yes for mingw32 target
2. configure.ac
- Added AC_PROG_RANLIB - this was missing. In real unix targets,
this variable is added because of AM_GNU_GETTEXT which performs
lots of tests - one of which is to set AC_PROG_RANLIB. In mingw32
target, this did not get set because try_gettext set to "no", hence
AC_PROGR_RANLIB never gets set.
- added a check for presence of strcasecmp function. Again, the reason
this did not get checked is because of the AM_GNU_GETTEXT problem.
3. cipher/rndw32.c
- forced include of winioctl.h. This is needed to include the
DISK_PERFORMANCE structure definition.
Soh Kok Hong wrote:
> Dear all,
>
> I have a 68-line diff file to patch the stock gnupg-1.0.7.tar.gz to
> build a mingw32 executable in the standard cygwin environment. It
> mainly patches the configure scripts and one source file (rndw32.c). I
> would like to know if the gnupg maintainers are interested and to whom
> can I email the patch to?
>
> Please email to me directly as I am not on the list.
>
>
> --
> *************************************************
> Soh Kok Hong
>
> kokhong@post1.com PGP Signature:
> D18B FC65 2202 3E43 A2D3 90D2 7BCC ABD3 77CE CD1C
> *************************************************
============ patch starts here =================
diff -Naur gnupg-1.0.7.orig/acinclude.m4 gnupg-1.0.7/acinclude.m4
--- gnupg-1.0.7.orig/acinclude.m4 2001-12-20 01:16:30.000000000 +0800
+++ gnupg-1.0.7/acinclude.m4 2002-05-18 16:03:16.000000000 +0800
@@ -661,7 +661,7 @@
AC_DEFUN(GNUPG_SYS_SYMBOL_UNDERSCORE,
[tmp_do_check="no"
case "${target}" in
- i386-emx-os2 | i[3456]86-pc-os2*emx | i386-pc-msdosdjgpp | *-*-cygwin)
+ i386-emx-os2 | i[3456]86-pc-os2*emx | i386-pc-msdosdjgpp | *-*-cygwin | *-*-mingw32 )
ac_cv_sys_symbol_underscore=yes
;;
*)
diff -Naur gnupg-1.0.7.orig/aclocal.m4 gnupg-1.0.7/aclocal.m4
--- gnupg-1.0.7.orig/aclocal.m4 2002-04-29 22:58:48.000000000 +0800
+++ gnupg-1.0.7/aclocal.m4 2002-05-18 16:03:18.000000000 +0800
@@ -665,7 +665,7 @@
AC_DEFUN(GNUPG_SYS_SYMBOL_UNDERSCORE,
[tmp_do_check="no"
case "${target}" in
- i386-emx-os2 | i[3456]86-pc-os2*emx | i386-pc-msdosdjgpp | *-*-cygwin)
+ i386-emx-os2 | i[3456]86-pc-os2*emx | i386-pc-msdosdjgpp | *-*-cygwin | *-*-mingw32 )
ac_cv_sys_symbol_underscore=yes
;;
*)
diff -Naur gnupg-1.0.7.orig/cipher/rndw32.c gnupg-1.0.7/cipher/rndw32.c
--- gnupg-1.0.7.orig/cipher/rndw32.c 2001-12-20 02:05:04.000000000 +0800
+++ gnupg-1.0.7/cipher/rndw32.c 2002-05-18 16:03:18.000000000 +0800
@@ -67,9 +67,7 @@
#include <string.h>
#include <windows.h>
-#ifdef __CYGWIN32__
-# include <winioctl.h>
-#endif
+#include <winioctl.h>
#include "types.h"
diff -Naur gnupg-1.0.7.orig/configure.ac gnupg-1.0.7/configure.ac
--- gnupg-1.0.7.orig/configure.ac 2002-04-29 22:56:08.000000000 +0800
+++ gnupg-1.0.7/configure.ac 2002-05-18 16:03:20.000000000 +0800
@@ -184,6 +184,7 @@
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
AC_PROG_CC
AC_PROG_CPP
+AC_PROG_RANLIB
AC_PATH_PROG(PERL,"perl")
AC_ISC_POSIX
AC_SYS_LARGEFILE
@@ -482,7 +483,7 @@
AC_FUNC_FSEEKO
AC_FUNC_VPRINTF
AC_FUNC_FORK
-AC_CHECK_FUNCS(strerror stpcpy strsep strlwr stricmp tcgetattr strtoul mmap)
+AC_CHECK_FUNCS(strerror stpcpy strsep strlwr stricmp tcgetattr strtoul strcasecmp mmap)
AC_CHECK_FUNCS(memmove gettimeofday getrusage setrlimit clock_gettime)
AC_CHECK_FUNCS(memicmp atexit raise getpagesize strftime nl_langinfo setlocale)
AC_CHECK_FUNCS(waitpid wait4 sigaction sigprocmask rand pipe stat)
diff -Naur gnupg-1.0.7.orig/scripts/build-mingw32 gnupg-1.0.7/scripts/build-mingw32
--- gnupg-1.0.7.orig/scripts/build-mingw32 1970-01-01 08:00:00.000000000 +0800
+++ gnupg-1.0.7/scripts/build-mingw32 2002-05-18 16:06:06.000000000 +0800
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+export CC="gcc -mno-cygwin -mthreads"
+
+./configure --target=i386-pc-mingw32
+