1
2	   Copyright (c) NetHack PC Development Team 1990-2002.
3       NetHack may be freely redistributed.  See license for details.
4       ==============================================================
5              Instructions for compiling and installing
6		     NetHack 3.6 on a DOS system
7         ======================================================
8                   (or, How to make PC NetHack 3.6)
9                 Last revision: $NHDT-Date: 1432512791 2015/05/25 00:13:11 $
10
11Credit for a runnable full PC NetHack 3.6 goes to the PC Development team
12of Paul Winner, Kevin Smolkowski, Michael Allison, Yitzhak Sapir, Bill Dyer,
13Timo Hakulinen, Yamamoto Keizo, Mike Threepoint, Mike Stephenson,
14Stephen White, Ken Washikita and Janet Walz.  The present port is based
15on the previous effort of Pierre Martineau, Stephen Spackman, Steve Creps, Mike
16Threepoint, Mike Stephenson, Norm Meluch and Don Kneller.
17
18There has been very little port-specific maintenance for NetHack on DOS since
19NetHack 3.3.0.
20
21CONTENTS:
22
23        I.  Dispelling the Myths
24        II. Compiling on a DOS machine
25        Appendix A - Building the "official binary"
26        Appendix B - DJGPP Compiler (gcc ported to msdos) notes
27        Appendix C - Additional Notes
28        Appendix D - Contacting Us
29
30I.  Dispelling the Myths:
31
32    Compiling NetHack is not as easy as it sounds, nor as hard as it looks,
33    however it will behoove you to read this entire file through before
34    beginning the task.
35
36    We have provided a proper Makefile for building NetHack using the
37    following compilers:
38    	djgpp V2.03 or later
39
40    For specific details concerning the djgpp compiler, please see the
41    appendix B.
42
43    The makefile named Makefile.GCC is for use with GNU Make that
44    accompanies djgpp.
45
46    If you want to build a copy of NetHack that is identical to the
47    "official binary", please see appendix A.
48
49    The unsupported sys/msdos/Makefile.MSC was for the old 16 bit
50    Microsoft Visual C 1.52c compiler and has not been made compliant
51    with 3.5.x.
52
53    You may find it useful to obtain copies of lex (flex) and yacc (bison
54    or byacc).  While not strictly necessary to compile nethack, they are
55    required should you desire to make any changes to the level and dungeon
56    compilers.  Flex and Bison are included with the DJGPP distribution and
57    are also available on many archive sites.
58
59    Also be sure to pick up djgpp v2gnu/fil41b.zip to get ls.exe and
60    touch.exe, since the Makefile uses them by default.
61
62II. To compile your copy of NetHack on a DOS machine:
63    (or "just follow these few 'simple' steps outlined below.")
64
651.  It almost goes without saying that you should make sure that your tools
66    are set up and running correctly.
67
682.  Make sure all the NetHack files are in the appropriate directory
69    structure.  You should have a main directory with subdirectories
70    dat, doc, include, src, sys\share, sys\msdos, util, win\tty and
71    win\share.  Other subdirectories may also be included in your
72    distribution, but they are not necessary for use with DOS.  You can
73    delete them to save space.
74
75    Required Source Directories for DOS NetHack:
76
77                           (top)
78                             |
79        -------------------------------------------------
80        |       |     |        |       |     |          |
81       util    dat   doc    include   src   sys        win
82                                             |          |
83                                          ------      -----
84                                          |    |      |   |
85                                       share msdos   tty share
86
87    Check the file "Files" in your top level directory for an exact
88    listing of what files are in which directory.  In order for the
89    Makefiles to work, all the source files must be in the proper
90    locations.
91
92    If you downloaded or ftp'd the sources from a UNIX system, the lines
93    will probably end in UNIX-style newlines, instead of the carriage
94    return and line feed pairs used by DOS.  Some programs have trouble
95    with them, so you may need to convert them (with a utility like
96    Rahul Dhesi's "flip").
97
983.  Go to the sys/msdos directory and ensure that the file setup.bat
99    has MSDOS style end-of-line characters rather than UNIX style
100    end-of-line characters.  You can do that using a utility like
101    Rahul Dhesi's "flip", or by invoking the MSDOS edit utility on
102    setup.bat and saving the file without making any changes. Failure to
103    do this will prevent the bat file from executing completely, yet no
104    warning message will be given.
105
106    Run the setup.bat batch file with the following as the argument:
107
108       GCC        For djgpp and GNU MAKE.
109
110    The appropriate and necessary Makefile movement will be accomplished
111    for you, as well as verifying a few files and fixing a few file names
112    on FAT systems with long file name support.
113
1144.  Now go to the include subdirectory to check a couple of the header
115    files there.  Things *should* work as they are, but since you have
116    probably set up your system in some sort of custom configuration
117    it doesn't hurt to check out the following:
118
119    First check config.h according to the comments to match your system and
120    desired set of features.  Mostly you need to check the WIZARD option,
121    and check TERMLIB and COMPRESS.  Also be sure to leave DLB support
122    commented out in config.h.  MSDOS has support for DLB, but it must be
123    done through the Makefile, rather than config.h, to ensure that the
124    necessary packaging steps are done.
125
126    We've managed to enable all the special features.  You may include all
127    or as few of them as you wish.  To conserve disk space, you may wish
128    to disable LOGFILE and NEWS.
129
130    Also check pcconf.h, which should not need much editing (if you are
131    including random.c, and if you do not require termcap for screen
132    management).  If you are not including random.c you will need to
133    comment out RANDOM.
134
135    If using DJGPP, you can choose between SCREEN_BIOS
136    and SCREEN_DJGPPFAST.  Never, never, ever choose both.  Bad things
137    will happen.  We are not kidding.
138
1395.  If you want to change the high score list behavior, examine the top of
140    topten.c, in the src directory.  You may want to change the definitions of
141    PERSMAX, POINTSMIN, and ENTRYMAX.  We set POINTSMIN to 51 and ENTRYMAX to
142    50 to keep the size of the score list down.
143
1446.  Go to the src directory and edit the top of your Makefile.  Be sure the
145    directory you want the game installed in (GAMEDIR) actually exists.
146
1477.  Now that everything is set up,
148
149       Go to the src directory, and using the GNU Make utility,
150       "make install".
151
152    Depending on your particular machine and compiler, you can either
153    grab a cup of coffee or go home for the day.  Your computer will be
154    occupied for quite some time.  If all goes well, you will get an
155    NetHack executable.
156
1579.  If you chose DLB support (recommended), make sure that the file nhdat
158    got copied into the game directory.
159
160    If you didn't choose DLB support, make sure the support files --
161    data, rumors, cmdhelp, opthelp, help, hh,history, guidebook.txt
162    license, and all the *.lev files -- were copied to the game directory.
163    If not, move them there from the dat directory yourself.  rumors can
164    be created manually be entering "makedefs -r", data by entering
165    "makedefs -d".
166
167    Make sure the files NetHack1.tib and NetHacko.tib made it to your game
168    directory.  Copy them from src to the game directory yourself if
169    necessary.
170
171    Make sure the files defaults.nh and termcap made it to your game
172    directory.  If not, go to sys\share and copy NetHack.cnf to
173    your game directory as defaults.nh.  The name in previous versions was
174    nethack.cnf, but the CNF extension conflicted with the MS Windows
175    speed-dialer, making the file hidden on many machines.
176
177    If you changed your build settings to include TERMCAP support, copy
178    termcap to your game directory.
179
180    Also, make sure the file msdoshlp.txt made it to your game directory.
181    If it didn't, move it from sys\msdos to your game directory
182    yourself.
183
18410. In your game directory, review the settings in defaults.nh and adjust
185    them according to your style of play.
186
18711. Play NetHack.  If it works, you're done!
188
189Appendix A - Building the "official binary"
190
191    If you wish to build a copy of NetHack identical to the one that
192    the pc team distributes, simply do the following:
193
194    The 32-bit Protected Mode DPMI version built with 32-bit djgpp
195    compiler V2.03 or greater, make no changes to any of the defines and use
196    the Makefile.GCC as distributed, and as moved in step 3.
197
198    Paths below are relative to the top of your unpacked
199    NetHack source distribution:
200
201       md \nethack\binary   (must match Makefile)
202       cd sys\msdos
203       setup GCC
204       cd ..\..\src
205       make install
206
207
208    Make sure the following files have been converted from the
209    unix style "^J" end of line, to the msdos style "^M^J":
210      license, defaults.nh.
211
212    Place all the files in a clean directory and test.
213
214Appendix B - DJGPP Compiler (gcc ported to msdos)
215
216    If you have a 386 or better machine, you are in luck.  You can compile
217    NetHack without spending money on a compiler.  DJGPP is available free
218    from many archive sites.
219    At the time of this release in April 2002, the URL
220	http://www.delorie.com/djgpp/zip-picker.html/
221    had information on how to obtain djgpp and what pieces to get.
222    Be sure to pick up djgpp v2gnu/fil41b.zip to get ls.exe and
223    touch.exe, since the Makefile uses them by default (or change
224    the Makefile to use alternatives).
225
226    Special note for Windows 2000 / Windows XP users: You must have a
227    recent djgpp distribution for the build process, and the generated
228    executables to work properly on those platforms.
229
230    Setting up DJGPP is more than adequately explained in the documentation
231    that comes with it.  Be sure to pick up the yacc and flex built with
232    DJGPP if you intend to do any modification of the special levels or
233    dungeon compilers.  They should be available at the same place you got
234    djgpp.
235
236    The latest version of djgpp, V2.03 with the most recent refresh
237    will produce a binary that will run under Microsoft Windows, or any
238    other DPMI provider.  djgpp also comes with a DPMI provider called CWSDPMI.
239    Place CWSDPMI.EXE in your path and it will be used in the absence of any
240    other DPMI provider.
241
242    If you want to use the built-in DJGPP screen routines, uncomment
243    SCREEN_DJGPPFAST in pcconf.h (the default for djgpp).
244
245Appendix C - Additional Notes
246
2471)  Save files and bones files from versions of NetHack prior to 3.5.0 will not
248    work with this NetHack.  Don't bother trying to keep them.
249
2502)  To install an update of NetHack after changing something, type 'make'
251    for DJGPP from the src directory.  If you add, delete, or reorder monsters or
252    objects, or you change the format of saved level files, delete any save
253    and bones files.  (Trying to use such files sometimes produces amusing
254    confusions on the game's part, but usually crashes.)
255
256
257Appendix D - Contacting the Development Team
258
259    If you discover a bug and wish to report it, or if you have comments
260    or suggestions we recommend using
261    our "Contact Us" web page at:
262        http://www.nethack.org/common/contact.html
263
264    If you don't have access to the web, or you want to send us a patch
265    to the NetHack source code feel free to drop us a line c/o:
266        DevTeam (at) nethack.org
267
268