Source code compiling/Makefiles
The Makefile is the preferred method of compiling SRB2, except on macOS. It has been tested on Windows and Linux.
On Windows, you must install MinGW. This guide uses the MSYS2 method.
Follow steps 1 to 6 of installation instructions at msys2.org.
You must open the 32-bit shortcut to be able to use 32-bit (i686) programs.
After you've followed the steps listed there, close the MSYS2 window and open its 32-bit shortcut. Then enter these commands into the new window.
pacman -S git make mingw-w64-i686-gcc mingw-w64-i686-nasm
This will install Git, for downloading the source code, and Make, GCC and NASM for compiling the source code.
SRB2 Kart does not use libopenmpt.
If you are using a 32-bit system, then you must also install NASM, or disable compiling assembler source code.
Enter the following command in a terminal to install the tools and dependencies required to build SRB2.
sudo apt-get install build-essential libpng-dev zlib1g-dev libsdl2-dev libsdl2-mixer-dev libgme-dev libopenmpt-dev libcurl4-openssl-dev
To install NASM:
sudo apt-get install nasm
sudo pacman -S base-devel libpng zlib sdl2 sdl2_mixer libgme curl libopenmpt
To install NASM:
sudo pacman -S nasm
Download the source code
Find a suitable folder on your hard drive. Git will download the source code into a subfolder there.
Enter this command to download the source code. You may substitute one of the above URLs.
git clone https://git.do.srb2.org/STJr/SRB2.git
Compile the source code
The SRB2 Kart codebase is not up to date with these instructions at the time of writing (16th of June 2021).
Enter the subfolder in which Git downloaded the source code.
By default, the source code is "checked out" on the
next branch. This is the code for the next release of the game.
To switch to the current release, enter this command.
git checkout master
Finally, enter this command to compile (see below if it doesn't work).
If you are compiling on Ubuntu or Debian, you may need to enter this command instead:
LIBGME_CFLAGS= LIBGME_LDFLAGS=-lgme make
To compile without assembler source code (applicable on 32-bit systems), add
If you're using a multi-core processor, you may try adding
make -j 4
Once the executable is ready, a line like the following will be printed, alerting you to its location.
=== Build is done, look for lsdl2srb2 at /home/james/proj/srb2/srb2/bin ===
Updating your copy of the source code
Your copy of the source code may eventually become outdated, such as with each new release of the game. Instead of downloading an entirely new copy of the source code, you may enter the following command to only download those changes since the last time that you updated.
In order to compile for an operating system different from your own, remove certain dependencies, or perform other operations, you must add certain compilation flags from the list below.
||Compile for i686 Linux.|
||Compile for x86_64 Linux.|
||Compile for Windows using MinGW.|
||Compile with SDL.|
||Windows only; use comptime.bat instead of comptime.sh, don't use certain gzip commands.|
||Windows only; make32-make by default, set CC to cc.exe, use gcc.exe to compiles using GCC|
||Disable OpenGL and OpenAL.|
||Fall back on |
||Do not use NASM/YASM code (software optimizations); fall back on extra C code instead of x86.|
||Do not use libpng; fall back on PCX/TGA code instead of PNG for screenshots.|
||Do not use UPX when compiling.|
||Compile using YASM instead of NASM.|
||Compile debug binaries.|
||Have more flags for warnings when compiling.|
||Have all warnings register as errors.|
||Compiles with profiling information. After running the executable and exiting normally, the profile data for it is written into a file named |
||Compile with dummy interface code.|
||Print detailed information during the compiling process.|
For a detailed list of these flags and many more, check here.