A pre-requisites before continuing:
you should know how to use CVS and can get the latest sources, if not see the CVS page for some info.
if you are downloading the source tarball, then you need a program like 7-zip to uncompress the tar.bz2 file as winzip does not know about this format.
If you like to do things the hard way, i.e. unixlike, then you can follow the Cygwin path. If, like me, you like an IDE and a simple setup, then you can go the Dev-C++ route.
Getting ToME v2.3.3 to work
Just follow the v3 instructions, but ignoring the instructions about SDL.
Getting ToME v3 to work
First choose what development environment you want to work with.
DevC++
I will use Dev-C++ as the build environment. I am currently using the "Dev-C++ 5.0 beta 9.2 (4.9.9.2) (9.0 MB) with Mingw/GCC 3.4.2" download to do my building and testing.
Once you have downloaded and installed Dev-C++, I installed it into C:\Dev-Cpp
- ==== SDL stuff ====
ToME v3 now needs SDL to compile so you need to add a few packages and this is done by:
- Go to "Tools" and then "Check for Updates/Packages...". This brings up the "Web Update" dialogue.
- In the "Select devpak server" combo select the "devpaks.org Community Devpaks". Then click the "Check for Updates" button. This should populate the "Available updates list:" (use the versions I specify as later ones do not download).
- Check the box against "SDL" version 1.2.8 and press the "Download Selected" button. This should download the package and bring up the "Installation Wizard", which you can just click through.
- Once SDL is installed you need to download the following before you try and get SDL_image:
- "libjpeg" 6b-4
- "libpng" 1.2.8
- "zlib" 1.2.3
- And once those are installed you can do the following:
- "SDL_image" 1.2.4notiff
- "SDL_gfx" 2.0.13
- "SDL_mixer" 1.2.6
- "SDL_net" 1.2.5 (see note below)
- "SDL_ttf" 2.0.7
To get SDL_net 1.2.5 you will have to download this from here as its currently hidden. After you download the file you can go to "Tools", then "Package Manager" and then press the "Install" icon. Once the open file GUI comes up choose the file that you just downloaded and select "open" to install the packaage.
You also need to copy the following files from the C:\Dev-Cpp\bin directory to your C:\Windows\system32 directory:
- SDL.dll
- SDL_mixer.dll
- SDL_net.dll
- libpng13.dll file ### NOTE: Rename this file to libpng12.dll after you copy it ###
and the the following files from the C:\Dev-Cpp\dll directory:
- SDL_gfx.dll
- SDL_image.dll
- SDL_ttf.dll
- ==== Project and Makefile ====
Ok that should be the IDE set up, now we need a project file and a makefile. The project file will define what files you are looking at and how the project compiles and the makefile tells the system how to compile each file and generate the binary image.
For a v3 build you need to copy the tome.dev file out of the src/windows directory into the src directory and for a v2 build you need to get the dev file from here and the makefile from here.
If you have NOT installed into C:\Dev-Cpp then you must edit src/makefile.devcpp and change DEVCPP_PATH to point to where it has been installed into.
If you have problems with line-endings in the makefile, then this is related to how CVS retreives the files from the server and you need to check out the text files with Unix LF (0xa). This can be done by passing the -kb option to cvs and then you wont have this problem.
- ==== Compiling and running the code ====
To open the project you need to go to "File" menu and then "Open Project or File..." and select the tome.dev file in the src directory.
Once the project is open you can compile the code by going to the "Execute" menu and then "Compile". This should then generate a ToME3.exe (or ToME.exe if done for v2) in the main tome root directory.
To run this new version all you have to do is double click the executable file in the root directory, or create a batch file in that directory, examples can be found elsewhere.
CygWin
I will use cygwin as the build environment, so I expect you to have it installed and configured properly with a decent development/build environment i.e. gcc, make etc installed.
- ==== SDL stuff ====
ToME v3 relies on a couple of SDL packages to build and run. As the default packages do not have SDL available, you will need to add ftp://sunsite.dk/projects/cygwinports to the available download site list. You will then have to download and install the following packages:
- libSDL
- libSDL - devel
- libSDL_gfx
- libSDL_image
- libSDL_mixer
- libSDL_net
- libSDL_ttf
You will also have to install the MS Windows runtime libraries of the above and they can be found at the following locations:
I would suggest unzipping them into the windows system32 directory.
- ==== Compiling and running the code ====
To build the binary you go into the src directory and do the standard "make -f makefile.cyg" followed by the usual "make install -f makefile.cyg" and you should now have a ToME3.exe (or ToME.exe if done for v2) one directory up.
Reducing the image size
If you are going to distribute your results, then you will want to reduce the size of the exe. To do this I use Ultimate Packer for eXecutables.
Chatter
DarkGod: SDL_mixer should be compiled with libvorbis for the ogg files too
TerryPatcher: I managed to compile the latest CVS using this method, but I can't see any difference related to SDL. Is the bat-file above lacking an argument, or some configuration, or something?
IainMac: By default you get the windows version rather than the SDL version. In makefile.devcpp you need to comment out the comment out the windows block (the ## Only supports "main-win.c" block) and uncomment the SDL block (the ## Only support "main-sdl.c" (not "main-win.c") block).
BinkleyBinkley: Ignore makefile.cyg. Copy makefile.mingw to makefile. Edit and change CC to gcc -mno-cygwin and WRES to windres. That's it: now make. Optionally, change -O2 to -Os in CFLAGS (size does matter). Explanation: the -mno-cygwin flag turns off Cygwin dependencies and makes a pure Windows executable; -Os asks GCC to optimize for the size of the code in preference for performance. As a practical matter, smaller size is sometimes faster anyway.
LaLuneEtMoi: These instructions worked brilliantly for me under XP, but lately I got a new Vista machine and I am killing myself trying to get DEV-C++ to compile TOME 2.3.4. Getting help out of Bloodshed is a fool's errand, so I was wondering if anyone here is successfully compiling this game under Vista, and if so, how?
ToME Wiki