Raine Logo
Raine Logo Mirror





Zzap! Raine


Things have become very easy lately. Start by installing msys2 from there : MSYS2.
Once installed you'll get a few different shells that you can run from your msys2 group, the 2 relevant here are mingw32 and mingw64 to build respectively raine in 32 and 64 bits.
Well the basic commands to know for any architecture are :
pacman -Ss name : search a package named name. For example if you search muparser which was needed by raine, you'll find at least these 2 files :
The prefix is mingw-w64-i686 for 32 bits, mingw-w64-x86_64 for 64 bits.
Then the name of the package (muparser), and finally the version number.
Once you have found the package you want, just use pacman -S name to install it, you can use the mouse to copy and paste the name you want from the search, double click to select a name, then right click to paste it.

For raine, you'll need these packages :
SDL2, SDL2_image, SDL2_ttf, curl (mingw-w64-i686-curl or mingw-w64-x86_64-curl). Search for each one using pacman -Ss, then install the version you want (either 32 or 64 bits, or both). If compiling the 32 bits version, you'll also need nasm. Of course you also need some basic gcc installation, at least make if it wasn't already installed, and git. If you want to compile 32 and 64 bits versions, you can install just 1 version of git (there is no prefix anyway).
You can also choose to disable curl entierly, in this case edit the makefile and comment the line USE_CURL = 1. (curl uses a lot of external libs that raine doesn't need). After version 0.95.3 raine uses lua to increase even more the speed of scripts so install lua too, same name convention as the other packages.
Then to get raine sources, go to a directory where you want to be, or just the default home directory, then :
git clone https://github.com/zelurker/raine.git
It will create a raine directory with everything needed inside.
cd raine
And if you installed everything correctly after a few minutes you'll get your brand new binary in the current directory. You can edit the makefile to choose quite a few options too, the main one being if you want a debug or an optimized build, by default it's optimized, uncomment the RAINE_DEBUG line if you want a debug build, faster to build, and more convenient to run from the debugger gdb. By the way gdb seems to still have some problems in windows, you won't be able to use all the features apparently. Here again there are at lest 2 versions to try, 32 or 64 bits, the 64 bits can load the 32 bits binaries too. gdb runs better in linux, but it's still useful to get some infos sometimes.
To run your brand new binary : ./raine (for 64 bits) or ./raine32 (for 32 bits).
Notice that the currently released binaries are cross compiled from linux, so they don't use the same dlls as the ones you'll find in msys2.
If you ever want to update the sources with the latest version from git later, just :
cd raine
git pull
Notice : you don't need to touch the target setting in the makefile if compiling from mingw32/mingw64. There are 2 main shells, one for mingw32, the other for mingw64, use the one you want, the makefile will detect it and build the corresponding raine, 32 or 64 bits. The target setting is for cross compiling from linux !

Maintaining a mingw installation

This is for those who don't know mingw at all and just installed all this to compile raine. There are a few basic commands to know. The basic : the terminal is a unix shell, so you have / to separate directories instead of \. No drive letters, they are replaced by /c for c:, /d for d: etc... (in these shells of course). You should start by editing your .bashrc in your home directory (if you installed mingw in c:, that's c:\msys64\home\user\.bashrc by default if you want to edit it with a windows editor). If you do try to use something with color syntax like notepad++, it should display this kind of file nicely. The file is heavily commented to explain what happens, this file is read everytime you start a shell, so it's your basic settings, and you want at least to edit the aliases. Find them by searching alias, avoid the part about .bash_alias unless you absolutely want to, continue down there, leave the interactive ones commented, it slows down things, human readable figures are good, so uncomment these 2 lines below (remove the # !). The one for less and grep is not bad, assuming you use that. The 1st for ls is good : alias ls='ls -hF --color=tty'. Uncomment also alias ll='ls -l'. If you use vi, that's where you can add an alias for vim : alias vi=vim, but I won't explain how to use vim here, it would be too long !

Basic useful commands :

ls displays the files in the current directory in columns, if you uncommented the lines in the .bashrc file above, you'll have a display in colors, directories in dark blue, symlinks in cyan (if you have symlinks, symlinks in windows are usually quite a headache), etc... Notice that directories whose names begin by a . are not displayed by default by ls, you must use ls -a to see them.
ll : the alias in .bashrc too gives you the files on 1 column and displays attributes for each, size date, owner, permissions.
cd : like the good old dos cd command
find : find a file, most of the time you want to use it like find -name 'name', where name is name is a whilecard, like '*.c', keep the single quotes otherwise it won't work.
man : gives you info on a command, type man ls to know everything about ls, and there is a lot to know ! or even longer, man bash ! (bash is the name of the default shell, the command interpreter you use in mingw). While displaying a man page, use arrow keys, page up/down, space is like page down, / to find a specific word, home and end.
explorer . : that's not a mingw command, but it's useful when you work from a mingw terminal in a specific directory and you want to open a windows shell window to this place to use a windows application here

