Ticket #13081: fix-vs-build-win2.txt

File fix-vs-build-win2.txt, 8.2 KB (added by NewEraCracker, 5 years ago)

New patch for building TOR with VS. Includes test and tools build.

Line 
1diff -uNraw tor-0.2.5.6-alpha/Makefile.nmake tor-0.2.5.6-alpha.new/Makefile.nmake
2--- tor-0.2.5.6-alpha/Makefile.nmake    Sat Jun 21 21:16:03 2014
3+++ tor-0.2.5.6-alpha.new/Makefile.nmake        Mon Sep  8 13:07:20 2014
4@@ -1,15 +1,23 @@
5 all:
6        cd src/common
7        $(MAKE) /F Makefile.nmake
8+       cd ../../src/ext
9+       $(MAKE) /F Makefile.nmake
10        cd ../../src/or
11        $(MAKE) /F Makefile.nmake
12        cd ../../src/test
13        $(MAKE) /F Makefile.nmake
14+       cd ../../src/tools
15+       $(MAKE) /F Makefile.nmake
16 
17 clean:
18        cd src/common
19        $(MAKE) /F Makefile.nmake clean
20+       cd ../../src/ext
21+       $(MAKE) /F Makefile.nmake clean
22        cd ../../src/or
23        $(MAKE) /F Makefile.nmake clean
24        cd ../../src/test
25        $(MAKE) /F Makefile.nmake clean
26+       cd ../../src/tools
27+       $(MAKE) /F Makefile.nmake clean
28diff -uNraw tor-0.2.5.6-alpha/src/common/Makefile.nmake tor-0.2.5.6-alpha.new/src/common/Makefile.nmake
29--- tor-0.2.5.6-alpha/src/common/Makefile.nmake Sat Jun 21 21:16:03 2014
30+++ tor-0.2.5.6-alpha.new/src/common/Makefile.nmake     Mon Sep  8 14:07:41 2014
31@@ -1,12 +1,12 @@
32 all: libor.lib libor-crypto.lib libor-event.lib
33 
34-CFLAGS = /I ..\win32 /I ..\..\..\build-alpha\include /I ..\ext
35+CFLAGS = /D TOR_UNIT_TESTS /O2 /MT /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common /I ..\or /I ..\ext
36 
37-LIBOR_OBJECTS = address.obj compat.obj container.obj di_ops.obj \
38-       log.obj memarea.obj mempool.obj procmon.obj util.obj \
39+LIBOR_OBJECTS = address.obj backtrace.obj compat.obj container.obj di_ops.obj \
40+       log.obj memarea.obj mempool.obj procmon.obj sandbox.obj util.obj \
41        util_codedigest.obj
42 
43-LIBOR_CRYPTO_OBJECTS = aes.obj crypto.obj torgzip.obj tortls.obj \
44+LIBOR_CRYPTO_OBJECTS = aes.obj crypto.obj crypto_format.obj torgzip.obj tortls.obj \
45        crypto_curve25519.obj curve25519-donna.obj
46 
47 LIBOR_EVENT_OBJECTS = compat_libevent.obj
48diff -uNraw tor-0.2.5.6-alpha/src/ext/Makefile.nmake tor-0.2.5.6-alpha.new/src/ext/Makefile.nmake
49--- tor-0.2.5.6-alpha/src/ext/Makefile.nmake    Thu Jan  1 00:00:00 1970
50+++ tor-0.2.5.6-alpha.new/src/ext/Makefile.nmake        Mon Sep  8 13:50:36 2014
51@@ -0,0 +1,12 @@
52+all: csiphash.lib tinytest.lib
53+
54+CFLAGS = /O2 /MT /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common /I ..\or /I ..\ext
55+
56+csiphash.lib: csiphash.obj
57+       lib csiphash.obj /out:csiphash.lib
58+
59+tinytest.lib: tinytest.obj
60+       lib tinytest.obj /out:tinytest.lib
61+
62+clean:
63+       del *.obj *.lib
64diff -uNraw tor-0.2.5.6-alpha/src/ext/tinytest.c tor-0.2.5.6-alpha.new/src/ext/tinytest.c
65--- tor-0.2.5.6-alpha/src/ext/tinytest.c        Mon Jul 28 10:00:13 2014
66+++ tor-0.2.5.6-alpha.new/src/ext/tinytest.c    Mon Sep  8 14:16:50 2014
67@@ -56,6 +56,10 @@
68 #define __attribute__(x)
69 #endif
70 
71+#ifdef _WIN32
72+#define snprintf _snprintf
73+#endif
74+
75 #include "tinytest.h"
76 #include "tinytest_macros.h"
77 
78diff -uNraw tor-0.2.5.6-alpha/src/or/Makefile.nmake tor-0.2.5.6-alpha.new/src/or/Makefile.nmake
79--- tor-0.2.5.6-alpha/src/or/Makefile.nmake     Sat Jun 21 21:16:03 2014
80+++ tor-0.2.5.6-alpha.new/src/or/Makefile.nmake Mon Sep  8 14:05:38 2014
81@@ -1,7 +1,6 @@
82 all: tor.exe
83 
84-CFLAGS = /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common \
85-    /I ..\ext
86+CFLAGS = /D TOR_UNIT_TESTS /O2 /MT /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common /I ..\or /I ..\ext
87 
88 LIBS = ..\..\..\build-alpha\lib\libevent.lib \
89  ..\..\..\build-alpha\lib\libcrypto.lib \
90@@ -15,6 +14,7 @@
91   buffers.obj \
92   channel.obj \
93   channeltls.obj \
94+  circpathbias.obj \
95   circuitbuild.obj \
96   circuitlist.obj \
97   circuitmux.obj \
98@@ -35,6 +35,7 @@
99   dirvote.obj \
100   dns.obj \
101   dnsserv.obj \
102+  ext_orport.obj \
103   fp_pair.obj \
104   entrynodes.obj \
105   geoip.obj \
106@@ -69,7 +70,7 @@
107        lib $(LIBTOR_OBJECTS) /out:$@
108 
109 tor.exe: libtor.lib tor_main.obj
110-       $(CC) $(CFLAGS) $(LIBS) libtor.lib ..\common\*.lib tor_main.obj /Fe$@
111+       $(CC) $(CFLAGS) $(LIBS) libtor.lib ..\common\*.lib ..\ext\*.lib tor_main.obj /Fe$@
112 
113 clean:
114-       del $(LIBTOR_OBJECTS) *.lib tor.exe
115+       del $(LIBTOR_OBJECTS) tor_main.obj *.lib tor.exe
116diff -uNraw tor-0.2.5.6-alpha/src/test/Makefile.nmake tor-0.2.5.6-alpha.new/src/test/Makefile.nmake
117--- tor-0.2.5.6-alpha/src/test/Makefile.nmake   Thu Jan  1 00:00:00 1970
118+++ tor-0.2.5.6-alpha.new/src/test/Makefile.nmake       Mon Sep  8 14:17:54 2014
119@@ -0,0 +1,52 @@
120+all: bench.exe test.exe
121+
122+CFLAGS = /D TOR_UNIT_TESTS /O2 /MT /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common /I ..\or /I ..\ext
123+
124+LIBS = ..\..\..\build-alpha\lib\libevent.lib \
125+ ..\..\..\build-alpha\lib\libcrypto.lib \
126+ ..\..\..\build-alpha\lib\libssl.lib \
127+ ..\..\..\build-alpha\lib\libz.lib \
128+ ws2_32.lib advapi32.lib shell32.lib \
129+ crypt32.lib gdi32.lib user32.lib
130+
131+TEST_OBJECTS = \
132+  test.obj                   \
133+  test_addr.obj              \
134+# test_bt_cl.obj             \
135+  test_buffers.obj           \
136+  test_cell_formats.obj      \
137+  test_cell_queue.obj        \
138+  test_circuitlist.obj       \
139+  test_circuitmux.obj        \
140+  test_config.obj            \
141+  test_containers.obj        \
142+  test_controller_events.obj \
143+  test_crypto.obj            \
144+  test_data.obj              \
145+  test_dir.obj               \
146+  test_extorport.obj         \
147+  test_hs.obj                \
148+  test_introduce.obj         \
149+  test_logging.obj           \
150+  test_microdesc.obj         \
151+  test_nodelist.obj          \
152+# test_ntor_cl.obj           \
153+  test_oom.obj               \
154+  test_options.obj           \
155+  test_policy.obj            \
156+  test_pt.obj                \
157+  test_relaycell.obj         \
158+  test_replay.obj            \
159+  test_routerkeys.obj        \
160+  test_socks.obj             \
161+  test_status.obj            \
162+  test_util.obj
163+
164+bench.exe: bench.obj
165+       $(CC) $(CFLAGS) $(LIBS) ..\or\libtor.lib ..\common\*.lib ..\ext\*.lib bench.obj /Fe$@
166+
167+test.exe: $(TEST_OBJECTS)
168+       $(CC) $(CFLAGS) $(LIBS) ..\or\libtor.lib ..\common\*.lib ..\ext\*.lib $(TEST_OBJECTS) /Fe$@
169+
170+clean:
171+       del bench.obj bench.exe $(TEST_OBJECTS) test.exe
172diff -uNraw tor-0.2.5.6-alpha/src/test/test.h tor-0.2.5.6-alpha.new/src/test/test.h
173--- tor-0.2.5.6-alpha/src/test/test.h   Mon Jul 28 10:00:13 2014
174+++ tor-0.2.5.6-alpha.new/src/test/test.h       Mon Sep  8 13:43:03 2014
175@@ -61,7 +61,7 @@
176 
177 #ifdef _MSC_VER
178 #define U64_PRINTF_TYPE uint64_t
179-#define U64_PRINTF_TYPE int64_t
180+#define I64_PRINTF_TYPE int64_t
181 #else
182 #define U64_PRINTF_TYPE unsigned long long
183 #define I64_PRINTF_TYPE long long
184diff -uNraw tor-0.2.5.6-alpha/src/test/test_bt_cl.c tor-0.2.5.6-alpha.new/src/test/test_bt_cl.c
185--- tor-0.2.5.6-alpha/src/test/test_bt_cl.c     Mon Jul 28 10:00:13 2014
186+++ tor-0.2.5.6-alpha.new/src/test/test_bt_cl.c Mon Sep  8 14:10:24 2014
187@@ -18,6 +18,9 @@
188 #ifdef __GNUC__
189 #define NOINLINE __attribute__((noinline))
190 #define NORETURN __attribute__((noreturn))
191+#else
192+#define NOINLINE
193+#define NORETURN
194 #endif
195 
196 int crash(int x) NOINLINE;
197diff -uNraw tor-0.2.5.6-alpha/src/tools/Makefile.nmake tor-0.2.5.6-alpha.new/src/tools/Makefile.nmake
198--- tor-0.2.5.6-alpha/src/tools/Makefile.nmake  Thu Jan  1 00:00:00 1970
199+++ tor-0.2.5.6-alpha.new/src/tools/Makefile.nmake      Mon Sep  8 13:29:50 2014
200@@ -0,0 +1,22 @@
201+all: tor-checkkey.exe tor-gencert.exe tor-resolve.exe
202+
203+CFLAGS = /O2 /MT /I ..\win32 /I ..\..\..\build-alpha\include /I ..\common /I ..\or /I ..\ext
204+
205+LIBS = ..\..\..\build-alpha\lib\libevent.lib \
206+ ..\..\..\build-alpha\lib\libcrypto.lib \
207+ ..\..\..\build-alpha\lib\libssl.lib \
208+ ..\..\..\build-alpha\lib\libz.lib \
209+ ws2_32.lib advapi32.lib shell32.lib \
210+ crypt32.lib gdi32.lib user32.lib
211+
212+tor-checkkey.exe: tor-checkkey.obj
213+       $(CC) $(CFLAGS) $(LIBS) ..\or\libtor.lib ..\common\*.lib ..\ext\*.lib tor-checkkey.obj /Fe$@
214+
215+tor-gencert.exe: tor-gencert.obj
216+       $(CC) $(CFLAGS) $(LIBS) ..\or\libtor.lib ..\common\*.lib ..\ext\*.lib tor-gencert.obj /Fe$@
217+
218+tor-resolve.exe: tor-resolve.obj
219+       $(CC) $(CFLAGS) $(LIBS) ..\or\libtor.lib ..\common\*.lib ..\ext\*.lib tor-resolve.obj /Fe$@
220+
221+clean:
222+       del tor-checkkey.obj tor-gencert.obj tor-resolve.obj tor-checkkey.exe tor-gencert.exe tor-resolve.exe
223diff -uNraw tor-0.2.5.6-alpha/src/win32/orconfig.h tor-0.2.5.6-alpha.new/src/win32/orconfig.h
224--- tor-0.2.5.6-alpha/src/win32/orconfig.h      Mon Jul 28 10:00:13 2014
225+++ tor-0.2.5.6-alpha.new/src/win32/orconfig.h  Mon Sep  8 14:15:37 2014
226@@ -257,3 +257,11 @@
227 #define USE_CURVE25519_DONNA
228 
229 #define ENUM_VALS_ARE_SIGNED 1
230+
231+#ifndef STDOUT_FILENO
232+#define STDOUT_FILENO 1
233+#endif
234+
235+#ifndef STDERR_FILENO
236+#define STDERR_FILENO 2
237+#endif