This page documents the instructions for setting up a Windows build using MSYS2.
First, you have to download and install MSYS2 from https://www.msys2.org/
pacman -Sy pacman
pacman -Syu
If needed, close the MSYS2 command prompt, and run it again to update the rest.
pacman -Su
pacman -S yasm
pacman -S make
pacman -S autoconf automake
pacman -S diffutils
pacman -S patch
pacman -S git
pacman -S svn
pacman -S tar
pacman -S pkg-config
If you plan to create a Windows build with a mingw-msys profile, you have to install the corresponding toolchain. CMake is only required for compiling the x265 encoder.
Note that cross compiling with MSYS-MinGW will take considerably longer than cross compiling with MinGW on a Unix host.
pacman -Sy mingw-w64-x86_64-{gcc,libtool,cmake,clang}