Why might you want to compile NetHack from source, instead of simply installing the package (sudo dnf install nethack)? For many reasons. Applying patches for custom game mechanics. Running an alternate frontend. And more!
While the official Linux instructions are complete, they are pretty involved and must be followed exactly for things to work. To give the dev team credit, they’ve been supporting a plethora of platforms and environments for 20+ years (and the number is still increasing). While a consolidated guide was written for compiling NetHack from scratch on Ubuntu/Debian but nothing exists for Fedora… until now!
# On a fresh Fedora installation (with updates) install the dependencies:
$ sudo dnf install ncurses-devel libXt-devel libXaw-devel byacc flex
# Download the NetHack (3.6.0) source tarball from the official site and unpack it:
$ tar xzvf [download] $ cd nethack-3.6.0/
# Run the base setup utility for Linux:
$ cd sys/unix $ ./setup.sh hints/linux $ cd ../..
# Edit [include/unixconf.h] to uncomment the following line…
# Edit [include/config.h] to uncomment the following line…
# Edit [src/Makefile] and update the following lines…
WINSRC = $(WINTTYSRC) WINOBJ = $(WINTTYOBJ) WINLIB = $(WINTTYLIB)
# …to look like so
WINSRC = $(WINTTYSRC) $(WINX11SRC) WINOBJ = $(WINTTYOBJ) $(WINX11OBJ) WINLIB = $(WINTTYLIB) $(WINX11LIB)
# Edit [Makefile] to uncomment the following line
VARDATND = x11tiles NetHack.ad pet_mark.xbm pilemark.xpm rip.xpm
# In previous line, apply this bugfix by changing…
# Build and install the game
$ make all $ make install
# Finally create [~/.nethackrc] config file and populate it with the following:
# To play:
Go get that Amulet!