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

From FreeSpace Wiki
Jump to: navigation, search
m (Fix Title)
m (Cosmetics)
Line 4: Line 4:
 
PrevPage=[[Fs2_open on Linux/Compiling|Compiling]]|
 
PrevPage=[[Fs2_open on Linux/Compiling|Compiling]]|
 
NextPage=[[Fs2_open on Linux/Acquiring the Game Data|Acquiring the Game Data]]}}
 
NextPage=[[Fs2_open on Linux/Acquiring the Game Data|Acquiring the Game Data]]}}
 
+
<p></p>
 
{{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.}}
 
{{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>
 
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>

Revision as of 23:12, 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.