Building NetHack using MSYS2 Prerequisite Requirements: o MSYS2 - https://www.msys2.org/ - Download the installer, and start the UCRT64 shell. then pacman -S mingw-w64-ucrt-x86_64-gcc pacman -S git pacman -S vim (or your editor of choice) pacman -S man (otherwise "git help foo" will not work) o Lua NetHack 3.7 for Windows requires 3rd party Lua source that is not part of the NetHack distribution or repository. A windows cmd command procedure for fetching prerequisite sources is available, and can be run as follows from the top of the NetHack source tree to obtain lua: sys\windows\fetch.cmd lua o pdcursesmod (Only required if curses interface support is desired) If you want to include curses interface support in NetHack 3.7 for 3rd part pdcursesmod source code is required and is not part of the NetHack distribution or repository. A windows cmd command procedure for fetching prerequisite sources is available, and can be run as follows from the top of the NetHack source tree to obtain pdcursesmod: sys\windows\fetch.cmd pdcursesmod /---------------------------------------------\ | Directories for a Windows NetHack build | \---------------------------------------------/ (NetHack-top) | +-----+------+-----+-------+-----------+-----------+-----~-----+------+ | | | | | | | | | dat doc include lib src sys win submodules util | | | | +----------+ +------+ +----+ +----+ | | | | | | | | | | | | | | | | lua-5.4.6 pdcursesmod share windows tty win32 lua pdcursesmod | vs | +----------+-------+--------+--------+-----------+-------+-----+------+ | | | | | | | | | makedefs NetHack NetHackW PDCurses PDCursesGui tile2bmp tilemap tiles uudecode /-----------------------------------------------------------\ | Building from MSYS2 bash | \-----------------------------------------------------------/ Required components that are not bundled in the NetHack repository, but are required to build NetHack yourself. Lua NetHack 3.7 for Windows requires 3rd party Lua source that is not part of the NetHack distribution or repository. A bash shell script for fetching prerequisite sources is available, and can be run as follows from the top of the NetHack source tree to obtain lua: sh sys/windows/fetch.sh lua Curses If you want to include curses interface support in NetHack 3.7 for 3rd part pdcursesmod source code is required and is not part of the NetHack distribution or repository. A bash shell script for fetching prerequisite sources is available, and can be run as follows from the top of the NetHack source tree to obtain pdcursesmod: sh sys/windows/fetch.sh pdcursesmod Building Two different versions of NetHack will be built for Windows from the command line using the Makefile approach: A tty port utilizing the Win32 Console I/O subsystem Console, and a curses interface in an executabled called NetHack.exe. NetHack A Win32 native port built on the Windows API Graphical NetHack, and graphical curses in an executable called NetHackW.exe. The Makefile configurations will build both; NetHack.exe and NetHackW.exe and will be able to use the same datafiles, save files and bones files. Since the last official release of NetHack, compilers and computer architectures have evolved and you can now choose whether to build a 32-bit x86 version, or a 64-bit x64 version. The default Makefile is set up for a 32-bit x86 version, but that's only because it will run on the most number of existing Windows environments. Change it if you want. Be aware that NetHack's save files and bones files in the 3.7.0 release have not yet evolved enough to allow them to interchange between the 32-bit version and the 64-bit version (or between different platforms). That may change in future. I. Dispelling the Myths: Compiling NetHack for Windows is not as easy as it sounds, nor as hard as it looks, however it will behoove you to read this entire section through before beginning the task. We have provided Makefile.mingw32 in sys/windows/Makefile.mingw32, which you use from the bash Windows command shell included with MSYS2. II. To compile your copy of NetHack on a Windows machine using MSYS2: Setting Up 1. Change your current directory the top of the nethack source tree if it isn't there already. 2. Execute the following command to place copies of the Makefiles in the src subfolder. cp sys/windows/Makefile.mingw32* src 3. Change your current directory to the src subfolder of the nethack source tree. The following command assumes you are still in the sys/windows folder from steps #1 and #2 above: cd src Compiling 4. Now that everything is set up, you should be ready to start the process. Your current directory should be the NetHack src directory. Issue these following commands: make -f Makefile.mingw32 clean make -f Makefile.mingw32 depend make -f Makefile.mingw32 If all goes well, intermediate NetHack files will be placed in the binary subfolder of the NetHack tree, and the final NetHack package for windows will be in the package subfolder. Notes: 1. To rebuild NetHack after changing something, change your current directory to src and issue the appropriate command for your compiler: For Microsoft compiler: make -f Makefile.mingw32 2. An alternative to MSYS2 may be MinGW-w64 - winlibs standalone build. That has not been tested by us at time of writing. MinGW-w64 - winlibs standalone build - https://github.com/brechtsanders/winlibs_mingw - Download one of the releases from https://github.com/brechtsanders/winlibs_mingw/releases and extract the contents into a folder (ideally in a folder without spaces in the path), and add the location of the subfolder containing gcc.exe to your PATH.