Git basic commands

git log : displays the description of the latest modifications, the date and author are included, for raine it's almost always me. You can use the same commands as for man to search a specific entry.
git status : gives you the list of changed files, + files which are not tracked, not recognized. You can add a list of files that you want git status to ignore in a .gitignore file at the base of your project (where the .git directory is).
git checkout ref|file : pass either a file or a reference to this command. If it's file, it's restored from the git info, that is any change you made on disk are discarded and it's returned to its last status in git. Useful to go back quickly to a previous version. git checkout reference : take back the whole repository to a previous version. The references are what appears in the git log display as a long hex number, like b728956f6c52b05c48c516b248b04395f5f62c91. Copy the one you want with a double click of your mouse, and paste it at the end of this command with the right button. To go back to the latest version, use git checkout master.
git pull : to retrieve the latest changes from the repository.

If you want to make your own changes to raine, you'll have to read git manual in more detail, changes are always welcome !

Basic pacman commands :

pacman -Syu : update your packages ! Probably the most used command, try to do that at least once per month, it's not mandatory of course but if you wait too long it becomes long and teddious plus you run the risk to get some incompatiblities.
pacman -Ql name : where name is a package name, gives the list of files of the package. Notice a few directories are mapped in mingw, you have / which is mapped to your base mingw install by default, except if you use /c/ which is c:
pacman -Qo file : tells you which package owns this file
pacman -Sc : clean the cache, you get a ton of files after an update, and pacman keeps the archives by default, if you want to remove all that, you can use pacman -Scc it can remove a lot of files !

That should be the bare minimum to get you started, after that get curious, a lot of people took the time to write very detailled documentation about all that, so you just need time and curiosity to learn all that you need.

Cross compiling raine

Sometimes 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 you can run it in dosemu.
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 windows if you still have a windows boot.

Arch linux not only has some cross compilers, it also has some pre-compiled packages for windows, which makes cross compiling for windows very easy.
mingw-w64-gcc installs at the same time /usr/bin/i686-w64-mingw32-gcc and /usr/bin/x86_64-w64-mingw32-gcc with their respective directories in /usr/i686-w64-mingw32/ and /usr/x86_64-w64-mingw32
After that the packages you install are on the same model, they install at the same time in the 32 bits and the 64 bits directory. You'll probably need the aur repository, and chaotic-aur is a good idea too.
Also yay is a good alternative to pacman to automatically install packages from aur for example.
Just search for the sdl2 packages :
yay mingw-w64-sdl2
Which should give you something like that :
6 aur/mingw-w64-sdl2_mixer 2.0.4-3 (+1 0.00)
    A simple multi-channel audio mixer (mingw-w64)
5 aur/mingw-w64-sdl2_net 2.0.1-1 (+2 0.00)
    A small sample cross-platform networking library (Version 2) (mingw-w64)
4 aur/mingw-w64-sdl2_gfx 1.0.4-1 (+3 0.00) (Orphelin)
    SDL graphics drawing primitives and other support functions (Version 2)mingw-w64)
3 aur/mingw-w64-sdl2_ttf 2.0.15-1 (+4 0.00)
    A library that allows you to use TrueType fonts in your SDL applications (Version 2) (mingw-w64)
2 aur/mingw-w64-sdl2_image 2.0.5-1 (+4 0.00) (Installé)
    SDL2 image libraries (mingw-w64)
1 aur/mingw-w64-sdl2 2.0.16-1 (+24 0.01) (Installé : 2.0.18-1)
    A library for portable low-level access to a video framebuffer, audio output, mouse, and keyboard (Version 2) (mingw-w64)
Here I had some troubles with SDL2_ttf, and I ended up installing this one manually from sources, but all the others worked. Also to update a package to a more recent version, just edit the PKGBUILD file and change the version inside. Once it has failed on bad sha256 for the source package, just run sha256 on the source package, and update the PKGBUILD again with the new sha256 info.

You can edit the raine's makefile to directly compile for one of these targets, search for target= and read the comments. Uncomment the target you want, there is 1 for windows 32 bits, 64 bits, and djgpp. Then run make, and you'll get your binary if everything is installed correctly.

For djgpp, you can also install this package from arch : https://aur.archlinux.org/packages/djgpp-gcc/.