INSTALL-WINDOWS 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. It is possible to compile BadVPN on Windows natively or to cross-compile from Linux
  2. (but you need Windows to compile NSS).
  3. Here are detailed instructions:
  4. - Get a gcc compiler for compiling 32-bit Windows programs from the mingw-w64 project:
  5. - If you are compiling BadVPN from Linux:
  6. Download (for Linux x86_64)
  7. http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/sezero_20101003/mingw-w32-bin_x86_64-linux_20101003_sezero.tar.gz/download
  8. or (for Linux x86)
  9. http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/sezero_20101003/mingw-w32-bin_i686-linux_20101003_sezero.tar.gz/download .
  10. Extract it to /home/<user>/mingw so that you have /home/<user>/mingw/cross_win32.
  11. - If you are compiling BadVPN from Windows:
  12. Download
  13. http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/sezero_20101003/mingw-w32-bin_i686-mingw_20101003_sezero.zip/download .
  14. Extract it to c:\ and rename it from "mingw32" to "mingw" so that you have C:\mingw\bin.
  15. Be sure not to overwrite something. It really must be called "mingw" because cmake looks there.
  16. - Create a folder where build dependencies will be stored. Make sure it doesn't have spaces in its path.
  17. Call it <root>.
  18. - Build required libraries:
  19. - OpenSSL:
  20. - If you are compiling BadVPN from Linux:
  21. (This is for building OpenSSL with GCC. It is also possible to build it with MSVC from Windows; see below.)
  22. (This should also work in Windows under Cygwin with the Cygwin build of mingw-w64.)
  23. Download the OpenSSL source code. Extract it. Open a shell in the source dir. Run:
  24. $ export PATH="${PATH}":/home/<user>/mingw/cross_win32/bin
  25. $ perl Configure mingw --cross-compile-prefix=i686-w64-mingw32- --prefix=/ shared disable-capieng
  26. $ make depend
  27. $ make
  28. $ make INSTALL_PREFIX=<root> install
  29. - If you are compiling BadVPN from Windows:
  30. (This is for building OpenSSL with MSVC. It is also possible to build it with GCC from Linux or Cygwin; see above.)
  31. - Install "Windows SDK for Windows 7" (unless you have Visual Studio) and install at least the headers,
  32. libraries and compilers.
  33. - Install ActivePerl.
  34. - Download the OpenSSL source code.
  35. Extract is somewhere.
  36. - Open the SDK terminal (Programs -> Microsoft Windows SDK v7.1 -> Windows SDK 7.1 Command Prompt).
  37. Enter the OpenSSL source folder.
  38. Run:
  39. > perl Configure VC-WIN32 --prefix=<root> no-asm
  40. > ms\do_ms
  41. > nmake -f ms\ntdll.mak
  42. > nmake -f ms\ntdll.mak install
  43. - NSS:
  44. - You need to build it from Windows.
  45. - Install "Windows SDK for Windows 7" (unless you have Visual Studio) and install at least the headers,
  46. libraries and compilers.
  47. - Install MozillaBuild:
  48. http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe .
  49. - Download the NSS source code that includes NSPR. As of the time of writing the latest version is 3.12.8:
  50. https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_12_8_RTM/src/nss-3.12.8-with-nspr-4.8.6.tar.gz .
  51. Extract it to c:\ so that you have C:\mozilla .
  52. - Open the SDK terminal (Programs -> Microsoft Windows SDK v7.1 -> Windows SDK 7.1 Command Prompt) and run:
  53. > c:\mozilla-build\start-l10n.bat
  54. A new terminal opens. In that terminal, run:
  55. (here paths are written as /driveletter/...)
  56. $ export OS_TARGET=WINNT
  57. $ export BUILD_OPT=1
  58. $ cd <nss_source_dir>/mozilla/security/nss
  59. $ make nss_build_all
  60. $ <badvpn_source_dir>/scripts/copy_nss ../../dist <root>
  61. If you will be compiling BadVPN from Linux, use an empty folder for <root> in the above command,
  62. and copy its contents into <root> on the Linux system.
  63. - Compile it:
  64. Choose a folder <dest> where the resulting binaries will be copied.
  65. - If you are compiling BadVPN from Linux:
  66. Copy <badvpn_source_dir>/scripts/toolchain.cmake to <root>/toolchain.cmake.
  67. Copy <badvpn_source_dir>/scripts/cmake to <root>/ .
  68. In that file, substitute <root> and <user>.
  69. Create an empty folder, call it <build>, and open a shell in that folder.
  70. Now run:
  71. $ <root>/cmake <path_to_badvpn_source> -DCMAKE_INSTALL_PREFIX=<dest>
  72. $ make
  73. $ make install
  74. $ cp <root>/bin/*.dll <dest>/bin/
  75. - If you are compiling BadVPN from Windows:
  76. Install CMake if you don't have it already. Select the option to include cmake in PATH
  77. to avoid having to type a long command.
  78. Create an empty folder, call it <build>, and open a command prompt in that folder.
  79. Now run:
  80. > cmake <badvpn_source_dir> -G "MinGW Makefiles" -DCMAKE_FIND_ROOT_PATH=<root> -DCMAKE_INSTALL_PREFIX=<dest>
  81. > c:\mingw\bin\mingw32-make.exe
  82. > c:\mingw\bin\mingw32-make.exe install
  83. > copy <root>\bin\*.dll <dest>\bin\
  84. - Test it:
  85. Execute <dest>\bin\badvpn-server.exe (on Windows or with Wine). It should print something like this and wait forever:
  86. NOTICE(server): initializing BadVPN server <version>
  87. NOTICE(server): entering event loop