summaryrefslogtreecommitdiff
path: root/doc/tor-win32-mingw-creation.txt
blob: 4550d0d1e4961abdea263abe17139e6f4efb6b2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
## Instructions for building Tor with MinGW (http://www.mingw.org/)
##

Stage One:  Download and Install MinGW.
---------------------------------------

Download mingw:
http://prdownloads.sf.net/mingw/MinGW-5.0.3.exe?download


Download msys:
http://prdownloads.sf.net/mingw/MSYS-1.0.10.exe?download

Download the mingw developer tool kit:
http://prdownloads.sf.net/mingw/msysDTK-1.0.1.exe?download

Download the mingw win32api:
http://prdownloads.sf.net/mingw/w32api-3.6.tar.gz?download

Install mingw, msys and mingw-dtk.

Stage Two:  Download, extract, compile openssl
----------------------------------------------

Download openssl:
http://www.openssl.org/source/openssl-0.9.8c.tar.gz

Extract openssl:
cp openssl-0.9.8c.tar.gz tor-mingw/
cd tor-mingw/
tar zxf openssl-0.9.8c.tar.gz

Make openssl.dll:
cd tor-mingw/openssl-0.9.8c/
cd crypto/
find ./ -name "*.h" -exec cp {} ../include/openssl/ \;
find ./crypto/ -type f -name "*.c" -exec cp {} test/ \
cd ../ssl/
find ./ -name "*.h" -exec cp {} ../include/openssl/ \;
cp *.h ./include/openssl/
cp ssl/ssltest.c test/
./Configure mingw
make

Note: this fails in test due to: 
make[1]: *** No rule to make target `sha256t.o', needed by `sha256t.exe'.  Stop.
--need to research this - phobos

Alternatively:
Download the pre-compiled openssl for win32.
Install and proceed.


Stage Three:  Download, extract, compile zlib
---------------------------------------------

Download zlib source:
http://www.zlib.net/zlib-1.2.3.tar.gz

Extract zlib:
cp zlib-1.2.3.tar.gz tor-mingw/
cd tor-mingw/
tar zxf zlib-1.2.3.tar.gz

Make zlib1.dll:
cd tor-mingw/zlib-1.2.3/
make -f win32/Makefile.gcc

Done.


Stage Four: Download, extract, and patch libevent-1.1b.
------------------------------------------------------

Download libevent-1.1b:
http://www.monkey.org/~provos/libevent/

Start up MSYS:
Start -> Programs -> MinGW -> MSYS -> msys

Create a directory to work within, for example, /c/tor-mingw.

Copy libevent and tor tarballs into this working dir:
cp /path/to/libevent-1.1b.tar.gz /c/tor-mingw/
cp /patch/to/tor-alpha.tar.gz /c/tor-mingw/
cd /c/tor-mingw/

Extract libevent: tar zxf libevent-1.1b.tar.gz
Extract tor: tar zxf tor-alpha.tar.gz

Copy the libevent-1.1b diff into libevent-1.1b:
cp /c/tor-mingw/tor/Win32Build/mingw/libevent-1.1b-mingw-custom.diff /c/tor-mingw/libevent-1.1b/
patch -i libevent-1.1b-mingw-custom.diff

Your output of the "patch" command should be similar to:
"patch -i libevent-1.1b-mingw-custom.diff 
patching file `Makefile.am'
can't find file to patch at input line 49
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|Only in libevent-1.1b: Makefile.in
|diff -uwr libevent-1.1b-old/WIN32-Code/misc.c libevent-1.1b/WIN32-Code/misc.c
|--- libevent-1.1b-old/WIN32-Code/misc.c        Wed Aug  9 21:01:14 2006
|+++ libevent-1.1b/WIN32-Code/misc.c    Fri Sep  1 22:21:31 2006
--------------------------
File to patch: WIN32-Code/misc.c
patching file `WIN32-Code/misc.c'
can't find file to patch at input line 65
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff -uwr libevent-1.1b-old/WIN32-Code/misc.h libevent-1.1b/WIN32-Code/misc.h
|--- libevent-1.1b-old/WIN32-Code/misc.h        Wed Aug  9 21:01:14 2006
|+++ libevent-1.1b/WIN32-Code/misc.h    Fri Sep  1 18:47:09 2006
--------------------------
File to patch: WIN32-Code/misc.h
patching file `WIN32-Code/misc.h'
can't find file to patch at input line 78
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
--------------------------
|diff -uwr libevent-1.1b-old/WIN32-Code/win32.c
libevent-1.1b/WIN32-Code/win32.c
|--- libevent-1.1b-old/WIN32-Code/win32.c       Wed Aug  9 21:25:48 2006
|+++ libevent-1.1b/WIN32-Code/win32.c   Sat Sep  2 00:45:55 2006
--------------------------
File to patch: WIN32-Code/win32.c
patching file `WIN32-Code/win32.c'
patching file `buffer.c'
patching file `config.h.in'
patching file `configure.in'
patching file `evbuffer.c'
patching file `event.c'
patching file `log.c' "

--This is a complete hack right now:
remove from event.c and log.c:
#ifdef __GNUC__
#include "WIN32-Code/misc.h"
#else
#include "misc.h"
#endif

Run "aclocal && autoheader && automake && autoconf".
There may be WARNING messages.  There will be no output if all runs successfuly.

Run "./configure"
Run "make"
Run "make install"

Stage Five:  Build Tor
----------------------

Extract the latest tor from svn in tor-mingw dir:
tar zxf latest-tor-alpha.tar.gz

cd tor-alpha
./autogen.sh
./configure 

(less magic happens here and a complete tor-alpha.exe is created)