tor-win32-mingw-creation.txt 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. ## Instructions for building Tor with MinGW (http://www.mingw.org/)
  2. ##
  3. Stage One: Download and Install MinGW.
  4. ---------------------------------------
  5. Download mingw:
  6. http://prdownloads.sf.net/mingw/MinGW-5.0.3.exe?download
  7. Download msys:
  8. http://prdownloads.sf.net/mingw/MSYS-1.0.10.exe?download
  9. Download the mingw developer tool kit:
  10. http://prdownloads.sf.net/mingw/msysDTK-1.0.1.exe?download
  11. Download the mingw win32api:
  12. http://prdownloads.sf.net/mingw/w32api-3.6.tar.gz?download
  13. Install mingw, msys and mingw-dtk.
  14. Stage Two: Download, extract, compile openssl
  15. ----------------------------------------------
  16. Download openssl:
  17. http://www.openssl.org/source/openssl-0.9.8c.tar.gz
  18. Extract openssl:
  19. cp openssl-0.9.8c.tar.gz tor-mingw/
  20. cd tor-mingw/
  21. tar zxf openssl-0.9.8c.tar.gz
  22. Make openssl.dll:
  23. cd tor-mingw/openssl-0.9.8c/
  24. cd crypto/
  25. find ./ -name "*.h" -exec cp {} ../include/openssl/ \;
  26. find ./crypto/ -type f -name "*.c" -exec cp {} test/ \
  27. cd ../ssl/
  28. find ./ -name "*.h" -exec cp {} ../include/openssl/ \;
  29. cp *.h ./include/openssl/
  30. cp ssl/ssltest.c test/
  31. ./Configure mingw
  32. make
  33. Note: this fails in test due to:
  34. make[1]: *** No rule to make target `sha256t.o', needed by `sha256t.exe'. Stop.
  35. --need to research this - phobos
  36. Alternatively:
  37. Download the pre-compiled openssl for win32.
  38. Install and proceed.
  39. Stage Three: Download, extract, compile zlib
  40. ---------------------------------------------
  41. Download zlib source:
  42. http://www.zlib.net/zlib-1.2.3.tar.gz
  43. Extract zlib:
  44. cp zlib-1.2.3.tar.gz tor-mingw/
  45. cd tor-mingw/
  46. tar zxf zlib-1.2.3.tar.gz
  47. Make zlib1.dll:
  48. cd tor-mingw/zlib-1.2.3/
  49. make -f win32/Makefile.gcc
  50. Done.
  51. Stage Four: Download, extract, and patch libevent-1.1b.
  52. ------------------------------------------------------
  53. Download libevent-1.1b:
  54. http://www.monkey.org/~provos/libevent/
  55. Start up MSYS:
  56. Start -> Programs -> MinGW -> MSYS -> msys
  57. Create a directory to work within, for example, /c/tor-mingw.
  58. Copy libevent and tor tarballs into this working dir:
  59. cp /path/to/libevent-1.1b.tar.gz /c/tor-mingw/
  60. cp /patch/to/tor-alpha.tar.gz /c/tor-mingw/
  61. cd /c/tor-mingw/
  62. Extract libevent: tar zxf libevent-1.1b.tar.gz
  63. Extract tor: tar zxf tor-alpha.tar.gz
  64. Copy the libevent-1.1b diff into libevent-1.1b:
  65. cp /c/tor-mingw/tor/Win32Build/mingw/libevent-1.1b-mingw-custom.diff /c/tor-mingw/libevent-1.1b/
  66. patch -i libevent-1.1b-mingw-custom.diff
  67. Your output of the "patch" command should be similar to:
  68. "patch -i libevent-1.1b-mingw-custom.diff
  69. patching file `Makefile.am'
  70. can't find file to patch at input line 49
  71. Perhaps you should have used the -p or --strip option?
  72. The text leading up to this was:
  73. --------------------------
  74. |Only in libevent-1.1b: Makefile.in
  75. |diff -uwr libevent-1.1b-old/WIN32-Code/misc.c libevent-1.1b/WIN32-Code/misc.c
  76. |--- libevent-1.1b-old/WIN32-Code/misc.c Wed Aug 9 21:01:14 2006
  77. |+++ libevent-1.1b/WIN32-Code/misc.c Fri Sep 1 22:21:31 2006
  78. --------------------------
  79. File to patch: WIN32-Code/misc.c
  80. patching file `WIN32-Code/misc.c'
  81. can't find file to patch at input line 65
  82. Perhaps you should have used the -p or --strip option?
  83. The text leading up to this was:
  84. --------------------------
  85. |diff -uwr libevent-1.1b-old/WIN32-Code/misc.h libevent-1.1b/WIN32-Code/misc.h
  86. |--- libevent-1.1b-old/WIN32-Code/misc.h Wed Aug 9 21:01:14 2006
  87. |+++ libevent-1.1b/WIN32-Code/misc.h Fri Sep 1 18:47:09 2006
  88. --------------------------
  89. File to patch: WIN32-Code/misc.h
  90. patching file `WIN32-Code/misc.h'
  91. can't find file to patch at input line 78
  92. Perhaps you should have used the -p or --strip option?
  93. The text leading up to this was:
  94. --------------------------
  95. |diff -uwr libevent-1.1b-old/WIN32-Code/win32.c
  96. libevent-1.1b/WIN32-Code/win32.c
  97. |--- libevent-1.1b-old/WIN32-Code/win32.c Wed Aug 9 21:25:48 2006
  98. |+++ libevent-1.1b/WIN32-Code/win32.c Sat Sep 2 00:45:55 2006
  99. --------------------------
  100. File to patch: WIN32-Code/win32.c
  101. patching file `WIN32-Code/win32.c'
  102. patching file `buffer.c'
  103. patching file `config.h.in'
  104. patching file `configure.in'
  105. patching file `evbuffer.c'
  106. patching file `event.c'
  107. patching file `log.c' "
  108. --This is a complete hack right now:
  109. remove from event.c and log.c:
  110. #ifdef __GNUC__
  111. #include "WIN32-Code/misc.h"
  112. #else
  113. #include "misc.h"
  114. #endif
  115. Run "aclocal && autoheader && automake && autoconf".
  116. There may be WARNING messages. There will be no output if all runs successfuly.
  117. Run "./configure"
  118. Run "make"
  119. Run "make install"
  120. Stage Five: Build Tor
  121. ----------------------
  122. Extract the latest tor from svn in tor-mingw dir:
  123. tar zxf latest-tor-alpha.tar.gz
  124. cd tor-alpha
  125. ./autogen.sh
  126. ./configure
  127. (less magic happens here and a complete tor-alpha.exe is created)