building-tor-msvc.txt 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. Building Tor with MSVC.
  2. =======================
  3. NOTE: This is not the preferred method for building Tor on windows: we use
  4. mingw for our packages.
  5. Last updated 9 September 2014.
  6. Requirements:
  7. -------------
  8. * Visual Studio 2010
  9. http://go.microsoft.com/fwlink/?LinkId=323467
  10. * CMake 2.8.12.2
  11. http://www.cmake.org/download/
  12. * Perl 5.16
  13. http://www.activestate.com/activeperl/downloads
  14. * Latest stable OpenSSL tarball
  15. https://www.openssl.org/source/
  16. * Zlib 1.2.8 tarball
  17. http://zlib.net/
  18. * Libevent 2.1 tarball
  19. https://github.com/libevent/libevent/releases
  20. Make sure you check signatures on all these packages!
  21. Steps:
  22. ------
  23. Building OpenSSL from source as a shared library:
  24. cd <openssl source dir>
  25. perl Configure VC-WIN32
  26. perl util\mkfiles.pl >MINFO
  27. perl util\mk1mf.pl no-asm dll VC-WIN32 >32dll.mak
  28. perl util\mkdef.pl 32 libeay > ms\libeay32.def
  29. perl util\mkdef.pl 32 ssleay > ms\ssleay32.def
  30. nmake -f 32dll.mak
  31. Making OpenSSL final package:
  32. Create <openssl final package dir>, I'd recommend using a name like <openssl source dir>-vc10.
  33. Copy the following directories and files to their respective locations
  34. <openssl source dir>\inc32\openssl => <openssl final package dir>\include\openssl
  35. <openssl source dir>\out32dll\libeay32.lib => <openssl final package dir>\lib\libeay32.lib
  36. <openssl source dir>\out32dll\ssleay32.lib => <openssl final package dir>\lib\ssleay32.lib
  37. <openssl source dir>\out32dll\libeay32.dll => <openssl final package dir>\bin\libeay32.dll
  38. <openssl source dir>\out32dll\openssl.exe => <openssl final package dir>\bin\openssl.exe
  39. <openssl source dir>\out32dll\ssleay32.dll => <openssl final package dir>\bin\ssleay32.dll
  40. Building Zlib from source:
  41. cd <zlib source dir>
  42. nmake -f win32/Makefile.msc
  43. Building libevent:
  44. cd <libevent source dir>
  45. mkdir build && cd build
  46. SET OPENSSL_ROOT_DIR=<openssl final package dir>
  47. 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>"
  48. nmake event
  49. Building Tor:
  50. Create a dir above tor source dir named build-alpha and two subdirs include and lib.
  51. Your build tree should now be similar to this one:
  52. * build-alpha
  53. - include
  54. - lib
  55. * <libevent source dir>
  56. - build
  57. - cmake
  58. - ...
  59. * <openssl source dir>
  60. - ...
  61. - ms
  62. - util
  63. - ...
  64. * <openssl final package dir>
  65. - bin
  66. - include
  67. - lib
  68. * <tor source dir>
  69. - ...
  70. - src
  71. - ...
  72. * <zlib source dir>
  73. - ...
  74. - win32
  75. - ...
  76. Copy the following dirs and files to the following locations:
  77. <openssl final package dir>\include\openssl => build-alpha\include\openssl
  78. <libevent source dir>\include => build-alpha\include
  79. <libevent source dir>\WIN32-Code\nmake\event2 => build-alpha\include\event2
  80. <zlib source dir>\z*.h => build-alpha\include\z*.h
  81. Now copy the following files to the followin locations:
  82. <libevent source dir>\build\lib\event.lib => build-alpha\lib\libevent.lib
  83. <openssl final package dir>\lib\libeay32.lib => build-alpha\lib\libcrypto.lib
  84. <openssl final package dir>\lib\ssleay32.lib => build-alpha\lib\libssl.lib
  85. <zlib source dir>\zdll.lib => build-alpha\lib\libz.lib
  86. And we are now ready for the build process:
  87. cd <tor source dir>
  88. nmake -f Makefile.nmake
  89. After the above process is completed there should be a tor.exe in <tor source dir>\src\or
  90. Copy tor.exe to desired location and also copy zlib1.dll, libeay32.dll and ssleay32.dll from built zlib and openssl packages