From 4e98ec8149ef362eb6eb0b5e1fdaad3132b6a0d9 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 9 Sep 2014 10:30:57 -0400 Subject: [PATCH] Add instructions for building Tor with MSVC. Written by "NewEraCracker" on ticket 13081; I've added a note that this is not our preferred or supported build method. --- doc/building-tor-msvc.txt | 116 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 doc/building-tor-msvc.txt diff --git a/doc/building-tor-msvc.txt b/doc/building-tor-msvc.txt new file mode 100644 index 000000000..b22f44481 --- /dev/null +++ b/doc/building-tor-msvc.txt @@ -0,0 +1,116 @@ +Building Tor with MSVC. +======================= + +NOTE: This is not the preferred method for building Tor on windows: we use +mingw for our packages. + +Last updated 9 September 2014. + + +Requirements: +------------- + + * Visual Studio 2010 + http://go.microsoft.com/fwlink/?LinkId=323467 + * CMake 2.8.12.2 + http://www.cmake.org/download/ + * Perl 5.16 + http://www.activestate.com/activeperl/downloads + * Latest stable OpenSSL tarball + https://www.openssl.org/source/ + * Zlib 1.2.8 tarball + http://zlib.net/ + * Libevent 2.1 tarball + https://github.com/libevent/libevent/releases + +Make sure you check signatures on all these packages! + +Steps: +------ + +Building OpenSSL from source as a shared library: + + cd + perl Configure VC-WIN32 + perl util\mkfiles.pl >MINFO + perl util\mk1mf.pl no-asm dll VC-WIN32 >32dll.mak + perl util\mkdef.pl 32 libeay > ms\libeay32.def + perl util\mkdef.pl 32 ssleay > ms\ssleay32.def + nmake -f 32dll.mak + +Making OpenSSL final package: + + Create , I'd recommend using a name like -vc10. + + Copy the following directories and files to their respective locations + \inc32\openssl => \include\openssl + \out32dll\libeay32.lib => \lib\libeay32.lib + \out32dll\ssleay32.lib => \lib\ssleay32.lib + \out32dll\libeay32.dll => \bin\libeay32.dll + \out32dll\openssl.exe => \bin\openssl.exe + \out32dll\ssleay32.dll => \bin\ssleay32.dll + +Building Zlib from source: + + cd + nmake -f win32/Makefile.msc + +Building libevent: + + cd + mkdir build && cd build + SET OPENSSL_ROOT_DIR= + cmake -G "NMake Makefiles" .. -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING="/MT /Zi /O2 /Ob1 /D NDEBUG" -DZLIB_LIBRARY:FILEPATH="\zdll.lib" -DZLIB_INCLUDE_DIR:PATH="" + nmake event + +Building Tor: + + Create a dir above tor source dir named build-alpha and two subdirs include and lib. + + Your build tree should now be similar to this one: + * build-alpha + - include + - lib + * + - build + - cmake + - ... + * + - ... + - ms + - util + - ... + * + - bin + - include + - lib + * + - ... + - src + - ... + * + - ... + - win32 + - ... + + Copy the following dirs and files to the following locations: + \include\openssl => build-alpha\include\openssl + \include => build-alpha\include + \WIN32-Code\nmake\event2 => build-alpha\include\event2 + \z*.h => build-alpha\include\z*.h + + Now copy the following files to the followin locations: + + \build\lib\event.lib => build-alpha\lib\libevent.lib + \lib\libeay32.lib => build-alpha\lib\libcrypto.lib + \lib\ssleay32.lib => build-alpha\lib\libssl.lib + \zdll.lib => build-alpha\lib\libz.lib + + And we are now ready for the build process: + + cd + nmake -f Makefile.nmake + + After the above process is completed there should be a tor.exe in \src\or + + Copy tor.exe to desired location and also copy zlib1.dll, libeay32.dll and ssleay32.dll from built zlib and openssl packages