This page:
Page history
Links to here

Last modified:
2008-04-25 at 14:27

Compiling

Compiling Angband

You only want to read this file if you want to compile the game. It is probably unnecessary to do so, since most platforms have pre-compiled versions available.

If can construct "main-xxx.c" and/or "Makefile.xxx" files for a currently unsupported system, please write to the Angband development list with details, and it will probably be included in a future version.

Getting the development version

If you want to compile the current development verion of the game, then you will first need a Subversion client to get a copy of the code. On Windows, try using TortoiseSVN.

When you have it, try

 $ svn co http://dev.rephial.org/svn/trunk

Or, in the case of TortoiseSVN, make a new folder where you want to check out, right-click, and select "SVN checkout". Use the above URL and click "OK".

Then follow the instructions below as usual. On Unix, if you want to use the ./configure script, then you will first have to generate one:

 $ sh autogen.sh

If you're using OpenBSD, you may have to specify which version of automake and autoconf you wish to use, like:

 $ AUTOCONF_VERSION=2.59 AUTOMAKE_VERSION=1.9 ./autogen.sh

Linux/Unix

If you use Unix, then the best option is to use the ./configure script. This requires a recent version of autoconf (v2.60 or later).

If you are using a Debian-based distribution, the following should get you all the packages you need:

 $ sudo apt-get install autoconf gcc libc6-dev libncurses5-dev libx11-dev \
                        libsdl1.2-dev libsdl-ttf2.0-dev libsdl-mixer1.2-dev libsdl-image1.2-dev

To get a basic build (X11 + curses), with your home directory as the install target, try:

 $ ./configure --enable-x11 --prefix=$HOME
 $ make
 $ make install

If you don't want to install locally, but would rather play from the same directory you compiled the game in, try:

 $ ./configure --enable-x11
 $ make
 $ cd src
 $ make localinstall

For help with configure:

 $ ./configure --help

Other settings can be tuned. You can set CC (compiler), CPPFLAGS (preprocessor flags), CFLAGS (compiler flags), LDFLAGS (linker flags), and LIBS (libraries). Configure may modify all but CC. For example:

 $ env CC='cc' CPPFLAGS='-DUSE_HARDCODE' ./configure

For a system wide installation you might want to try something more like:

 $ ./configure --with-setgid=games --with-libpath=/usr/local/games/lib/angband
               --bindir=/usr/local/games
 $ make
 $ su -c "make install"

The autotools build uses "Objective Make" (OMK) from [http://www.atheme.org/].

If you don't have/want autotools, or want to use a frontend not supported by automake, then Makefile.std should work for you,


Windows + Cygwin/MinGW

  1. Get MinGW and MSYS. (Or get Cygwin, though it's not recommended.)

    1. Try using the automated installer.
    2. Click through the installer, accepting the defaults until you get to "Choose components".
    3. Tick the "MingGW Make" entry.
  2. Enter the shell for your environment (in the case of MinGW, this is the Windows command prompt) and get into the src/ directory of the game.

  3. Run make -f makefile.win. Add " MINGW=yes" to the end of that iff you're using MinGW.


Windows + Dev-C++

  1. Get and install DevC++.

  2. Create an empty C project, located in the source directory (you can place it elsewhere but you may need to fiddle about a bit more if you do).

  3. Add every C file in src/, and also everything from the src/win directory.

  4. Go to Project -> Project Options, and:

    1. In the "General" tab, ensure "Win32 console application" is selected.
    2. On Dev-C++ 4, click on "Browse" under "Icon" and select angband.ico.
    3. In the "Build Options" tab, change the executable output directory to "..\".
  5. For SDL, in the "parameters" tab, add:

    1. -lmingw32 -mwindows -DWINDOWS -DUSE_SDL to the compiler options.
    2. -lwinmm -lmingw32 -mwindows -lSDL -lSDLmain -lSDL_ttf to the linker options.
  6. For the Windows port, in the "parameters" tab, add:

    1. -mwindows -DWINDOWS to the compiler options.
    2. -lmingw32 -lwinmm -mwindows to the linker options.
  7. Compile.


Mac OS X + GCC

  1. Install the Apple Developer CD if you haven't already done so.
  2. Compile Angband: In Terminal.app type cd angband/src to get to the Angband source directory. Then type make -f Makefile.osx.

If everything compiled, then you should have an 'Angband' application bundle in your 'angband' directory. If you want to distribute a modified version to other players then you can use the 'dist' Makefile target to repackage the game. In Terminal.app type make -f Makefile.osx dist to create a *.dmg disk-image.

If you are trying to compile a variant that doesn't have OS X support, install subversion/svn and recent versions of autoconf & automake, and follow the UNIX instructions above. The curses version probably won't work properly ("LIGHT_DARK" renders as black on black in Terminal.app), but the X11 version should be adequate.


Summary of Developer Resources