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

From FreeSpace Wiki
Jump to: navigation, search
(New page: {{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...)
(No difference)

Revision as of 21:33, 3 September 2007

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.