This document describes the infrastructure for maintaining GHC's mingw64/mingw32 toolchain tarballs for Windows.
Why
On Windows, GHC binary distributions ship with a full C compiler/linker toolchain targetting the host platform. These tarballs are generated by the make sdist
build rules and are derived from mingw toolchains built by the msys2 project. Unfortunately, GHC must patch around a variety of limitations of this toolchain to ensure reliable operation (specifically, working around the MAX_PATH
limitation). For this, @Phyx has developed a patch utility.
Building the jailbreak utility
The following assumes a Windows machine with 32- and 64-bit toolchains installed:
$ MSYSTEM=MINGW64 bash --login -c "pacman -Suy mingw-w64-x86_64-gcc"
$ MSYSTEM=MINGW32 bash --login -c "pacman -Suy mingw-w64-i686-gcc"
In an msys2 shell
git clone https://github.com/Mistuke/ghc-jailbreak
cd ghc-jailbreak
- In a mingw64 shell:
make
- In a mingw32 shell:
make
tar -czf ghc-jailbreak.tar.gz x86_64 i686
Building the toolchain tarballs
GHC's source tree contains a script, mk/get-win32-tarballs.sh
, which is used to build and fetch GHC's toolchain tarballs. To build the toolchain tarballs,
$ mk/get-win32-tarballs.sh grab all
$ rm -f ghc-tarballs/mingw-w64/*/*-phyx.*
$ mk/get-win32-tarballs.sh patch
$ mk/get-win32-tarballs.sh hash > mk/win32-tarballs.md5sum
$ vim mk/get/win32-tarballs.sh
# [edit download_tarballs() to reflect the new version numbers]