You will need a working gcc environement. In linux, it's usually installed with
your distribution, in dos you will have to install djgpp, and in windows I
advice to install mingw32.
For windows, get mingw32 from here, get the ``current'' branch preferably, and install gcc, MSYS, MinGW Runtime, MinGW utilities, MinGW, windows API, binutils, and make. Normally the windows api file contains what is needed for directx.
This guide is not for the complete beginer, I'll suppose you know how to compile things already.
Required tools/libsIn linux, all of these tools/libs should be available directly from your distribution, so will just have to install the development versions. In windows and dos, you will have to visit the web and in most cases compile the latest versions !
SDL : you can get the latest development version (but in the stable 1.2 branch, don't play with 1.3 branch yet unless you are absolutely sure about what you are doing !). For mingw32, it will be SDL-devel-1.2.x-mingw32.tar.gz probably ! There is no sdl in dos, you will get the old allegro sound driver. In linux the dev package is most likely available from your distribution.
Allegro : Only if you intend to compile a version < 0.50. get the latest version available (not the so called ``stable'' one, there are usually more bugs in their stable versions than in their dev ones !). There is now a version of allegro in the rainemu site, in the Extras part of the Downloads section (Allegro-4.2.2, patched for a better dos support, at the bottom of the page). It's recommended to get this one and compile it where you need it, it doesn't work only in dos. It will avoid bad surprises from the official versions.
libpng : for mingw32, I used the makefile.cygwin in their scripts directory. It produces the cygpng12.dll file, but it works fine with mingw32.
For versions >= 0.50, you'll also need :
muParser: this one is necessary if you want the console. It's a little tricky to build though, you will probably be forced to use the static version in windows. It's a C++ lib, so you'll obviously need libstdc++ too. You can build raine without the console if you prefer by editing the makefile, and compiling the ``HAS_CONSOLE'' line, near the top of the file.
And finally, if you want to compile neoraine, you must add this :
SDL_sound : you should be able to use the stable 1.0.3 version.
Out of the box SDL_sound has support for "free mp3", and maybe wav.
You can add these optional libraries if you want :
libogg and libvorbis to get ogg suport
libflac : the problem with flac is that their library has been changing its interface quite a few times. Changes seem to have slowed down now, and it becomes usable. I have used 1.2.1 without problem.
smpeg : required if you want to decode the other mp3 formats. It's a shame you are obliged to use svn to get the source of smpeg...
That should be all !!! ;-)
CompilationAfter you have installed all these tools, uncompress raine. Eventually you can edit the makefile if you want to make a debug version (optional debug messages). The top of the makefile is heavily commented, you will only have to uncomment the options you are interested in.
You also need to edit this part of the makefile if you want to build neoraine, the raine version for neocd. Just uncomment the line "NEO=1", and then neoraine will be built instead of raine ! (notice that raine and neoraine share the same makefile since version 0.51.0 of raine. For compatibility you can still build neoraine by typing "make -f makefile.neocd", but makefile.neocd just contains 2 lines now !)
Other option : HAS_CONSOLE. The default is to have the console. If you disable it, you will also loose the cheat scripts for neoraine.
If you don't edit anything, it will build an optimized version for your cpu. Just type make when you are ready, and that's all. In linux you might want to install it after with a ``make install'', but notice that the executable can be run directly from its source directory (just type ./raine).
Building raine in a 64 bit architectureRaine can't be compiled in 64 bits, because there are too many differences in the 64 bit assembler, some instructions are missing, and it's not the trouble. But you can still compile a 32 bit raine from a 64 bit environment. Starting with version 0.51.0, the makefile should autodetect your environment, and use the correct gcc/g++/linker command line arguments to accomplish this. You'll still need of course 32 bit vesions of all the libs used. There are lib32 packages in most distributions which should do for almost all the libs. Just add a symbolic link from libstdc++.so.6 to libstdc++.so in the /usr/lib32 directory. For libmuparser, you'll have either to compile your own 32 bit version manually, or to extract the 32 bit lib from a precompiled package and place it in /usr/lib32. Your choice.
Anyway, once all this is done, the compilation works very well, no chroot environment needed for this.
Cross compiling raineSometimes it might be usefull to cross compile raine from a linux installation, especially for the dos version since it becomes quite hard to compile in windows, and almost it's almost impossible to test in windows xp when running it in dosemu works fine.
You can also cross compile for mingw32, it's easier to install the cross compiler there since most distributions ship one (for debian it's the mingw32* packages), the main problem comes from the big number of libraries you'll have to compile in the mingw32 environement, there it's often easier to boot in xp if you still have an xp boot.
So I'll focus here on cross compiling for djgpp.
Building the cross compiler
There is a cross directory in the djgpp distribution, with a howto and some docs in it. Just follow it, it's pretty straight forward. Basically there is a patch to apply to the standard gcc distribution, and then compile gcc. Use the version of gcc which was intended for the patch and not the latest gcc version available, or expect troubles !
Preparing to compile for dos
Once it's done and the cross compiler is installed, create a shell script as adviced in the djgpp distribution. I used this one, which I called djgpp and placed in the /usr/local/i586-pc-msdosdjgpp/ directory :
#!/bin/sh # enable djgpp cross compilation export prefix=/usr/local export target=i586-pc-msdosdjgpp export PATH=$prefix/$target/bin:$PATH export DJDIR=$prefix/$target export CROSSCOMPILE=1 export NATIVE=linux-gnu-sdl
When you want to compile something in dos, just type :
. /usr/local/i586-pc-msdosdjgpp/djgppand then make and it should work if the package supports cross compiling.
You can then apply this to build allegro-4.2.2, available from rainemu. It should work out of the box, but you can check what the say about cross compiling in their docs/build/djgpp.txt file if you are not sure.
For raine it's really out of the box once this script has been run, I just did it for version 0.51.0. After this, you just need to test the Raine.exe file you get with dosemu or dosbox. I found that dosemu is more stable on my amd64 system, and runs raine much faster, but it might be different in 32 bits.