[Gpg4win-users-en] compiling gpg/winpt under windows..

j at mumrik.net j at mumrik.net
Thu Apr 10 19:50:12 CEST 2008


ok, my idea is to poke gpg/winpt a little so that it doesn't use the
registry or any fixed directories (like C:\Documents and Settings\User\ or
whatever) so i'd like to be able to run it under a debugger.. this is what i
did to compile gpg/gpgme/winpt from source  under windows (mingw/msys,
http://clbianco.altervista.org/gnupg/eng/gnupg.html explains how to install
that environment), i have no idea if any of this breaks anything (esp the
gpgme implementation as there is some tweaking to do) but at least the
fscking thing compiles.. and if i get a poked version working properly i can
always compile the "dist" version on a *nix..

compiled gpg-1.4.9 as per
http://clbianco.altervista.org/gnupg/eng/gnupg.html it's essentially these
steps:
1. change a test script (seat.test) to handle \r\n:
    $ sed -i -e "s/cmp \$i/unix2dos -c 7bit -n \$i z\n    cmp z/"
gpg-1.4.9/checks/seat.test
2. run configure with a few flags to make it as machine independent as
possible (i just stole them from clbianco)
    $ ./configure CFLAGS="-O3 -mtune=i386 -march=i386 -mfpmath=387 -mno-mmx
-mno-sse -mno-3dnow -mno-sse2" LDFLAGS=-s
3. $ make

compiled libgpg-error-1.6 out of the box by
$ ./configure
$ make install

to compile gpgme-1.1.4 i:
1. modified assuan.h (after the stand alone version of libassuan)
    $ diff -B assuan_orig/assuan.h assuan/assuan.h
    462a463
    > #ifndef _WIN32
    464a466
    > #endif

2. modified assuan-connect.c (after the stand alone version of libassuan)
    $ diff -B assuan_orig/assuan-connect.c assuan/assuan-connect.c
    61a62
    > #ifndef HAVE_W32_SYSTEM
    71a73
    > #ifdef HAVE_SO_PEERCRED
    77a80
    > #endif
    79a83
    > #endif /* HAVE_W32_SYSTEM */

3. modified assuan-defs.h (after stand alone version of libassuan)
    $ diff -B assuan_orig/assuan-defs.h assuan/assuan-defs.h
    144a145
    > #ifdef HAVE_SO_PEERCRED
    147a149
    > #endif /* HAVE_SO_PEERCRED */
    282a285,288
    > #ifdef HAVE_W32_SYSTEM
    > int _assuan_simple_sendmsg (assuan_context_t ctx, void *msg);
    > int _assuan_simple_recvmsg (assuan_context_t ctx, void *msg);
    > #else
    284a291
    > #endif

4. modified assuan-socket-server.c (after the stand alone version of
libassuan)
    $ diff -B assuan_orig/assuan-socket-server.c
assuan/assuan-socket-server.c
    82c82
    <
    ---
    > #define socklen_t int

5. conditionally (#ifndef _WIN32) removed the contents of funopen.c (after
the stand alone version of libassaun which doesn't even compile funopen.c)
    $ diff -B assuan_orig/funopen.c assuan/funopen.c
    21a22
    > #ifndef _WIN32
    64a66
    > #endif /* _WIN32 */

6. modified assuan-io.c (after the stand alone version of libassuan)
    $ diff -B assuan_orig/assuan-io.c assuan/assuan-io.c
    28c28,30
    < #include <sys/socket.h>
    ---
    > #ifdef HAVE_SYS_SOCKET_H
    > # include <sys/socket.h>
    > #endif
    61a64,67
    > #ifdef HAVE_W32_SYSTEM
    > int
    > _assuan_simple_sendmsg (assuan_context_t ctx, void *msg)
    > #else
    63a70
    > #endif
    75c82,85
    <
    ---
    > #ifdef HAVE_W32_SYSTEM
    > int
    > _assuan_simple_recvmsg (assuan_context_t ctx, void *msg)
    > #else
    77a88
    > #endif

7. modified setenv.c, changed "#if HAVE_ASSUAN_H" to "#ifdef HAVE_ASSUAN_H"
as HAVE_ASSUAN_H is just defined, but not to a value
    $ diff -B gpgme_orig/setenv.c gpgme/setenv.c
    23c23
    < #if HAVE_ASSUAN_H
    ---
    > #ifdef HAVE_ASSUAN_H

8. modified tests/gpg/t-eventloop.c for a conditional include of
sys/select.h or sys/time.h and added a conditional include of winsock2.h
    $ diff -B tests/gpg_orig/t-eventloop.c tests/gpg/t-eventloop.c
    34c34,41
    < #include <sys/select.h>
    ---
    > # ifdef HAVE_SYS_SELECT_H
    > #  include <sys/select.h>
    > # else
    > #  include <sys/time.h>
    > # endif
    > #ifdef _WIN32
    > #include <winsock2.h>
    > #endif

9. modified tests/gpg/t-wait.c to conditionally (#ifdef _WIN32) include
windows.h and use Sleep() instead of sleep()
    $ diff -B tests/gpg_orig/t-wait.c tests/gpg/t-wait.c
    31a32,35
    > #ifdef _WIN32
    > #include <windows.h>
    > #endif
    >
    57a62
    > #ifndef _WIN32
    59c64,66
    <
    ---
    > #else
    >     Sleep(1);
    > #endif

10. ran configure adding wsock32 for linking
    $ ./configure LDFLAGS=-lwsock32

11. modified config.h by "#undef ENABLE_GPGSM" and "#undef GPGSM_PATH" to
remove gpgsm support and "#undef USE_DESCRIPTOR_PASSING" after the stand
alone version of libassuan, there's probably some nifty way to do this with
configure however i'm not too suave with
configure-automake-autoconf-autowhatever-weird-sh-scripts so i cheated :)

12. modified the tests/gpg/Makefile to exclude the thread test (it could
probably be enabled by adding pthreads-w32), removed the t-thread1$(EXEEXT)
from am__EXEEXT_1

13. $ make install

well obviously that's not the order i did it in :) rather "make - correct an
error - make - correct an error"..

and then for winpt-1.2.0
$ ./configure
$ cd Gnupg ; make
$ cd ../PTD ; make
$ cd ../Src ; make
and voila: you have one WinPT.exe a deguster ;)

and now i just have to poke it a little, i'll post the diffs for that if
anyone's interested..

j
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wald.intevation.org/pipermail/gpg4win-users-en/attachments/20080410/b157ff80/attachment.html>


More information about the Gpg4win-users-en mailing list