Download and run the 64-bit installer from https://www.msys2.org/ (middle button, currently msys2-x86_64-20180531.exe)
Do not run msys2 at the end of the installer (or close the msys2 window again).
Run MSYS2 MinGW 32-bit:
A black console window will open. Install the compiler, tools and libraries with the following command (you can paste from the clipboard with right-mouse or Ctrl+Shift+Ins):
pacman -S mingw32/mingw-w64-i686-gcc tar scons pkg-config mingw32/mingw-w64-i686-SDL mingw32/mingw-w64-i686-SDL_mixer mingw32/mingw-w64-i686-physfs
Download the d2x-rebirth 0.58.1 source with the command:
wget https://www.dxx-rebirth.com/download/dxx/d2x-rebirth_v0.58.1-src.tar.gz
And extract it with the command:
tar -xvzf d2x-rebirth_v0.58.1-src.tar.gz
Enter the d2x-rebirth directory with the command:
cd d2x-rebirth_v0.58.1-src
Make a small fix to the build system to support msys with the command:
sed -i "s/sys.platform == 'win32':/sys.platform == 'win32' or sys.platform == 'msys':/" SConstruct
Set some compatibility build flags with the command (you need to run this command every time you open a new msys window):
export CFLAGS="-mno-ms-bitfields -fwrapv -fno-aggressive-loop-optimizations -fno-strict-aliasing -Wno-deprecated-declarations -Wno-misleading-indentation -I/mingw32/include/SDL -D__EXPORT__= -DHAVE_STRUCT_TIMESPEC"
Build it (the -j3 option is for 3 concurrent compile commands, this is usually the fastest on dual core processors):
scons -j3
And run it (the -hogdir argument is your Descent 2 directory with the hog/pig/ham etc. files. Backslashes (\) have a special meaning in msys, double them (\\) or use forward slashes (/) instead.)
./d2x-rebirth.exe -hogdir c:/games/descent2
You have extracted the source code in the c:\msys64\home\username\d2x-rebirth_v0.58.1-src directory. You can edit the files here with a text editor and run the scons command again to rebuild.
If you want to run d2x-rebirth.exe outside msys you need to copy the following dll files from c:\msys64\mingw32\bin to the directory with d2x-rebirth.exe:
SDL.dll
libFLAC-8.dll
libSDL_mixer-1-2-0.dll
libgcc_s_dw2-1.dll
libmad-0.dll
libmikmod-3.dll
libogg-0.dll
libopenal-1.dll
libphysfs.dll
libvorbis-0.dll
libvorbisfile-3.dll
libwinpthread-1.dll