Taylorbyte.com

Documentation Wiki

Compiling flightgear from git

Before we start

Using git both has its advantages and disadvantages. The advantage is you can pick the version you wish to compile, It has ALOT smaller updates, and you can update whenever you feel like it. The disadvantages are a harder install process, And you must download the ENTIRE HISTORY of flightgear. I will try to explain the commands/reasoning as I go along the tutorial.

There is a lot of data that needs to be downloaded for flightgear. Its somewhere around 4-5GB (fgdata is the biggest download). First we will download all of the source and data needed for flightgear, then we will compile it.

I prefer to follow the stable branch (currently 2.8), but you can always use the development version (2.9).

Downloading the source code

This places the source code in folders under /usr/src/flightgear You cannot interrupt (Ctrl+C) the downloads of git. Git must have a stable connection to the internet during it's download. Because of the size of fgdata, it is downloaded from a resumeable http file download first, and then updated normally. The initial download will probably take overnight on ADSL, but incremental updates take between 5 seconds to a minute depending on what was changed.

mkdir /usr/src/flightgear/
cd /usr/src/flightgear
svn checkout http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk OpenSceneGraph-svn
git clone git://gitorious.org/fg/simgear.git simgear-git
git clone git://gitorious.org/fg/flightgear.git flightgear-git
git clone git://gitorious.org/fg/fgcom.git fgcom-git
wget -c http://flightgear.mxchange.org/pub/fgfs/fgdata.bundle
git clone fgdata.bundle fgdata-git
cd /usr/src/flightgear/fgdata-git
git checkout -b master-tmp
git remote rm origin
git remote add origin git://gitorious.org/fg/fgdata
git fetch origin
git branch --track master origin/master
git checkout master
git branch -D master-tmp
cd /usr/src/flightgear

Switch to the release version

You can skip this if you like, but I recommended to run the stable version. NB: If you do skip this, you need to change 2.8 in the automatic update/build script to master, and origin/release/2.8.0 to origin/master.

cd /usr/src/flightgear/simgear-git
git branch --track 2.8 origin/release/2.8.0
git checkout 2.8
cd /usr/src/flightgear/flightgear-git
git branch --track 2.8 origin/release/2.8.0
git checkout 2.8
cd /usr/src/flightgear/fgdata
git branch --track 2.8 origin/release/2.8.0
git checkout 2.8

Automatic update and build script

You use this for the first compile, there is some tweaks I have added in cmake to get the thing to compile. OSG is picky about its ffmpeg version so I disable it, and fgcom has some weird linker error without my adjustments. MAKE SURE YOU RUN THIS LINE BY LINE LOOKING FOR PROBLEMS ON THE FIRST RUN!. I could change it to run without root but really don't care atm.

Hopefully this doesn't run over your dog or set your house on fire.

if [ "`whoami`" != "root" ]; then
  echo "Run as root please!"
  exit
fi
cd /usr/src/flightgear
rm -rf /opt/flightgear
cd /usr/src/flightgear/OpenSceneGraph-svn
svn update
cd /usr/src/flightgear/simgear-git
git fetch --all
git checkout 2.8
git merge origin/release/2.8.0
cd /usr/src/flightgear/flightgear-git
git fetch --all
git checkout 2.8
git merge origin/release/2.8.0
cd /usr/src/flightgear/fgdata-git
git fetch --all
git checkout 2.8
git merge origin/release/2.8.0
cd /usr/src/flightgear/fgcom-git
git fetch --all
git checkout master
git merge origin/master
mkdir /usr/src/flightgear/OpenSceneGraph-build
cd /usr/src/flightgear/OpenSceneGraph-build
cmake /usr/src/flightgear/OpenSceneGraph-svn -DCMAKE_INSTALL_PREFIX=/opt/flightgear/ -DFFMPEG_LIBAVCODEC_LIBRARIES=OFF -DFFMPEG_LIBAVDEVICE_LIBRARIES=OFF -DFFMPEG_LIBAVFORMAT_LIBRARIES=OFF -DFFMPEG_LIBAVUTIL_LIBRARIES=OFF -DFFMPEG_LIBAVUTIL_LIBRARIES=OFF -DFFMPEG_LIBSWSCALE_LIBRARIES=OFF -DCMAKE_BUILD_TYPE=Release
nice -n 19 make -j 8
make install
mkdir /usr/src/flightgear/simgear-build
cd /usr/src/flightgear/simgear-build
cmake /usr/src/flightgear/simgear-git -DCMAKE_INSTALL_PREFIX:PATH=/opt/flightgear/ -DCMAKE_BUILD_TYPE=Release
nice -n 19  make -j 8
make install
mkdir /usr/src/flightgear/flightgear-build
cd /usr/src/flightgear/flightgear-build
cmake /usr/src/flightgear/flightgear-git -DCMAKE_INSTALL_PREFIX:PATH=/opt/flightgear/ -DFG_DATA_DIR:PATH=/opt/flightgear/share/flightgear/ -DCMAKE_BUILD_TYPE=Release
nice -n 19 make -j 8
make install
mkdir /usr/src/flightgear/fgcom-build
cd /usr/src/flightgear/fgcom-build
cmake /usr/src/flightgear/fgcom-git -DCMAKE_INSTALL_PREFIX:PATH=/opt/flightgear/ -DDEFAULT_POSITIONS_FILE=/opt/flightgear/share/fgcom/positions.txt -DSPECIAL_FREQUENCIES_FILE=/opt/flightgear/share/fgcom/special_frequencies.txt -DCMAKE_BUILD_TYPE=Release
sed 's/.*/& -lpthread/g' -i /usr/src/flightgear/fgcom-build/CMakeFiles/fgcom.dir/link.txt
nice make
make install
mkdir /usr/src/flightgear/fgrun-build
cd /usr/src/flightgear/fgrun-build
cmake /usr/src/flightgear/fgrun-svn/fgrun -DCMAKE_INSTALL_PREFIX:PATH=/opt/flightgear/ -DCMAKE_BUILD_TYPE=Release
nice make -j 8
make install
cd /usr/src/flightgear
ln -s /usr/src/flightgear/fgdata-git /opt/flightgear/share/flightgear
rm -rf /usr/src/flightgear/OpenSceneGraph-build
rm -rf /usr/src/flightgear/simgear-build
rm -rf /usr/src/flightgear/flightgear-build
rm -rf /usr/src/flightgear/fgcom-build
rm -rf /usr/src/flightgear/fgrun-build