How to patch and build a tremded SVN linux binaryThis HOWTO describes how to build a Tremulous dedicated server for linux and accompanying qvm from SVN. It's important to know that the current SVN version is not compatible with Tremulous 1.1.0. To make your server compatible with 1.1.0 clients you will have to patch the SVN source code.
There is a special backport patch that does just, but since most general patches already incorporate this backport, you do not have to install it seperatly. If you should need it you can find it on the
Mercenaries Guild patch trackerRequirementsBefore you you begin you will need to have a working compiler toolchain (gcc, binutils, make) and svn, the subversion client. Your specific linux distribution does not matter, these instructions should even work on FreeBSD as well.
Building the dedicated server is quite straightforward, and getting it to run is easy if you take the client-server incompatibilities into account. If you have never compiled software on linux before, you are probably better of using a precompiled binary.
You should also be able to add a tremulous user account to your system.
Getting your patchBefore we get the tremulous source code, you have to decide on what patchset you are going to use. We have to know this upfront because we have to determine what SVN revision we need.
Lakitu7's patchset is based on SVN revision 910:
-- lakitu7 QVM 910 v4.16.patchThe Alien Wrath patchset is based on SVN revision 901:
999.all_in_one-037.patchDownload the patch of your choice to your home directory.
Getting the sourceIn this example you'll either need SVN revision 910 or 901 depending on the patch you have choosen. We will download the tremulous source code to a new folder and give it a descriptive name. A lot of people don't realize how important this is: once you have five folders called 'tremulous' it is easy to make mistakes.
To get revision 910:
svn co -r 910 svn://svn.icculus.org/tremulous/trunk tremulous-910-lakitu7
To get revision 901:
svn co -r 901 svn://svn.icculus.org/tremulous/trunk tremulous-901-alienwrath
Applying the patchNext, we will enter the new directory and apply the patch
cd tremulous-910-lakitu7
patch -Np0 -i ~/--\ lakitu7\ QVM\ 910\ v4.16.patch
or
cd tremulous-901-alienwrath
patch -Np1 -i ~/999.all_in_one-037.patch
Note that the first patch command uses -p0 and the next one -p1. -p
<level> indicates how many levels of directory names should be stripped from the file names in the patch files. -p0 or -p1 usually works. In general, you can try -p0 first and if that fails, try -p1 next. For more information on patch files, go to the
GNU website.
You can apply other patches in the same way. Just be warned that a patch is essentially a change to the source code: if you start mixing multiple patches that haven't been tested together you can get unpredicted results: the patch can fail, the build can fail, or the server can crash.
We have to know the SVN revision for the same reason. It is the original
version the author used to make his changes. Using any other version can give the same unpredictable result.
Larger patches, like the alien wrath, are actually a collection of smaller patches. You can apply the smaller parts seperatly by running the patch command for each patch you want. Just make sure you apply the patches in the correct order. It's always a good idea to check the authors documentation for more information.
BuildingWe can speed up the build by disabling everything we don't need. Open the file called Makefile in your favourite editor. Around line 24 you can specify what has to be included in our build:
BUILD_CLIENT = 0
BUILD_CLIENT_SMP = 0
BUILD_SERVER = 1
BUILD_GAME_SO = 0
BUILD_GAME_QVM = 1
Start the build:
make
This will take a few minutes on a +1Ghz system. When the build is completed, you will find the tremded binary and the game.qvm in the build directory.
build/release-linux-x86/tremded.x86
build/release-linux-x86/base/vm/game.qvm
Note:
if you are building for x86_64, you will have to replace x86 by x86_64 in the following instructions.
InstallationTo keep track of your tremulous server files we copy the files to the tremulous directory under a different name. The instructions assume tremulous is installed in /usr/local/games/tremulous.
cp build/release-linux-x86/tremded.x86 /usr/local/games/tremulous/tremded-910-lakitu7.x86
cp build/release-linux-x86/base/vm/game.qvm /usr/local/games/tremulous/game.qvm-910-lakitu
or
cp build/release-linux-x86/tremded.x86 /usr/local/games/tremulous/tremded-901-alienwrath.x86
cp build/release-linux-x86/base/vm/game.qvm /usr/local/games/tremulous/game.qvm-901-alienwrath
Even for testing purposes it is a good idea to have a seperate user account to run the dedicated server. Not only does it improve security, but it also keeps your server files separated from your client installation.
su - tremulous
Instead of the default ~/.tremulous/base directory we install each qvm in a seperate directory:
mkdir -p ~/.tremulous/lakitu7/vm
ln -s /usr/local/games/tremulous/game.qvm-910-lakitu7 ~/.tremulous/lakitu7/vm/game.qvm
or
mkdir -p ~/.tremulous/alienwrath/vm
ln -s /usr/local/games/tremulous/game.qvm-910-lakitu7 ~/.tremulous/alienwrath/vm/game.qvm
Server configurationOut of thin air, a server configuration file appears. It is called server.cfg
Running the serverStill logged in as the tremulous user, we're ready start our new server now. Because we installed the game.qvm
in a non-standard place we will have to tell tremded where to find it:
/usr/local/games/tremulous/tremded-910-lakitu7.x86 +exec server.cfg +set fs_game lakitu7
or
/usr/local/games/tremulous/tremded-901-alienwrath.x86 +exec server.cfg +set fs_game alienwrath
Installing a single versionIf you don't care about multiple versions you don't have to rename the files. To copy the tremded binary and the qvm:
cp build/release-linux-x86/tremded.x86 /usr/local/games/tremulous/tremded.x86
cp build/release-linux-x86/base/vm/game.qvm /usr/local/games/tremulous/game.qvm
Install the game.qvm in the base folder:
su - tremulous
mkdir -p ~/.tremulous/base/vm
ln -s /usr/local/games/tremulous/game.qvm ~/.tremulous/base/vm/game.qvm
Using the same ~/.tremulous/base for an SVN tremded and a client doesn't work. In other words, do not copy the game.qvm to your own home directory on a machine you use to play tremulous.