Howto:Get Local Copies of Flightgear Source Code

From FlightGear wiki
Jump to navigation Jump to search

Local copies of source code for each component that needs to be built for FlightGear can be downloaded with a single Git command each.

You can execute the git commands individually, or you can do it the easy way and use the download_and_compile.sh script to do it for you.

Git Repository Directories

Most of the source code needed to build flightgear is in git repositories either on SourceForge, Github or Cmake's git server.

=== Getting Source code with download_and_compile.sh Use the download and compile script to do an initial get of the sources for plib, OSG, OpenRTI simgear, flightgear and fgdata. This will allow you to build the Main Flightgear executable.

cd ~/fg
mkdir -p ~/fg/next
cd ~/fg
wget -O download_and_compile.sh https://sourceforge.net/p/flightgear/fgmeta/ci/n
cd ~/fg/next
~/fg/download_and_compile.sh PLIB OSG OPENRTI SIMGEAR FGFS DATA

if you wish to add additional flightgear modules supported by the script, you can add any of these to the parameter list for the script: CMAKE FGRUN FGO FGX OPENRADAR ATCPIE TERRAGEAR TERRAGEARGUI

using the script, source code appears in folders beneath the ~/fg/next/ folder.

optional: move the fgdata directory so you do not have to download it again if you delete your install directory.
Be sure to recreate the symbolic link if delete the ~/fg/next/install directory for any reason.

if [ ! -e ~/fg/fgdata ] 
then
  mv ~/fg/next/install/flightgear/fgdata/ ~/fg/fgdata/
  ln -s ~/fg/fgdata ~/fg/next/install/flightgear/fgdata
fi

Git Commands for Downloading sources

You can use these commands if you prefer a hands on approach or if you are only going to build flightgear through an IDE.

cd to some directory, and run these commands:

git clone https://cmake.org/cmake.git
git clone https://git.code.sf.net/p/libplib/code
git clone https://git.code.sf.net/p/openrti/OpenRTI
git clone https://github.com/openscenegraph/osg.git
git clone https://git.code.sf.net/p/flightgear/simgear
git clone https://git.code.sf.net/p/flightgear/flightgear
git clone https://git.code.sf.net/p/flightgear/fgdata
git clone https://git.code.sf.net/p/flightgear/fgrun
git clone https://git.code.sf.net/p/atc-pie/code
git clone https://git.code.sf.net/p/flightgear/terragear
git clone https://git.code.sf.net/p/flightgear/fgscenery/terrageargui

You may need to re-do one or more git clone commands if one of the projects gets corrupted beyond repair. Or again, you could just let the script take care of you.

Flightgear components FGO and FGX different download and build procedures. Use the download_and_compile script if you need them.

cmake

At some point in it's history the flightgear project needed to work with a specific version of cmake. The version was not available in one or more Linux distributions. This appears to no longer be the case and cmake installed from most linux distributions will be sufficient. You don't have to build it. We include it here because the situation may happen again.