building-tor-msvc.txt 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. https://go.microsoft.com/fwlink/?LinkId=323467
  10. * CMake 2.8.12.2
  11. https://www.cmake.org/download/
  12. * Perl 5.16
  13. https://www.activestate.com/activeperl/downloads
  14. * Latest stable OpenSSL tarball
  15. https://www.openssl.org/source/
  16. * Latest stable zlib tarball
  17. https://zlib.net/
  18. * Latest stable libevent Libevent tarball
  19. https://github.com/libevent/libevent/releases
  20. Make sure you check signatures for 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
  33. source dir>-vc10.
  34. Copy the following directories and files to their respective locations
  35. <openssl source dir>\inc32\openssl => <openssl final package dir>\include\openssl
  36. <openssl source dir>\out32dll\libeay32.lib => <openssl final package dir>\lib\libeay32.lib
  37. <openssl source dir>\out32dll\ssleay32.lib => <openssl final package dir>\lib\ssleay32.lib
  38. <openssl source dir>\out32dll\libeay32.dll => <openssl final package dir>\bin\libeay32.dll
  39. <openssl source dir>\out32dll\openssl.exe => <openssl final package dir>\bin\openssl.exe
  40. <openssl source dir>\out32dll\ssleay32.dll => <openssl final package dir>\bin\ssleay32.dll
  41. Building Zlib from source:
  42. cd <zlib source dir>
  43. nmake -f win32/Makefile.msc
  44. Building libevent:
  45. cd <libevent source dir>
  46. mkdir build && cd build
  47. SET OPENSSL_ROOT_DIR=<openssl final package dir>
  48. 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>"
  49. nmake event
  50. Building Tor:
  51. Create a dir above tor source dir named build-alpha and two subdirs include
  52. and lib.
  53. Your build tree should now be similar to this one:
  54. * build-alpha
  55. - include
  56. - lib
  57. * <libevent source dir>
  58. - build
  59. - cmake
  60. - ...
  61. * <openssl source dir>
  62. - ...
  63. - ms
  64. - util
  65. - ...
  66. * <openssl final package dir>
  67. - bin
  68. - include
  69. - lib
  70. * <tor source dir>
  71. - ...
  72. - src
  73. - ...
  74. * <zlib source dir>
  75. - ...
  76. - win32
  77. - ...
  78. Copy the following dirs and files to the following locations:
  79. <openssl final package dir>\include\openssl => build-alpha\include\openssl
  80. <libevent source dir>\include => build-alpha\include
  81. <libevent source dir>\WIN32-Code\nmake\event2 => build-alpha\include\event2
  82. <zlib source dir>\z*.h => build-alpha\include\z*.h
  83. Now copy the following files to the following locations and rename them
  84. according new names:
  85. <libevent source dir>\build\lib\event.lib => build-alpha\lib\libevent.lib
  86. <openssl final package dir>\lib\libeay32.lib => build-alpha\lib\libcrypto.lib
  87. <openssl final package dir>\lib\ssleay32.lib => build-alpha\lib\libssl.lib
  88. <zlib source dir>\zdll.lib => build-alpha\lib\libz.lib
  89. And we are now ready for the build process:
  90. cd <tor source dir>
  91. nmake -f Makefile.nmake
  92. After the above process is completed there should be a tor.exe in <tor
  93. source dir>\src\or
  94. Copy tor.exe to desired location and also copy zlib1.dll, libeay32.dll and
  95. ssleay32.dll from built zlib and openssl packages