Compiling

From NetHackWiki
Revision as of 16:23, 22 September 2006 by Paxed (talk | contribs) (add info about compiling on Linux)
Jump to navigation Jump to search

This page contains help on compiling NetHack from source.

On Windows

This was tested on Win2k.

  • Install MinGW. If you use the 'minimal' installation, remember to also select the optional 'MinGW make' -component, so it gets installed. Use, say, C:\mingw\ as the path to install to.
  • Unpack NetHack's sources somewhere, say, c:\nh343\. That directory should contain several subdirectories, such as src, include, win and sys. You will need WinZip or some other utility that can uncompress the package.
  • Go to c:\nh343\sys\winnt\ and run nhsetup.bat
  • If you want to run the graphical windows GUI, edit c:\nh343\src\makefile.gcc and change the line
#GRAPHICAL=Y

to

GRAPHICAL=Y
  • Go to c:\nh343\ and create a new file called 'install.bat' with the following contents:
PATH=c:\mingw\bin
cd src
mingw32-make -f makefile.gcc install
  • Run the install.bat you just created.
  • The NetHack binary should now be in c:\nh343\binary\
  • If you want to patch your NetHack, you should next see the article on patching.

On Linux

The following compiles the TTY-version of NetHack, with all the default settings.

  • Make sure you have the development packages for ncurses installed. On debian these are called libncurses5-dev.
  • Open a terminal, and cd to the directory where you downloaded the source package to.
  • Unpack the NetHack sources and move to the NetHack source root directory:
tar xvzf nethack-343-src.tgz
cd nethack-3.4.3
  • Execute the script that moves the Makefiles to the correct places:
sh sys/unix/setup.sh x
  • Edit include/unixconf.h by changing
/* #define LINUX */

to

#define LINUX
  • Edit src/Makefile by changing
WINTTYLIB = -ltermlib

to

WINTTYLIB = -lncurses
  • Typing make in the NetHack source root dir should compile the binary executable.
  • To install NetHack to /usr/games/, type make install while you're logged in as root. If you want to change the installation directory, you need to edit the top Makefile.
  • For more information about compiling NetHack, see the sys/unix/Install.unx text file.
  • If you want to patch your NetHack, you should next see the article on patching.