How to compile
These are instructions for compiling ToME4 on Debian Linux. If you haven't done so already, see Source Setup for obtaining the source code.
Building ToME4 beta 43 or higher requires snapshots of the currently unreleased SDL 2.0 library (also referred to as SDL HG). Most operating systems only supply the latest stable release, SDL 1.2, which will not work for ToME4.
In addition, you will need SDL2-compatible versions of the SDL_image and SDL_ttf libraries. Again, these are typically not available from your operating system distributor, because they are in a prerelease state. The instructions on this page will guide you through the process of building these from source.
Contents
Addons
The ToME 1.0.0RC1 through 1.0.0 source code in SVN is incomplete. You must install two "addons" which are not part of the SVN tree in order to get all the game features. The procedure recommended by DarkGod is to download one of the official releases, extract the addon files from it, and copy them into the SVN tree.
If you prefer to avoid doing that, the addons are available from a third-party site:
Copy these into the game/addons/ subdirectory once you've followed the rest of the instructions below.
Addons are version-locked to the specific ToME version for which they are bundled, except ToME versions above 1.0.1, which can use the 1.0.1 addons.
SDL
ToME beta 43 was built with the prerelease versions of SDL2, SDL2_image and SDL2_ttf available on November 25, 2012. Later versions may also work, depending on the stability of the library's interface. For reference, the following hg revision numbers are known to work:
- SDL revision 6687
- SDL_image revision 339
- SDL_ttf revision 222
(You should try the current SDL2 first, and only fall back to these older versions if necessary.)
Install prerequisite development packages for your operating system. You'll need mercurial (hg), C and C++ compilers, make, autoconf and friends, and the development packages for X, libopenal, libogg, libvorbis, libpng, libglu1-mesa, libfreetype, libasound, and libaudiofile.
For Debian, this might work:
sudo apt-get build-dep libsdl1.2debian sudo apt-get install subversion mercurial autoconf automake libtool
If that doesn't work, then this may get you close:
sudo apt-get install build-essential subversion mercurial sudo apt-get install autoconf automake libtool sudo apt-get install libopenal-dev libogg-dev libpng12-dev libvorbis-dev sudo apt-get install libglu1-mesa-dev libfreetype6-dev xorg-dev sudo apt-get install libasound2-dev libaudiofile-dev
Install the prerelease version of SDL2:
cd /usr/local/src hg clone http://hg.libsdl.org/SDL cd SDL # OPTIONAL: hg update 6687 ./autogen.sh cd .. mkdir SDL-build cd SDL-build ../SDL/configure && make && sudo make install sudo ldconfig
Install the prerelease version of SDL_image:
cd /usr/local/src hg clone http://hg.libsdl.org/SDL_image cd SDL_image # OPTIONAL: hg update 339 ./autogen.sh cd .. mkdir SDL_image-build cd SDL_image-build ../SDL_image/configure && make && sudo make install sudo ldconfig
Install the prerelease version of SDL_ttf:
cd /usr/local/src hg clone http://hg.libsdl.org/SDL_ttf cd SDL_ttf # OPTIONAL: hg update 222 ./autogen.sh cd .. mkdir SDL_ttf-build cd SDL_ttf-build ../SDL_ttf/configure && make && sudo make install sudo ldconfig
At this point you should have headers in /usr/local/include/SDL2/ and libraries in /usr/local/lib/. The libraries should be named libSDL2, libSDL2_image and libSDL2_ttf (with appropriate version numbers and extensions). If any of the SDL libraries fail to build, check the SDL website for assistance.
Premake4
Install premake4 from http://industriousone.com/premake/download (Note: if your OS has a "premake" version 3 package, that will not work.)
ToME4
Decide where you'll keep the ToME source code. You'll need about 1 gigabyte of space. Let's assume you're going to use /usr/local/src/t-engine4. Make this directory and make sure you have write permission.
Fetch the ToME sources:
cd /usr/local/src svn checkout --username guest --password guestor http://svn.net-core.org/repos/t-engine4
Use http://forums.te4.org/viewtopic.php?p=98424#p98424 to determine the SVN release number for the version of ToME you want to build.
cd t-engine4 svn update -r REVISIONNUMBER
Check, and possibly edit, premake4.lua and build/te4core.lua to reflect the location of your SDL installation.
- In premake4.lua, make sure "/usr/local/include/SDL2" appears before any other SDL directory in the includedirs section.
- In build/te4core.lua, under the configuration "linux" section, make sure "/usr/local/lib/" appears on the libdirs line, and make sure "SDL2", "SDL2_ttf", "SDL2_image" appear on the links line.
If your ToME source tree was previously configured for beta 42 or earlier, you may have to undo some of the changes that you used for the older betas. The premake4.lua and build/te4core.lua files are different, as described above. Also, if you commented out the SDL_VideoInfo struct in src/core_lua.c, you should uncomment it now.
That's all the setup stuff. Apart from the svn update -r NUMBER commands, you don't need to do any of that ever again. (Phew!) Whenever you want to build a new version, you just do:
cd /usr/local/src/t-engine4 make clean; premake4 clean # Don't worry if these fail. svn update -r REVISIONNUMBER premake4 gmake && make
Troubleshooting
If you get an error like this:
Lua Error: /engine/utils.lua:666: could not load font: /data/font/Vera.ttf (12)
It means you've linked against the wrong versions of SDL_image and/or SDL_ttf. Make sure ToME is linked against the new versions, which have "SDL2" in their names.
If you get an error like this:
Error initializing SDL video: No available video device
It probably means you didn't have all the development packages installed when you built SDL.