1 Instructions for installing NetHack 3.4 2 on a UNIX system 3 ======================================= 4 50. Read this entire file before starting, and come back to the Notes 6 below if you have any problems. If you are trying to use X11, 7 also read all of win/X11/Install.X11, or read win/Qt/Install.Qt 8 if you are using Qt or KDE under X11. For help in controlling 9 and running the game after it is installed, see the '?' command 10 within the game and doc/Guidebook (non-installers want to know 11 about those things too). 12 131. Make sure all the NetHack files are in the appropriate directory 14 structure. You should have a main directory with subdirectories 15 dat, doc, include, src, util, sys/share, sys/unix, win/tty, win/X11, 16 and win/Qt. You may have other subdirectories under sys and win, 17 but they will not affect compilation for a UNIX system. If you do 18 not follow this structure, the Makefiles will not function properly. 19 The .c files for the main program belong in src, those for utility 20 programs in util, and UNIX-specific ones in sys/unix. All the .h 21 files belong in include, the documentation in doc, and assorted 22 data files in dat. Some UNIX versions may also be interested in 23 sys/share's random.c or its lex/yacc output, as explained in note 11. 24 (A more detailed explanation of the directory structure may be found 25 in Files, which should be in the top directory.) 26 272. Your Makefiles may still be in sys/unix with tags on the end of them. 28 If so, run "sh setup.sh" in that directory to distribute the Makefiles 29 to places they can do their work. (If later official patches change 30 these Makefiles, setup.sh should be rerun to make sure you use the 31 current copies.) 32 333. Go to the include subdirectory and edit config.h according to the 34 comments to match your system and desired set of features. Similarly 35 edit unixconf.h. Please see the "Notes:" section, below, for some 36 configuration hints for particular systems. 37 384. If you want to, look through system.h. This file attempts to match the 39 types for system calls and library routines with various flavors of 40 operating systems. Leaving this file alone is unlikely to cause worse 41 problems than lint errors, but it's worth checking if you get compile 42 errors, especially if you have an unusual system. 43 445. Go to the src subdirectory and look at the top of topten.c. You may want 45 to change the definitions of PERSMAX and PERS_IS_UID here to get different 46 behavior from the high score list. 47 486. Edit the top sections of the src and util Makefiles. (If you are doing 49 a full recompile, or if you got your files from someplace besides the 50 official distribution, type 'touch makedefs.c' to make sure certain files 51 (onames.h, pm.h) get remade instead of relying on the potentially 52 troublesome timestamps.) Then type 'make' in src and go get a cup of 53 coffee or take a nap, depending on the speed of your system. You should 54 now have created the game executable. 55 567. Go back to the top directory and edit that Makefile, explaining where 57 you want everything to be installed. 58 59 Make sure that you follow the comments about setting GAMEDIR -- the 60 installation process will wipe out the contents of the directory you 61 point it at, under the assumption that it's debris from an old version 62 of NetHack. If this is not the case, you'll want to install somewhere 63 else, or comment out the rm under the install target. 64 65 The Makefile assumes you want to run NetHack setuid 'games' to cut down 66 on possible tampering; it's fairly straightforward to comment out the 67 appropriate chmod if you don't want that, or to change any of the rest 68 of the procedure. (Note that if you don't want to run NetHack either 69 setuid or setgid, and people in more than one group will be playing it, 70 you'll need to go back and set FCMASK to 0666 in unixconf.h and let 71 everybody fiddle with the files NetHack creates.) 72 73 If the tbl, nroff or col commands are not available on your system, 74 edit the doc/Makefile and change the GUIDECMD as directed. 75 76 Type 'make all' from the top directory to set up all the auxiliary 77 files the main executable will use. Then become root if necessary and 78 type 'make install'. Everything should now be set. 79 808. Read doc/recover.man or doc/recover.txt to learn how to use the recover 81 program. The recover program can be used in case of a crash to recover 82 a game that was in progress. The recover command is installed in the 83 GAMEDIR by default. 84 85Notes: 86 871. Save files and bones files from previous versions will not work with 88 NetHack 3.4. Don't bother trying to keep them. 89 902. To install an update of this version of NetHack after changing something, 91 type 'make update' from the main directory. If you created the new 92 version yourself, it should be safe to use 'make update' as long as you 93 did not add, delete, or reorder monsters or objects and you did not change 94 the format of saved level files. If you did any of these things, you 95 should also remove any saved games and bones levels. (Trying to use such 96 files often produces amusing but useless confusions on the game's part.) 97 983. If you insisted on doing the final installation by hand, you probably 99 forgot to make a save directory. If you don't go back and do this, you 100 won't be able to save games. 101 1024. If you get unexplained deaths by trickery, you are probably running 103 NetHack on a bunch of workstations, but you have overlooked the NETWORK 104 definition in unixconf.h that is necessary in that configuration. 105 1065. If spurious characters appear on the screen while throwing, kicking, 107 zapping, etc., it is likely that you have linked the source to the wrong 108 library or mistakenly defined/undefined TERMINFO. A number of systems, 109 such as Xenix, support both the termcap and terminfo terminal capability 110 libraries. In such cases, the TERMINFO definition in unixconf.h and the 111 WINTTYLIB definition in the source Makefile must correspond. 112 113 If your terminal library does not provide suitable delays, NetHack will 114 try to fake its own if you set the nonull option. 115 1166. Since NetHack overflows the stock C preprocessors for AT&T 3b1 and 3b2 117 systems ("too many defines"), we are including an alternate preprocessor 118 to allow these folks to compile. This is the DECUS cpp by Martin Minow, 119 slightly modified by Kevin Darcy to use larger buffers, be less verbose, 120 and handle strange constructs in AT&T's include files. 121 122 To use this preprocessor, unpack the cpp* files found in sys/unix into 123 some handy directory (util will do). For the AT&T machines mentioned 124 above, nothing needs to be configured; you should get a working cpp by 125 merely typing "make -f makefile.txt". To get your compiler to use the 126 new cpp, you will have to add to CFLAGS in src/Makefile and util/Makefile. 127 If you put the cpp files in /foo/bar/util, add "-B/foo/bar/util/ -tp" 128 for a 3b1 or "-Yp,/foo/bar/util" for a 3b2. 129 130 For any other machine whose preprocessor can't handle the NetHack source, 131 you'll have to play it by ear. The preprocessor has many esoteric 132 configuration options, but most probably you will only need to change 133 the flags in makefile.txt, and then refer to your compiler's documentation 134 to find the appropriate CFLAGS for the NetHack Makefiles. (The SunOS flag, 135 for instance, would be "-Qpath /foo/bar/util", although the native cpp 136 has no trouble with NetHack. So much for standardization.) 137 1387. If you are trying to compile NetHack on an AT&T 3B that is running an 139 OS earlier than SVR3, you are likely to have problems with overflowing 140 symbol tables. This can be worked around by editing the source Makefile 141 to make the Sys.3B2 target work more like the SysV-AT target, adding 142 -DDUMB to CFLAGS and DUMB.Setup to the Sys.3B2 dependency line. The 143 compiler provided with later versions of the OS has a large enough 144 symbol table that it does not need this workaround. 145 1468. If NetHack seems to compile fine, starts up, allows you to pick a 147 character, and then hangs indefinitely, gets a segmentation fault, or 148 traps you in a single room on the first level, you might try changing 149 the schar and uchar definitions in config.h to short ints. This problem 150 is known to occur on the AT&T 3B series, Silicon Graphics Irises, and 151 IBM systems (PC/RT & RS/6000) running AIX, and may occur on other 152 computers as well. 153 154 This problem is really most likely caused by having a non-__STDC__ 155 compiler with char's unsigned by default. Since some such compilers 156 don't understand the new "signed" keyword, and others don't have signed 157 characters to use (the 3B2 line falls into this category), "signed" 158 is #ifdefed away for them. If you are sure your compiler can deal 159 with it, you can add your compiler to the __HC__ case in tradstdc.h. 160 161 Alternatively, if the compiler supports a command line switch for 162 setting the default char type to signed, you could try setting it in 163 the Makefiles. The appropriate switch for SGI Irises with MIPS C 164 compiler is "-signed" and for RS/6000's with standard cc "-qchars=signed". 165 (SGI machines running IRIX 4.0.x have a compiler close enough to 166 standard to suit NetHack, so you may merely use the suggested flags 167 in the Makefiles.) 168 169 Note that at least RS/6000's seem to like changing the default to 170 signed better but there is also a problem: The lexers created by 171 the standard lex program in AIX may come out faulty when this switch 172 is used (known to happen at least in AIX 3.1.3), so you may have to 173 use an alternative, like flex, which is available at major archive 174 sites (see notes 10 and 11). 175 176 By AIX 3.2.5, this whole problem should be taken care of automatically 177 (but AIX_31 should still be defined in unixconf.h for other reasons). 178 1799. Under SCO UNIX, you may have all sorts of complaints about 180 include/obj.h. Go to the file and uncomment the marked line, working 181 around the fact that SCO's system include files preempt a major 182 NetHack structure name. Also, there are difficulties with SCO's cc 183 that thus far have been solved only by changing compilers; one report 184 says gcc-NetHack works, and another says rcc-NetHack can be made to 185 work by defining NOTSTDC, applying note 8, and compiling with -tinfo 186 and -xenix. The cc problems are old enough that a new, working 187 version may have been released by this time. 188 18910. Xenix/286's lex generates a faulty lexical analyser from lev_comp.l. 190 The beta-release of flex 2.3 (available from uunet, osu-cis, 191 prep.ai.mit.edu, etc.) can be used to generate the lexer. 192 The only change to flex is to change "#define yyleng (yy_cp - yy_bp)" 193 to "#define yyleng (int)(yy_cp - yy_bp)" in flex.skel. 194 Flex is not needed with Xenix/386, as its lex generates a proper lexical 195 analyser. [Xenix instructions by J.T. Conklin] 196 19711. If your system does not have a lex/yacc or flex/bison combination 198 capable of producing the dungeon and level compilers, lex and yacc 199 output from one of our development systems can be found in sys/share. 200 Unfortunately, this output is less portable than the rest of the code, 201 as it contains skeleton parsing code provided by the specific vendor 202 who has no particular incentive to make such skeletons portable, but 203 the output works on most systems. To try it on yours, copy dgn_comp.h 204 and lev_comp.h to include and dgn_lex.c, dgn_yacc.c, lev_lex.c, and 205 lev_yacc.c to util. 206 20712. Yes, Virginia, you compile NetHack for a NeXT as if it ran UNIX instead 208 of Mach. Just tell NetHack you're a BSD system (Mach is extremely 209 close to BSD UNIX for traditional system calls, so this is also a 210 likely thing to try for any other programs you want to compile). 211 212 If you get errors when starting nethack warning that "Setuid execution is 213 not allowed", you might want to re-install using the setgid option instead 214 (see Note 7 above, and the setgid comment in the toplevel Makefile). 215 21613. If you are using Solaris 2.x (aka SunOS 5.x) you shouldn't have to 217 do any system configuration -- this is the default. In case it is 218 messed up, follow these instructions. 219 220 Solaris is basically a SVR4 system, not a BSD system. Therefore, you 221 configure config.h and unixconf.h as per a SVR4 system: 222 223 config.h: UNIX, TTY_GRAPHICS 224 unixconf.h: SYSV, SVR4, TERMINFO, POSIX_JOB_CONTROL, POSIX_TYPES 225 226 X11_GRAPHICS does work. Do not define OPENWINBUG. You may safely define 227 NETWORK, TEXTCOLOR if desired. Other #defines in these files may be 228 defined too, as needed. Just make sure that the set mentioned here are 229 not misdefined, or your compile will fail (do _not_ define BSD or SUNOS4). 230 Unless you are using gzip you will probably want to define COMPRESS to 231 be "/usr/bin/compress". 232 233 When compiling, make sure that you use the ANSI C SVR4 compatible 234 compiler, /usr/bin/cc, or gcc, but _not_ ucbcc. The lattermost will 235 not work. After this, you should get a clean compile. 236 237 Also, it is recommended that you use FLEX instead of the standard 238 lex bundled with Solaris 2.x (even if that last one should work ;-). 239 24014. If your machine is a 286, 386, or 486 running an appropriate OS, you 241 may wish to use the console speaker driver included in 242 sys/unix/snd86unx.shr. This will allow audible music to be played 243 on your console speaker in certain appropriate game situations. The only 244 modification to the main-line code needed to enable use of the driver 245 is defining UNIX386MUSIC or VPIX_MUSIC in unixconf.h. 246 24715. If you are trying to cross-compile for another system, there is some 248 support in the src and util Makefiles, but there are still other 249 complications. It may well be best to make another copy of util, 250 util2, to compile target copies of makedefs, lev_comp, and recover 251 (duplicating the cross-compilation settings from the src Makefile) 252 without disturbing the main build. 253 254 You can use the host makedefs for everything but "makedefs -v", which 255 creates include/date.h, which provides various sanity-checking values 256 for making sure files read by NetHack at run-time are compatible. 257 These values depend on the endianness of your processor, its type 258 sizes, and its compiler's idea of struct packing. Your host and target 259 computers may disagree on these things, so you'll need to build a target 260 version of makedefs, run "makedefs -v" on your target, and bring the 261 resulting date.h back for the builds on the host. (Making sure the host 262 makedefs doesn't decide it needs to overwrite it for you. :-) 263 264 You also need a target version of lev_comp, and to provide it with all 265 the dat/*.des files, and copy all the resulting *.lev files back for 266 packaging on the host. 267 268 For recover, you just want the target binary to install on the target. 269