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 svn://rephial.org/angband/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
If you are using a RedHat/Fedora based distribution (such as Linpus on an Acer Aspire One) and only want the text based interface you can use:
$ sudo yum install make gcc ncurses-devel
To get a basic build (X11 + curses), with your home directory as the install target, try:
$ ./configure --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 --with-noinstall $ make
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,
Notes for Solaris users:
- Package SUNWgmake may have been installed by default, if so, you can use gnu make (/usr/sfw/bin/gmake). The default Solaris make utilities will give an error.
- If "gmake install" gives an error, change the "INSTALL =" line of mk/rules.mk to an absolute path.
Windows + Cygwin/MinGW
Get MinGW and MSYS. (Or get Cygwin, though it's not recommended.)
- Try using the automated installer.
- Click through the installer, accepting the defaults until you get to "Choose components".
- Tick the "MingGW Make" entry.
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.
Run
make -f makefile.win. Add " MINGW=yes" to the end of that iff you're using MinGW.
Windows + Dev-C++
Get and install DevC++.
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).
Add every C file in src/, and also everything from the src/win, src/monster, src/object and src/player directories.
Go to Project -> Project Options, and:
- In the "General" tab, ensure "Win32 console application" is selected.
- On Dev-C++ 4, click on "Browse" under "Icon" and select
angband.ico. - In the "Build Options" tab, change the executable output directory to "..\".
For SDL, in the "parameters" tab, add:
-lmingw32 -mwindows -DWINDOWS -DUSE_SDLto the compiler options.-lwinmm -lmingw32 -mwindows -lSDL -lSDLmain -lSDL_ttfto the linker options.
For the Windows port, in the "parameters" tab, add:
-mwindows -DWINDOWS -I.to the compiler options.-lmingw32 -lwinmm -mwindowsto the linker options.
Compile.
Windows + Visual C++
- Get and install Microsoft Visual C++ 2008 Express edition.
- Start the Visual Studio 2008 command prompt and change to the source directory of angband (e.g. C:\angband-3.1.0beta\src\)
- Compile with
nmake /fMakefile.nmake.
Mac OS X + GCC
- Install the Apple Developer CD if you haven't already done so.
- Compile Angband: In Terminal.app type
cd angband/srcto get to the Angband source directory. Then typemake -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.
