Difference between revisions of "Guide to FS Open on Linux"

From FreeSpace Wiki
Jump to: navigation, search
(add contents to Optimizing)
m (format)
Line 72: Line 72:
 
  ./configure CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer"
 
  ./configure CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer"
 
You should read up on CFLAGS and what they do before trying anything. I recommend you read through these links.<br>
 
You should read up on CFLAGS and what they do before trying anything. I recommend you read through these links.<br>
http://linuxreviews.org/howtos/compiling/safe-cflags/
+
http://linuxreviews.org/howtos/compiling/safe-cflags/<br>
 
http://en.wikipedia.org/wiki/CFLAGS
 
http://en.wikipedia.org/wiki/CFLAGS
 
=== Using the Binaries ===
 
=== Using the Binaries ===
  
 
When the compile is done and if all went well, a binary executable will reside in the code directory ''fs2_open_r'' or ''fs2_open_d'' if you configured for a debug build. Move the binary to where you got your mediaVP's and your all set to go.
 
When the compile is done and if all went well, a binary executable will reside in the code directory ''fs2_open_r'' or ''fs2_open_d'' if you configured for a debug build. Move the binary to where you got your mediaVP's and your all set to go.

Revision as of 06:37, 2 March 2006

This HOWTO was written by ni1s to help Freespace fans get the latest bleeding-edge version of fs2_open from CVS.

WARNING! Compling from CVS will let you play with the most recent features and BUGS! Yes, BUGS, compile errors, strange game behavior and/or angry monkeys attacking you. Murphy's Law is very much in effect!

Installing CVS

CVS stands for Concurrent Versions System and is a version control system used to record the changes in documents, such as source files. Developers use CVS so they can easily share their code changes among other developers. You will need this tool to download ("checkout" in CVS termology) fs2_open from the CVS server.

Use your package tool supplied by your distribution to download and install CVS.

Debian users want to:

apt-get install cvs

Gentoo users want to:

emerge cvs

NOTE: Radhat, Mandrake,Slackware and all the other distros should go here too, but I have no knowlage on how these work, so if you do, please enlighten us.

Installing Dev Libs

You will also need OpenAL, libvorbis, OpenGL (most likely provided with your videocard driver), and LUA development packages (you dont need LUA if you dont need LUA scripting enabled, it wont go b0rk the compile if it cant find it). And ofcourse the GCC compiler and required make tools.

Debian users want to:

apt-get install libopenal-dev libvorbis-dev build-essential automake1.9 autoconf

NOTE: The build-essential meta package installs GCC4. This should work, but if you want GCC 3.4(gcc-3.4), add it to the apt-get line above.
Gentoo users want to:

emerge openal libvorbis

NOTE: Gentoo Linux dose not distinguish between development and runtime libs. But you are a Gentoo user, so you already know that, don't you.
NOTE: Radhat, Mandrake,Slackware and all the other distros should go here too, but I have no knowlage on how these work, so if you do, please enlighten us.

Before you begin, make sure you are situated in a a directory where you have write permissons. Your /home/user/ directory is pretty much a sure bet. I recommend that you create a permanent home/user/dev directory from which you run the CVS command, this way CVS will only update the files changed the next time you download the source.

Using the source

Downloading

Now get the source. Run from a terminal:

cvs -d:pserver:anonymous:[email protected]:/home/fs2source/cvsroot login

and then

cvs -z3 -d:pserver:[email protected]:/home/fs2source/cvsroot co fs2_open

The first cvs command tells the CVS tool to first use a password file for authentication (pserver), that you are user "anonymous" with the password "anonymous" who wants to access warpcore.org's CVS repository "/home/fs2source/cvsroot" and login. The second command tells the CVS server on which we are now connected to that we want to checkout (co) the fs2_open module.

CVS Checkout Script

Because 99,999% of all computer errors can be traced back to human-to-keyboard mishaps (linguistically proven by yours truly), I've written a quick bash script that will get the source for you. Save this and name it something appropriate like "get-fs2_open", and make it executable (chmod +x get-fs2_open).

#!/bin/bash
# CVS Checkout Script for fs2_open
CVS_ATTEMPT=0
until [  $CVS_ATTEMPT = 1 ]; do
	cvs -d:pserver:anonymous:[email protected]:/home/fs2source/cvsroot  login && \
	cvs -z3 -d:pserver:anonymous:[email protected]:/home/fs2source/cvsroot co fs2_open && \
let CVS_ATTEMPT=1
done

NOTE: This script will run until it successfully downloaded fs2_open, abort it with CTRL+C (originally designed to hammer SourceForge's CVS server). Run the script from a terminal (./get-fs2_open) and wait for it to download the source files.

Building

In the directory you ran the CVS command from, a new directory will appear, namely fs2_open. From that fs2_open directory run in a terminal:

./autogen.sh

autogen.sh is a script that will generate the required makefiles. You will see alot of "checking for this" and "checking for that", this is actually the "configure" script (which can be run with ./configure if you need to change the options) examining and configuring fs2_open for your system.
It is possible to give autogen.sh configure options aswell, autogen.sh will pass them along to configure.

Now run:

make 

Sit back and enjoy gcc work its magic.

Optimizing fs2_open

Optimizing fs2_open might have little or no effect, or improve performace greatly, I honestly have no clue. You can specify your compiler flags with the configure script, se below.

./configure CFLAGS="<your desired flags>"

If you got a Athlon-XP and want to play it safe, a good set of CFLAGS would be

./configure CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer"

You should read up on CFLAGS and what they do before trying anything. I recommend you read through these links.
http://linuxreviews.org/howtos/compiling/safe-cflags/
http://en.wikipedia.org/wiki/CFLAGS

Using the Binaries

When the compile is done and if all went well, a binary executable will reside in the code directory fs2_open_r or fs2_open_d if you configured for a debug build. Move the binary to where you got your mediaVP's and your all set to go.