/README.Windows.md

https://github.com/solemnwarning/rehex · Markdown · 152 lines · 100 code · 52 blank · 0 comment · 0 complexity · 76b232f638a754b161c61cd001798d64 MD5 · raw file

  1. # Building for Windows
  2. This is a rough guide of how I have set up my 64-bit Windows build environment. Things may need changing e.g. to install a 32-bit one, or when version numbers change.
  3. ## Toolchain setup
  4. ### mingw-w64
  5. Download the installer from http://mingw-w64.org/ and use the following settings:
  6. Architecture: x86_64
  7. Threads: posix
  8. Install path: C:\x86_64-w64-mingw32\
  9. You can use a different install path, but it will impact the following steps, and it MUST NOT contain any spaces.
  10. ### MSYS2
  11. Download and install MSYS2 from http://www.msys2.org/
  12. Open the MSYS2 command line and install additional packages.
  13. $ pacman -S make
  14. ### wxWidgets
  15. Open the MSYS2 command line and add the appropriate mingw-w64 toolchain to your PATH.
  16. $ export PATH="$PATH:/c/x86_64-w64-mingw32/mingw64/bin"
  17. Unpack the wxWidgets source and set up a build directory.
  18. $ cd wxWidgets-3.0.4
  19. $ mkdir build-release-static-x86_64
  20. $ cd build-release-static-x86_64
  21. Build and install wxWidgets.
  22. $ ../configure --host=x86_64-w64-mingw32 \
  23. --build=x86_64-w64-mingw32 \
  24. --prefix=/c/x86_64-w64-mingw32/wxWidgets-3.0.4-release-static/ \
  25. --disable-shared \
  26. --with-zlib=builtin \
  27. --with-expat=builtin \
  28. --without-libjpeg \
  29. --without-libtiff \
  30. --without-regex
  31. $ make
  32. $ make install
  33. ### Jansson
  34. Open the MSYS2 command line and add the appropriate mingw-w64 toolchain to your PATH.
  35. $ export PATH="$PATH:/c/x86_64-w64-mingw32/mingw64/bin"
  36. Build and install Jansson.
  37. $ cd jansson-2.10
  38. $ ./configure --host=x86_64-w64-mingw32 \
  39. --build=x86_64-w64-mingw32 \
  40. --prefix=/c/x86_64-w64-mingw32/mingw64/x86_64-w64-mingw32/ \
  41. --enable-shared=no \
  42. --enable-static=yes
  43. $ make
  44. $ make install
  45. ### Capstone
  46. Open the MSYS2 command line.
  47. $ cd capstone-4.0.2
  48. $ PREFIX=/c/x86_64-w64-mingw32/mingw64/x86_64-w64-mingw32/ \
  49. CAPSTONE_STATIC=yes \
  50. CAPSTONE_SHARED=no \
  51. CAPSTONE_BUILD_CORE_ONLY=yes \
  52. CC=x86_64-w64-mingw32-gcc \
  53. CXX=x86_64-w64-mingw32-g++ \
  54. make install
  55. ## Build rehex
  56. Once the above steps are done, you should be able to build from the MSYS2 command line so long as you have the appropriate environment variables set.
  57. $ export PATH="$PATH:/c/x86_64-w64-mingw32/mingw64/bin"
  58. $ export CC=x86_64-w64-mingw32-gcc
  59. $ export CXX=x86_64-w64-mingw32-g++
  60. $ export WX_CONFIG=/c/x86_64-w64-mingw32/wxWidgets-3.0.4-release-static/bin/wx-config
  61. $ make -f Makefile.win
  62. $ make -f Makefile.win check
  63. # Buildkite Agent deployment
  64. Create a "buildkite" user
  65. Install the Buildkite Agent somewhere (e.g. `C:\Program Files\Buildkite`)
  66. Create a "builds" folder under the installation directory, give the buildkite user permission to write under it.
  67. Create buildkite-agent-i686.cfg, e.g:
  68. # The token from your Buildkite "Agents" page
  69. token="XXX"
  70. # The name of the agent
  71. name="%hostname-%n"
  72. # The priority of the agent (higher priorities are assigned work first)
  73. # priority=1
  74. # Meta-data for the agent (default is "queue=default")
  75. meta-data="queue=windows-i686"
  76. # Path to the bootstrap script. You should avoid changing this file as it will
  77. # be overridden when you update your agent. If you need to make changes to this
  78. # file: use the hooks provided, or copy the file and reference it here.
  79. bootstrap-script="bootstrap.bat"
  80. # Path to where the builds will run from
  81. build-path="builds"
  82. # Directory where the hook scripts are found
  83. hooks-path="hooks"
  84. # Flags to pass to the `git clean` command
  85. git-clean-flags="-fdqx"
  86. Create run-agent-i686.bat:
  87. C:
  88. cd "\Program Files\Buildkite"
  89. set PATH=%PATH%;C:\i686-w64-mingw32\mingw64\bin;C:\msys64\usr\bin
  90. set CC=x86_64-w64-mingw32-gcc
  91. set CXX=x86_64-w64-mingw32-g++
  92. buildkite-agent.exe start --config buildkite-agent-i686.cfg
  93. Setup service(s) to run the Agent using NSSM (https://nssm.cc/)
  94. ## Appendix: HTTP proxy
  95. If your build agent needs to access the internet via a HTTP proxy, put lines like the following in your agent startup batch script:
  96. set http_proxy=http://10.52.13.1:8080/
  97. set https_proxy=http://10.52.13.1:8080/
  98. set HTTP_PROXY=http://10.52.13.1:8080/
  99. set HTTPS_PROXY=http://10.52.13.1:8080/
  100. You may also need to change the buildkite user's Windows proxy settings, you can do this from your own account by running Internet Explorer as the buildkite user and changing the Internet Options within.