1Building a PPC NetHack 3.4 with the Metrowerks compilers 2 3 4You must be familiar with the Metrowerks compiler and know how to construct 5projects. The NetHack source may come with the four pre-made projects that 6are needed to build NetHack and the files it needs. These four projects are 7in :sys:mac and are MakeDefs.u, DgnComp.u, LevComp.u, and NetHack.u. If you 8do not have them, or wish to construct them yourself, see the section "Project 9Contents" below. 10 11 121. Move the projects MakeDefs.u, DgnComp.u, LevComp.u, and NetHack.u to the 13top level of the NetHack tree. If you are building your own, create each 14project as needed, in the order given below. 15 162. Create a folder "lib" in the top level. This is where the files used by 17NetHack will be deposited by MakeDefs, DgnComp, and LevComp. 18 193. Build and run MakeDefs. 20 21You will be presented with a list of options. Initially choose them all (the 22default). Later you may wish to only run a few of them. The options are 23"odemvpqrhz", each of which makes a file: 24 25 -o creates :include:onames.h 26 -p creates :include:pm.h 27 -z creates :src:vis_tab.c 28 -m creates :src:monstr.c 29 -e creates :dat:dundeon.pdf 30 -v creates :lib:options 31 -d creates :lib:data 32 -r creates :lib:rumors 33 -h creates :lib:oracles 34 -q creates :lib:quest.dat 35 36 374. If you are _not_ using DLB, follow these directions. As of v3.3, DLB is ON 38for the Mac. Copy the following files. You may want to change News or NHDeflts. 39 40 a. copy ':sys:mac:MacHelp' to ':lib:MacHelp' 41 b. copy ':sys:mac:News' to ':lib:News' 42 c. copy ':sys:mac:NHDeflts' to ':lib:NetHack Defaults' 43 44 d. copy ':dat:cmdhelp' to ':lib:cmdhelp' 45 e. copy ':dat:help' to ':lib:help' 46 f. copy ':dat:hh' to 'lib:hh' 47 g. copy ':dat:history' to ':lib:history' 48 h. copy ':dat:license' to ':lib:license' 49 i. copy ':dat:opthelp' to ':lib:opthelp' 50 j. copy ':dat:wizhelp' to ':lib:wizhelp' 51 525. Create an empty file, ':lib:record' 53 546. Build and run DgnComp. 55 This will create a file "dungeon" in the lib directory. 56 577. Build and run LevComp. 58 This will build the level files (*.lev) in the lib directory. 59 608. Build NetHack. 61 Move NetHack in the lib directory. 62 63 64------------------------ 65 66 67Building NetHack with MetroWerks IDE 1.x (DR7-DR10, DR11 was never used) 68 69 70To build NetHack, you will need to create four projects at the top level of 71the NetHack directory tree. These four projects are MakeDefs.u, DgnComp.u, 72LevComp.u, and NetHack.u. The projects don't have to end in ".u", but you 73should append some form of ".XXX" to the end of the project's name to 74distinguish the project from the executable that it produces. The files 75and libraries to include in these projects are listed in the "Project 76Contents" section below. You must create and run Makedefs before creating 77NetHack because MakeDefs will create files used by NetHack. 78 79Use the MacOS C/C++ template for each of the projects. The libraries included 80will be overkill for all the projects (e.g. the C++ libraries are not needed). 81Add the .c and resource files as indicated below. Unless otherwise noted, the 82projects can use the default preferences: 83 84 Font 85 The tabbing on all non-mac files is 8. All mac files have a 86 tab of 4. 87 PPC Processor 88 All projects must have the same alignment to build a consistent 89 NetHack. To share save files with 68K, the alignments 90 must match for their projects, as well. 91 Turn on Global Optimization (official version is compiled 92 with level 1). If you don't turn it on, some files may 93 not compile because of register overflow. [NetHack 94 only] 95 PPC Project 96 Set name to <MakeDefs, LevComp DgnComp, NetHack> 97 Other settings [NetHack only] 98 creator: nh31 99 preferred heap size:2500 100 minimum heap size: 2000 101 stack size: 128 [PPC only] 102 103 104The SIOUX library may be replaced with console.stubs.c for the NetHack 105project. 106 107NOTE: As NetHack 3.3, you must turn on OLDROUTINENAMES -- so you can't use 108the default pre-compiled header. You should either remove it from the 109preferences or insert another precompiled header that has this define off. 110 111 112------------------------ 113 114 115Building NetHack with MetroWerks IDE 2.0. 116 117This is for building a PowerPC version only. This doesn't take advantage 118of the IDE's subprojects. These will be investigated later. 119 120 121MakeDefs.u, DgnComp.u, LevComp.u: Select ANSI C Console PPC. 122 Settings: 123 PPC Target 124 + Change File Name to MakeDefs, DgnComp, or LevComp respectively. 125 C/C++ Language 126 + Turn off ANSI strict, ANSI Keywords Only, Expand Trigraphs 127 PPC Processor 128 + Turn on global optimization (at least to level 1) 129 130NetHack.u: Basic ToolBox PPC 131 PPC Target 132 + Change File Name to NetHack. Other settings 133 creator: nh31 134 preferred heap size:2500 135 minimum heap size: 2000 136 stack size: 128 [PPC only] 137 C/C++ Language 138 + Options ANSI strict, ANSI Keywords Only, Expand Trigraphs 139 are already turned off, so you don't have to do anything. 140 PPC Processor 141 + Turn on global optimization (at least to level 1) 142 143 144------------------------ 145Creating projects for NetHack with MetroWerks IDE 3.3 (Pro 4) 146 147This is what I changed from the default settings when creating a 68K version. Some of 148the settings may not be necessary. For example, NetHack doesn't use floating point, 149so I didn't have to check 8 byte doubles. Some are interrelated. For example, the 150codegen and the Math and MSL libraries used. 151 152For MakeDefs.u, DgnComp.u, LevComp.u: 1531. Select File>>New Project...>>MacOS>>C_C++>>Standard Console>>Std C Console 68K 1542. 68K Settings: 155 Target Settings: 156 + Set "Target Name" to {MakeDefs,DgnComp,LevComp}. 157 68K Target: 158 + Set "File Name" to {MakeDefs,DgnComp,LevComp}. 159 C/C++ Language: 160 + Check Require Function Prototypes, uncheck everything else. 161 + Clear "Prefix File". 162 68K Processor: 163 + Set "Code Model" to Large. 164 + Check 68020 Codegen, 4-Byte Ints, 8-Byte Doubles, Far Data, Far Method Tables, 165 Far String Constants. Uncheck everything else. 1663. Libraries 68K 167 + Remove the C++ Library (it is not needed). 168 + Change math library to MathLib68K Fa(4i_8d).Lib. 169 + Change MSL C library to MSL C.68K Fa(4i_8d).Lib. 170 Note: The actual libraries used must match the CodeGen options in 68K Processor. 171 172 173For NetHack.u: 1741. Select File>>New Project...>>MacOS>>C_C++>>MacOS ToolBox>>MacOS ToolBox 68K 1752. 68K Settings 176 Target Settings: 177 + Set "Target Name" to NetHack Debug and NetHack Final. 178 68K Target: 179 + Set "File Name" to NetHack Debug and NetHack Final. 180 + Set "Creator" to 'nh31'. 181 + Set "Preferred Heap Size (k)" to 2500. 182 + Set "Minimum Heap Size (k)" to 1500. 183 C/C++ Language: 184 + Check Require Function Prototypes, uncheck everything else. 185 + Set "Prefix File" to LocalDefines.h. I use this header to define 186 OLDROUTINENAMES because the pre-compiled header doesn't have it set 187 any more. One of these days we'll fix up the code... 188 68K Processor: 189 + Set "Code Model" to Large. 190 + Check 68020 Codegen, 4-Byte Ints, 8-Byte Doubles, Far Data, Far Method Tables, 191 Far String Constants. Uncheck everything else. 1923. Libraries 68K 193 + Remove the C++ Library (it is not needed). 194 + Change math library to MathLib68K Fa(4i_8d).Lib. 195 + Change MSL C library to MSL C.68K Fa(4i_8d).Lib. 196 Note: The actual libraries used must match the CodeGen options in 68K Processor. 197 198 199For Recover.u: 2001. Select File>>New Project...>>MacOS>>C_C++>>MacOS ToolBox>>MacOS ToolBox 68K 2012. 68K Settings 202 Target Settings: 203 + Set "Target Name" to Recover Debug and Recover Final. 204 68K Target: 205 + Set "File Name" to Recover Debug and Recover Final. 206 + Set "Creator" to 'nhRc'. 207 C/C++ Language: 208 + Check Require Function Prototypes, uncheck everything else. 209 + Set "Prefix File" to LocalDefines.h. I use this header to define 210 OLDROUTINENAMES because the pre-compiled header doesn't have it set 211 any more. One of these days we'll fix up the code... 212 68K Processor: 213 + Set "Code Model" to Large. 214 + Check 68020 Codegen, 4-Byte Ints, 8-Byte Doubles, Far Data, Far Method Tables, 215 Far String Constants. Uncheck everything else. 2163. Libraries 68K 217 + Remove the C++ Library (it is not needed). 218 + Change math library to MathLib68K Fa(4i_8d).Lib. 219 + Change MSL C library to MSL C.68K Fa(4i_8d).Lib. 220 Note: The actual libraries used must match the CodeGen options in 68K Processor. 221 222 223------------------------ 224 225Project Contents: 226 227MakeDefs.u should contain the following source files: 228 229 src 230 objects.c 231 monst.c 232 util 233 makedefs.c 234 235 236DgnComp.u should contain the following source files: 237 238 src 239 alloc.c 240 sys:share 241 dgn_lex.c 242 dgn_yacc.c 243 util 244 dgn_main.c 245 panic.c 246 247 248LevComp.u should contain the following source files: 249 250 src 251 alloc.c 252 decl.c 253 drawing.c 254 monst.c 255 objects.c 256 sys:mac 257 macerrs.c 258 macfile.c 259 sys:share 260 lev_lex.c 261 lev_yacc.c 262 util 263 lev_main.c 264 panic.c 265 266 267NetHack.u should contain the following source files: 268 269 src 270 *.c [can do an add all] 271 sys:mac 272 *.c except mrecover.c 273 NetHack.rsrc 274 machelp.bh [for baloon help] 275 Sound.rsrc [if you wish to have a few, crude sounds] 276 Files.r [if you use DLB (on by default)] 277 sys:share 278 random.c 279 win:tty 280 *.c [can do an add all - termcap.c is not needed, but will compile to nothing] 281 282 Note: src:monstr.c and src:vis_tab.c are created by MakeDefs -m and -s 283 respectively. 284 285Recover.u should contain the following source files: 286 287 sys:mac 288 mrecover.c 289 mrecover.rsrc 290