Add NetTiles, a new Tiles interface with online play support (v24)
[crawl/crawl-nettiles.git] / crawl-ref / INSTALL.txt
blob3239c23e3ea4b7817dcfaf32c418170125f447d4
1 Install instructions for Dungeon Crawl Stone Soup (DCSS)
2 --------------------------------------------------------
3 (Last updated on 20091025 for Dungeon Crawl Stone Soup 0.6.0.)
5 Getting DCSS to run
6 -------------------
8 This file describes how to compile a runtime executable of DCSS from the source
9 code. If you're trying to compile Crawl yourself, skip ahead to the next
10 section, "Building Dungeon Crawl Stone Soup".
12 If, however, you're having trouble getting a precompiled binary to run:
14 1) Check whether you've downloaded and extracted the correct version.
16     Platform        Tiles?          Download package
17     --------        ------          ----------------
18     Windows         yes             stone_soup-VERSION-tiles-win32.zip
19     Windows         no              stone_soup-VERSION-win32.zip
20     Mac OS X        yes             stone_soup-VERSION-tiles-osx.zip
21                                     or stone_soup-VERSION-tiles-osx-app.dmg
22     Mac OS X        no              stone_soup-VERSION-osx.zip
23                                     or stone_soup-VERSION-osx-app.dmg
24     DOS             no              stone_soup-VERSION-dos.zip
25     Source code     yes             stone_soup-VERSION-src.zip
26                                     or stone_soup-VERSION-src.tar.bz2
28 2) Try removing/renaming your saves/ directory in case older saves aren't
29    recognized anymore.
32 If you still can't get Crawl to run, you can ask for further help on
33 rec.games.roguelike.misc. Please try to be as detailed as possible about any
34 error messages you're getting.
36 The rest of the file deals with compiling from the source.
39 Building Dungeon Crawl Stone Soup
40 ---------------------------------
42 Crawl Stone Soup is known to compile successfully on the following platforms as
43 of version 0.3:
45 - Any Unix with a recent gcc (and g++), GNU make and libncurses, including Linux
46   and Mac OS X. "Recent" is defined as gcc 3.3 or newer.
47 - Microsoft Windows NT/2000/XP. The game will also run on Windows 9X and ME. DOS
48   binaries can also be compiled on Windows NT+.
50 The only supported compiler is gcc (available on almost all Unixes, and as djgpp
51 for DOS, and MinGW for Windows).
53 Other platforms are unsupported, but you should be able to build Crawl on pretty
54 much any operating system with a modern C++ compiler (full support for the
55 standard C++ library, in particular <string>, the collection classes and
56 <algorithm> is necessary) and the curses library.
59 Source Code Checkout
60 --------------------
62 If you don't already have the source code downloaded (in the form of a .zip or
63 .tbz2 file), you can obtain the latest source code from Git. MinGW users can
64 obtain Git by installing msysgit (described in the MinGW section). Linux users
65 can just install the 'git' or 'git-core' package with whatever package manager
66 they use. Note that there is another package called 'git' going around which
67 stands for 'GNU interactive tools'. This is not what you want.
69 Once you have Git installed, you just need to do:
71     git clone git://crawl-ref.git.sourceforge.net/gitroot/crawl-ref/crawl-ref
73 And then to get the contributing libraries, enter the newly cloned repository
74 via 'cd crawl-ref' and type:
76     git submodule update --init
78 This should get you all you need to build Crawl from source.
81 Optional libraries
82 ------------------
84 Crawl can be built with some optional features:
86 * Sounds
87 * Regular expressions
88 * User Lua scripts
89 * Unicode characters for the map (Unix only).
91 Crawl Stone Soup also uses a level compiler to compile special level
92 definitions; to make changes to the level compiler, you'll need the flex and
93 bison/byacc tools (Other lex/yaccs may also work). More details are available
94 below.
96 Sounds must be enabled by editing AppHdr.h (uncomment SOUND_PLAY_COMMAND on
97 Unixes or WINMM_PLAY_SOUNDS on Windows).
99 Regular expressions require libpcre on non-Unix operating systems. On Unixes,
100 the standard POSIX regular expression support is adequate for Crawl's needs.
102 Stone Soup 0.6 includes Lua 5.1.4 in its source tree. Crawl uses Lua for dungeon
103 generation. In addition, Crawl has a (rudimentary) Lua interface for users to
104 run scripts which can do things such as conditionalise parts of the
105 .crawlrc/init.txt. Such user Lua scripts are enabled by default, but can be
106 turned off by removing -DCLUA_BINDINGS from your makefile.
108 Unicode support needs libncursesw and its header files; these are usually
109 available in your operating system's package-management system. Unicode is not
110 supported on Windows or DOS. Some systems, such as Mac OS X, may have Unicode
111 support available in libncurses itself (i.e., without a separate libncursesw).
114 Building on Unix (Linux, *BSD, Solaris, etc.)
115 ---------------------------------------------
117 Security:
119 If you have untrusted local users, we highly recommend you do not install Crawl
120 setgid or setuid. Just running "make install" will install Crawl setgid games,
121 do *not* do this unless you're sure you trust your users.
123 If you have untrusted users, the correct way to install a multiplayer Crawl is
124 using a chrooted game launcher such as dgamelaunch.
127 To install or not to install:
129 If only one user on the system (you) is going to be playing Crawl, you do not
130 need to use "make install". A simple "make" will build Crawl in the source
131 directory, where you can run it as "./crawl".
134 Prerequisites:
136 GNU gcc and g++, GNU make, libncurses or libcurses. You need the development
137 headers for ncurses - they may not be installed by default on some Unixes.
139 For tile builds, you need FreeDesktop's pkg-config.
141 flex and bison are optional but highly recommended. Recent versions of byacc are
142 also fine (edit your makefile appropriately).
144 If you want to use Unicode, you need to link with a curses library that
145 understands Unicode characters, usually named libncursesw (the development
146 headers for libncursesw are usually in /usr/include/ncursesw.) You also need to
147 have a UTF-8 locale installed. You can then build Crawl with support for Unicode
148 by setting USE_UNICODE on the 'make' command line.
151 Building:
153 * cd to the source directory (you can safely ignore the dolinks.sh and
154   domake.sh scripts).
156 * Most users can simply type 'make' without any extra flags, and get a working
157   build as a result. If just typing 'make' works for you, then you shouldn't
158   need to read any further. BSD and Solaris users may have to use 'gmake'
159   instead of 'make'.
161 * If you want a graphical (tiled) build, then you should add 'TILES=y' to the
162   'make' command-line, like so:
164     make TILES=y
166   Note that the graphical build requires that you have development libraries
167   installed for SDL, SDL_image, libpng, zlib, and freetype. If your system
168   doesn't have these installed, you can usually get them via your package
169   manager (apt-get, emerge, yum, etc).
171   If you would rather, you can go to the source/contrib directory and type
172   'make', and the required libraries should be built for you.
174 * If you want to install Crawl for multiple users, you can add the savegame
175   path and game data path to the 'make' command line. For instance:
177     make prefix=/usr/games/crawl SAVEDIR=saves/ DATADIR=data/
179   Please note that SAVEDIR and DATADIR are relative to 'prefix'.
181   Of course, you should make sure that SAVEDIR and DATADIR reference the
182   appropriate directories. This is not necessary if only one user is going to
183   play Crawl.
185 * Edit AppHdr.h and check that SAVE_PACKAGE_CMD and LOAD_UNPACKAGE_CMD are set
186   correctly for your system. If you do not want your saves packaged in a zip
187   archive, it's safe to comment out SAVE_PACKAGE_CMD and LOAD_UNPACKAGE_CMD.
189 * If you're installing Crawl for multiple users, run 'make install' as root.
190   Crawl will be copied into the directory specified by 'prefix' (see above). The
191   save and data directories will be created if necessary, and the level layout
192   and help files will be copied to the data directory.
194 * If you do not want players to be able to script Crawl with Lua, add
195   'NO_LUA_BINDINGS=y' to the 'make' command-line.
198 Building on Mac OS X
199 --------------------
201 For non-graphical builds, you can use the Unix build process described above, or
202 you can use Xcode, as described below.
204 For graphical builds, we do not support the use of the Unix build process for
205 various reasons.
207 * Crawl is officially built and tested under Xcode 3.2 on OS X 10.6.1, but
208   it's highly likely that other versions of Xcode will work fine.
210 * Make sure Xcode is installed. Xcode should be available on the Mac OS X
211   install DVD if you haven't already installed it. You can also download Xcode
212   from Apple's website (note that their website often has versions of Xcode
213   that are newer than the versions distributed on their Mac OS X DVDs):
214     http://developer.apple.com/TOOLS/Xcode/
216 * Open the Xcode project (Crawl.xcodeproj) under the "source"
217   directory.
219 * Hit Build in Xcode. This should build all the necessary dependencies,
220   including libpng, freetype, SDL, and SDL_image, and then finally build Crawl
221   itself. The process may take quite a while, so go grab a coke or a cup of
222   coffee.
224 * The default build configuration, Release, will build a ppc/i386 Universal
225   binary suitable for play on all OS X 10.4 or newer systems. The other build
226   configurations are intended for development and may not result in a binary
227   that can be distributed to others.
229 * If you'd like users to be able to script Crawl with Lua, you can edit
230   AppHdr.h, uncomment
231         // #define CLUA_BINDINGS
232   and rebuild to compile with Lua support. See the section on Lua for more
233   information.
236 Building on Windows (MinGW)
237 ---------------------------
239 NOTE: You cannot build Windows binaries on Windows 9x/ME using MinGW. On 9x/ME, 
240 you can use the Cygwin build instructions, or build a binary on a Windows 
241 NT/2k/XP system (the binary will run on 9x), or build a DOS binary.
243 * To install MinGW, you have two options. You can install via the installer
244   provided by the MinGW project (http://www.mingw.org), but this is not
245   officially supported by the Crawl team. If you have problems with it, we will
246   not help you until you get a supported version of MinGW, which can be obtained
247   from the msysgit project. msysgit is a full MinGW setup that even includes Git
248   (which happens to be the source code management system used by the Crawl team).
249   To get msysgit, be sure to download the 'netinstall' from here:
251     http://code.google.com/p/msysgit/downloads/list
253   NOTE: Do NOT get any of the versions that do not have 'netinstall' in the
254         filename. The 'netinstall' is the only one used by the Crawl team.
256 * Start msys by running 'c:\msysgit\msys.bat'. Now you're in a MinGW build
257   environment.
259 * cd to the the Crawl source directory. For instance, if you have the crawl
260   sources in c:\crawl\source, you would type 'cd /c/crawl/source'.
262 * Build Crawl by running 'make'. If you want a graphical build, you will need to
263   add 'TILES=y' on the 'make' command line.
265 * When the process finishes, you should be able to run crawl right from the
266   source directory by typing './crawl'
269 Building on Windows (cygwin)
270 ----------------------------
272 * Get Cygwin from http://www.cygwin.com/. When installing, ensure that the
273   following packages are selected: gcc, g++, make, flex, bison,
274   libncurses-devel. If you'd like to build from git, install the git-core
275   package. You may also want to install diff, patch, and other such tools.
277 * Once Cygwin is installed, open a Cygwin bash shell (use the Start
278   menu or desktop icon, do not double-click bash.exe in Explorer).
280 * cd to the the Crawl source directory. For instance, if you have the crawl
281   sources in c:\crawl\source, you would type 'cd /cygdrive/c/crawl/source'.
283 * Follow the Linux build instructions to build Crawl.
286 Building for DOS (djgpp)
287 ------------------------
289 * Install djgpp from http://www.delorie.com/djgpp/. Don't forget to
290   include C++ support when the Zip picker asks for what you want. You
291   may also have to download GNU make as a separate package. It's
292   important to follow the install instructions carefully, because bad
293   installs can produce rather confusing error messages.
295 * Make sure gxx and make are in your PATH.
297 * If you want to modify the level compiler, install the djgpp flex,
298   bison and m4 packages and set DOYACC := y in makefile.dos.
300 * cd to the Crawl source directory.
302 * Build Crawl by running
303         make -f makefile.dos
305 * When the build is done, crawl.exe should be in the source directory.
308 Building Tiles versions
309 -----------------------
311 * On most platforms, you can simply type:
312     make TILES=y
314 * If you compiled the ASCII binary before, you'll need to run 'make clean'
315   before running 'make'.
317 * All platforms require the same prerequisites listed in the other sections
318   above for building each of these platforms.
320 * All platforms additionally require the development versions of the following
321   software packages installed.
323     * SDL (http://www.libsdl.org/download-1.2.php)
324     * SDL_image (http://www.libsdl.org/projects/SDL_image/)
325     * libpng (http://www.libpng.org/pub/png/libpng.html)
326     * Freetype 2 (http://www.freetype.org/download.html)
328   On Linux, these can be installed via a package manager (apt-get, emerge,
329   yum, etc).
331   On Mac OS X, these will be compiled automatically when you build the Xcode
332   project.
334   On Windows (MinGW or Cygwin), these will be compiled as needed when you run
335   'make TILES=y'.
337 * If you want both ASCII and Tiles binaries you need to compile them
338   separately, rename one of them, and copy them into the same Crawl
339   directory.
342 *****************************************************************************
343 Data files
344 ----------
346 Crawl looks for several data files when starting up. They include:
348 * Special level and vault layout (dat/*.des) files.
349 * Core Lua code (dat/clua/*.lua).
350 * Descriptions for monsters and game features (dat/descript/*.txt).
351 * Definitions for monster dialogue and randart names (dat/database/*.txt).
353 All these files are in the source tree under source/dat.
355 Crawl will also look for documentation files when players invoke the help
356 system. These files are available under the docs directory.
358 Your built Crawl binary must be able to find these files, or it will not start.
360 If Crawl is built without an explicit DATA_DIR_PATH (this is the most common
361 setup), it will search for its data files under the current directory, and if it
362 can't find them there, one level above the current directory. In short, it uses
363 these search paths: ., ./dat, ./docs, .., ../dat, ../docs.
366 *****************************************************************************
368 The level compiler
369 ------------------
371 Crawl uses a level compiler to read the level design (.des) files in the
372 source/dat directory.
374 If you're using one of standard makefile, the steps described in this section
375 are performed automatically:
377 The level compiler source is in the source/util directory (levcomp.lpp and
378 levcomp.ypp). The steps involved in building the level compiler are:
380 * Run flex on levcomp.lpp to produce the levcomp.lex.cc lexer.
381 * Run bison on levcomp.ypp to produce the levcomp.tab.cc parser and
382   levcomp.tab.h
383 * Compile the resulting C++ source files and levcomp.cc and link the
384   object files into the Crawl executable.
386 For convenience on systems that don't have flex/bison, pre-generated
387 intermediate files are provided under source/prebuilt. The makefiles
388 provided with the Crawl source distribution will use these
389 pre-generated files automatically if flex/bison is not available.
392 *****************************************************************************
393 Optional Libraries (Lua and PCRE)
394 ---------------------------------
399 Security on multiuser systems (Unix):
401 Enabling Lua user scripts is unsuitable for Crawl installed setuid or setgid -
402 we have not audited the user scripting interface for security. If you're not
403 planning to install Crawl setuid/setgid (not running set[ug]id is a good idea in
404 general), you can enable the Lua user-script bindings safely.
406 As of 0.3, the Lua source is included with Crawl. The only step needed to enable
407 user-scripts is to uncomment CLUA_BINDINGS in AppHdr.h.
410 PCRE
411 ----
412 As of 0.6.0, PCRE 7.9 source is included with Crawl.  It is enabled by default.
413 The sources in contrib/pcre are identical to the 7.9 distro except for the use 
414 of a custom-made Makefile instead of the automake system that was in place 
415 previously.
417 On Unixes, you're better served by the existing POSIX regular expression
418 support. If you want PCRE, your package management system is again your best
419 bet. Remember to install development headers, not just the plain library.
422 Unicode (Unix only)
423 -------------------
425 Modern Unixes may support Unicode terminals (particularly xterms). If you have a
426 terminal that can display Unicode characters, and an ncurses library that can
427 handle Unicode (libncursesw, and its devel headers), you can build Crawl to
428 display Unicode in the map: set 'USE_UNICODE=y' when running 'make'.
430 NOTE: You may have libncursesw, but not have the header files; check that you
431 have the header files installed as well, or you'll get a lot of errors. Crawl
432 expects the ncursesw headers to be in /usr/include/ncursesw.
434 After compiling Crawl with Unicode support, you still need to add the line
435 "char_set = unicode" in your .crawlrc to tell Crawl to use Unicode. You may also
436 need to set the locale in your terminal if the encoding does not default to
437 UTF-8. To check this, run "locale charmap", which should say "UTF-8". If your
438 encoding is not UTF-8, you can force it to UTF-8 on most systems by doing
439 "export LC_ALL=en_US.UTF-8" or the equivalent, depending on your language locale
440 and what shell you're using.
442 Crawl tries to use en_US.UTF-8 as its default Unicode locale. If you do not have
443 this locale installed, but do have some other UTF-8 locale, you can tell Crawl
444 to use your preferred UTF-8 locale by setting UNICODE_LOCALE=${foo}.UTF-8 on
445 the 'make' command line, where ${foo} is your locale name.
447 You may not want to embed the locale in Crawl itself, but have Crawl use the
448 locale as set in the environment LC_* variables. In such cases, you can omit the
449 UNICODE_LOCALE option from the 'make' command line. Crawl will then use the
450 locale as set in your environment.
452 If you're playing Crawl on a remote machine, the remote Crawl should be built
453 with Unicode support, it needs to have a UTF-8 locale installed, *and* your
454 local terminal (where you're running telnet/ssh) needs to be able to decode
455 UTF-8.