Compiling

From Tales of Maj'Eyal
Revision as of 15:18, 21 May 2013 by Canderel (Talk | contribs) (Created page with "= Compiling ToME4 = Building ToME4 beta 43 or higher requires snapshots of the currently unreleased [http://www.libsdl.org/hg.php SDL 2.0] library (also referred to as '''SDL...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Compiling ToME4

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 significantly complicates building newer ToME4 betas.

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.

Addons for 1.0.0RC1 and up

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'd rather not download an extra 53 MB just to get 200k worth of addons, you can download the addons themselves here:

Or for 1.0:

Or for RC4:

Or for RC2:

Or for RC1:

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.

Windows

See Compiling ToME4 on Windows.

Linux Gentoo

See ToME4 on Gentoo.

Linux Debian

Updated for beta 43. This guide suggests building ToME sources from SVN, rather than using release tarballs. Given the frequent release schedule ToME is currently enjoying, this will greatly reduce wasted downloads as new versions come out.

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

These steps should result in a working ToME:

  • Install operating system prerequisite software packages:
sudo apt-get build-dep libsdl1.2debian
sudo apt-get install subversion mercurial autoconf automake libtool
  • Or if that doesn't work, 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
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.

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 # the parent of wherever you are putting t-engine4
svn co http://svn.net-core.org/repos/t-engine4
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.
  • Be sure to install the "addons" which are not included in the SVN repository.

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

Linux Ubuntu

These instructions are for beta 31 and earlier. They need to be updated.

deb http://lgp203.free.fr/ubuntu maverick universe
deb-src http://lgp203.free.fr/ubuntu maverick universe
  • If you get GPG error do (change key number if needed):
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 5D3F763EB8620CD6
  • Run following code:
sudo apt-get update
sudo apt-get install premake4
sudo apt-get install build-essential
sudo apt-get install libsdl1.2debian libsdl1.2-dev libsdl-image1.2
sudo apt-get install libsdl-image1.2-dev libsdl-mixer1.2 libsdl-mixer1.2-dev
sudo apt-get install libsdl-ttf2.0-0 libsdl-ttf2.0-dev
sudo apt-get install mesa-common-dev libglu1-mesa-dev
  • Unpack the source code, cd into the folder you unpacked your code to and run the following:
premake4 gmake
make

If you get the following error:

/usr/bin/ld: cannot find -luuid

Then run synaptic package manager and install uuid-dev

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 build SDL.