NetHack Porting Guidelines v 3.4 1999-11-291.0 IntroductionThis document goes through the steps required to port NetHack to anew machine. The basic steps in porting the program are:1. Get the code onto your machine. The parts of the currentdirectory setup you definitely need include src (NetHack codeshared by all systems), include (include files), util (codefor utility programs), and dat (various data files). Thedocumentation in doc is strongly recommended. You alreadyhave the files in the top directory since you're reading thisone. :-)A full list of the distribution files and their associatedOSes may be found in the top-level file "Files".If your machine uses an OS already supported, you need the syssubdirectory for that OS and possibly sys/share. Otherwise,get the closest match (say sys/msdos for single-tasking OSesand sys/unix for multi-user OSes, along with sys/share, ifnothing else comes to mind). You may want others forcomparison.If your machine uses a windowing system already supported,you need the win subdirectory for that system (or theappropriate sys subdirectory if the windowing system waspreviously considered restricted to one OS).2. Modify the appropriate include files to customize NetHack toyour system. You may need to add a new OS-specific "*conf.h"file (see unixconf.h, pcconf.h, tosconf.h, etc. as examples).3. If your machine uses a new OS instead of a variant of existingOSes, add a new sys subdirectory. Add, if required, a OS-specific copy of "main.c", "tty.c" and "unix.c". Possiblyadd an OS-specific library (see "msdos.c" and "tos.c" asexamples) to provide functions NetHack wants and your OS lacks.4. If your machine uses a new windowing system, follow doc/window.doccarefully. Put files implementing these routines in a win orsys subdirectory as appropriate.5. If your compilation environment isn't close to one alreadysupported, try starting from the UNIX makefiles. Modify thetop level makefile and the src makefile as required. Then runan initial compile. You are bound to get some errors. Youshould be able to fix them in a fairly simple fashion. Ifthings seem to be getting too complex, take a step back, andpossibly send us some mail. We might be able to help.6. Mail all of your fixes to us in a contextual form so that we caneasily integrate them into the code.One general rule of thumb exists. Always add code. Don't deletesomebody else's code for yours -- it won't work on their machine if you do.Always add your OS specific code inside #ifdef / #else / #endif constructsso that it will be able to be folded back into the original code easily.2.0 Include Files2.1 config.hThe file "config.h" is a master configuration file that determinesthe basic features of the game, as well as many of the security options.It is intended that end users configure the game by editing "config.h" andan appropriate "*conf.h" file, so any #defines for individual preferencesshould be added to those files. OS-specific #defines that are not intendedto be changed should also go in "*conf.h"; try to find the most appropriateplace for other #defines.The following sections may require modification:- Section 1: OS and window system selection.You may have to put a #define for your OS here.If your OS is yet another UNIX variant, put the#define in unixconf.h instead.An unfortunately large amount of stuff sharesthis section because the #definitions have tobe seen before *conf.h is reached. Don't addto this unless necessary.- Section 2: Global parameters and filenames.These will have to be customized to your system.- Section 3: Type definitions and other compiler behavior.These will have to be matched to your compiler.2.2 global.hThis file defines things specific to NetHack that should notrequire modification by an end user. For a new port, you may have to addautomatic inclusion of another auxiliary config file (*conf.h) which youwrote for your system.2.3 extern.hIf you create any new source modules or new functions in old modules,you must enter the names of the new external references (the functions definedthere for external use) in this file.2.4 system.hThis file contains references for all hooks into the OS (via thestandard "C" libraries). Depending on what your standard library looks like,you may have to put new entries into this file.3.0 Source filesThe first step in getting the game up is to get the "makedefs"program running. This program is used to create configuration-specificfiles for the game.Once "makedefs" has been built, the rest of the game can be compiled.You may have to create an OS-specific module to handle things you want touse, like a mouse or a ram-disk.The utility compilers "dgn_comp" and "lev_comp" may be a betterplace to start. They also require "makedefs" but are independent of"nethack". They are usually the last programs made, but since they aremuch smaller they may be more tractable when first arguing with the includefiles. These programs create binary data files that "nethack" uses toguide its dungeon creation.3.1 MakefilesThis distribution provides makefiles for several kinds of systems.There are joint makefiles for the various varieties of UNIX, makefiles forMSDOS, a makefile for NT, and so on. You may have to create a newmakefile for your specific machine. You may even have to translate somemakefiles into a form more congenial to your system. If possible, however,add to one of those provided.3.2 termcap.cIf your system wants to use tty windowing and it doesn't run offof a termcap or terminfo database, you may have to put the appropriateterminal control strings into termcap.c. This has already been done forMSDOS, and these mods can be used as an example. You can also considerusing the termcap code from sys/share/tclib.c or sys/share/termcap.uu,especially if your system supports multiple kinds of terminals.3.3 main.cYou may need to create a new "main.c" module. If you do, call it[OS]main.c where the [OS] is replaced with the name of the OS you are portingto. This file contains the mainline module, which reads options from thecommand line (or wherever) and processes them. It also contains variousfunctions associated with game startup.3.4 tty.cYou may need to create a new "tty.c" module. If you do, call it[OS]tty.c where the [OS] is replaced with the name of the OS you are portingto. This file contains the routines that configure the terminal/consolefor raw I/O, etc.3.5 unix.cYou may need to create a new "unix.c" module. If you do, call it[OS]unix.c where the [OS] is replaced with the name of the OS you are portingto. This file contains some OS dependencies concerning time and filenamecreation.An object of the NetHack development project is to get the gameworking on as many different types of hardware and under as many differentoperating systems as is practical. Any assistance will be appreciated.
：Code submit frequency
：React/respond to issue & PR etc.
：Well-balanced team members and collaboration
：Recent popularity of project
：Star counts, download counts etc.