The MXE project (https://mxe.cc) provides an easy way to set up a MinGW-w64 based cross-compiling toolchain with a set of special Makefiles. This allows us to build for Windows using GNU/Linux, FreeBSD, the Windows Subsystem for Linux or macOS as host systems with a high level of automation. Starting with ScummVM 2.1.0, this is the preferred way to provide release builds for the project.
Before setting up the MXE toolchain and the necessary libraries, you have to make sure your system has all the required packages installed that are needed for compiling the toolchain itself. At https://mxe.cc/#requirements, MXE provides a list of the required tools/libraries with their corresponding package names for various GNU/Linux distributions. In case the distribution is not listed there, you have to do some manual research in your distribution's repositories.
Setting up MXE
After you installed all the required packages mentioned above, you are ready to set up the MXE toolchain itself. 32 bit and 64 bit toolchains are available, either statically or dynamically linked.
MXE calls the combination between bitness and linking type a TARGET. The following MXE_TARGETS are available:
i686-w64-mingw32.static: 32 bit, statically linked i686-w64-mingw32.shared: 32 bit, dynamically linked x86_64-w64-mingw32.static: 64 bit, statically linked x86_64-w64-mingw32.shared: 64 bit, dynamically linked
In the following steps, we'll only focus on the .static targets since shared ones are not really suitable for distribution. They might be fine if you only use the builds by yourself and know exactly which additional DLL files you need, but for the releases, we want (almost - more on that later) every library used by ScummVM to be available directly in the ScummVM executable without the needs for any additional DLL files.