Author Topic: How to patch and build a tremded SVN linux binary [HOWTO]  (Read 8221 times)

Ingar

  • Tremulous Developers
  • *
  • Posts: 554
  • Turrets: +302/-7
    • Ingar's projects on the Web
How to patch and build a tremded SVN linux binary [HOWTO]
« 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

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

The Alien Wrath patchset is based on SVN revision 901:
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:
   
Code: [Select]
svn co -r 910 svn://svn.icculus.org/tremulous/trunk tremulous-910-lakitu7

To get revision 901:
   
Code: [Select]
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

Code: [Select]
cd tremulous-910-lakitu7
patch -Np0 -i ~/--\ lakitu7\ QVM\ 910\ v4.16.patch

or
Code: [Select]
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.

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:
Code: [Select]
BUILD_CLIENT     = 0
BUILD_CLIENT_SMP = 0
BUILD_SERVER     = 1
BUILD_GAME_SO    = 0
BUILD_GAME_QVM   = 1


Start the build:
Code: [Select]
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.

Code: [Select]
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.

Code: [Select]
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
Code: [Select]
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.

Code: [Select]
su - tremulous

Instead of the default ~/.tremulous/base directory we install each qvm in a seperate directory:

Code: [Select]
mkdir -p ~/.tremulous/lakitu7/vm
ln -s /usr/local/games/tremulous/game.qvm-910-lakitu7 ~/.tremulous/lakitu7/vm/game.qvm

or
Code: [Select]
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:

Code: [Select]
/usr/local/games/tremulous/tremded-910-lakitu7.x86 +exec server.cfg +set fs_game lakitu7
or
Code: [Select]
/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:

Code: [Select]
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:

Code: [Select]
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.

israroot

  • Posts: 21
  • Turrets: +0/-0
How to patch and build a tremded SVN linux binary [HOWTO]
« Reply #1 on: July 12, 2007, 04:23:54 pm »
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.

{M}IsrarootTdT

Ingar

  • Tremulous Developers
  • *
  • Posts: 554
  • Turrets: +302/-7
    • Ingar's projects on the Web
How to patch and build a tremded SVN linux binary [HOWTO]
« Reply #2 on: July 12, 2007, 04:31:31 pm »
If you start mixing patches from different sources you can run into all kinds of  unexpected problems.  I'll add something about it.

Lakitu7

  • Tremulous Developers
  • *
  • Posts: 1002
  • Turrets: +120/-73
How to patch and build a tremded SVN linux binary [HOWTO]
« Reply #3 on: July 12, 2007, 04:42:46 pm »
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. :)

benmachine

  • Posts: 915
  • Turrets: +99/-76
    • ben's machinery
How to patch and build a tremded SVN linux binary [HOWTO]
« Reply #4 on: July 12, 2007, 06:36:56 pm »
+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.
benmachine

israroot

  • Posts: 21
  • Turrets: +0/-0
How to patch and build a tremded SVN linux binary [HOWTO]
« Reply #5 on: July 13, 2007, 02:57:47 am »
Excellent.
   
Already I learned very.
I will wait anxious for the different lessons on patchs.

{M}IsrarootTdT

Undeference

  • Tremulous Developers
  • *
  • Posts: 1254
  • Turrets: +122/-45
Re: How to patch and build a tremded SVN linux binary [HOWTO
« Reply #6 on: July 15, 2007, 04:45:31 am »
Quote from: "Ingar"
Lakitu7's patchset is based on SVN revision 910:
-- lakitu7 QVM 910 v4.16.patch

The Alien Wrath patchset is based on SVN revision 901:
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.)

Quote from: "Ingar"
Building

We can speed up the build by disabling everything we don't need. Create a file called Makefile.local in your favourite editor:
Code: [Select]
BUILD_CLIENT     = 0
BUILD_CLIENT_SMP = 0
BUILD_SERVER     = 1
BUILD_GAME_SO    = 0
BUILD_GAME_QVM   = 1
Fixed.
Need help? Ask intelligently. Please share solutions you find.

Thats what we need, helpful players, not more powerful admins.

tehOen

  • Guest
How to patch and build a tremded SVN linux binary [HOWTO]
« Reply #7 on: July 15, 2007, 09:22:50 am »
nah directly edit the makefile
it is the best way

kevlarman

  • Posts: 2737
  • Turrets: +291/-295
How to patch and build a tremded SVN linux binary [HOWTO]
« Reply #8 on: July 15, 2007, 05:11:50 pm »
Quote from: "tehOen"
nah directly edit the makefile
it is the best way
not when you have 40+ copies of the trem source lying around.
Quote from: Asvarox link=topic=8622.msg169333#msg169333
Ok let's plan it out. Asva, you are nub, go sit on rets, I will build, you two go feed like hell, you go pwn their asses, and everyone else camp in the hallway, roger?
the dretch bites.
-----
|..d| #
|.@.-##
-----

Lakitu7

  • Tremulous Developers
  • *
  • Posts: 1002
  • Turrets: +120/-73
How to patch and build a tremded SVN linux binary [HOWTO]
« Reply #9 on: July 15, 2007, 05:23:52 pm »
Quote from: "kevlarman"
Quote from: "tehOen"
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.

kevlarman

  • Posts: 2737
  • Turrets: +291/-295
How to patch and build a tremded SVN linux binary [HOWTO]
« Reply #10 on: July 15, 2007, 05:30:04 pm »
Quote from: "Lakitu7"
Quote from: "kevlarman"
Quote from: "tehOen"
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.
Quote from: Asvarox link=topic=8622.msg169333#msg169333
Ok let's plan it out. Asva, you are nub, go sit on rets, I will build, you two go feed like hell, you go pwn their asses, and everyone else camp in the hallway, roger?
the dretch bites.
-----
|..d| #
|.@.-##
-----

next_ghost

  • Posts: 892
  • Turrets: +3/-6
Re: How to patch and build a tremded SVN linux binary [HOWTO
« Reply #11 on: July 15, 2007, 05:34:22 pm »
Quote from: "Ingar"
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:
Code: [Select]
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:
Code: [Select]
make BUILD_CLIENT=0 BUILD_SERVER=1 BUILD_GAME_SO=0 BUILD_GAME_QVM=1
If my answer to your problem doesn't seem helpful, it means I won't help you until you show some effort to fix your problem yourself!
1.2.0 release's been delayed for 5:48:00 already because of stupid questions.