Tremulous Forum
Mods => Modding Center => Topic started by: Ingar on July 12, 2007, 04:05:38 pm
-
How to patch and build a tremded SVN linux binary
This 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 tracker (http://www.mercenariesguild.net/patches/?do=details&task_id=2)
Requirements
Before 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 patch
Before 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.patch (http://www.mercenariesguild.net/patches/?getfile=179)
The Alien Wrath patchset is based on SVN revision 901:
999.all_in_one-037.patch (http://wraths.dyndns.org/downloads/code/patches/svn901/999.all_in_one-037.patch)
Download the patch of your choice to your home directory.
Getting the source
In 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 patch
Next, 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 (http://www.gnu.org/software/diffutils/manual/html_mono/diff.html).
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.
Building
We 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.
Installation
To 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 configuration
Out of thin air, a server configuration file appears. It is called server.cfg
Running the server
Still 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 version
If 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.
-
Very good!
Congratulations.
One asks:
And if I wanted to use several patchs?
That version of svn to choose?
It would have conflict?
Patchs would like to choose some and to make my proper game.qvm.
And the customers did not need to make downloads.
I do not know the limits of the modifications for only game.qvm.
-
If you start mixing patches from different sources you can run into all kinds of unexpected problems. I'll add something about it.
-
My own quick note is that if you choose to use my patchset, the documentation and feature list are here:
http://www.mercenariesguild.net/patches/?do=details&task_id=69
Please at least try to read some of it before asking me things. :)
-
+set fs_game lakitu7 D:
I see your reasoning but we do not need any more fs_games, there are like seven already. fs_game is for mods.
imo.
-
Excellent.
Already I learned very.
I will wait anxious for the different lessons on patchs.
-
Lakitu7's patchset is based on SVN revision 910:
-- lakitu7 QVM 910 v4.16.patch (http://www.mercenariesguild.net/patches/?getfile=179)
The Alien Wrath patchset is based on SVN revision 901:
999.all_in_one-037.patch (http://wraths.dyndns.org/downloads/code/patches/svn901/999.all_in_one-037.patch)
If someone doesn't know what patches they want, why are they reading this?
(Oops, quoted the wrong thing.)
Building
We can speed up the build by disabling everything we don't need. Create a file called Makefile.local in your favourite editor:
BUILD_CLIENT = 0
BUILD_CLIENT_SMP = 0
BUILD_SERVER = 1
BUILD_GAME_SO = 0
BUILD_GAME_QVM = 1
Fixed.
-
nah directly edit the makefile
it is the best way
-
nah directly edit the makefile
it is the best way
not when you have 40+ copies of the trem source lying around.
-
nah directly edit the makefile
it is the best way
not when you have 40+ copies of the trem source lying around.
I just have a directory for unmodded 910 (with Makefile.local) and copy that whenever I need it. I figure it makes more sense than wasting svn's bandwidth to redownload it 40 times.
-
nah directly edit the makefile
it is the best way
not when you have 40+ copies of the trem source lying around.
I just have a directory for unmodded 910 (with Makefile.local) and copy that whenever I need it. I figure it makes more sense than wasting svn's bandwidth to redownload it 40 times.
only about 3 of those copies are the same revision.
-
Building
We 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
You don't have to edit anything. You can override the default values by command line parameters to make:
make BUILD_CLIENT=0 BUILD_SERVER=1 BUILD_GAME_SO=0 BUILD_GAME_QVM=1