1 Building Tor with MSVC.
\r
2 =======================
\r
4 NOTE: This is not the preferred method for building Tor on windows: we use
\r
5 mingw for our packages.
\r
7 Last updated 9 September 2014.
\r
13 * Visual Studio 2010
\r
14 https://go.microsoft.com/fwlink/?LinkId=323467
\r
16 https://www.cmake.org/download/
\r
18 https://www.activestate.com/activeperl/downloads
\r
19 * Latest stable OpenSSL tarball
\r
20 https://www.openssl.org/source/
\r
21 * Latest stable zlib tarball
\r
23 * Latest stable libevent Libevent tarball
\r
24 https://github.com/libevent/libevent/releases
\r
26 Make sure you check signatures for all these packages.
\r
31 Building OpenSSL from source as a shared library:
\r
33 cd <openssl source dir>
\r
34 perl Configure VC-WIN32
\r
35 perl util\mkfiles.pl >MINFO
\r
36 perl util\mk1mf.pl no-asm dll VC-WIN32 >32dll.mak
\r
37 perl util\mkdef.pl 32 libeay > ms\libeay32.def
\r
38 perl util\mkdef.pl 32 ssleay > ms\ssleay32.def
\r
41 Making OpenSSL final package:
\r
43 Create <openssl final package dir>, I'd recommend using a name like <openssl
\r
46 Copy the following directories and files to their respective locations
\r
47 <openssl source dir>\inc32\openssl => <openssl final package dir>\include\openssl
\r
48 <openssl source dir>\out32dll\libeay32.lib => <openssl final package dir>\lib\libeay32.lib
\r
49 <openssl source dir>\out32dll\ssleay32.lib => <openssl final package dir>\lib\ssleay32.lib
\r
50 <openssl source dir>\out32dll\libeay32.dll => <openssl final package dir>\bin\libeay32.dll
\r
51 <openssl source dir>\out32dll\openssl.exe => <openssl final package dir>\bin\openssl.exe
\r
52 <openssl source dir>\out32dll\ssleay32.dll => <openssl final package dir>\bin\ssleay32.dll
\r
54 Building Zlib from source:
\r
56 cd <zlib source dir>
\r
57 nmake -f win32/Makefile.msc
\r
61 cd <libevent source dir>
\r
62 mkdir build && cd build
\r
63 SET OPENSSL_ROOT_DIR=<openssl final package dir>
\r
64 cmake -G "NMake Makefiles" .. -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING="/MT /Zi /O2 /Ob1 /D NDEBUG" -DZLIB_LIBRARY:FILEPATH="<zlib source dir>\zdll.lib" -DZLIB_INCLUDE_DIR:PATH="<zlib source dir>"
\r
69 Create a dir above tor source dir named build-alpha and two subdirs include
\r
72 Your build tree should now be similar to this one:
\r
76 * <libevent source dir>
\r
80 * <openssl source dir>
\r
85 * <openssl final package dir>
\r
98 Copy the following dirs and files to the following locations:
\r
99 <openssl final package dir>\include\openssl => build-alpha\include\openssl
\r
100 <libevent source dir>\include => build-alpha\include
\r
101 <libevent source dir>\WIN32-Code\nmake\event2 => build-alpha\include\event2
\r
102 <zlib source dir>\z*.h => build-alpha\include\z*.h
\r
104 Now copy the following files to the following locations and rename them
\r
105 according new names:
\r
107 <libevent source dir>\build\lib\event.lib => build-alpha\lib\libevent.lib
\r
108 <openssl final package dir>\lib\libeay32.lib => build-alpha\lib\libcrypto.lib
\r
109 <openssl final package dir>\lib\ssleay32.lib => build-alpha\lib\libssl.lib
\r
110 <zlib source dir>\zdll.lib => build-alpha\lib\libz.lib
\r
112 And we are now ready for the build process:
\r
114 cd <tor source dir>
\r
115 nmake -f Makefile.nmake
\r
117 After the above process is completed there should be a tor.exe in <tor
\r
120 Copy tor.exe to desired location and also copy zlib1.dll, libeay32.dll and
\r
121 ssleay32.dll from built zlib and openssl packages
\r