CronoCloud (Ron Rogers Jr.) HOWTO compile Nethack on Linux for Playstation 2 by Ron Rogers Jr. Cronocloud@mchsi.com This HOWTO is oriented towards those who are new to Linux and compiling in general. I will try to make as few assumptions as possible, but this will be much easier if you know how to get around the filesystem in a terminal and are able use the vi editor in a basic fashion. What you will need: A Playstation 2 with the Linux kit installed (and running). A copy of the nethack source, which can be acquired from: http://www.nethack.org Nothing else is necessary. It is possible to download and compile Nethack on a freshly installed kit. The first person to report compiling Nethack on Linux for Playstation 2 (outside of Japan anyway) was user name ps2tunes on June 7 of 2002, very soon after kits had shipped to users in North America. This HOWTO will create a binary with tty (and terminal in x), X11 tiled mode and QT support. the QT interface does not display well on televisions because of resolution issues. The tty interface has a few color issues on a television. Gnome support is experimental and did not compile for me. ########################### VI Tutorial ####################################### There is a nice tutorial on how to use the vi editor here: http://www.eng.hawaii.edu/Tutor/vi.html You can also use: man vi or run: vimtutor on the command line vi is your friend. you edit files with vi by typing: vi filename or path to file you delete characters with: x delete whole lines with: dd enter insert mode with: i exit insert mode with: Esc save with: :w (that's right a colon and a "w" or save and quit with: :wq or also with: ZZ ############################################################################### Get the sources from http://www.nethack.org. You want the plain unadulterated source code. Bring up a terminal window, I tend to use rxvt. Might as well become root now: su then the root password Put the nethack sources in /usr/src mv nh343.tgz /usr/src cd into the /usr/src directory cd /usr/src You can now un-archive the tarball: tar -xvzf nh343.tgz (or whatever tarball you have) cd into the created directory let's take a look at what's here: ls It should look like this: Files Porting README dat doc include src sys util win Read the README: less README Just a quick reminder, to return back up the directory hierarchy on the command line you use: cd .. ########################### Printing Text Files #################################### One handy thing to do is to print out text files and README's so you can refer to them without having to have another terminal window open. It's also useful for other purposes Printing with the Linux kit is easy, all you need is: The kit The proper cable, either USB to USB or USB to Centronics parallel. You also need to set up printing using the Red Hat Printtool. Not all printers will work. I suggest trying older printers first. You can check the list in printtool itself. You need to be root to run printtool which you do as follows: printtool You will choose Add in the menu The printer device is: /dev/usblp0 You can then select the proper print filter for your printer. You may need to tweak things a bit, like suppressing headers and the like. Once done use the menu and restart the daemon You will now need to enable the printer module for the kernel: /sbin/insmod printer.o Then run the tests. ###################################################################################### cd sys/unix We get to make the setup.sh file executable with: chmod a+x setup.sh Then we run the script: ./setup.sh you have to edit /include/config.h enable X11 graphics enable Qt graphics enable #define use_xpm comment out use compress and compress extension enable use gzip and gz but use /bin/gzip as the path to it. enable #define DLB enable score on botl enable #define autopickup exceptions edit include/unixconf.h enable #define Linux enable #timed delay edit src/Makefile enable CC=gcc enable compile normally cflags and lflags disable debugging flags remove comment from LINKS line in QT section remove tile.o from WINTQTOBJ add $(WINX11SRC) to WINSRC add $(WINQTSRC) to WINSRC add $(WINX11OBJ) to WINOBJ add $(WINQTOBJ) to WINOBJ enable WINTTYLIB lncurses disable WINTTYLIB termlib add -lXpm to WINX11LIB ADD $(WINX11LIB) to WINLIB add $(WINQTLIB) to WINLIB add -lc to LIBS edit util/Makefile enable CC= gcc enable Linux compile normally CFLAGS and LFLAGS disable debugging flags add -lc to LIBS disable YACC = yacc disable LEX = lex enable YACC = bison -y enable LEX = flex edit top Makefile edit these as follows GAMEGRP = games GAMEPERM = 02755 FILEPERM = 0664 EXEPERM = 0755 DIRPERM = 0775 disable the first VARDATND enable # VARDATND = x11tiles NetHack.ad pet_mark.xbm rip.xpm nhsplash.xpm go into the win/X11 /usr/X11R6/bin/bdftopcf -o nh10.pcf nh10.bdf /usr/X11R6/bin/bdftopcf -o ibm.pcf ibm.bdf cp *.pcf /usr/X11R6/lib/X11/fonts/misc/ cd /usr/X11R6/lib/X11/fonts/misc/ mkfontdir okay return to the nethack source top directory you will now have to: export QTDIR=/usr/lib/qt-2.1.0 type make, and pray then do the make install once the compile is finished return to /xin/X11 and copy the two .pcf fonts to /usr/games/lib/nethackdir like so: cp *.pcf /usr/games/lib/nethackdir/ cd /usr/games/lib/nethackdir mkfontdir xset fp+ /usr/games/lib/nethackdir cp Nethack.ad in /win/X11 to /usr/X11R6/lib/X11/app-defaults/NetHack edit the /usr/X11R6/lib/X11/app-defaults/NetHack file as follows for tile support uncomment the tile file line uncomment graphic tombstone uncomment the pet file uncomment the tombstone text uncomment nethack autofocus exit to normal user enter win/X11 and copy nethack.rc to your home directory cp Nethack.cnf .nethackrc edit as necessary ############################################################################### SAMPLE tty enabled .nethackrc # # Nethack configuration file. # # Naming this file $(HOME)/.nethackrc (for UNIX) or setting the environment # variable NETHACKOPTIONS to point to its full path name elsewhere tells # NetHack to use X11 windowing and fonts (provided the executable was # compiled with that ability). # # OPTIONS=windowtype:tty,IBMgraphics OPTIONS:name:CronoCloud #OPTIONS=windowtype:x11,tile_file:x11tiles,tiled_map OPTIONS=toptenwin,hilite_pet,time,showscore,showexp OPTIONS=confirm,fixinv,noautopickup,safe_pet,sortpack,tombstone OPTIONS=verbose,news,fruit:pineapple OPTIONS=dogname:Skippy OPTIONS=catname:Spunkie OPTIONS=use_inverse,splash_screen,extmenu,help,standout,sparkle OPTIONS=pettype:cat OPTIONS=scores:10 top/10 around/own OPTIONS=legacy,menustyle:full,number_pad,lit_corridor,cmdassist # If you want to get rid of "use #quit to quit..." use: #OPTIONS=suppress_alert:3.3.1 # # There are 17 object symbols and various graphics symbols. # The descriptions of these symbols can be found in dat/opthelp. # # # Font: nh10 (10x20) # #OBJECTS= 180 183 188 192 181 184 182 189 190 196 \ # 191 194 193 187 185 186 195 # #DUNGEON= 032 025 018 013 012 014 011 015 023 024 \ # 022 021 128 129 130 131 132 035 035 133 \ # 134 135 136 137 145 146 144 124 143 142 \ # 141 140 149 150 031 031 147 148 031 161 \ # 140 # #TRAPS= 138 138 138 138 138 138 138 138 138 138 \ # 138 138 138 138 138 139 138 138 138 138 \ # 138 138 # #EFFECTS= 151 152 153 154 155 156 157 158 \ # 159 160 161 162 \ # 163 164 165 166 167 168 169 170 \ # 171 172 173 174 175 176 177 178 179 # # # Font: ibm (8x14) # #OBJECTS= 207 210 215 219 208 211 209 216 217 223 \ # 218 221 220 214 212 213 222 # #DUNGEON= 032 128 129 130 131 132 133 134 135 136 \ # 137 138 139 045 124 142 143 035 035 144 \ # 145 146 147 148 155 156 227 124 154 153 \ # 152 151 159 160 200 200 157 158 250 170 \ # 151 # #TRAPS= 149 149 149 149 149 149 149 149 149 149 \ # 149 149 149 149 149 150 149 149 149 149 \ # 149 149 # #EFFECTS= 161 162 163 164 165 166 167 168 \ # 169 170 171 172 \ # 173 174 175 176 177 178 179 180 \ # 181 182 183 184 185 186 187 188 189 # # # Font: a "standard" font like 6x13 # Note that this version is unlikely to work on a tty on a Unix system because # many of these characters are also control characters. # #DUNGEON = 032 025 018 013 012 014 011 015 023 024 \ # 022 021 031 045 124 043 043 035 035 031 \ # 035 001 060 062 060 062 019 124 092 035 \ # 123 125 031 125 046 046 035 035 046 127 \ # 125 # #TRAPS= 094 094 094 094 094 094 094 094 094 094 \ # 094 094 094 094 094 002 094 094 094 094 \ # 094 094 # #EFFECTS= 124 045 092 047 042 033 041 040 \ # 048 035 064 042 \ # 047 045 092 124 124 092 045 047 \ # 047 064 092 064 064 064 092 064 047 ############################################################################### SAMPLE x11 enabled .nethackrc # # Nethack configuration file. # # Naming this file $(HOME)/.nethackrc (for UNIX) or setting the environment # variable NETHACKOPTIONS to point to its full path name elsewhere tells # NetHack to use X11 windowing and fonts (provided the executable was # compiled with that ability). # # #OPTIONS=windowtype:tty OPTIONS=name:CronoCloud OPTIONS=windowtype:x11,tile_file:x11tiles,tiled_map OPTIONS=toptenwin,hilite_pet,time,showscore,showexp OPTIONS=confirm,fixinv,noautopickup,safe_pet,sortpack,tombstone OPTIONS=verbose,news,fruit:pineapple OPTIONS=dogname:Skippy OPTIONS=catname:Spunkie OPTIONS=use_inverse,splash_screen,extmenu,help,standout,sparkle OPTIONS=pettype:cat OPTIONS=scores:10 top/10 around/own OPTIONS=legacy,menustyle:full,number_pad,lit_corridor,cmdassist # If you want to get rid of "use #quit to quit..." use: #OPTIONS=suppress_alert:3.3.1 # # There are 17 object symbols and various graphics symbols. # The descriptions of these symbols can be found in dat/opthelp. # # # Font: nh10 (10x20) # OBJECTS= 180 183 188 192 181 184 182 189 190 196 \ 191 194 193 187 185 186 195 # DUNGEON= 032 025 018 013 012 014 011 015 023 024 \ 022 021 128 129 130 131 132 035 035 133 \ 134 135 136 137 145 146 144 124 143 142 \ 141 140 149 150 031 031 147 148 031 161 \ 140 # TRAPS= 138 138 138 138 138 138 138 138 138 138 \ 138 138 138 138 138 139 138 138 138 138 \ 138 138 # EFFECTS= 151 152 153 154 155 156 157 158 \ 159 160 161 162 \ 163 164 165 166 167 168 169 170 \ 171 172 173 174 175 176 177 178 179 # # # Font: ibm (8x14) # #OBJECTS= 207 210 215 219 208 211 209 216 217 223 \ # 218 221 220 214 212 213 222 # #DUNGEON= 032 128 129 130 131 132 133 134 135 136 \ # 137 138 139 045 124 142 143 035 035 144 \ # 145 146 147 148 155 156 227 124 154 153 \ # 152 151 159 160 200 200 157 158 250 170 \ # 151 # #TRAPS= 149 149 149 149 149 149 149 149 149 149 \ # 149 149 149 149 149 150 149 149 149 149 \ # 149 149 # #EFFECTS= 161 162 163 164 165 166 167 168 \ # 169 170 171 172 \ # 173 174 175 176 177 178 179 180 \ # 181 182 183 184 185 186 187 188 189 # # # Font: a "standard" font like 6x13 # Note that this version is unlikely to work on a tty on a Unix system because # many of these characters are also control characters. # #DUNGEON = 032 025 018 013 012 014 011 015 023 024 \ # 022 021 031 045 124 043 043 035 035 031 \ # 035 001 060 062 060 062 019 124 092 035 \ # 123 125 031 125 046 046 035 035 046 127 \ # 125 # #TRAPS= 094 094 094 094 094 094 094 094 094 094 \ # 094 094 094 094 094 002 094 094 094 094 \ # 094 094 # #EFFECTS= 124 045 092 047 042 033 041 040 \ # 048 035 064 042 \ # 047 045 092 124 124 092 045 047 \ # 047 064 092 064 064 064 092 064 047 ############################################################################## SAMPLE QT enabled .nethackrc # # Nethack configuration file. # # Naming this file $(HOME)/.nethackrc (for UNIX) or setting the environment # variable NETHACKOPTIONS to point to its full path name elsewhere tells # NetHack to use X11 windowing and fonts (provided the executable was # compiled with that ability). # # #OPTIONS=windowtype:tty OPTIONS=name:CronoCloud #OPTIONS=windowtype:x11 OPTIONS=windowtype:qt OPTIONS=tile_file:x11tiles,tiled_map OPTIONS=toptenwin,hilite_pet,time,showscore,showexp OPTIONS=confirm,fixinv,noautopickup,safe_pet,sortpack,tombstone OPTIONS=verbose,news,fruit:pineapple OPTIONS=dogname:Skippy OPTIONS=catname:Spunkie OPTIONS=use_inverse,splash_screen,extmenu,help,standout,sparkle OPTIONS=pettype:cat OPTIONS=scores:10 top/10 around/own OPTIONS=legacy,menustyle:full,number_pad,lit_corridor,cmdassist SOUNDDIR=/home/CronoCloud/nhs SOUND=MESG "needs food, badly" "weak.au" 100 SOUND=MESG "feel weak" "weak.au" 100 SOUND=MESG "bear trap closes" "beartrap.au" 100 SOUND=MESG "board beneath you squeaks" "squeek.au" 100 SOUND=MESG "board beneath .....* squeaks" "squeek.au" 60 SOUND=MESG "a distant squeak" "squeek.au" 25 SOUND=MESG "mind releases itself from" "memories.au" 100 SOUND=MESG "on itself, you forget" "memories.au" 100 SOUND=MESG "Who was that Maud person" "memories.au" 100 SOUND=MESG "Thinking of Maud you forget" "memories.au" 100 SOUND=MESG "you forget everything" "memories.au" 100 SOUND=MESG "smell marsh gas" "frogs.au" 100 SOUND=MESG "must have been exercising" "tada.au" 100 SOUND=MESG "must have been very obs" "tada.au" 100 SOUND=MESG "must have been working on" "tada.au" 100 SOUND=MESG "must be leading a healthy" "tada.au" 100 SOUND=MESG "Keystone Kops appear!" "kops.au" 100 SOUND=MESG "Keystone Kops are after you" "kops.au" 100 SOUND=MESG "interesting topological ex" "mock.au" 100 SOUND=MESG "Interesting\.\.\." "mock.au" 100 SOUND=MESG "deathly sick\." "ohdear.au" 80 SOUND=MESG "feel feverish" "ohdear.au" 80 SOUND=MESG "brain is eaten" "minderode.au" 80 SOUND=MESG "thought thou couldst kill" "yendor.au" 120 SOUND=MESG "begin praying to" "latin_short.au" 70 SOUND=MESG "sense of peace" "latin.au" 20 SOUND=MESG "have a.* forbidding feeling" "latin.au" 20 SOUND=MESG "door opens\." "dooropen2.au" 100 SOUND=MESG "You drop " "drop.au" 10 SOUND=MESG "You destroy " "destroy2.au" 30 SOUND=MESG "You kill " "destroy2.au" 20 SOUND=MESG "is killed" "destroy2.au" 10 SOUND=MESG "You miss " "miss2.au" 20 SOUND=MESG "fiery blade burns" "hit2.au" 30 SOUND=MESG "ice-cold blade freezes" "hit2.au" 30 SOUND=MESG "You hit " "hit2.au" 20 SOUND=MESG "The spell hits" "hit2.au" 20 SOUND=MESG "breathes" "breath.au" 100 SOUND=MESG "a door open\." "dooropen2.au" 100 SOUND=MESG "Klunk" "clunk.au" 100 SOUND=MESG "guard on patrol" "coin.au" 50 SOUND=MESG "quarterback calling" "coin.au" 50 SOUND=MESG "someone counting" "coin.au" 50 SOUND=MESG "Ebenezer Scrooge" "coin.au" 50 SOUND=MESG "someone cursing shoplifters" "gong.au" 50 SOUND=MESG "chime of a cash register" "gong.au" 50 SOUND=MESG "Neiman and Marcus" "gong.au" 50 SOUND=MESG "You die" "death.au" 100 SOUND=MESG "sad feeling" "death.au" 50 SOUND=MESG "door closes\." "doorclos.au" 100 SOUND=MESG "cosmic" "hallu.au" 100 SOUND=MESG "explosion" "landmine.au" 100 SOUND=MESG "KABOOM" "landmine.au" 100 SOUND=MESG "KAABLAM" "landmine.au" 100 SOUND=MESG "trigger.* a land *mine" "landmine.au" 100 SOUND=MESG "elcome to experi" "level_up.au" 100 SOUND=MESG "memorize" "memor.au" 100 SOUND=MESG "Ouch" "ouch2.au" 100 SOUND=MESG "XXXfall through\.\.\." "trapdoor.au" 100 SOUND=MESG "vomit" "vomit.au" 100 SOUND=MESG "whistling" "whistle2.au" 100 SOUND=MESG "crashes open" "thump.au" 100 SOUND=MESG "You break open the lock" "thump.au" 100 SOUND=MESG "THUD" "thump.au" 40 SOUND=MESG "WHAMM" "thump.au" 50 SOUND=MESG "welcome to NetHack" "awaits.au" 100 SOUND=MESG "strange vibration under" "forcefld.au" 100 # If you want to get rid of "use #quit to quit..." use: #OPTIONS=suppress_alert:3.3.1 # # There are 17 object symbols and various graphics symbols. # The descriptions of these symbols can be found in dat/opthelp. # # # Font: nh10 (10x20) # OBJECTS= 180 183 188 192 181 184 182 189 190 196 \ 191 194 193 187 185 186 195 # DUNGEON= 032 025 018 013 012 014 011 015 023 024 \ 022 021 128 129 130 131 132 035 035 133 \ 134 135 136 137 145 146 144 124 143 142 \ 141 140 149 150 031 031 147 148 031 161 \ 140 # TRAPS= 138 138 138 138 138 138 138 138 138 138 \ 138 138 138 138 138 139 138 138 138 138 \ 138 138 # EFFECTS= 151 152 153 154 155 156 157 158 \ 159 160 161 162 \ 163 164 165 166 167 168 169 170 \ 171 172 173 174 175 176 177 178 179 # # # Font: ibm (8x14) # #OBJECTS= 207 210 215 219 208 211 209 216 217 223 \ # 218 221 220 214 212 213 222 # #DUNGEON= 032 128 129 130 131 132 133 134 135 136 \ # 137 138 139 045 124 142 143 035 035 144 \ # 145 146 147 148 155 156 227 124 154 153 \ # 152 151 159 160 200 200 157 158 250 170 \ # 151 # #TRAPS= 149 149 149 149 149 149 149 149 149 149 \ # 149 149 149 149 149 150 149 149 149 149 \ # 149 149 # #EFFECTS= 161 162 163 164 165 166 167 168 \ # 169 170 171 172 \ # 173 174 175 176 177 178 179 180 \ # 181 182 183 184 185 186 187 188 189 # # # Font: a "standard" font like 6x13 # Note that this version is unlikely to work on a tty on a Unix system because # many of these characters are also control characters. # #DUNGEON = 032 025 018 013 012 014 011 015 023 024 \ # 022 021 031 045 124 043 043 035 035 031 \ # 035 001 060 062 060 062 019 124 092 035 \ # 123 125 031 125 046 046 035 035 046 127 \ # 125 # #TRAPS= 094 094 094 094 094 094 094 094 094 094 \ # 094 094 094 094 094 002 094 094 094 094 \ # 094 094 # #EFFECTS= 124 045 092 047 042 033 041 040 \ # 048 035 064 042 \ # 047 045 092 124 124 092 045 047 \ # 047 064 092 064 064 064 092 064 047 ############################################################################## Nethack has a Guidebook, it is available in the /doc directory of the source. If you've never played NetHack before it might be a good idea to read it. Once you're ready you start nethack with: /usr/games/nethack End of HOWTO