Difference between revisions of "Fs2 open on Linux/Compile Script"

From FreeSpace Wiki
Jump to: navigation, search
(Page Navigation)
m (Fix Title)
Line 1: Line 1:
 
{{Page Navigation|
 
{{Page Navigation|
BookName=[[Fs2 open on Linux]]|
+
BookName=[[The fs2_open on Linux Guide]]|
 
CurrentPage=Compile Script|Compile Script|
 
CurrentPage=Compile Script|Compile Script|
 
PrevPage=[[Fs2_open on Linux/Compiling|Compiling]]|
 
PrevPage=[[Fs2_open on Linux/Compiling|Compiling]]|

Revision as of 22:53, 3 September 2007

« Compiling The fs2_open on Linux Guide
Compile Script
Acquiring the Game Data »


Note: This step is only for those who want the bleeding-edge source code to compile on their own. You can skip this if you intend to use a provided binary executable.

It's a lot easier to use a scripts when dealing with constantly changing code. Copy and save this to a suitably named file like "compile-fs2_open", and make it executable with the command, chmod +x <name of file>

#!/bin/bash
CFLAGS="-march=i686 -O2 -pipe"
CFLAGS="${CFLAGS} -fomit-frame-pointer -fno-ident"
CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden"
LDFLAGS="-Wl,-O1 -Wl,--sort-common"

if [ -e ./${*} ]; then
        cd ${*}
        if [ -e ./Makefile.in ]; then
                make clean
                ./configure CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}"
                make
                else
                ./autogen.sh CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" LDFLAGS="${LDFLAGS}"
                make
        fi
fi


You can add your options to the ./configure line. You need to give the script the fs2_open source directory, like this:

$ ./compile-fs2_open fs2_open

This makes it easier to deal with multiple source directories.