Fs2 open on Linux/Compile Script

From FreeSpace Wiki
Revision as of 23:12, 3 September 2007 by Ni1s (talk | contribs) (Cosmetics)
Jump to: navigation, search
« 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.