With cordite in the air, splintered steel, shell casings and powder burns, there’s only one explanation...
Discuss & improve the game engine.

Moderators: Tequila, sparcdr, torhu

[Tutorial] Compiling on GNU/Linux

Postby Barto » Fri Apr 26, 2013 5:04 pm

Introduction
In this small tutorial, I will present you how to compile the game from sources. I will use the latest long term support distribution for Ubuntu (12.04 LTS x86_64), but 90% of the tutorial could be applied to other distributions.

Content
  • Why
  • Getting the tools
  • Getting the code
  • Compilation
  • Update
  • Troubles

Why
There are few reasons that may motivate you from compiling SG from source:
  • You want to do some beta testing
  • You want to discover the new changes in the game code.
  • Baller bude's code base doesn't give any binaries, so you want to create yours manually
  • Or, you wanna get the x86_64 version of the game that is not provided in the official installers.

Getting the tools
For this step, we will simply just install the required tools to get the code, compile and run it. For that matter, open the terminal and just type:
Code: Select all
sudo apt-get build-dep ioquake3

Since SG is based on ioquake3, we are simply getting the same dependencies of them.
For the compiling tools and code management, just type this other command:
Code: Select all
sudo apt-get install build-essential git zip

And that's all! Next step!

Getting the code
This step is the easiest, just use git to download the code from GitHub with this command in your terminal:
Code: Select all
git clone https://github.com/smokin-guns/SmokinGuns.git

It will create a folder named SmokinGuns in your home folder with all the source code.

Compilation
This is where it starts to be fun :-) From your home folder, just get in the SmokinGuns folder via the terminal with
Code: Select all
cd SmokinGuns/

And from here, only one more step is required for compilation, just type:
Code: Select all
make

It will compile the game. If you have a multi core machine, you can use the -j<cores> option to compile faster. For example, if you have a quad core machine, just run "make -j4". If you have a machine that can run both 32 and 64 bits softwares, you also may be able to compile for the i386 platform with "setarch i386 make". The new binaries will be now in a sub-folder named build/release-linux-x86_64/ (x86_64 could be i386 or just x86 depending of the git revision and your machine). We just need to move now those compiled files to our existing game installation.

So, from the SmokinGuns folder, move to this folder with:
Code: Select all
cd build/release-linux-x86_64/

And copy the new files to your SG installation with:
Code: Select all
cp *.x86_64 /where/you/installed/the/game/ # it could be some *.i386 or *.x86 files if you are on a 32 bit system
cp *.so /where/you/installed/the/game/ # if there are any

There are also some compiled files that are called QVM that needs to be put in the SG installation, from where you have been, just do:
Code: Select all
cd smokinguns/
zip -r z_vm.pk3 vm/
mv z_vm.pk3 /where/you/installed/the/game/smokinguns/

And that's all!

Update
When there is a new change in the game source code, you may want to see it too. You don't actually need to redo the whole compile process for that matter, just open a terminal and do:
Code: Select all
cd SmokinGuns/
git pull

It will update the code, you will be notified if something changed since last download.
If something actually changed, you just need then to redo the compilation process and you will be ready to test again.

Troubles
  • If it doesn't compile for some reason when you just updated the code, try to remove the build folder and try to compile again. If it doesn't make the trick, contact the developers via the forum.
  • If you spot any bug while testing, just contact the developers via the forum or make a bug report (you will still need a forum account to log in here, in small caps).
  • If you want to play with the sources, I suggest you to learn git (especially the checkout command), there are plenty of tutorials around.
  • For some other problems, don't be scared to contact any developer or me (#smokinguns on freenode, this forum, email, etc.)
"Chuck Norris had to shorten his beard in the presence of Richard Stallman because two beards that awesome, so close would segfault the universe (again)."
User avatar
Barto
Jeuxlinux Admin
 
Posts: 329
Joined: Fri Oct 23, 2009 5:08 pm
Location: Switzerland



Return to Code

Show Sidebar
Show Sidebar

User Control Panel