Building SRB2 Kart for Linux

1- First install the dependencies

Assuming Ubuntu. For other distros find the equivalent dependencies
Open up a terminal and type
sudo apt-get install build-essential git p7zip-full p7zip-rar nasm libpng-dev zlib1g-dev libsdl2-dev libsdl2-mixer-dev libgme-dev libopenmpt-dev libcurl4-openssl-dev

2- Get the source code

vanilla source code:
https://git.do.srb2.org/KartKrew/Kart-Public.git

moe mansion:
https://gitlab.com/himie/kart-public.git

Moe Mansion is for playing at 60fps and all the latest probably unstable features. Recommended for client if you’re playing the game on linux.

Vanilla is the same code that kart krew released for 1.3. Recommended for a server since it doesn’t need all the extra features in moe.

Clone the code with git from the moe repository this will get the moe mansion srb2kart 1.3 code (change the url to vanilla if you’re building for a server or don’t want moe mansion)

git clone https://gitlab.com/himie/kart-public.git

In the terminal move to the directory you just cloned
cd Kart-Public

Change to the moe-mansion branch (use master for vanilla)

git checkout moe-mansion

3- Compile the source code

Add extra flags as necessary at the end of the line

LIBGME_CFLAGS= LIBGME_LDFLAGS=-lgme make -C src/ LINUX64=1

  • Change LINUX64=1 to LINUX=1 if doing 32-bit
  • Add NONX86=1 if compiling on ARM like an rpi
  • Add GCC91=1 if compiling on Ubuntu 20.04 or any distro with a gcc version higher than 9.1.0 (check your version by running gcc --version) this gets rid of all the warnings when compiling
  • Add NOUPX=1 to get rid of the upx warning at the end of compiling
  • If you still have problems with GME you can disable it by adding NOGME=1
  • Add NOOBJDUMP=1 to speedup linking time
  • Enable discord rich presence support by adding HAVE_DISCORDRPC=1
    • To compile with discord you need to download the discord rpc .zip from here
    • Copy the files from discord-rpc/linux-dynamic/
        • discord_register.h and discord_rpc.h go into /usr/local/include/
        • libdiscord-rpc.so goes into /usr/local/lib/

In the end your compile line should look something like this (this is what I use)

LIBGME_CFLAGS= LIBGME_LDFLAGS=-lgme make -C src/ LINUX64=1 GCC91=1 NOUPX=1 NOOBJDUMP=1

After waiting for a while the binary will be compiled to bin/Linux64/Release/lsdl2srb2kart

4- Install the binary

What I like to do is move this binary to /usr/local/bin for easy access
While still being in Kart-Public folder in the terminal:
sudo install -Dm755 bin/Linux64/Release/lsdl2srb2kart /usr/local/bin/srb2kart
Also copy the icon
sudo install -Dm644 srb2.png /usr/local/share/pixmaps/srb2kart.png

5- Obtain the assets

Next you’ll need to obtain the assets for srb2 kart.
You can get them with the windows release https://github.com/STJr/Kart-Public/releases/download/v1.3/srb2kart-v13-Installer.exe

If you are running a desktop on linux you can download the installer.exe and open it as an archive and extract all the .kart .srb mdls.dat and mdls/ files
They should go in a folder called .srb2kart inside your home folder

You can also do it via the terminal:

Create the .srb2kart directory
mkdir ~/.srb2kart

Move into it
cd ~/.srb2kart

Get the Installer
wget https://github.com/STJr/Kart-Public/releases/download/v1.3/srb2kart-v13-Installer.exe

Extract only the files we need
7z x srb2kart-v13-Installer.exe "*.kart" "*.srb" "mdls.dat" "mdls/*"

Delete the installer since it’s no longer needed
rm srb2kart-v13-Installer.exe

6- Run the game

Now you can run the game by typing in the terminal

srb2kart -opengl

7- Add shortcuts to your applications menu

Will use the .desktop files provided by SteelTitanium in the AUR

Type into the terminal:
sudo wget -O /usr/local/share/applications/srb2kart-opengl.desktop https://aur.archlinux.org/cgit/aur.git/plain/srb2kart-opengl.desktop?h=srb2kart

sudo wget -O /usr/local/share/applications/srb2kart.desktop https://aur.archlinux.org/cgit/aur.git/plain/srb2kart.desktop?h=srb2kart

Now srb2kart should appear in your applications menu.

Running with OpenGL lets you use models, better performance, among other things and it’s recommended.

 

Alternatively, you can do a rootless install, if you want to keep everything inside your home folder or are on a computer where you can’t access root (admin access).
Copy lsdl2srb2kart into ~/.local/bin, copy the .desktop files into ~/.local/share/applications, copy the icon into ~/.local/share/pixmaps

If everything on the guide worked fine you don’t have to do this.

 

If you need any help with this guide you can ping himie (ヒーミー#1031) on the kart.moe discord server

Credits

Thanks to DudeValenzetti, MajorGnuisance, and Ashnal for helping in figuring out compiling and linux fu to make this guide noob friendly.

This entry was posted in Linux and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *