howtocompile


How to compile T-Engine from sources

Please note that building ToME4 beta 32 or higher requires SDL version 1.3, which is not yet released. Most operating systems only supply the stable release, SDL 1.2.

Most of the instructions on this page have not yet been updated for beta 32's new requirements.

Windows

Note: This is still a work in progress. I have compiled successfully, but there are some issues that can easily occur.

Precursor

After some struggling, with DarkGod's help, we've got this down to a fairly easy process. Follow step by step and you *should* be OK.

Be prepared to use the command prompt and shells!

Requirements:

Step by step

For the purpose of this article, we'll assume you've installed/extracted it to C:\mingw2\, and the source is in C:\games\tome\

  • Add the path to the gcc binary to your path
    • Right click on My Computer -> Properties -> Advanced -> Set Environment Variables -> System Path -> Edit -> add c:\mingw2\bin to the path. Take care not to delete the existing parts

http://tomenotes.wikispaces.com/file/view/setpath.jpg/245522749/setpath.jpg

  • Edit premake4.lua so that it points to the correct paths
    • In C:\games\tome\premake4.lua edit the includedirs and the libdirs so that they point to the correct paths: (The libdirs part only needs the mingw2/include part, and the vorbis part) The paths are case sensitive, so check if you need /C/ or /c/ etc.

    libdirs {
        "/e/libs/SDL-1.2.14/lib",
        "/e/libs/SDL_ttf-2.0.9/lib",
        "/e/libs/SDL_image-1.2.10/lib",
        "/e/libs/SDL_mixer-1.2.11/lib",
        "/e/libs/libvorbis-1.3.2/lib/.libs",
        "/e/libs/libogg-1.2.2/src/.libs",
        "/c/mingw2/include/vorbis",
        "/c/mingw2/include",
    }
    includedirs {
        "/c/mingw2/include/SDL",
        "/c/mingw2/include/SDL_ttf-2.0.9/include/",
        "/c/mingw2/include/SDL_image-1.2.10/include/",
        "/c/mingw2/include/SDL_mixer-1.2.11/include/",
        "/c/mingw2/include/libvorbis-1.3.2/include",
        "/c/mingw2/include/libogg-1.2.2/include",
        "/c/mingw2/include/GL",
        "/c/mingw2/include",
    }
  • Run Mingw (C:\mingw2\msys\1.0\msys.bat)
  • Run these commands
    • cd /c/games/tome
    • premake4.exe --cc=gcc gmake
    • make -e CC=gcc
  • Copy all the DLL files from a previous download to c:\games\tome
  • Try to run the game.
  • Troubleshooting: If you have previously compiled the game and are compiling a more recent version you may need to run the following commands (from within Mingw, after changing directory but before running premake4 and make) in order for the game to compile correctly.
    • premake4.exe clean
    • make clean

Please join us on IRC (#tome on irc.rizon.net), or leave a comment, or edit this page if you are having trouble and found a solution.

Windows - older instructions

  • Get the latest source code from http://te4.org/Download
  • Download SDL http://www.libsdl.org/download-1.2.php, you need to choose development libraries for windows for mingw
  • Download SDL_mixer http://www.libsdl.org/projects/SDL_mixer/ (choose devel)
  • Download SDL_image http://www.libsdl.org/projects/SDL_image/ (choose devel)
  • Download SDL_ttf http://www.libsdl.org/projects/SDL_ttf/ (choose devel)
  • Download http://industriousone.com/premake
  • Download MinGW installer https://sourceforge.net/downloads/mingw
  • Unpack the latest source code in a folder, let's say c:\tengine
  • Create libs sub-dir in c:\tengine
  • Unpack SDL, sdl_mixer, sdl_image and sdl_ttf in c:\tengine\libs. Each of the four archives unpacks in a separate folder. The names are similar to SDL-1.2.14 SDL_image-1.2.10 SDL_mixer-1.2.11 SDL_ttf-2.0.10
  • Unpack premake4.exe into c:\tengine
  • Run MinGW installer. When asked check C++, MSYS and DevTools. Let's assume you install MinGW into C:\MinGW
  • Open C:\tengine\premake4.lua in a text editor and find line that says 'configuration "windows"'
  • Edit the paths in the sections below (both libs and includes) to correspond to the paths/version you unpacked/installed software into. See example below.
  • Run premake4.exe gmake
  • Open MSYS from the shortcut installed by MinGW. Do 'cd /c/tengine'
  • Run 'make -e CC=gcc' in MSYS

Example of lib/include section:

configuration "windows"
    libdirs {
        "libs/SDL-1.2.14/lib",
        "libs/SDL_ttf-2.0.10/lib",
        "libs/SDL_image-1.2.10/lib",
        "libs/SDL_mixer-1.2.11/lib",
        "/c/MinGW/lib",
    }
    includedirs {
        "libs/SDL-1.2.14/include/SDL/",
        "libs/SDL_ttf-2.0.10/include/",
        "libs/SDL_image-1.2.10/include/",
        "libs/SDL_mixer-1.2.11/include/",
        "/c/MinGW/include/GL",
    }

Linux Debian

Updated for beta 33. 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.

  • Install operating system prerequisite software packages:
sudo apt-get install build-essential subversion mercurial libopenal-dev libogg-dev libpng12-dev libsdl-image1.2-dev libsdl-ttf2.0-dev libvorbis-dev autoconf automake libtool

  • There may be more... sorry, I can't remember!
  • Install premake4 from http://industriousone.com/premake/download
  • Install the correct version of SDL. This is different that the one most operating systems provide
cd /usr/local/src
hg clone http://hg.libsdl.org/SDL
cd SDL
hg update 5580
./autogen.sh && ./configure && make && sudo make install

  • If it fails, see http://forums.te4.org/viewtopic.php?p=114539#p114539 or check for upstream bug reports and workarounds.
  • Decide where you'll keep the ToME source code. You'll need about half a 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.
cd /usr/local/src (the parent of wherever you are putting t-engine4)
svn co http://svn.net-core.org/repos/t-engine4

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
svn update -r REVISIONNUMBER
make clean; premake4 clean   # Don't worry if these fail.
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 libsdl-image1.2-dev libsdl-mixer1.2 libsdl-mixer1.2-dev libsdl-ttf2.0-0 libsdl-ttf2.0-dev 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

Linux Gentoo

  • Get the latest source code from
  • Get SDL requires
 $ emerge -uND media-libs/libsdl media-libs/sdl-gfx media-libs/sdl-image media-libs/sdl-mixer media-libs/sdl-net media-libs/sdl-ttf

  • I have USE="-* <others> mmx gif jpeg png tiff flac mad mikmod mp3 vorbis X" as far as Jan 14th, 2011 is concerned.