Compiling Angband for the Mac using CodeWarrior

  1. Download the source code. When you download the source code archive, use binary mode transfer or save as source. If your web browser fails to download the source and you have to use something like Fetch, keep in mind that if the source code archive is in the Incoming directory the file will be invisible.

  2. Expand the source archive. The source code will usually be in .gz or .zip format. Many of the .gz archives will also be .tar archives. MacGzip works well for .gz archives (hold down the shift key while drag-and-dropping to force expansion), and I use UnZip for .zip archives, and SunTar for .tar archives. Sometimes the variant writer will forget to put the files in a folder before archiving, so to avoid having a mess of files to clean up I usually put the archive in its own folder before unarchiving.

  3. Download the proper ext file. Once you have the source code unarchived, you will need to get the ext-mac file for the base Angband version the variant was derived from. You can sometimes get this information from the readme file that is enclosed with the source code. If it is not there it will sometimes be in the defines.h file, if the particular variant has the base version along with the variant version. Failing that, you can check the variant's home page or a general Angband page using my links page. The ext-mac files are in the Macintosh directory of export.andrew.cmu.edu. Once you have the ext-mac file, expand it and put the files in the src directory. (N. B.: The indomitable mac variant compiler Prfnoff reports that ext-mac-283.sit.bin works for all of his compiling needs, no matter what the base version.)

  4. Edit the header files. Open the h-config.h file and uncomment the #define MACINTOSH line. Check to make sure that all of the other #ifndef foo / #define foo blocks are commented out. Also look for this codeblock in h-config.h:
    /*
     * Remove the WINDOWS flag when using MACINTOSH
     */
    #ifdef MACINTOSH
    # ifdef WINDOWS
    #  undef WINDOWS
    # endif
    #endif
    
    It will usually be after the "Remove the MSDOS flag when using WINDOWS" codeblock. If it is not there, add it in.

  5. Edit the main-mac.c file. Open the main-mac.c file and change all file specifications with the string "Angband Preferences" to "Fooband Preferences"where Fooband is the name of the variant. Change A271 in the line "_fcreator = 'A271';" to an appropriate four character creator code.

  6. Edit the resource file. Open the Angband.º.rsrc file using ResEdit. If you don't have ResEdit you can get it free from Apple. Double click on the BNDL resource. Double click on the resource that shows up (ID = 128). Change the Signature from A271 to the four character code you chose in the previous step.

  7. Open/create and edit the project file. If you are running CodeWarrior Pro (you lucky dog :-)) you should be able to open the project file from the ext-mac file directly. If you are running CodeWarrior, you may need to construct the project file manually. Here are instructions on how to do this. Once this is done, you should compare the files in the src directory to the files in the project file. There may be additional files that need to be included in the project file, and some files may have different names in the src directory than in the project file. One common example is in some variants load1.c and load2.c are replaced by a single load.c for the variant. Note that the only main*.c file needed is main-mac.c, and readdib.c and randmain.c (really any *.c file with a main function) aren't used by the mac compilation.

  8. Compile and fix bugs. Use the Make command and get out a good book. Compilation usually takes a while and usually ends with a page full of warnings and errors. Most of the time you are on your own at this point. But don't panic. Here are some workarounds for common bugs in the variants, and you can always e-mail the variant author or post questions to the rec.games.roguelike.angband newsgroup.

Return to my Home Page