<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.flightgear.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jebba</id>
	<title>FlightGear wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.flightgear.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Jebba"/>
	<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/Special:Contributions/Jebba"/>
	<updated>2026-04-17T09:16:01Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Scripted_Compilation_on_Linux_Debian/Ubuntu&amp;diff=141182</id>
		<title>Scripted Compilation on Linux Debian/Ubuntu</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Scripted_Compilation_on_Linux_Debian/Ubuntu&amp;diff=141182"/>
		<updated>2025-01-03T01:34:41Z</updated>

		<summary type="html">&lt;p&gt;Jebba: /* ccache */ Think it needs that -D...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is a Bash script that takes care of downloading and compiling FlightGear and related software from their source code repositories with just one command execution&amp;lt;ref name=&amp;quot;just-one-command&amp;quot;&amp;gt;Due to technical problems on the [https://sourceforge.net/ SourceForge] side, this is currently only true once you have an [[FGData]] clone. See [[User:Rominet|here]] for details.&amp;lt;/ref&amp;gt; for both 32-bit and 64-bit [https://www.debian.org/ Debian]-based systems. Pre-existing versions (if any) of the software installed by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; are not touched at all since the script downloads, builds and installs everything under the directory in which it is launched. You can choose the particular components to download, build and install.&lt;br /&gt;
&lt;br /&gt;
Unless told not to do so, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; installs packages with &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt;. For this reason, it is primarily useful on Debian-based distributions. However, if one disables package installation (using &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;--sudo=echo&amp;lt;/code&amp;gt;) and installs the corresponding dependencies oneself, it can be useful on other Unix-like systems as well—one of the FlightGear developers apparently uses it under [https://www.openbsd.org/ OpenBSD].&lt;br /&gt;
&lt;br /&gt;
For hints on using &amp;lt;tt&amp;gt;rpm&amp;lt;/tt&amp;gt;-based distributions such as Redhat, Fedora and CentOS, please see [[CentOS]]. Please also see [[Superbuild]].&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is a [https://www.gnu.org/software/bash/ Bash] script written for [https://www.debian.org/ Debian]-derived distributions ([https://www.ubuntu.com/ Ubuntu], [https://devuan.org/ Devuan], [https://www.linuxmint.com/ Linux Mint], etc.). Its purpose is to automatically install dependencies using the package manager, then build and install FlightGear-related programs.&lt;br /&gt;
&lt;br /&gt;
By default, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; installs most dependencies with &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; run under &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;.&amp;lt;ref name=&amp;quot;disabling-installation-of-dependencies-via-package-manager&amp;quot;&amp;gt;If you think you already have the dependencies, this installation can be disabled either by using option &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; or by passing option &amp;lt;code&amp;gt;--sudo=echo&amp;lt;/code&amp;gt; (the latter results in printing the &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; command line without running it).&amp;lt;/ref&amp;gt; Other dependencies, either because they aren't available in the standard APT repositories, or because of non-option arguments passed to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, are downloaded and compiled on the fly (this can be the case for [[PLIB]], [[Simgear]] and [[OpenSceneGraph]], for instance—it all depends on the arguments passed to the script).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; works in the directory it is run from: apart from dependencies installed via the package manager, all programs built by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; are installed under the &amp;lt;tt&amp;gt;install&amp;lt;/tt&amp;gt; subdirectory of the directory from which the script was run. In other words, installation of programs by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is clean, very easy to undo and doesn't interfere with other programs on the system.&lt;br /&gt;
&lt;br /&gt;
It is possible to manage several directory trees with &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;; as far as it is concerned, such directory trees are completely independent from each other. For instance, if you run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;dir1&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;dir2&amp;lt;/tt&amp;gt;, the programs installed under &amp;lt;tt&amp;gt;dir1&amp;lt;/tt&amp;gt; won't “see” those installed under &amp;lt;tt&amp;gt;dir2&amp;lt;/tt&amp;gt;, and vice versa.&lt;br /&gt;
&lt;br /&gt;
Apart from its main purpose, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; can be used to find hopefully up-to-date build-dependency information for FlightGear and related software. You would do so by inspecting [https://sourceforge.net/p/flightgear/fgmeta/ci/next/tree/download_and_compile.sh the script] at the point where it installs packages.&amp;lt;ref name=&amp;quot;note-inspecting-download-and-compile-sh-to-gather-build-dependency-information&amp;quot;&amp;gt;Look for strings such as &amp;lt;tt&amp;gt;zlib1g-dev&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;libglew-dev&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;qt5-default&amp;lt;/tt&amp;gt;.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before embarking on building your own FlightGear binaries, you need to install a few tools that &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; uses to retrieve and compile source code. These tools are found in the following packages on [https://www.debian.org/ Debian] systems (and presumably on most Debian derivatives too):&lt;br /&gt;
&lt;br /&gt;
* build-essential&lt;br /&gt;
* git&lt;br /&gt;
* cmake&lt;br /&gt;
&lt;br /&gt;
These packages can be installed by running a command such as:&lt;br /&gt;
 $ sudo apt-get install build-essential git cmake&lt;br /&gt;
Once this is done, the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; script can be run. Unless told otherwise, it will install additional tools and libraries as it runs, depending on the chosen components (this will be explained in further sections).&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span id=&amp;quot;disk-space-requirements-and-build-time&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Disk space requirements and build time ==&lt;br /&gt;
&lt;br /&gt;
As of April 2019, building FlightGear requires about 12 [https://en.wikipedia.org/wiki/Gibibyte GiB] of disk space. Note that this includes downloaded source code for [[SimGear]] and FlightGear, generated build files and the large [[FGData]] repository (about 6 GiB for that one).&lt;br /&gt;
&lt;br /&gt;
With an Intel Core i7 860 CPU (2.80 GHz) purchased in 2009, compiling [[SimGear]] and FlightGear 2019.2 with option &amp;lt;code&amp;gt;-j8&amp;lt;/code&amp;gt; takes about 14 minutes. If you don't have a fast machine and build using only one core, it may require several hours.&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
You can get &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; {{fgmeta source&lt;br /&gt;
| path = download_and_compile.sh&lt;br /&gt;
| text = from FGMeta &lt;br /&gt;
}}. It is contained in the [[FGMeta]] repository, which is maintained by the FlightGear developers. The script can be downloaded from the link given above, however, for easier updates and in order to have the command &amp;lt;code&amp;gt;download_and_compile.sh --version&amp;lt;/code&amp;gt; work as intended, it is recommended to get it as explained [[#getting-download-and-compile-sh-using-an-fgmeta-clone|below]].&lt;br /&gt;
&lt;br /&gt;
In case you build stable versions of FlightGear using either of the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; options of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, remember to update the script before trying to build a new version of FlightGear (see [[#updating-download-and-compile-sh-using-an-fgmeta-clone|Updating &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;]] below). Of course, you can update it more often in order to benefit from new features or bug fixes; this is especially useful if you are building ''next''—that is, the development branch of FlightGear.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span id=&amp;quot;getting-started-with-download-and-compile-sh&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Getting started with &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== For the impatient ===&lt;br /&gt;
&lt;br /&gt;
So, you're in a hurry, want to build FlightGear but don't want to read any explanation? You can try what follows, but be aware that you may need to come back and read part of the the following sections if you encounter a problem. All commands should be run under a normal user account; however, unless you pass option &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; or something similar to disable installation of packages from your distribution, you'll be asked for your &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt; password during execution of the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command (&amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt; is used by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to run commands like &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt;). So, here is your quick recipe for getting &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; and using it to build FlightGear:&lt;br /&gt;
 mkdir -p ~/flightgear/dnc-managed&lt;br /&gt;
 cd ~/flightgear&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;git clone https://git.code.sf.net/p/flightgear/fgmeta&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 cd ~/flightgear/dnc-managed&lt;br /&gt;
 ~/flightgear/fgmeta/download_and_compile.sh -s -j$(nproc)&lt;br /&gt;
 ./run_fgfs.sh --launcher&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option passed to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; instructs it to build the latest stable release of FlightGear. Use option &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; instead if you want the latest Long Term Stable release (it may be older but possibly more stable), or &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; for the previous LTS release. If you pass none of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; will build the ''next'' suite, which contains the development version of FlightGear. For more details on these options, see [[#Release selection|Release selection]].&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;tt&amp;gt;run_fgfs.sh --launcher&amp;lt;/tt&amp;gt; starts the [[FlightGear Qt launcher|FlightGear built-in launcher]]. This is often convenient but not compulsory. Another way to start FlightGear could be &amp;lt;code&amp;gt;./run_fgfs.sh --airport=PHTO --aircraft=c172p&amp;lt;/code&amp;gt;. There are plenty of other options, which are listed by &amp;lt;code&amp;gt;./run_fgfs.sh --help --verbose&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In some cases, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; stops and waits for your answer before continuing. This is done when there is something important that you should know. When you are used to these prompts and would rather not see them anymore, pass the &amp;lt;code&amp;gt;--non-interactive&amp;lt;/code&amp;gt; option to suppress them.&lt;br /&gt;
&lt;br /&gt;
More detailed instructions are given below. The following sections also explain how to update &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; and FlightGear.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;getting-started-with-download-and-compile-sh-notations&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Notations ===&lt;br /&gt;
&lt;br /&gt;
When a command should be run as an unpriviledged user, it will be preceded by a dollar sign:&lt;br /&gt;
 $ whoami&lt;br /&gt;
 toto&lt;br /&gt;
In contrast, a hash sign (#) means that the command must be run with superuser privileges to achieve the desired effect:&lt;br /&gt;
 # whoami&lt;br /&gt;
 root&lt;br /&gt;
&lt;br /&gt;
In order to make instructions easy to understand, two directories (= folders) will be consistently used for the same purpose below:&lt;br /&gt;
* &amp;lt;tt&amp;gt;~/flightgear/fgmeta&amp;lt;/tt&amp;gt; will contain a clone of the [[FGMeta]] repository; therefore, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; will reside in that directory;&lt;br /&gt;
* &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; will be the directory from which we run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. In other words, with this setup, a typical sequence of commands could be:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ~/flightgear/fgmeta/download_and_compile.sh&lt;br /&gt;
or&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ~/flightgear/fgmeta/download_and_compile.sh SIMGEAR FGFS DATA OSG&lt;br /&gt;
These are of course just examples. The aforementioned paths are not hardwired anywhere in the script; you are free to choose the directories you want for these purposes.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;getting-download-and-compile-sh-using-an-fgmeta-clone&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Getting &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; the “right way” ===&lt;br /&gt;
&lt;br /&gt;
There are several ways to obtain [https://sourceforge.net/p/flightgear/fgmeta/ci/next/tree/download_and_compile.sh download_and_compile.sh]. The method described here makes it very easy to update the script and causes the command &amp;lt;code&amp;gt;download_and_compile.sh --version&amp;lt;/code&amp;gt; to work as intended.&lt;br /&gt;
&lt;br /&gt;
As explained in [[#getting-started-with-download-and-compile-sh-notations|Notations]], we want to clone the [[FGMeta]] repository in &amp;lt;tt&amp;gt;~/flightgear/fgmeta&amp;lt;/tt&amp;gt; and work with its ''next'' branch. Let's go:&lt;br /&gt;
 $ mkdir -p ~/flightgear&lt;br /&gt;
 $ cd ~/flightgear&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;$ git clone -b next https://git.code.sf.net/p/flightgear/fgmeta&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
You now have a fresh FGMeta clone in &amp;lt;tt&amp;gt;~/flightgear/fgmeta&amp;lt;/tt&amp;gt; and your brand new &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; script is located in that directory. You can already try it to see the available options:&lt;br /&gt;
&amp;lt;pre&amp;gt;$ ~/flightgear/fgmeta/download_and_compile.sh --help&lt;br /&gt;
download_and_compile.sh [OPTION...] [--] [COMPONENT...]&lt;br /&gt;
Download and compile components belonging to the FlightGear ecosystem.&lt;br /&gt;
&lt;br /&gt;
Without any COMPONENT listed, or if ALL is specified, recompile all&lt;br /&gt;
components listed in the WHATTOBUILDALL variable. Each COMPONENT may&lt;br /&gt;
be one of the following words:&lt;br /&gt;
&lt;br /&gt;
  ALL, CMAKE, OSG, PLIB, OPENRTI, SIMGEAR, FGFS, DATA, FGRUN, FGO, FGX,&lt;br /&gt;
  OPENRADAR, ATCPIE, TERRAGEAR, TERRAGEARGUI, ZLIB.&lt;br /&gt;
&lt;br /&gt;
Available options:&lt;br /&gt;
  -h, --help    show this help message and exit&lt;br /&gt;
      --version print version and license information, then exit&lt;br /&gt;
&lt;br /&gt;
(...)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;updating-download-and-compile-sh-using-an-fgmeta-clone&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Updating &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Now that you have &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; from the [[FGMeta]] repository, it is very easy to update (this assumes you didn't modify anything yourself inside &amp;lt;tt&amp;gt;~/flightgear/fgmeta&amp;lt;/tt&amp;gt;!):&lt;br /&gt;
 $ cd ~/flightgear/fgmeta &amp;amp;&amp;amp; git pull&lt;br /&gt;
&lt;br /&gt;
If you want to keep updates as easy as we just showed, it is best not to modify &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; yourself. &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; has plenty of options that usually make it unnecessary to modify the script. Just run &amp;lt;code&amp;gt;download_and_compile.sh --help&amp;lt;/code&amp;gt; and learn about the available options when you feel the need to change something. Unless you have special needs that can only be accomodated by modifying &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, you are invited to skip to the next section.&lt;br /&gt;
&lt;br /&gt;
If you really, ''really'' want to modify &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; while keeping updates easy, a good technique is to add your changes to your FGMeta clone in the form of one or more Git ''commits'' (no need to push them anywhere, commits can remain in your clone). How to do that is beyond the scope of this document, though; read Git tutorials if you want to learn it (there are plenty on the Internet). Once you have committed your changes to your FGMeta clone, make sure the repository is clean (use &amp;lt;code&amp;gt;git status&amp;lt;/code&amp;gt;), then update it with:&lt;br /&gt;
 $ cd ~/flightgear/fgmeta &amp;amp;&amp;amp; git pull --rebase&lt;br /&gt;
This will apply your commits on top of the latest commit of the branch that is currently checked out, which so far contained the official version of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. In case your changes conflict with the update, Git will tell you and you'll have to resolve the conflict manually (look for “Git resolve conflict” on your favorite search engine)... or start again from a pristine [[FGMeta]] clone.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;using-download-and-compile-sh-to-build-flightgear&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Building FlightGear ===&lt;br /&gt;
&lt;br /&gt;
In what follows, we won't give the full path to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; when showing commands to be run, but you should prepend it to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; whenever you see a &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command. For instance, if you used the same path as in [[#getting-started-with-download-and-compile-sh-notations|Notations]] and see the command:&lt;br /&gt;
 $ download_and_compile.sh --help&lt;br /&gt;
what you should actually run is:&lt;br /&gt;
 $ ~/flightgear/fgmeta/download_and_compile.sh --help&lt;br /&gt;
&lt;br /&gt;
Apart from this harmless command, ''do not'' run other &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; commands from an arbitrary directory, in particular ''don't'' run them from &amp;lt;tt&amp;gt;~/flightgear/fgmeta&amp;lt;/tt&amp;gt;. This is because '''most other &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; commands write to the current directory''' (&amp;lt;code&amp;gt;download_and_compile.sh --help&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;download_and_compile.sh --version&amp;lt;/code&amp;gt; are safe to run from any directory, though).&lt;br /&gt;
&lt;br /&gt;
Of course, it is always possible to make commands shorter by setting up aliases (see tips at the end of [https://sourceforge.net/p/flightgear/mailman/message/36634426/ this message]), by adding the directory containing &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to your &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; or by creating a symbolink link pointing to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in a directory that is part of your &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt;. This is not necessary, though; do it only if you feel the need (when enabled, persistent shell history is often enough to obviate the need to extend the &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
{{Note|The following commands should be run from an empty directory&amp;lt;ref name=&amp;quot;dedicated-directory-won-t-stay-empty-forever&amp;quot;&amp;gt;Well, empty before the first time; later, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is going to populate it with plenty of FlightGear files and subdirectories, of course.&amp;lt;/ref&amp;gt; in a partition that has enough free space (see [[#disk-space-requirements-and-build-time | Disk space requirements and build time]]). As explained in [[#getting-started-with-download-and-compile-sh-notations|Notations]], we are going to choose the directory &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; for this purpose, in order to express that the whole directory tree is managed by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. This is just an example; feel free to choose another directory if you want.&lt;br /&gt;
&lt;br /&gt;
'''Don't run the commands from a non-dedicated directory,''' because it will be filled with files and directories created by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; and the FlightGear, SimGear, etc. build systems. That would be a complete mess! In particular, ''don't'' run the commands from the directory containing your [[FGMeta]] clone.}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|For some commands, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; may use &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;. In case you want to run some other program instead of &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;, this can be done with the &amp;lt;code&amp;gt;--sudo&amp;lt;/code&amp;gt; option of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. For instance, in order to see the commands that would be run with sudo without actually running them, you can pass &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;--sudo=echo&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. Like all other options, &amp;lt;code&amp;gt;--sudo&amp;lt;/code&amp;gt; must be given ''before'' all arguments that are component names (such as &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, etc.).}}&lt;br /&gt;
&lt;br /&gt;
The package manager used by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; by default is &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; (it won't be used if you pass &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; the &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; option). You can use another one if you wish, as long as it supports the following calls:&lt;br /&gt;
 ''pkg-mgr'' update&lt;br /&gt;
 ''pkg-mgr'' install ''pkg1 pkg2'' ...&lt;br /&gt;
This is the case for &amp;lt;tt&amp;gt;aptitude&amp;lt;/tt&amp;gt; as well as &amp;lt;tt&amp;gt;apt&amp;lt;/tt&amp;gt;. If you want &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to use &amp;lt;tt&amp;gt;aptitude&amp;lt;/tt&amp;gt;, give it the option &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;--package-manager=aptitude&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; before any of the ''COMPONENT'' arguments.&lt;br /&gt;
&lt;br /&gt;
All options of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; can be seen by running the following command:&lt;br /&gt;
 $ download_and_compile.sh --help&lt;br /&gt;
&lt;br /&gt;
Now the instructions. '''You have chosen a dedicated directory''' where all the stuff that is downloaded and built by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; will be stored. This is &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; if you followed the suggestions given in [[#getting-started-with-download-and-compile-sh-notations|Notations]], and should be empty before you run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; for the first time. However, it is quite correct to start &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; from the same directory for subsequent runs, even when non-empty (otherwise, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; would automatically reclone the repositories every time you run it; that would be a sheer waste of time and bandwidth). All that remains to do is to run:&lt;br /&gt;
 $ mkdir -p ~/flightgear/dnc-managed&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh -s -j$(nproc)&lt;br /&gt;
The &amp;lt;code&amp;gt;-j$(nproc)&amp;lt;/code&amp;gt; option is not necessary, but is likely to save you a lot of time; with it, all available CPU cores will be used when compiling—see [[#Multicore acceleration| Multicore acceleration]].&lt;br /&gt;
&lt;br /&gt;
{{Note|Because of the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option, the above &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command would build the latest stable release of FlightGear. If you want to build the latest Long Term Stable release, use &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; instead. For the previous LTS release, use &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;. If you want to build the development version of FlightGear, use none of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;, but be warned: it may very well be unstable and unsuitable for flying. For more details on these options, see [[#Release selection|Release selection]].}}&lt;br /&gt;
&lt;br /&gt;
When you don't pass any non-option argument to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; as done here, it takes care of the base components needed to run FlightGear in good conditions: &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;OSG&amp;lt;/tt&amp;gt; (these are the component names used by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, i.e., the final arguments one can optionally give in a &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command; in normal speech, they correspond to the {{simgear source&lt;br /&gt;
| text = SimGear&lt;br /&gt;
}}, {{flightgear source&lt;br /&gt;
| text = FlightGear&lt;br /&gt;
}} and {{fgdata source&lt;br /&gt;
| text = FGData&lt;br /&gt;
}} repositories as well as a suitable repository for [[OpenSceneGraph]]). Therefore, the above command is presently exactly equivalent to:&lt;br /&gt;
 $ download_and_compile.sh -s -j$(nproc) SIMGEAR FGFS DATA OSG&lt;br /&gt;
&lt;br /&gt;
In case you want to build another component such as, say, [[PLIB]], you can add it to the command, like this:&lt;br /&gt;
 $ download_and_compile.sh -s -j$(nproc) SIMGEAR FGFS DATA OSG PLIB&lt;br /&gt;
&lt;br /&gt;
When the command terminates, you should have a script called &amp;lt;tt&amp;gt;run_fgfs.sh&amp;lt;/tt&amp;gt; in the directory from which you ran &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (i.e., &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; in the suggested setup). This will be your script to run FlightGear. For instance, in order to start the [[FlightGear Qt launcher|built-in launcher]], you can run the following commands:&amp;lt;ref name=&amp;quot;no-need-to-change-to-dnc-managed-dir-before-starting-generated-scripts&amp;quot;&amp;gt;We give these commands because they are easy to read, but the &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; command is not needed if you use the correct path, as in &amp;lt;code&amp;gt;~/flightgear/dnc-managed/run_fgfs.sh --launcher&amp;lt;/code&amp;gt;.&amp;lt;/ref&amp;gt;&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgfs.sh --launcher&lt;br /&gt;
(You may omit the &amp;lt;code&amp;gt;--launcher&amp;lt;/code&amp;gt; option; this would simply start FlightGear without any launcher, at the default airport and with the default aircraft.)&amp;lt;br /&amp;gt;&lt;br /&gt;
In case you find this tedious to type or have more arguments to pass on a regular basis, you can follow the advice given at the end of [https://sourceforge.net/p/flightgear/mailman/message/36634426/ this message] or use another launcher such as [[FFGo]]—but the [[FlightGear Qt launcher|FlightGear built-in launcher]] started with &amp;lt;code&amp;gt;run_fgfs.sh --launcher&amp;lt;/code&amp;gt; is quite fine, be sure to try it first!&lt;br /&gt;
&lt;br /&gt;
{{Note|If you ran &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; from &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; as proposed above, the full path of the &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata&amp;lt;/tt&amp;gt; directory is your [[$FG_ROOT]]. This is a very important path for FlightGear; knowing this may be useful for troubleshooting or doing “advanced things.”}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;using-download-and-compile-sh-to-update-flightgear&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Updating FlightGear ===&lt;br /&gt;
&lt;br /&gt;
{{Note|If you built FlightGear with either of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;, you need to pass the ''same option'' to the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command given below that will update your FlightGear installation. Otherwise, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; will automatically build the ''next'' suite (bleeding-edge development version), which is probably not what you wish. Moreover, if you do want to switch from one suite to another (for instance from ''stable'' to ''next'', or from ''Long Term Stable'' to ''stable''), using the &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; option of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is heartily recommended.}}&lt;br /&gt;
&lt;br /&gt;
Keeping the above note in mind, go to the directory from which you previously ran &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (&amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; in the [[#Notations|suggested setup]]). This is the folder which, if you did a complete run of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; as shown in the previous section, contains the &amp;lt;tt&amp;gt;run_fgfs.sh&amp;lt;/tt&amp;gt; script and a log file named &amp;lt;tt&amp;gt;compilation_log.txt&amp;lt;/tt&amp;gt; that records what &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; did in its last run. If you wish to update, say, {{simgear source&lt;br /&gt;
| text = SimGear&lt;br /&gt;
}}, {{flightgear source&lt;br /&gt;
| text = FlightGear&lt;br /&gt;
}}, {{fgdata source&lt;br /&gt;
| text = FGData&lt;br /&gt;
}} and [[OpenSceneGraph|OSG]], simply execute this:&lt;br /&gt;
 $ download_and_compile.sh -pn -j$(nproc) SIMGEAR FGFS DATA OSG&lt;br /&gt;
The &amp;lt;code&amp;gt;-j$(nproc)&amp;lt;/code&amp;gt; option is not necessary, but is likely to save you a lot of time; with it, all available CPU cores will be used when compiling—see [[#Multicore acceleration| Multicore acceleration]].&lt;br /&gt;
&lt;br /&gt;
We'll explain the &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; in a minute. &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;OSG&amp;lt;/tt&amp;gt; are called ''components'' in &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; terminology. A component generally corresponds to a software repository, or something close. In fact, since &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;OSG&amp;lt;/tt&amp;gt; are often precisely the components people wish to update, they form the default component set, so that the previous command is equivalent (as of Sept. 2024) to:&lt;br /&gt;
 $ download_and_compile.sh -pn -j$(nproc)&lt;br /&gt;
Now about this &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt;. It is equivalent to &amp;lt;code&amp;gt;-p n&amp;lt;/code&amp;gt; and means “don't install packages from my (Linux) distribution” (&amp;lt;code&amp;gt;y&amp;lt;/code&amp;gt; means ''yes, please install'', &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; means ''no, don't install''). In case you forgot that, simply run:&lt;br /&gt;
 $ download_and_compile.sh --help&lt;br /&gt;
What does it imply to pass &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt;? This tells &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to completely skip the step where it checks for needed packages from your distribution and installs them, by default using &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt;. It thus goes straight to the following steps:&lt;br /&gt;
* update each repository corresponding to one of the selected components (&amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;OSG&amp;lt;/tt&amp;gt; in our example);&lt;br /&gt;
* compile each selected component that requires compilation;&lt;br /&gt;
* install each selected component in the appropriate place (under &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; according to our [[#getting-started-with-download-and-compile-sh-notations|Notations]]).&lt;br /&gt;
In case you don't have all required dependencies for the selected components, one of them is likely to fail, of course, since by passing &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, you forbid it to install these dependencies for you. So, you can also very well update without passing the &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; option, it will simply take a little longer (the time to check if all dependencies of the selected components are available with &amp;lt;tt&amp;gt;APT&amp;lt;/tt&amp;gt;). In fact, this is '''what you should do if the previous &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; run failed:''' first update &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (see [[#getting-download-and-compile-sh-using-an-fgmeta-clone|above]]) then run it ''without'' &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt;&amp;lt;ref name=&amp;quot;passing-no-pn-option-equals-passing-py&amp;quot;&amp;gt;Which is the same as passing &amp;lt;code&amp;gt;-py&amp;lt;/code&amp;gt;.&amp;lt;/ref&amp;gt; in case new dependencies have been recently added and you don't have them on your system yet—this would be a very likely cause for the failure. In this case, running &amp;lt;code&amp;gt;download_and_compile.sh --cleanup&amp;lt;/code&amp;gt; to restart the build from a clean state is probably a good idea (see [[#Cleaning built and installed files|Cleaning built and installed files]] for details on this option).&lt;br /&gt;
&lt;br /&gt;
'''Summary'''&lt;br /&gt;
&lt;br /&gt;
Routine update:&lt;br /&gt;
 $ download_and_compile.sh -pn -j$(nproc) ''COMPONENT...''&lt;br /&gt;
In case this fails, first update &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (see [[#getting-download-and-compile-sh-using-an-fgmeta-clone|above]]), then run&lt;br /&gt;
 $ download_and_compile.sh --cleanup&lt;br /&gt;
 $ download_and_compile.sh -j$(nproc) ''COMPONENT...''&lt;br /&gt;
where ''COMPONENT...'' stands for the space-separated list of selected components, and defaults to &amp;lt;tt&amp;gt;SIMGEAR FGFS DATA OSG&amp;lt;/tt&amp;gt; if you don't specify any.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;examining-download-and-compile-sh-history&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Examining the history of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Looking at the latest commits that affected &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is quite easy with your FGMeta clone:&lt;br /&gt;
 $ cd ~/flightgear/fgmeta&lt;br /&gt;
 $ git log -- download_and_compile.sh&lt;br /&gt;
(then quit by typing &amp;lt;tt&amp;gt;q&amp;lt;/tt&amp;gt;, assuming your &amp;lt;tt&amp;gt;$GIT_PAGER&amp;lt;/tt&amp;gt; is &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt;)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to do the same, but also see the patch for each commit:&lt;br /&gt;
 $ cd ~/flightgear/fgmeta&lt;br /&gt;
 $ git log -p -- download_and_compile.sh&lt;br /&gt;
&lt;br /&gt;
=== For the curious: the SSH way ===&lt;br /&gt;
&lt;br /&gt;
The method described below is not necessary anymore since {{fgmeta commit | 420034d5b51ff2d32fc0c3716b17a2d862841e0f}} (May 2020). What it does is teach you how to clone [[FGData]] using SSH, then change the Git remote setup in your clone of that repository to retrieve further updates using https—which is convenient, as it does not require you to provide a password. This technique used to be necessary to securely retrieve FGData because of a problem in the [https://sourceforge.net/ SourceForge] infrastructure (namely, &amp;lt;code&amp;gt;git clone&amp;lt;/code&amp;gt; from SourceForge doesn't work for the big FGData repository using https). Current versions of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; avoid the problem by proposing the user to automatically clone FGData from its [https://gitlab.com/flightgear/fgdata official mirror at GitLab], then change the Git remote setup to fetch further updates using https from SourceForge.&lt;br /&gt;
&lt;br /&gt;
Because the following method will make you connect to [https://sourceforge.net/ SourceForge] using the SSH protocol, you'll need an account on that site. If you don't already have one, go to the [https://sourceforge.net/user/registration registration page] and create an account. In all this section, we'll assume that your account name at SourceForge is ''SFusername''.&lt;br /&gt;
&lt;br /&gt;
{{Note|As explained in [[#getting-started-with-download-and-compile-sh-notations|Notations]], we assume that your Unix user name (login) is &amp;lt;tt&amp;gt;toto&amp;lt;/tt&amp;gt;. Don't confuse the &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt; password prompt (where you need to enter &amp;lt;tt&amp;gt;toto&amp;lt;/tt&amp;gt;'s password) with the password prompt for your SourceForge account! The former appears as&lt;br /&gt;
 [sudo] password for toto:&lt;br /&gt;
whereas the latter is just:&lt;br /&gt;
 Password:&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|For some commands, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; may use &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;. In case you want to run some other program instead of &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;, this can be done with the &amp;lt;code&amp;gt;--sudo&amp;lt;/code&amp;gt; option of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. For instance, in order to see the commands that would be run with sudo without actually running them, you can pass &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;--sudo=echo&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. Like all other options, &amp;lt;code&amp;gt;--sudo&amp;lt;/code&amp;gt; must be given ''before'' all arguments that are component names (such as &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, etc.).}}&lt;br /&gt;
&lt;br /&gt;
{{Note|The commands given below will build the ''next'' suite, which contains the bleeding-edge development version of FlightGear. This is likely to be unstable, possibly unsuitable for flying. If you'd rather build the latest stable release or the latest Long Term Stable release, add option &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; to all &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; commands given below (or &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; for the previous LTS release). You may add the chosen option right after the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command name (in any case, the option should come before non-option arguments such as SIMGEAR, FGFS, DATA, etc.). See [[#Release selection|Release selection]] for more explanations on options &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
Now the instructions. You have chosen a dedicated directory where all the stuff that is downloaded and built by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; will be stored. This is &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; in our example, and should be empty before you run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; for the first time. However, it is quite correct to start &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; from the same directory for subsequent runs, even when non-empty (otherwise, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; would automatically reclone the repositories every time you run it; that would be a sheer waste of time and bandwidth).&lt;br /&gt;
&lt;br /&gt;
Ready? Let's go!&lt;br /&gt;
&amp;lt;pre&amp;gt;$ mkdir -p ~/flightgear/dnc-managed&lt;br /&gt;
$ cd ~/flightgear/dnc-managed&lt;br /&gt;
$ download_and_compile.sh --git-clone-site-params SourceForge=ssh:SFusername DATA&lt;br /&gt;
**********************************************************************&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Warning: a typical SimGear + FlightGear + FGData build requires    *&lt;br /&gt;
* about 12 GiB of disk space. The compilation part may last from a   *&lt;br /&gt;
* few minutes to hours, depending on your computer.                  *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Hint: use the -j option if your CPU has several cores, as in:      *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
*         download_and_compile.sh -j$(nproc)                         *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
**********************************************************************&lt;br /&gt;
Running 'apt-get update'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
Considering a package alternative: libcurl4-openssl-dev libcurl4-gnutls-dev&lt;br /&gt;
Package alternative matched for libcurl4-openssl-dev&lt;br /&gt;
Running 'apt-get install build-essential git libcurl4-openssl-dev cmake'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
****************************************&lt;br /&gt;
**************** DATA ******************&lt;br /&gt;
****************************************&lt;br /&gt;
Fetching DATA with 'git clone ssh://SFusername@git.code.sf.net/p/flightgear/fgdata'&lt;br /&gt;
Cloning into '.'...&lt;br /&gt;
The authenticity of host 'git.code.sf.net (216.105.38.16)' can't be established.&lt;br /&gt;
ECDSA key fingerprint is SHA256:FeVkoYYBjuQzb5QVAgm3BkmeN5TTgL2qfmqz9tCPRL4.&lt;br /&gt;
Are you sure you want to continue connecting (yes/no)?&lt;br /&gt;
Warning: Permanently added 'git.code.sf.net,216.105.38.16' (ECDSA) to the list of known hosts.&lt;br /&gt;
Connection closed by 216.105.38.16 port 22&lt;br /&gt;
fatal: Could not read from remote repository.&lt;br /&gt;
&lt;br /&gt;
Please make sure you have the correct access rights&lt;br /&gt;
and the repository exists.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above messages are perfectly normal but deserve a little explanation. Here, &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt; asked us to confirm that the fingerprint sent by the remote host is that of the real &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;, as opposed to that of some malicious server ''pretending'' to be &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;. This confirmation only has to be done once, after which it is remembered thanks to &amp;lt;tt&amp;gt;~/.ssh/known_hosts&amp;lt;/tt&amp;gt;. You should visit the [https://sourceforge.net/p/forge/documentation/SSH%20Key%20Fingerprints/#fingerprint-listing page that gives the host key fingerprint of every publically-accessible SSH server at SourceForge] and carefully check that the fingerprint appearing on your terminal is listed on that page for &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;, or some matching pattern such as &amp;lt;tt&amp;gt;*.code.sf.net&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the fingerprint that is printed on your terminal is not listed on that page, answer &amp;lt;tt&amp;gt;no&amp;lt;/tt&amp;gt; to the question ''Are you sure you want to continue connecting (yes/no)?'' and copy/paste to flightgear-devel (see [[Mailing lists]]) the above message from &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt; that contains the fingerprint sent to you by the remote host which pretends to be &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;. If this happened, you should stop here and wait for answers from readers of flightgear-devel.&lt;br /&gt;
&lt;br /&gt;
From now on, we'll assume that the fingerprint you received was correct, and therefore that you have answered &amp;lt;tt&amp;gt;yes&amp;lt;/tt&amp;gt; to the ''Are you sure you want to continue connecting (yes/no)?'' question.&lt;br /&gt;
&lt;br /&gt;
In this example, it took us several minutes to verify the fingerprint of the &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt; server and confirm it to &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt;. Because of this delay, &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt; hung up on us and closed the connection. This is absolutely ''not a problem:'' we can just rerun the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command with the same arguments as the first time. Since we answered &amp;lt;tt&amp;gt;yes&amp;lt;/tt&amp;gt; to the ''Are you sure you want to continue connecting (yes/no)?'' prompt, the fingerprint of &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;'s key has been stored in &amp;lt;tt&amp;gt;~/.ssh/known_hosts&amp;lt;/tt&amp;gt;, therefore we won't get this prompt anymore. But if some server claiming to be &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt; presents a host key that has a different fingerprint in the future, &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt; will print a big fat warning that the server may belong to an attacker trying to impersonate &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;. Therefore, this SSH host key verification is very useful to protect us from future attacks (which hopefully won't happen at all).&lt;br /&gt;
&lt;br /&gt;
As said, we just rerun the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command with the same arguments:&lt;br /&gt;
&amp;lt;pre&amp;gt;$ download_and_compile.sh --git-clone-site-params SourceForge=ssh:SFusername DATA&lt;br /&gt;
**********************************************************************&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Warning: a typical SimGear + FlightGear + FGData build requires    *&lt;br /&gt;
* about 12 GiB of disk space. The compilation part may last from a   *&lt;br /&gt;
* few minutes to hours, depending on your computer.                  *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Hint: use the -j option if your CPU has several cores, as in:      *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
*         download_and_compile.sh -j$(nproc)                         *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
**********************************************************************&lt;br /&gt;
Running 'apt-get update'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
Considering a package alternative: libcurl4-openssl-dev libcurl4-gnutls-dev&lt;br /&gt;
Package alternative matched for libcurl4-openssl-dev&lt;br /&gt;
Running 'apt-get install build-essential git libcurl4-openssl-dev cmake'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
****************************************&lt;br /&gt;
**************** DATA ******************&lt;br /&gt;
****************************************&lt;br /&gt;
Fetching DATA with 'git clone ssh://SFusername@git.code.sf.net/p/flightgear/fgdata'&lt;br /&gt;
Cloning into '.'...&lt;br /&gt;
Password:&amp;lt;/pre&amp;gt;&lt;br /&gt;
As explained above, the preceding prompt is for your SourceForge password (which you could guess from the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;git clone ssh://SFusername@git.code.sf.net/p/flightgear/fgdata&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; command).&lt;br /&gt;
&amp;lt;pre&amp;gt;remote: Enumerating objects: 67011, done.&lt;br /&gt;
remote: Counting objects: 100% (67011/67011), done.&lt;br /&gt;
remote: Compressing objects: 100% (31342/31342), done.&lt;br /&gt;
remote: Total 67011 (delta 38776), reused 59640 (delta 33570)&lt;br /&gt;
Receiving objects: 100% (67011/67011), 2.60 GiB | 313.00 KiB/s, done.&lt;br /&gt;
Resolving deltas: 100% (38776/38776), done.&lt;br /&gt;
Checking out files: 100% (12959/12959), done.&lt;br /&gt;
Password:&amp;lt;/pre&amp;gt;&lt;br /&gt;
(It will take a fair amount of time to get there, because this is the complete download of [[FGData]].)&amp;lt;br /&amp;gt;&lt;br /&gt;
This is again a prompt for your SourceForge password, because &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; wants to run &amp;lt;code&amp;gt;git pull --rebase&amp;lt;/code&amp;gt; in the repository (admittedly, it's a bit dumb after a &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; operation—please forgive us). In case you were not monitoring the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; operation, you probably saw the password prompt way after &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt; got bored waiting for you and closed our second connection:&lt;br /&gt;
&amp;lt;pre&amp;gt;Connection closed by 216.105.38.16 port 22&lt;br /&gt;
fatal: Could not read from remote repository.&lt;br /&gt;
&lt;br /&gt;
Please make sure you have the correct access rights&lt;br /&gt;
and the repository exists.&amp;lt;/pre&amp;gt;&lt;br /&gt;
(if not, there should be no error message and you should have a clean FGData clone)&amp;lt;br /&amp;gt;&lt;br /&gt;
No worries. Just as before, simply rerun the command with the same arguments:&lt;br /&gt;
&amp;lt;pre&amp;gt;$ download_and_compile.sh --git-clone-site-params SourceForge=ssh:SFusername DATA&lt;br /&gt;
**********************************************************************&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Warning: a typical SimGear + FlightGear + FGData build requires    *&lt;br /&gt;
* about 12 GiB of disk space. The compilation part may last from a   *&lt;br /&gt;
* few minutes to hours, depending on your computer.                  *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Hint: use the -j option if your CPU has several cores, as in:      *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
*         download_and_compile.sh -j$(nproc)                         *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
**********************************************************************&lt;br /&gt;
Running 'apt-get update'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
Considering a package alternative: libcurl4-openssl-dev libcurl4-gnutls-dev&lt;br /&gt;
Package alternative matched for libcurl4-openssl-dev&lt;br /&gt;
Running 'apt-get install build-essential git libcurl4-openssl-dev cmake'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
****************************************&lt;br /&gt;
**************** DATA ******************&lt;br /&gt;
****************************************&lt;br /&gt;
DATA: the repository already exists&lt;br /&gt;
Password:&lt;br /&gt;
Already up to date.&lt;br /&gt;
Current branch next is up to date.&lt;br /&gt;
Already on 'next'&lt;br /&gt;
Your branch is up to date with 'origin/next'.&lt;br /&gt;
All optional package alternatives have found a matching package.&lt;br /&gt;
&lt;br /&gt;
download_and_compile.sh has finished to work.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There we are! You now have a clean, up-to-date [[FGData]] clone in &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata&amp;lt;/tt&amp;gt; (remember: &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; is the directory from which you ran &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;). Note this place: the full path of the &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata&amp;lt;/tt&amp;gt; directory is your [[$FG_ROOT]].&lt;br /&gt;
&lt;br /&gt;
Now, change the protocol to use for future updates of your FGData clone:&amp;lt;ref name=&amp;quot;changing-the-protocol-for-a-git-remote-manual-method&amp;quot;&amp;gt;Another way would be to manually change the relevant line starting with &amp;lt;code&amp;gt;url = &amp;lt;nowiki&amp;gt;ssh://SFusername@&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;origin&amp;lt;/code&amp;gt; remote in the &amp;lt;tt&amp;gt;.git/config&amp;lt;/tt&amp;gt; file that lives inside your repository clone (i.e., &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata/.git/config&amp;lt;/tt&amp;gt; in our example).&amp;lt;/ref&amp;gt;&lt;br /&gt;
 (cd install/flightgear/fgdata &amp;amp;&amp;amp; \&lt;br /&gt;
 git remote set-url origin &amp;lt;nowiki&amp;gt;https://git.code.sf.net/p/flightgear/fgdata&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
(you can check at any time the protocol(s) in use with the command &amp;lt;code&amp;gt;git remote -v&amp;lt;/code&amp;gt; run inside a Git repository—in this case, inside the folder &amp;lt;tt&amp;gt;install/flightgear/fgdata&amp;lt;/tt&amp;gt;). As a consequence of this change, all future updates of your FGData clone will use the &amp;lt;tt&amp;gt;https&amp;lt;/tt&amp;gt; protocol, therefore you won't be prompted anymore for your SourceForge password.&lt;br /&gt;
&lt;br /&gt;
All that remains to do is to run, from the same directory as before (&amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; in our example):&lt;br /&gt;
 $ download_and_compile.sh -j$(nproc)&lt;br /&gt;
The &amp;lt;code&amp;gt;-j$(nproc)&amp;lt;/code&amp;gt; option is not necessary, but is likely to save you a lot of time; with it, all available CPU cores will be used when compiling—see [[#Multicore acceleration| Multicore acceleration]].&lt;br /&gt;
&lt;br /&gt;
Assuming the compilation was successful, you can now start the [[FlightGear Qt launcher|FlightGear built-in launcher]] using for instance:&lt;br /&gt;
 $ ./run_fgfs.sh --launcher&lt;br /&gt;
See [[#Building FlightGear|Building FlightGear]] for more details.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span id=&amp;quot;list-of-available-components&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; List of available components ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; script is able to download, compile (when applicable) and install the following components:&lt;br /&gt;
&lt;br /&gt;
* ATCPIE (for the [[ATC-pie]] air traffic control simulation program)&lt;br /&gt;
* CMAKE (for the [https://cmake.org/ CMake] build tool—this can be useful in case CMake is too old in your distribution)&lt;br /&gt;
* DATA (for [[FGData]], the main set of data files used by FlightGear)&lt;br /&gt;
* FGFS (for FlightGear itself)&lt;br /&gt;
* FFGO (for the [[FFGo]] FlightGear launcher)&lt;br /&gt;
* FGRUN (for the [[Fgrun|FGRun]] FlightGear launcher)&lt;br /&gt;
* FGX (for the [[FGX|FGx]] FlightGear launcher&amp;lt;ref name=&amp;quot;note-on-the-status-of-FGx-support-in-download-and-compile-sh&amp;quot;&amp;gt;Support for FGx in &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; would probably benefit from a code review.&amp;lt;/ref&amp;gt;)&lt;br /&gt;
* OPENRADAR (for the [[OpenRadar]] air traffic control simulation program)&lt;br /&gt;
* OPENRTI (for [[FlightGear HLA support (High Level Architecture)#OpenRTI | OpenRTI]]&amp;lt;ref name=&amp;quot;note-on-the-status-of-OpenRTI-support-in-FG&amp;quot;&amp;gt;Note that OpenRTI is just an optional dependency for [[FlightGear high-level architecture support | HLA support]]. For the time being, you should be just fine building without it. Eventually, the idea is for HLA to replace the existing MP system and even increasingly distribute the FlightGear architecture such that more and more components can be more easily run in separate threads or even separate processes, possibly even on different machines. So this is going to be an important feature for professional users, using several computers and screens to create a comprehensive and immersive simulation environment.&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
At the moment, it is probably safe to say that HLA is only of interest to developers and people willing to play with experimental features.&amp;lt;/ref&amp;gt;)&lt;br /&gt;
* OSG (for the [[OpenSceneGraph]] library)&lt;br /&gt;
* PLIB (for the [[PLIB]] library)&lt;br /&gt;
* SIMGEAR (for the [[SimGear]] library—foundation for FlightGear and TerraGear)&lt;br /&gt;
* TERRAGEAR (for the [[TerraGear]] terrain building toolchain)&lt;br /&gt;
* TERRAGEARGUI (for [[TerraGear GUI]], a graphical interface for TerraGear)&lt;br /&gt;
* ZLIB (for the [http://www.zlib.net/ zlib] compression library)&lt;br /&gt;
&lt;br /&gt;
Each of the items listed above is a ''component'' in &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; terminology. Components are written in uppercase by convention.&lt;br /&gt;
&lt;br /&gt;
{{Note|The preceding list might not be up-to-date. The up-to-date list of components supported by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; can always be obtained by running &amp;lt;code&amp;gt;download_and_compile.sh --help&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
What is the point of knowing this? Because you may pass component names to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in order to tell it what you want to download, build and install. By default, only the components [[SimGear|SIMGEAR]], [[FlightGear|FGFS]], [[FGData|DATA]] and [[OpenSceneGraph|OSG]] are taken care of, which means that the command:&lt;br /&gt;
 $ download_and_compile.sh&lt;br /&gt;
is equivalent to:&lt;br /&gt;
 $ download_and_compile.sh SIMGEAR FGFS DATA OSG&lt;br /&gt;
&lt;br /&gt;
In case you'd like to do the same build with just [[PLIB]] added, you could use:&lt;br /&gt;
 $ download_and_compile.sh SIMGEAR FGFS DATA OSG PLIB&lt;br /&gt;
&lt;br /&gt;
You get the idea. When several components are passed on the same command line, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; chooses a reasonable order for processing, so don't worry about that.&lt;br /&gt;
&lt;br /&gt;
== When building ''next'', you may encounter problems ==&lt;br /&gt;
&lt;br /&gt;
Keeping in mind that this script compiles sometimes bleeding edge software, it can happen that what was successfully compiling last week, does not compile anymore today. Building the latest stable version (option &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;) or the latest Long Term Stable release (option &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;) should always work, unless there is a problem with the script (well, in some cases, there may be packages of your distribution that are too recent for &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;; for instance, in July 2020, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; didn't build with OpenSceneGraph 3.6, but simply passing the OSG component on the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command solved the problem, because at that time, option &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; selected OpenSceneGraph 3.4).&lt;br /&gt;
&lt;br /&gt;
That said, you may want to build the development version (called ''next''): this is the one developers use all the time, so kindly asking on the flightgear-devel [[Mailing_lists|mailing list]] in case a problem popped up&amp;lt;ref name=&amp;quot;what-to-provide-when-asking-for-help&amp;quot;&amp;gt;Don't forget in this case to precisely tell what you did and include the &amp;lt;tt&amp;gt;compilation_log.txt&amp;lt;/tt&amp;gt; file written by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;.&amp;lt;/ref&amp;gt; should allow you to find good advice and get the problem quickly fixed, if it's a new one.&lt;br /&gt;
&lt;br /&gt;
{{Warning|As of July 2020, heavy development will be done on ''next'', the development branch of FlightGear. It is expected to be rather unstable for several months. Unless you are really interested in FlightGear development or in providing feedback to the developers, you're probably better off building either the latest stable version (option &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;) or the latest Long Term Stable release (option &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;). In case you want something even older, the previous LTS release can be selected with option &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
== Task-specific instructions ==&lt;br /&gt;
&lt;br /&gt;
{{Note|In this section, we assume you've read and followed the advice given in [[#getting-started-with-download-and-compile-sh|Getting started with &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;]].}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;selecting-the-components-to-work-on&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Selecting the components to build ===&lt;br /&gt;
&lt;br /&gt;
By default, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; downloads or updates, then compiles, [[SimGear]], FlightGear, [[FGData]] and [[OpenSceneGraph|OSG]] (more precisely, FGData is downloaded but not compiled—that wouldn't make sense). This is what happens when running:&lt;br /&gt;
 $ download_and_compile.sh&lt;br /&gt;
The preceding command is therefore equivalent to:&lt;br /&gt;
 $ download_and_compile.sh SIMGEAR FGFS DATA OSG&lt;br /&gt;
&lt;br /&gt;
To make &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; take care of other programs or libraries, use non-option arguments naming the ''components'' you want, for instance:&lt;br /&gt;
 $ download_and_compile.sh SIMGEAR FGFS DATA OSG CMAKE&lt;br /&gt;
SIMGEAR, FGFS, DATA, OSG and CMAKE are the component names respectively corresponding to [[SimGear]], FlightGear, [[FGData]], [[OpenSceneGraph]] and [https://cmake.org/ CMake] in &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;'s terminology.&lt;br /&gt;
&lt;br /&gt;
A [[#list-of-available-components|list of available components]] is provided on this page, but the fully up-to-date list can always be obtained by running &amp;lt;code&amp;gt;download_and_compile.sh --help&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Choosing between stable and development versions ===&lt;br /&gt;
&lt;br /&gt;
By default, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; fetches code and data from development branches of the source repositories (which sometimes causes compilation or runtime errors). However, it is possible to tell the script to download the latest “stable” version of each component, for some suitable definition of “stable”. This is by means of the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; options:&lt;br /&gt;
 $ download_and_compile.sh -s ''COMPONENT1 COMPONENT2...''&lt;br /&gt;
or&lt;br /&gt;
 $ download_and_compile.sh --lts ''COMPONENT1 COMPONENT2...''&lt;br /&gt;
or&lt;br /&gt;
 $ download_and_compile.sh --old-lts ''COMPONENT1 COMPONENT2...''&lt;br /&gt;
&lt;br /&gt;
How does it work?&lt;br /&gt;
* For [[SimGear]], FlightGear and [[FGData]], &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; uses the most recent stable release branch of the corresponding Git repository, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; uses the most recent Long Term Stable release (LTS) and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; uses the previous LTS release.&lt;br /&gt;
* For other components, a known-stable version is selected by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, which may be influenced by the use of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
So, as far as the SIMGEAR, FGFS and DATA components are concerned, you can:&lt;br /&gt;
* build the latest stable release (&amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;);&lt;br /&gt;
* build the latest Long Term Stable release (&amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;);&lt;br /&gt;
* build the previous Long Term Stable release (&amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;);&lt;br /&gt;
* build the current development version (bleeding edge), which lives in the {{flightgear source&lt;br /&gt;
| branch = next&lt;br /&gt;
| text = next&lt;br /&gt;
}} branch of the FlightGear repository.&lt;br /&gt;
The use of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; also influences the version of other components you may have selected (this can be overridden using &amp;lt;code&amp;gt;--component-branch&amp;lt;/code&amp;gt; for advanced users—see [[#Component-specific settings|Component-specific settings]]).&lt;br /&gt;
&lt;br /&gt;
{{Note|In a given folder where &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is run, you should normally either always use the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option, or always use &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;, or always use &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;, or always none of these (in other words, stick to the same suite: latest stable, latest LTS, previous LTS or ''next'', consistently accross all components).}}&lt;br /&gt;
&lt;br /&gt;
Actually, it ''is'' possible to switch between suites but you have to use the &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; option when doing the switch (see [[#Cleaning built and installed files|Cleaning built and installed files]] for information on this option). For instance:&lt;br /&gt;
* Build with &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; as many times as you want.&lt;br /&gt;
* Want to try ''next''? Okay, then build once with &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; (no &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option anymore).&lt;br /&gt;
* You can then perform as many builds of ''next'' as you want; no need to use &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; unless something special went wrong.&lt;br /&gt;
* If you later decide to switch back to the stable release, build once with &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt;, then only with &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; for further builds.&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
This way, ''you don't need to download the repositories again'' when trying the various suites. In particular, you can switch between ''next'', stable, LTS and old LTS without downloading nor having several copies of [[FGData]] on your hard drive. (This works because a Git repository may internally contain data for several branches, even if only one is “normally visible” in the filesystem at a given time.)&lt;br /&gt;
&lt;br /&gt;
==== Building the latest Long Term Stable release of FlightGear ====&lt;br /&gt;
&lt;br /&gt;
When executing &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, use the &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; option to build the latest Long Term Stable release: &lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh --lts&lt;br /&gt;
(In this example, the implicitly-selected components are SIMGEAR, FGFS and DATA, as explained [[#selecting-the-components-to-work-on | above]].)&lt;br /&gt;
&lt;br /&gt;
{{Note|If you decide to use the &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; option in a given directory tree, you should use it for all components in that directory tree (SIMGEAR, FGFS, DATA, etc.). Running &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in a given directory with the &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; option for some components and not for others is not supported.}}&lt;br /&gt;
&lt;br /&gt;
==== Building the latest stable release of FlightGear ====&lt;br /&gt;
&lt;br /&gt;
When executing &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, use the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option to build the latest stable release: &lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh -s&lt;br /&gt;
&lt;br /&gt;
{{Note|If you decide to use the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option in a given directory tree, you should use it for all components in that directory tree (SIMGEAR, FGFS, DATA, etc.). Running &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in a given directory with the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option for some components and not for others is not supported.}}&lt;br /&gt;
&lt;br /&gt;
==== Building the current FlightGear development version ====&lt;br /&gt;
&lt;br /&gt;
When executing &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; without any option, the development version of every selected component is built:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh&lt;br /&gt;
&lt;br /&gt;
{{Note|The development version of FlightGear changes on an almost daily basis. It provides the latest features, but is not guaranteed to always work reliably. If you don't want to take the risk of finding new bugs when updating, you may prefer to use the latest stable release.}}&lt;br /&gt;
&lt;br /&gt;
==== Building the previous Long Term Stable release of FlightGear ====&lt;br /&gt;
&lt;br /&gt;
When executing &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, use the &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; option to build the previous Long Term Stable release (i.e., oldish code): &lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh --old-lts&lt;br /&gt;
(In this example, the implicitly-selected components are SIMGEAR, FGFS and DATA, as explained [[#selecting-the-components-to-work-on | above]].)&lt;br /&gt;
&lt;br /&gt;
{{Note|If you decide to use the &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; option in a given directory tree, you should use it for all components in that directory tree (SIMGEAR, FGFS, DATA, etc.). Running &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in a given directory with the &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; option for some components and not for others is not supported.}}&lt;br /&gt;
&lt;br /&gt;
=== Overriding the source repository or branch for a component ===&lt;br /&gt;
&lt;br /&gt;
This section shows how to override the location and/or branch from which a given component will be downloaded.&lt;br /&gt;
&lt;br /&gt;
{{Warning|The rest of this section is for people who know what they are doing. Don't use the following unless you trust the person who publishes the repository and have good reasons to believe that it has been kept up-to-date.}}&lt;br /&gt;
&lt;br /&gt;
==== A short example ====&lt;br /&gt;
&lt;br /&gt;
Let's start with an example to make it easier to understand to following paragraphs. Suppose we want to build the current stable release of FlightGear, linked against an [[OpenSceneGraph]] library whose source code is to be retrieved from branch &amp;lt;tt&amp;gt;fgfs-osg-36-2&amp;lt;/tt&amp;gt; of the Git repository located at [https://gitlab.com/flightgear/openscenegraph.git https://gitlab.com/flightgear/openscenegraph.git] (this is actually the default in September 2024). Since the default protocol used when &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; clones a repository is [https://en.wikipedia.org/wiki/HTTPS HTTPS], this can be done with&lt;br /&gt;
 download_and_compile.sh --cleanup -s \&lt;br /&gt;
 --override-repo OSG=GitLab:gitlab.com/flightgear/openscenegraph.git \&lt;br /&gt;
 --component-branch OSG=fgfs-osg-36-2 SIMGEAR FGFS DATA OSG&lt;br /&gt;
&lt;br /&gt;
==== The site name ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; uses case-insensitive short names such as &amp;lt;tt&amp;gt;GitHub&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;SourceForge&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;gitlab.kitware.com&amp;lt;/tt&amp;gt; as keys in order to identify the settings describing where and how a given component will be initially fetched (these settings are effective at clone time; later updates simply use the settings recorded in the local repository). These names are referred to as ''site'' in the output of &amp;lt;code&amp;gt;download_and_compile.sh --help&amp;lt;/code&amp;gt;, in particular in the &amp;lt;tt&amp;gt;--git-clone-site-params&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;--override-repo&amp;lt;/tt&amp;gt; options we'll present below. These ''site'' keys are simply identifier strings; they are not used in the DNS queries.&lt;br /&gt;
&lt;br /&gt;
==== The protocol ====&lt;br /&gt;
&lt;br /&gt;
Current &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (from December 2022) fetches the source code of most components from Git repositories (earlier versions used Subversion for some components); a few non-core components (currently [[FGo!]] and [[OpenRadar]]) are fetched using &amp;lt;tt&amp;gt;wget&amp;lt;/tt&amp;gt; and are out-of-scope for this section.&lt;br /&gt;
&lt;br /&gt;
The default protocol used by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; when cloning a Git repository is [https://en.wikipedia.org/wiki/HTTPS HTTPS]. This can be overridden using the &amp;lt;tt&amp;gt;--git-clone-default-proto&amp;lt;/tt&amp;gt; option. In other words, the default is &amp;lt;tt&amp;gt;--git-clone-default-proto=https&amp;lt;/tt&amp;gt; (the protocol name is case-insensitive). Other possibilities for the protocol are &amp;lt;tt&amp;gt;git&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Warning|The &amp;lt;tt&amp;gt;git&amp;lt;/tt&amp;gt; protocol doesn't protect against man-in-the-middle attacks; use at your own risk! Unfortunately, “clever” people often recommend it on the forum without mentioning its downsides.}}&lt;br /&gt;
&lt;br /&gt;
Using the &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt; protocol as the argument of &amp;lt;tt&amp;gt;--git-clone-default-proto&amp;lt;/tt&amp;gt; has little use, because in general you'll want to specify a particular username when using SSH and this username is likely not to be the same for all components you intend to clone via SSH (right, &amp;lt;tt&amp;gt;~/.ssh/config&amp;lt;/tt&amp;gt; can be used to automatically provide a site-dependent username). That is why &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; offers the &amp;lt;tt&amp;gt;--git-clone-site-params&amp;lt;/tt&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
==== Site-specific settings ====&lt;br /&gt;
&lt;br /&gt;
Using&lt;br /&gt;
 --git-clone-site-params ''SITE''=''PROTOCOL''[:''USERNAME'']&lt;br /&gt;
you can tell &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; that every component fetched from ''SITE'' should be cloned with the specified protocol and username (allowed protocols are &amp;lt;tt&amp;gt;https&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;git&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
{{Note|In case you have several repositories at a given site (say, GitHub) and need to use different SSH usernames for these repositories, you can use different site names:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--override-repo COMPONENT_A=GitHubA:ADDRESS_A&lt;br /&gt;
--git-clone-site-params GitHubA=ssh:userA&lt;br /&gt;
--override-repo COMPONENT_B=GitHubB:ADDRESS_B&lt;br /&gt;
--git-clone-site-params GitHubB=ssh:userB&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here, the site names are &amp;lt;tt&amp;gt;GitHubA&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;GitHubB&amp;lt;/tt&amp;gt;; the &amp;lt;tt&amp;gt;--override-repo&amp;lt;/tt&amp;gt; option will be presented below.&lt;br /&gt;
&lt;br /&gt;
By default, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; case-insensitively uses the &amp;lt;tt&amp;gt;GitHub&amp;lt;/tt&amp;gt; (resp. &amp;lt;tt&amp;gt;SourceForge&amp;lt;/tt&amp;gt;) site name to identify the settings used when cloning a repository from github.com (resp. git.code.sf.net). Therefore, the settings for GitHubA and GitHubB in this example would only apply to components ''c'' for which --override-repo ''c''&amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt;GitHubA:... or --override-repo ''c''&amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt;GitHubB:... has been specified.}}&lt;br /&gt;
&lt;br /&gt;
==== Component-specific settings ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;--override-repo&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;--component-branch&amp;lt;/tt&amp;gt; options allow one to override the default settings used by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; for cloning the repository corresponding to the specified component (they only apply to components whose source code is retrieved with Git). The syntax of these options is&lt;br /&gt;
 --override-repo ''COMPONENT''=''SITE'':''ADDRESS''&lt;br /&gt;
and&lt;br /&gt;
 --component-branch ''COMPONENT''=''BRANCH''&lt;br /&gt;
In this syntax:&lt;br /&gt;
* ''COMPONENT'' represents the name of a component for &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (e.g., &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;—see [[#List of available components|List of available components]]);&lt;br /&gt;
* ''ADDRESS'' is something like &amp;lt;tt&amp;gt;git.code.sf.net/p/flightgear/simgear&amp;lt;/tt&amp;gt; (don't include any &amp;lt;tt&amp;gt;protocol://&amp;lt;/tt&amp;gt; part in ''ADDRESS'');&lt;br /&gt;
* ''BRANCH'' should be the name of an existing branch of the Git repository hosted at ''ADDRESS'';&lt;br /&gt;
* ''SITE'' is a string used as a key in a mapping; &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; uses it to find out how to connect to ''ADDRESS'' in order to clone the repository for ''COMPONENT'' (see [[#Site-specific settings|Site-specific settings]]).&lt;br /&gt;
See the [[#A short example|above example]] for a concrete example where these options are used.&lt;br /&gt;
&lt;br /&gt;
{{Note|The argument of any long option of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; that takes an argument may be introduced immediately after the option name using an equal sign. However, in the above cases, I find this way a bit confusing because the option value ''also'' uses an equal sign as separator. Hence the above use of separate command arguments: one for the option name, one for its argument.}}&lt;br /&gt;
&lt;br /&gt;
=== Passing custom arguments to CMake ===&lt;br /&gt;
&lt;br /&gt;
Sometimes, when building a program, you may want to enable a feature that is not enabled by default, or disable a feature that is enabled by default. With recent versions of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (October 2020 or later), this can be done for SimGear and FlightGear using the &amp;lt;code&amp;gt;--sg-cmake-arg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--fg-cmake-arg&amp;lt;/code&amp;gt; options (the environment variables &amp;lt;tt&amp;gt;SG_CMAKEARGS&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;FG_CMAKEARGS&amp;lt;/tt&amp;gt; are still supported, but they don't allow one to pass arguments containing spaces). For instance, in order to link SimGear with the system Expat library, you can do:&lt;br /&gt;
 $ download_and_compile.sh --sg-cmake-arg='-DSYSTEM_EXPAT=ON' SIMGEAR&lt;br /&gt;
Similarly, disabling HID-based input when building FlightGear can be achieved this way:&lt;br /&gt;
 $ download_and_compile.sh --fg-cmake-arg='-DENABLE_HID_INPUT=OFF' FGFS&lt;br /&gt;
&lt;br /&gt;
{{Note|Such options are typically defined in &amp;lt;tt&amp;gt;CMakeLists.txt&amp;lt;/tt&amp;gt; files, for example {{simgear source&lt;br /&gt;
| path = CMakeLists.txt&lt;br /&gt;
| text = here&lt;br /&gt;
}} for SimGear and {{flightgear source&lt;br /&gt;
| path = CMakeLists.txt&lt;br /&gt;
| text = here&lt;br /&gt;
}} for FlightGear.}}&lt;br /&gt;
&lt;br /&gt;
This can be useful, for instance, to work around bugs in a part of SimGear or FlightGear that you don't need, but causes a build or runtime failure (see {{forum link|t=35740|text=here}} for example). This is often convenient when using the development version of FlightGear, but doesn't mean such bugs shouldn't be reported!&lt;br /&gt;
&lt;br /&gt;
If you have several such options to pass, just use &amp;lt;code&amp;gt;--sg-cmake-arg&amp;lt;/code&amp;gt; and/or &amp;lt;code&amp;gt;--fg-cmake-arg&amp;lt;/code&amp;gt; several times:&lt;br /&gt;
 $ download_and_compile.sh --fg-cmake-arg='-DENABLE_SWIFT=ON' \&lt;br /&gt;
                           --fg-cmake-arg='-DENABLE_HID_INPUT=OFF' FGFS&lt;br /&gt;
It is even possible to pass arguments containing spaces to CMake, as in:&lt;br /&gt;
 $ download_and_compile.sh \&lt;br /&gt;
     --sg-cmake-arg='-DCMAKE_CXX_FLAGS=-Wno-deprecated-declarations -Wall' \&lt;br /&gt;
     SIMGEAR&lt;br /&gt;
(just a silly example to show a working syntax) or:&lt;br /&gt;
 $ download_and_compile.sh \&lt;br /&gt;
     --fg-cmake-arg=&amp;quot;-DCMAKE_CXX_FLAGS=$(pkg-config --cflags gl)&amp;quot; \&lt;br /&gt;
     FGFS&lt;br /&gt;
Note the use of double-quotes here to enable the &amp;lt;code&amp;gt;$(...)&amp;lt;/code&amp;gt; command substitution.&lt;br /&gt;
&lt;br /&gt;
Using the (half-deprecated) environment variables &amp;lt;tt&amp;gt;SG_CMAKEARGS&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;FG_CMAKEARGS&amp;lt;/tt&amp;gt;, it is also possible to define CMake arguments in a single place that are going to be used for both SimGear and FlightGear. However, this technique doesn't allow one to pass arguments containing spaces to CMake.&lt;br /&gt;
 $ export SG_CMAKEARGS='-DSYSTEM_EXPAT=ON'&lt;br /&gt;
 $ export FG_CMAKEARGS='-DENABLE_SWIFT=ON -DENABLE_HID_INPUT=OFF'&lt;br /&gt;
 $ download_and_compile.sh&lt;br /&gt;
&lt;br /&gt;
=== Seeing the compilation commands run by Make ===&lt;br /&gt;
&lt;br /&gt;
As a simple application of the previous section, the following options are often useful. When passed to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, these options cause the compilation commands run via Make to be printed on the terminal and recorded in the compilation_log.txt file:&lt;br /&gt;
  --sg-cmake-arg='-DCMAKE_VERBOSE_MAKEFILE=1' \&lt;br /&gt;
  --fg-cmake-arg='-DCMAKE_VERBOSE_MAKEFILE=1'&lt;br /&gt;
(the backslash is unneeded if you put both options on the same line). Passing the value 0 instead of 1 would explicitly request the default, non-verbose behavior.&lt;br /&gt;
&lt;br /&gt;
=== Launching FlightGear ===&lt;br /&gt;
&lt;br /&gt;
When using &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, apart from those installed with the package manager, the FlightGear dependencies (which are typically libraries) are not installed system-wide but under the directory from which &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; was run. This makes it possible to easily use, for instance, different [[OpenSceneGraph]], [[SimGear]] and FlightGear versions on a single system—e.g., for testing purposes—but also to have separate build trees (optimized/debug). This is also why you either need to set LD_LIBRARY_PATH to run the built programs, or simply use the scripts created by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in the directory where it is run, such as &amp;lt;tt&amp;gt;run_fgfs.sh&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;run_fgfs_debug.sh&amp;lt;/tt&amp;gt;: these scripts automatically set up the required environment variables according to your build settings before firing the desired program (e.g., &amp;lt;tt&amp;gt;fgfs&amp;lt;/tt&amp;gt;) with the arguments you provided. &lt;br /&gt;
&lt;br /&gt;
Therefore, the simplest way to run a FlightGear program built by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is to launch the &amp;lt;tt&amp;gt;run_fgfs.sh&amp;lt;/tt&amp;gt; script that &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; created in the directory from which it was run, for example:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgfs.sh --launcher&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;./run_fgfs.sh --launcher&amp;lt;/code&amp;gt; starts FlightGear with its built-in launcher. If you just do &amp;lt;code&amp;gt;./run_fgfs.sh&amp;lt;/code&amp;gt;, FlightGear will be started without any launcher, at the default airport and with the default aircraft.}}&lt;br /&gt;
&lt;br /&gt;
In order to start FlightGear without any launcher, at a given airport (say, [https://en.wikipedia.org/wiki/Paro_Airport Paro airport], whose ICAO code is VQPR) and with a chosen aircraft, you can do:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgfs.sh --airport=VQPR --aircraft=dhc6&lt;br /&gt;
Actually, the directory change is not needed, we only gave it here for readability. Therefore, the following single command does the same:&lt;br /&gt;
 $ ~/flightgear/dnc-managed/run_fgfs.sh --airport=VQPR --aircraft=dhc6&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;avoiding-multiple-downloads-of-fgdata&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Avoiding multiple downloads of FGData ===&lt;br /&gt;
&lt;br /&gt;
Some people use &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to maintain several directory trees such as the tree starting at &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; in [[#getting-started-with-download-and-compile-sh|Getting started with &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;]] (this can be useful if you want to have one tree with programs compiled in Release mode and another tree where they are built in Debug mode, for instance). This can easily be done by running &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in each of the directories. But since [[FGData]] is so large, it may be tempting to share a single instance of this repository among several trees. This is not officially supported, but apparently can be made to work with symbolic links.&lt;br /&gt;
&lt;br /&gt;
Let's show how this can be done on an example. Suppose your master copy of FGData is in &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata&amp;lt;/tt&amp;gt;. Then the following appears to work:&lt;br /&gt;
 $ mkdir -p ~/flightgear/other-dnc-managed-tree/install/flightgear&lt;br /&gt;
 $ cd ~/flightgear/other-dnc-managed-tree/install/flightgear&lt;br /&gt;
 $ ln -s ../../../dnc-managed/install/flightgear/fgdata&lt;br /&gt;
 $ cd ~/flightgear/other-dnc-managed-tree&lt;br /&gt;
 $ download_and_compile.sh&lt;br /&gt;
&lt;br /&gt;
The last of these commands will use and update the FGData repository present in &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Warning|This can only work simply if all trees that share a given FGData repository are from the same release (e.g., current stable or development). Running a “stable“ FlightGear with FGData from the ''next'' branch or the other way round, a development version of FlightGear with FGData from a release branch, doesn't work—and FlightGear should tell you when you start it in such a situation.&lt;br /&gt;
&lt;br /&gt;
That said, people comfortable with Git can check out the correct FGData branch before building or starting FlightGear, for instance:&lt;br /&gt;
 $ cd /path/to/fgdata &amp;amp;&amp;amp; git checkout release/2019.1&lt;br /&gt;
or&lt;br /&gt;
 $ cd /path/to/fgdata &amp;amp;&amp;amp; git checkout next&lt;br /&gt;
So, this is possible but somewhat acrobatic. You've been warned.}}&lt;br /&gt;
&lt;br /&gt;
Note: there is a [[Avoiding multiple downloads of FGData on Linux|wiki article about this subject]], but it is severely outdated as of April 2019.&lt;br /&gt;
&lt;br /&gt;
== Additional programs ==&lt;br /&gt;
&lt;br /&gt;
{{Note|In this section, we assume you've read and followed the advice given in [[#getting-started-with-download-and-compile-sh|Getting started with &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;]].}}&lt;br /&gt;
&lt;br /&gt;
If you wish to get other programs (precisely: download, build and install them), you need to launch &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; with the desired component names as arguments. For instance:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh SIMGEAR FGFS DATA OSG&lt;br /&gt;
&lt;br /&gt;
See [[#list-of-available-components|above]] for the list of available components.&lt;br /&gt;
&lt;br /&gt;
=== TerraGear ===&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; with the TERRAGEAR component in order to build and install the [[TerraGear]] terrain building toolchain:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh TERRAGEAR&lt;br /&gt;
&lt;br /&gt;
This creates the following scripts in &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt;:&lt;br /&gt;
* &amp;lt;tt&amp;gt;run_genapts850.sh&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;run_ogr-decode.sh&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;run_tg-construct.sh&amp;lt;/tt&amp;gt;&lt;br /&gt;
These scripts themselves run the corresponding TerraGear tools, as expected.&lt;br /&gt;
&lt;br /&gt;
=== TerraGear GUI ===&lt;br /&gt;
&lt;br /&gt;
[[TerraGear GUI]] is a graphical interface for [[TerraGear]] written with the Qt toolkit (still Qt 4 in 2019, but it works). In order to install it, run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; with the TERRAGEARGUI component:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh TERRAGEARGUI&lt;br /&gt;
This will create a &amp;lt;tt&amp;gt;run_terrageargui.sh&amp;lt;/tt&amp;gt; script in &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt;, and also a default configuration file &amp;lt;tt&amp;gt;~/.config/TerraGear/TerraGearGUI.conf&amp;lt;/tt&amp;gt;, unless you already have one. This default configuration file contains paths to the TerraGear and [[$FG_ROOT]] directories, assuming you have installed the TERRAGEAR and DATA components.&lt;br /&gt;
&lt;br /&gt;
To run TerraGear GUI:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_terrageargui.sh&lt;br /&gt;
&lt;br /&gt;
=== FGCom ===&lt;br /&gt;
&lt;br /&gt;
{{Note|[[FGCom]] has been integrated into FlightGear long ago, therefore the following is not needed in general.}}&lt;br /&gt;
&lt;br /&gt;
[[FGCom]] is the system used by FlightGear to simulate radio communications between users. It is automatically built and installed when you tell &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to take care of the FGFS component. You can launch the standalone FGCom program by using the &amp;lt;tt&amp;gt;run_fgcom.sh&amp;lt;/tt&amp;gt; script:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgcom.sh&lt;br /&gt;
&lt;br /&gt;
=== FGRun ===&lt;br /&gt;
&lt;br /&gt;
{{Note|As of 2019, FGRun has been superseded by the [[FlightGear Qt launcher|FlightGear built-in launcher]]. The built-in launcher is the most actively maintained launcher for FlightGear. Other launchers are [[FFGo]] and [[FGX|FGx]].}}&lt;br /&gt;
&lt;br /&gt;
[[File:fgrun-page2.jpg|thumb|right]]&lt;br /&gt;
Before FlightGear had its built-in launcher (the one you get with &amp;lt;code&amp;gt;run_fgfs.sh --launcher&amp;lt;/code&amp;gt;), many users found comfortable having FlightGear launched by the graphical utility [[Fgrun|FGRun]]. This program is built and installed when &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is run with the FGRUN component. You then have to launch the &amp;lt;tt&amp;gt;run_fgrun.sh&amp;lt;/tt&amp;gt; command, for example:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgrun.sh&lt;br /&gt;
&lt;br /&gt;
FGRun will save its settings in &amp;lt;tt&amp;gt;~/.fltk/flightgear.org/fgrun.prefs&amp;lt;/tt&amp;gt;. You may want to save copies of the preferences customized for stable and next.&lt;br /&gt;
&lt;br /&gt;
=== FGo! ===&lt;br /&gt;
&lt;br /&gt;
{{Note|As of 2019, FGo! is not maintained anymore. You may want to try the built-in launcher (started with &amp;lt;code&amp;gt;run_fgfs.sh --launcher&amp;lt;/code&amp;gt;) or [[FFGo]].}}&lt;br /&gt;
&lt;br /&gt;
[[File:Fgo01.jpg|thumb|left]]&lt;br /&gt;
FGo! is a graphical utility written in [[python]]. It is downloaded and installed when &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is run with the FGO component. You then have to launch the &amp;lt;tt&amp;gt;run_fgo.sh&amp;lt;/tt&amp;gt; command, for example:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgo.sh&lt;br /&gt;
&lt;br /&gt;
Remember that the first time you run it, you have to go to open the ''Preferences'' dialog and set the paths to the &amp;lt;tt&amp;gt;fgfs&amp;lt;/tt&amp;gt; executable and to FGData.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Compilation errors ===&lt;br /&gt;
Here we are, no fear, if you wish to use programs from the cvs/svn/git repositories, you might face compilation errors that will prevent you to have a working copy of one or more of the programs provided by this script. What can be the causes that prevent us from successfully compiling? As far as I know those:&lt;br /&gt;
# Software developers introduce a new functionality with a new piece of code that prevents the compilation under your architecture, this can happen working with cvs/svn/git sources.&lt;br /&gt;
# The program refuses to compile because of a divergence in the libraries on which it depends. For example FlightGear might not compile because OSG has been modified, while OSG itself compiles fine, FG won't.&lt;br /&gt;
# One or more repositories are down and you can't get the library you need. (Both from cvs/svn/git or apt-get)&lt;br /&gt;
&lt;br /&gt;
There is a simple solution to the above errors: wait and relaunch the script after some time (hours or days), if software developers repair or synchronize their code with the newly updated libraries (which generally happens eventually), your FlightGear will compile fine as if the previous error never took place.&lt;br /&gt;
&lt;br /&gt;
Sometimes it happens that the script fails to compile only [[Fgrun|FGRun]], [[FGCom]] or atlas, if you then see the run_fgfs.sh file it means that FlightGear installation was successful and you can safely run it.&lt;br /&gt;
&lt;br /&gt;
=== OpenRTI undefined reference errors ===&lt;br /&gt;
&lt;br /&gt;
Sometimes, due to the way &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; builds projects, linking errors might occur. This is the case with the error “libRTI-NG.so: undefined reference to xxx”. You might want to patch the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; script to clean OpenRTI with &amp;lt;code&amp;gt;rm -f CMakeCache.txt &amp;amp;&amp;amp; rm -rf CMakeFiles/&amp;lt;/code&amp;gt;, or just restart the build in a clean environment. Assuming you are in the base directory from which you ran &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, you can run &amp;lt;code&amp;gt;download_and_compile.sh --cleanup&amp;lt;/code&amp;gt; (see [[#Cleaning built and installed files|Cleaning built and installed files]]). Alternatively, the following command could be used:&lt;br /&gt;
 $ rm -rf build/* install/simgear/ install/openrti/ install/flightgear/share/ install/flightgear/bin/&lt;br /&gt;
&lt;br /&gt;
See {{forum link|t=26244|text=this thread}} for more details. Note that &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; didn't have the &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; option at that time!&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
=== Release selection ===&lt;br /&gt;
&lt;br /&gt;
* Build the latest stable release: &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build the latest Long Term Stable release: &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build the previous Long Term Stable release: &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Long Term Stable (&amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;) is supposed to yield a more stable setup than what you would obtain with option &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, however it will generally be older. Both of these options are suitable for users.&lt;br /&gt;
&lt;br /&gt;
If you pass none of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; in a &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; invocation, you'll build the the ''next'' suite, which contains the development version of FlightGear. The corresponding FlightGear code will be very recent but may well be unstable—this is particularly the case starting from July 2020. This is therefore mostly intended for developers.&lt;br /&gt;
&lt;br /&gt;
=== Skipping most prompts ===&lt;br /&gt;
&lt;br /&gt;
For some important things, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; asks for confirmation in order to be sure that you are well informed about what will be done. When you have a good understanding of these informations, you may want to use the &amp;lt;code&amp;gt;--non-interactive&amp;lt;/code&amp;gt; option in order to suppress these prompts (technically, this causes the default answer to be automatically used).&lt;br /&gt;
&lt;br /&gt;
=== Cleaning built and installed files ===&lt;br /&gt;
&lt;br /&gt;
Option &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; causes &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to remove everything that was built and installed in the directory it is run from. The Git repositories will not be removed, so this is good if you want to restart a compilation from a clean state.&lt;br /&gt;
&lt;br /&gt;
If you use &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; without specifying any component, only this removal will be done (nothing will be compiled nor installed). Otherwise, the usual rules concerning components apply.&lt;br /&gt;
&lt;br /&gt;
=== Multicore acceleration ===&lt;br /&gt;
&lt;br /&gt;
Passing option &amp;lt;code&amp;gt;-j x&amp;lt;/code&amp;gt; to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (where ''x'' is the number of your CPU cores you wish to assign to the job) will considerably speed up the compilation steps. Passing &amp;lt;code&amp;gt;-j$(nproc)&amp;lt;/code&amp;gt; is a convenient way to automatically use all available cores.&lt;br /&gt;
&lt;br /&gt;
=== Advanced options ===&lt;br /&gt;
&lt;br /&gt;
* Build a release version: &amp;lt;code&amp;gt;-b Release&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build a version that should run as fast as a release build, yet has debug information that can be used to post backtraces: &amp;lt;code&amp;gt;-b RelWithDebInfo&amp;lt;/code&amp;gt; (this is the default)&lt;br /&gt;
* Build a full debug version for very complete bug reporting: &amp;lt;code&amp;gt;-b Debug&amp;lt;/code&amp;gt;&lt;br /&gt;
* Skip download of distro packages (i.e., by default: &amp;lt;tt&amp;gt;apt-get install ...&amp;lt;/tt&amp;gt;): &amp;lt;code&amp;gt;-p n&amp;lt;/code&amp;gt;&lt;br /&gt;
* Skip retrieving of component downloads and updates (which typically use Git or wget): &amp;lt;code&amp;gt;-d n&amp;lt;/code&amp;gt;&lt;br /&gt;
* Skip the configure step (like running [https://cmake.org/ CMake] or [https://www.gnu.org/software/autoconf/ autoconf]'s &amp;lt;tt&amp;gt;./configure&amp;lt;/tt&amp;gt;): &amp;lt;code&amp;gt;-r n&amp;lt;/code&amp;gt;&lt;br /&gt;
* Skip compilation of programs: &amp;lt;code&amp;gt;-c n&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build with compositor: &amp;lt;code&amp;gt;--compositor&amp;lt;/code&amp;gt;&lt;br /&gt;
* Force the use of a particular branch for a given component: &amp;lt;code&amp;gt;--component-branch ''COMPONENT=BRANCH''&amp;lt;/code&amp;gt; (e.g., &amp;lt;code&amp;gt;--component-branch OSG=OpenSceneGraph-3.6&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--component-branch FGFS=next&amp;lt;/code&amp;gt;, etc.—but remember that components FGFS, SIMGEAR and DATA must ''always'' be in sync). See [[#Component-specific settings|Component-specific settings]] for details.&lt;br /&gt;
* Override the repository from which a given component is initially fetched: &amp;lt;code&amp;gt;--override-repo ''COMPONENT''=''SITE'':''ADDRESS''&amp;lt;/code&amp;gt; (see [[#Component-specific settings|Component-specific settings]]).&lt;br /&gt;
* Generate build.ninja files and build using Ninja: &amp;lt;code&amp;gt;-G Ninja&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run CMake in verbose mode: &amp;lt;code&amp;gt;--verbose&amp;lt;/code&amp;gt; (this shows compilation commands)&lt;br /&gt;
&lt;br /&gt;
For example, if you are a developer and wish to quickly recompile and reinstall only your own modifications for FlightGear, you can do this:&lt;br /&gt;
 $ download_and_compile.sh -j$(nproc) -p n -d n -r n FGFS&lt;br /&gt;
&lt;br /&gt;
Note that this is the same as:&lt;br /&gt;
 $ download_and_compile.sh -j$(nproc) -pn -dn -rn FGFS&lt;br /&gt;
&lt;br /&gt;
This command will only rebuild modified files and reinstall FlightGear. Note that depending on the kind of changes you made, reconfiguring and thus dropping the &amp;lt;code&amp;gt;-rn&amp;lt;/code&amp;gt; option may be necessary, though (this is the case in particular if you added or removed C++ files).&lt;br /&gt;
&lt;br /&gt;
=== ccache ===&lt;br /&gt;
{{wikipedia|Ccache|ccache}} is a compiler cache that can help speed up subsequent re-compilations. Even if &amp;lt;code&amp;gt;ccache&amp;lt;/code&amp;gt; is installed and in the &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;download_and_compile.sh&amp;lt;/code&amp;gt; won't use it by default. To use it, install it, such as via &amp;lt;code&amp;gt;apt install ccache&amp;lt;/code&amp;gt;. Then enable it when building with &amp;lt;code&amp;gt;download_and_compile.sh&amp;lt;/code&amp;gt; by one of the below methods.&lt;br /&gt;
&lt;br /&gt;
Export in environment:&lt;br /&gt;
 export CMAKE_CXX_COMPILER_LAUNCHER=ccache&lt;br /&gt;
&lt;br /&gt;
Or when running &amp;lt;code&amp;gt;download_and_compile.sh&amp;lt;/code&amp;gt; add this option (does not work on 2024.1, but works with -next branch):&lt;br /&gt;
 --cmake-arg=ALL=&amp;quot;-DCMAKE_CXX_COMPILER_LAUNCHER=ccache&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Optimus technology ==&lt;br /&gt;
If your computer has a GPU with Optimus technology, you need a dedicated script in order to make FlightGear run with the powerful GPU.&lt;br /&gt;
&lt;br /&gt;
After having installed required tools (Bumblebee) you just need to run this command line in your FlightGear installation directory (where you executed &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;):&lt;br /&gt;
 $ sed  's|\./fgfs|optirun ./fgfs|' run_fgfs.sh &amp;gt; run_fgfs_optirun.sh &amp;amp;&amp;amp; chmod +x run_fgfs_optirun.sh&lt;br /&gt;
Now you can run FlightGear with &amp;lt;code&amp;gt;./run_fgfs_optirun.sh&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The same can be done for the [[FlightGear_Launch_Control|FGRun]] launcher:&lt;br /&gt;
 $ sed  's|\./fgrun|optirun ./fgrun|' run_fgrun.sh &amp;gt; run_fgrun_optirun.sh &amp;amp;&amp;amp; chmod +x run_fgrun_optirun.sh&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* {{fgmeta source&lt;br /&gt;
| path = compile-scripts&lt;br /&gt;
| text = Other FlightGear build scripts&lt;br /&gt;
}} present in [[FGMeta]]&lt;br /&gt;
* {{fgmeta source&lt;br /&gt;
| path = fg-from-scratch&lt;br /&gt;
| simplepath = true&lt;br /&gt;
}}&lt;br /&gt;
* [http://geoffmclane.com/fg/fgfs-052.htm Another script] for building FlightGear and all its dependencies in an automated fashion. The page seems a bit oldish, though (as of 2019).&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Building from source]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Script de compilation sous Linux Debian/Ubuntu]]&lt;br /&gt;
[[nl:Compileren met een Script op Linux Debian/Ubuntu]]&lt;/div&gt;</summary>
		<author><name>Jebba</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Scripted_Compilation_on_Linux_Debian/Ubuntu&amp;diff=141127</id>
		<title>Scripted Compilation on Linux Debian/Ubuntu</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Scripted_Compilation_on_Linux_Debian/Ubuntu&amp;diff=141127"/>
		<updated>2024-12-24T20:12:43Z</updated>

		<summary type="html">&lt;p&gt;Jebba: /* ccache */ --cmake-arg only with -next&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is a Bash script that takes care of downloading and compiling FlightGear and related software from their source code repositories with just one command execution&amp;lt;ref name=&amp;quot;just-one-command&amp;quot;&amp;gt;Due to technical problems on the [https://sourceforge.net/ SourceForge] side, this is currently only true once you have an [[FGData]] clone. See [[User:Rominet|here]] for details.&amp;lt;/ref&amp;gt; for both 32-bit and 64-bit [https://www.debian.org/ Debian]-based systems. Pre-existing versions (if any) of the software installed by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; are not touched at all since the script downloads, builds and installs everything under the directory in which it is launched. You can choose the particular components to download, build and install.&lt;br /&gt;
&lt;br /&gt;
Unless told not to do so, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; installs packages with &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt;. For this reason, it is primarily useful on Debian-based distributions. However, if one disables package installation (using &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;--sudo=echo&amp;lt;/code&amp;gt;) and installs the corresponding dependencies oneself, it can be useful on other Unix-like systems as well—one of the FlightGear developers apparently uses it under [https://www.openbsd.org/ OpenBSD].&lt;br /&gt;
&lt;br /&gt;
For hints on using &amp;lt;tt&amp;gt;rpm&amp;lt;/tt&amp;gt;-based distributions such as Redhat, Fedora and CentOS, please see [[CentOS]]. Please also see [[Superbuild]].&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is a [https://www.gnu.org/software/bash/ Bash] script written for [https://www.debian.org/ Debian]-derived distributions ([https://www.ubuntu.com/ Ubuntu], [https://devuan.org/ Devuan], [https://www.linuxmint.com/ Linux Mint], etc.). Its purpose is to automatically install dependencies using the package manager, then build and install FlightGear-related programs.&lt;br /&gt;
&lt;br /&gt;
By default, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; installs most dependencies with &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; run under &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;.&amp;lt;ref name=&amp;quot;disabling-installation-of-dependencies-via-package-manager&amp;quot;&amp;gt;If you think you already have the dependencies, this installation can be disabled either by using option &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; or by passing option &amp;lt;code&amp;gt;--sudo=echo&amp;lt;/code&amp;gt; (the latter results in printing the &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; command line without running it).&amp;lt;/ref&amp;gt; Other dependencies, either because they aren't available in the standard APT repositories, or because of non-option arguments passed to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, are downloaded and compiled on the fly (this can be the case for [[PLIB]], [[Simgear]] and [[OpenSceneGraph]], for instance—it all depends on the arguments passed to the script).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; works in the directory it is run from: apart from dependencies installed via the package manager, all programs built by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; are installed under the &amp;lt;tt&amp;gt;install&amp;lt;/tt&amp;gt; subdirectory of the directory from which the script was run. In other words, installation of programs by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is clean, very easy to undo and doesn't interfere with other programs on the system.&lt;br /&gt;
&lt;br /&gt;
It is possible to manage several directory trees with &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;; as far as it is concerned, such directory trees are completely independent from each other. For instance, if you run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;dir1&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;dir2&amp;lt;/tt&amp;gt;, the programs installed under &amp;lt;tt&amp;gt;dir1&amp;lt;/tt&amp;gt; won't “see” those installed under &amp;lt;tt&amp;gt;dir2&amp;lt;/tt&amp;gt;, and vice versa.&lt;br /&gt;
&lt;br /&gt;
Apart from its main purpose, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; can be used to find hopefully up-to-date build-dependency information for FlightGear and related software. You would do so by inspecting [https://sourceforge.net/p/flightgear/fgmeta/ci/next/tree/download_and_compile.sh the script] at the point where it installs packages.&amp;lt;ref name=&amp;quot;note-inspecting-download-and-compile-sh-to-gather-build-dependency-information&amp;quot;&amp;gt;Look for strings such as &amp;lt;tt&amp;gt;zlib1g-dev&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;libglew-dev&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;qt5-default&amp;lt;/tt&amp;gt;.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before embarking on building your own FlightGear binaries, you need to install a few tools that &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; uses to retrieve and compile source code. These tools are found in the following packages on [https://www.debian.org/ Debian] systems (and presumably on most Debian derivatives too):&lt;br /&gt;
&lt;br /&gt;
* build-essential&lt;br /&gt;
* git&lt;br /&gt;
* cmake&lt;br /&gt;
&lt;br /&gt;
These packages can be installed by running a command such as:&lt;br /&gt;
 $ sudo apt-get install build-essential git cmake&lt;br /&gt;
Once this is done, the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; script can be run. Unless told otherwise, it will install additional tools and libraries as it runs, depending on the chosen components (this will be explained in further sections).&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span id=&amp;quot;disk-space-requirements-and-build-time&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Disk space requirements and build time ==&lt;br /&gt;
&lt;br /&gt;
As of April 2019, building FlightGear requires about 12 [https://en.wikipedia.org/wiki/Gibibyte GiB] of disk space. Note that this includes downloaded source code for [[SimGear]] and FlightGear, generated build files and the large [[FGData]] repository (about 6 GiB for that one).&lt;br /&gt;
&lt;br /&gt;
With an Intel Core i7 860 CPU (2.80 GHz) purchased in 2009, compiling [[SimGear]] and FlightGear 2019.2 with option &amp;lt;code&amp;gt;-j8&amp;lt;/code&amp;gt; takes about 14 minutes. If you don't have a fast machine and build using only one core, it may require several hours.&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
You can get &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; {{fgmeta source&lt;br /&gt;
| path = download_and_compile.sh&lt;br /&gt;
| text = from FGMeta &lt;br /&gt;
}}. It is contained in the [[FGMeta]] repository, which is maintained by the FlightGear developers. The script can be downloaded from the link given above, however, for easier updates and in order to have the command &amp;lt;code&amp;gt;download_and_compile.sh --version&amp;lt;/code&amp;gt; work as intended, it is recommended to get it as explained [[#getting-download-and-compile-sh-using-an-fgmeta-clone|below]].&lt;br /&gt;
&lt;br /&gt;
In case you build stable versions of FlightGear using either of the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; options of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, remember to update the script before trying to build a new version of FlightGear (see [[#updating-download-and-compile-sh-using-an-fgmeta-clone|Updating &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;]] below). Of course, you can update it more often in order to benefit from new features or bug fixes; this is especially useful if you are building ''next''—that is, the development branch of FlightGear.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span id=&amp;quot;getting-started-with-download-and-compile-sh&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Getting started with &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== For the impatient ===&lt;br /&gt;
&lt;br /&gt;
So, you're in a hurry, want to build FlightGear but don't want to read any explanation? You can try what follows, but be aware that you may need to come back and read part of the the following sections if you encounter a problem. All commands should be run under a normal user account; however, unless you pass option &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; or something similar to disable installation of packages from your distribution, you'll be asked for your &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt; password during execution of the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command (&amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt; is used by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to run commands like &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt;). So, here is your quick recipe for getting &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; and using it to build FlightGear:&lt;br /&gt;
 mkdir -p ~/flightgear/dnc-managed&lt;br /&gt;
 cd ~/flightgear&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;git clone https://git.code.sf.net/p/flightgear/fgmeta&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 cd ~/flightgear/dnc-managed&lt;br /&gt;
 ~/flightgear/fgmeta/download_and_compile.sh -s -j$(nproc)&lt;br /&gt;
 ./run_fgfs.sh --launcher&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option passed to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; instructs it to build the latest stable release of FlightGear. Use option &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; instead if you want the latest Long Term Stable release (it may be older but possibly more stable), or &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; for the previous LTS release. If you pass none of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; will build the ''next'' suite, which contains the development version of FlightGear. For more details on these options, see [[#Release selection|Release selection]].&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;tt&amp;gt;run_fgfs.sh --launcher&amp;lt;/tt&amp;gt; starts the [[FlightGear Qt launcher|FlightGear built-in launcher]]. This is often convenient but not compulsory. Another way to start FlightGear could be &amp;lt;code&amp;gt;./run_fgfs.sh --airport=PHTO --aircraft=c172p&amp;lt;/code&amp;gt;. There are plenty of other options, which are listed by &amp;lt;code&amp;gt;./run_fgfs.sh --help --verbose&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In some cases, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; stops and waits for your answer before continuing. This is done when there is something important that you should know. When you are used to these prompts and would rather not see them anymore, pass the &amp;lt;code&amp;gt;--non-interactive&amp;lt;/code&amp;gt; option to suppress them.&lt;br /&gt;
&lt;br /&gt;
More detailed instructions are given below. The following sections also explain how to update &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; and FlightGear.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;getting-started-with-download-and-compile-sh-notations&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Notations ===&lt;br /&gt;
&lt;br /&gt;
When a command should be run as an unpriviledged user, it will be preceded by a dollar sign:&lt;br /&gt;
 $ whoami&lt;br /&gt;
 toto&lt;br /&gt;
In contrast, a hash sign (#) means that the command must be run with superuser privileges to achieve the desired effect:&lt;br /&gt;
 # whoami&lt;br /&gt;
 root&lt;br /&gt;
&lt;br /&gt;
In order to make instructions easy to understand, two directories (= folders) will be consistently used for the same purpose below:&lt;br /&gt;
* &amp;lt;tt&amp;gt;~/flightgear/fgmeta&amp;lt;/tt&amp;gt; will contain a clone of the [[FGMeta]] repository; therefore, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; will reside in that directory;&lt;br /&gt;
* &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; will be the directory from which we run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. In other words, with this setup, a typical sequence of commands could be:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ~/flightgear/fgmeta/download_and_compile.sh&lt;br /&gt;
or&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ~/flightgear/fgmeta/download_and_compile.sh SIMGEAR FGFS DATA OSG&lt;br /&gt;
These are of course just examples. The aforementioned paths are not hardwired anywhere in the script; you are free to choose the directories you want for these purposes.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;getting-download-and-compile-sh-using-an-fgmeta-clone&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Getting &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; the “right way” ===&lt;br /&gt;
&lt;br /&gt;
There are several ways to obtain [https://sourceforge.net/p/flightgear/fgmeta/ci/next/tree/download_and_compile.sh download_and_compile.sh]. The method described here makes it very easy to update the script and causes the command &amp;lt;code&amp;gt;download_and_compile.sh --version&amp;lt;/code&amp;gt; to work as intended.&lt;br /&gt;
&lt;br /&gt;
As explained in [[#getting-started-with-download-and-compile-sh-notations|Notations]], we want to clone the [[FGMeta]] repository in &amp;lt;tt&amp;gt;~/flightgear/fgmeta&amp;lt;/tt&amp;gt; and work with its ''next'' branch. Let's go:&lt;br /&gt;
 $ mkdir -p ~/flightgear&lt;br /&gt;
 $ cd ~/flightgear&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;$ git clone -b next https://git.code.sf.net/p/flightgear/fgmeta&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
You now have a fresh FGMeta clone in &amp;lt;tt&amp;gt;~/flightgear/fgmeta&amp;lt;/tt&amp;gt; and your brand new &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; script is located in that directory. You can already try it to see the available options:&lt;br /&gt;
&amp;lt;pre&amp;gt;$ ~/flightgear/fgmeta/download_and_compile.sh --help&lt;br /&gt;
download_and_compile.sh [OPTION...] [--] [COMPONENT...]&lt;br /&gt;
Download and compile components belonging to the FlightGear ecosystem.&lt;br /&gt;
&lt;br /&gt;
Without any COMPONENT listed, or if ALL is specified, recompile all&lt;br /&gt;
components listed in the WHATTOBUILDALL variable. Each COMPONENT may&lt;br /&gt;
be one of the following words:&lt;br /&gt;
&lt;br /&gt;
  ALL, CMAKE, OSG, PLIB, OPENRTI, SIMGEAR, FGFS, DATA, FGRUN, FGO, FGX,&lt;br /&gt;
  OPENRADAR, ATCPIE, TERRAGEAR, TERRAGEARGUI, ZLIB.&lt;br /&gt;
&lt;br /&gt;
Available options:&lt;br /&gt;
  -h, --help    show this help message and exit&lt;br /&gt;
      --version print version and license information, then exit&lt;br /&gt;
&lt;br /&gt;
(...)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;updating-download-and-compile-sh-using-an-fgmeta-clone&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Updating &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Now that you have &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; from the [[FGMeta]] repository, it is very easy to update (this assumes you didn't modify anything yourself inside &amp;lt;tt&amp;gt;~/flightgear/fgmeta&amp;lt;/tt&amp;gt;!):&lt;br /&gt;
 $ cd ~/flightgear/fgmeta &amp;amp;&amp;amp; git pull&lt;br /&gt;
&lt;br /&gt;
If you want to keep updates as easy as we just showed, it is best not to modify &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; yourself. &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; has plenty of options that usually make it unnecessary to modify the script. Just run &amp;lt;code&amp;gt;download_and_compile.sh --help&amp;lt;/code&amp;gt; and learn about the available options when you feel the need to change something. Unless you have special needs that can only be accomodated by modifying &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, you are invited to skip to the next section.&lt;br /&gt;
&lt;br /&gt;
If you really, ''really'' want to modify &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; while keeping updates easy, a good technique is to add your changes to your FGMeta clone in the form of one or more Git ''commits'' (no need to push them anywhere, commits can remain in your clone). How to do that is beyond the scope of this document, though; read Git tutorials if you want to learn it (there are plenty on the Internet). Once you have committed your changes to your FGMeta clone, make sure the repository is clean (use &amp;lt;code&amp;gt;git status&amp;lt;/code&amp;gt;), then update it with:&lt;br /&gt;
 $ cd ~/flightgear/fgmeta &amp;amp;&amp;amp; git pull --rebase&lt;br /&gt;
This will apply your commits on top of the latest commit of the branch that is currently checked out, which so far contained the official version of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. In case your changes conflict with the update, Git will tell you and you'll have to resolve the conflict manually (look for “Git resolve conflict” on your favorite search engine)... or start again from a pristine [[FGMeta]] clone.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;using-download-and-compile-sh-to-build-flightgear&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Building FlightGear ===&lt;br /&gt;
&lt;br /&gt;
In what follows, we won't give the full path to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; when showing commands to be run, but you should prepend it to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; whenever you see a &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command. For instance, if you used the same path as in [[#getting-started-with-download-and-compile-sh-notations|Notations]] and see the command:&lt;br /&gt;
 $ download_and_compile.sh --help&lt;br /&gt;
what you should actually run is:&lt;br /&gt;
 $ ~/flightgear/fgmeta/download_and_compile.sh --help&lt;br /&gt;
&lt;br /&gt;
Apart from this harmless command, ''do not'' run other &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; commands from an arbitrary directory, in particular ''don't'' run them from &amp;lt;tt&amp;gt;~/flightgear/fgmeta&amp;lt;/tt&amp;gt;. This is because '''most other &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; commands write to the current directory''' (&amp;lt;code&amp;gt;download_and_compile.sh --help&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;download_and_compile.sh --version&amp;lt;/code&amp;gt; are safe to run from any directory, though).&lt;br /&gt;
&lt;br /&gt;
Of course, it is always possible to make commands shorter by setting up aliases (see tips at the end of [https://sourceforge.net/p/flightgear/mailman/message/36634426/ this message]), by adding the directory containing &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to your &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; or by creating a symbolink link pointing to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in a directory that is part of your &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt;. This is not necessary, though; do it only if you feel the need (when enabled, persistent shell history is often enough to obviate the need to extend the &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
{{Note|The following commands should be run from an empty directory&amp;lt;ref name=&amp;quot;dedicated-directory-won-t-stay-empty-forever&amp;quot;&amp;gt;Well, empty before the first time; later, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is going to populate it with plenty of FlightGear files and subdirectories, of course.&amp;lt;/ref&amp;gt; in a partition that has enough free space (see [[#disk-space-requirements-and-build-time | Disk space requirements and build time]]). As explained in [[#getting-started-with-download-and-compile-sh-notations|Notations]], we are going to choose the directory &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; for this purpose, in order to express that the whole directory tree is managed by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. This is just an example; feel free to choose another directory if you want.&lt;br /&gt;
&lt;br /&gt;
'''Don't run the commands from a non-dedicated directory,''' because it will be filled with files and directories created by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; and the FlightGear, SimGear, etc. build systems. That would be a complete mess! In particular, ''don't'' run the commands from the directory containing your [[FGMeta]] clone.}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|For some commands, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; may use &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;. In case you want to run some other program instead of &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;, this can be done with the &amp;lt;code&amp;gt;--sudo&amp;lt;/code&amp;gt; option of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. For instance, in order to see the commands that would be run with sudo without actually running them, you can pass &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;--sudo=echo&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. Like all other options, &amp;lt;code&amp;gt;--sudo&amp;lt;/code&amp;gt; must be given ''before'' all arguments that are component names (such as &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, etc.).}}&lt;br /&gt;
&lt;br /&gt;
The package manager used by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; by default is &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; (it won't be used if you pass &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; the &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; option). You can use another one if you wish, as long as it supports the following calls:&lt;br /&gt;
 ''pkg-mgr'' update&lt;br /&gt;
 ''pkg-mgr'' install ''pkg1 pkg2'' ...&lt;br /&gt;
This is the case for &amp;lt;tt&amp;gt;aptitude&amp;lt;/tt&amp;gt; as well as &amp;lt;tt&amp;gt;apt&amp;lt;/tt&amp;gt;. If you want &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to use &amp;lt;tt&amp;gt;aptitude&amp;lt;/tt&amp;gt;, give it the option &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;--package-manager=aptitude&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; before any of the ''COMPONENT'' arguments.&lt;br /&gt;
&lt;br /&gt;
All options of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; can be seen by running the following command:&lt;br /&gt;
 $ download_and_compile.sh --help&lt;br /&gt;
&lt;br /&gt;
Now the instructions. '''You have chosen a dedicated directory''' where all the stuff that is downloaded and built by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; will be stored. This is &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; if you followed the suggestions given in [[#getting-started-with-download-and-compile-sh-notations|Notations]], and should be empty before you run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; for the first time. However, it is quite correct to start &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; from the same directory for subsequent runs, even when non-empty (otherwise, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; would automatically reclone the repositories every time you run it; that would be a sheer waste of time and bandwidth). All that remains to do is to run:&lt;br /&gt;
 $ mkdir -p ~/flightgear/dnc-managed&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh -s -j$(nproc)&lt;br /&gt;
The &amp;lt;code&amp;gt;-j$(nproc)&amp;lt;/code&amp;gt; option is not necessary, but is likely to save you a lot of time; with it, all available CPU cores will be used when compiling—see [[#Multicore acceleration| Multicore acceleration]].&lt;br /&gt;
&lt;br /&gt;
{{Note|Because of the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option, the above &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command would build the latest stable release of FlightGear. If you want to build the latest Long Term Stable release, use &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; instead. For the previous LTS release, use &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;. If you want to build the development version of FlightGear, use none of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;, but be warned: it may very well be unstable and unsuitable for flying. For more details on these options, see [[#Release selection|Release selection]].}}&lt;br /&gt;
&lt;br /&gt;
When you don't pass any non-option argument to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; as done here, it takes care of the base components needed to run FlightGear in good conditions: &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;OSG&amp;lt;/tt&amp;gt; (these are the component names used by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, i.e., the final arguments one can optionally give in a &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command; in normal speech, they correspond to the {{simgear source&lt;br /&gt;
| text = SimGear&lt;br /&gt;
}}, {{flightgear source&lt;br /&gt;
| text = FlightGear&lt;br /&gt;
}} and {{fgdata source&lt;br /&gt;
| text = FGData&lt;br /&gt;
}} repositories as well as a suitable repository for [[OpenSceneGraph]]). Therefore, the above command is presently exactly equivalent to:&lt;br /&gt;
 $ download_and_compile.sh -s -j$(nproc) SIMGEAR FGFS DATA OSG&lt;br /&gt;
&lt;br /&gt;
In case you want to build another component such as, say, [[PLIB]], you can add it to the command, like this:&lt;br /&gt;
 $ download_and_compile.sh -s -j$(nproc) SIMGEAR FGFS DATA OSG PLIB&lt;br /&gt;
&lt;br /&gt;
When the command terminates, you should have a script called &amp;lt;tt&amp;gt;run_fgfs.sh&amp;lt;/tt&amp;gt; in the directory from which you ran &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (i.e., &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; in the suggested setup). This will be your script to run FlightGear. For instance, in order to start the [[FlightGear Qt launcher|built-in launcher]], you can run the following commands:&amp;lt;ref name=&amp;quot;no-need-to-change-to-dnc-managed-dir-before-starting-generated-scripts&amp;quot;&amp;gt;We give these commands because they are easy to read, but the &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; command is not needed if you use the correct path, as in &amp;lt;code&amp;gt;~/flightgear/dnc-managed/run_fgfs.sh --launcher&amp;lt;/code&amp;gt;.&amp;lt;/ref&amp;gt;&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgfs.sh --launcher&lt;br /&gt;
(You may omit the &amp;lt;code&amp;gt;--launcher&amp;lt;/code&amp;gt; option; this would simply start FlightGear without any launcher, at the default airport and with the default aircraft.)&amp;lt;br /&amp;gt;&lt;br /&gt;
In case you find this tedious to type or have more arguments to pass on a regular basis, you can follow the advice given at the end of [https://sourceforge.net/p/flightgear/mailman/message/36634426/ this message] or use another launcher such as [[FFGo]]—but the [[FlightGear Qt launcher|FlightGear built-in launcher]] started with &amp;lt;code&amp;gt;run_fgfs.sh --launcher&amp;lt;/code&amp;gt; is quite fine, be sure to try it first!&lt;br /&gt;
&lt;br /&gt;
{{Note|If you ran &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; from &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; as proposed above, the full path of the &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata&amp;lt;/tt&amp;gt; directory is your [[$FG_ROOT]]. This is a very important path for FlightGear; knowing this may be useful for troubleshooting or doing “advanced things.”}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;using-download-and-compile-sh-to-update-flightgear&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Updating FlightGear ===&lt;br /&gt;
&lt;br /&gt;
{{Note|If you built FlightGear with either of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;, you need to pass the ''same option'' to the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command given below that will update your FlightGear installation. Otherwise, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; will automatically build the ''next'' suite (bleeding-edge development version), which is probably not what you wish. Moreover, if you do want to switch from one suite to another (for instance from ''stable'' to ''next'', or from ''Long Term Stable'' to ''stable''), using the &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; option of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is heartily recommended.}}&lt;br /&gt;
&lt;br /&gt;
Keeping the above note in mind, go to the directory from which you previously ran &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (&amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; in the [[#Notations|suggested setup]]). This is the folder which, if you did a complete run of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; as shown in the previous section, contains the &amp;lt;tt&amp;gt;run_fgfs.sh&amp;lt;/tt&amp;gt; script and a log file named &amp;lt;tt&amp;gt;compilation_log.txt&amp;lt;/tt&amp;gt; that records what &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; did in its last run. If you wish to update, say, {{simgear source&lt;br /&gt;
| text = SimGear&lt;br /&gt;
}}, {{flightgear source&lt;br /&gt;
| text = FlightGear&lt;br /&gt;
}}, {{fgdata source&lt;br /&gt;
| text = FGData&lt;br /&gt;
}} and [[OpenSceneGraph|OSG]], simply execute this:&lt;br /&gt;
 $ download_and_compile.sh -pn -j$(nproc) SIMGEAR FGFS DATA OSG&lt;br /&gt;
The &amp;lt;code&amp;gt;-j$(nproc)&amp;lt;/code&amp;gt; option is not necessary, but is likely to save you a lot of time; with it, all available CPU cores will be used when compiling—see [[#Multicore acceleration| Multicore acceleration]].&lt;br /&gt;
&lt;br /&gt;
We'll explain the &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; in a minute. &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;OSG&amp;lt;/tt&amp;gt; are called ''components'' in &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; terminology. A component generally corresponds to a software repository, or something close. In fact, since &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;OSG&amp;lt;/tt&amp;gt; are often precisely the components people wish to update, they form the default component set, so that the previous command is equivalent (as of Sept. 2024) to:&lt;br /&gt;
 $ download_and_compile.sh -pn -j$(nproc)&lt;br /&gt;
Now about this &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt;. It is equivalent to &amp;lt;code&amp;gt;-p n&amp;lt;/code&amp;gt; and means “don't install packages from my (Linux) distribution” (&amp;lt;code&amp;gt;y&amp;lt;/code&amp;gt; means ''yes, please install'', &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; means ''no, don't install''). In case you forgot that, simply run:&lt;br /&gt;
 $ download_and_compile.sh --help&lt;br /&gt;
What does it imply to pass &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt;? This tells &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to completely skip the step where it checks for needed packages from your distribution and installs them, by default using &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt;. It thus goes straight to the following steps:&lt;br /&gt;
* update each repository corresponding to one of the selected components (&amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;OSG&amp;lt;/tt&amp;gt; in our example);&lt;br /&gt;
* compile each selected component that requires compilation;&lt;br /&gt;
* install each selected component in the appropriate place (under &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; according to our [[#getting-started-with-download-and-compile-sh-notations|Notations]]).&lt;br /&gt;
In case you don't have all required dependencies for the selected components, one of them is likely to fail, of course, since by passing &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, you forbid it to install these dependencies for you. So, you can also very well update without passing the &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; option, it will simply take a little longer (the time to check if all dependencies of the selected components are available with &amp;lt;tt&amp;gt;APT&amp;lt;/tt&amp;gt;). In fact, this is '''what you should do if the previous &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; run failed:''' first update &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (see [[#getting-download-and-compile-sh-using-an-fgmeta-clone|above]]) then run it ''without'' &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt;&amp;lt;ref name=&amp;quot;passing-no-pn-option-equals-passing-py&amp;quot;&amp;gt;Which is the same as passing &amp;lt;code&amp;gt;-py&amp;lt;/code&amp;gt;.&amp;lt;/ref&amp;gt; in case new dependencies have been recently added and you don't have them on your system yet—this would be a very likely cause for the failure. In this case, running &amp;lt;code&amp;gt;download_and_compile.sh --cleanup&amp;lt;/code&amp;gt; to restart the build from a clean state is probably a good idea (see [[#Cleaning built and installed files|Cleaning built and installed files]] for details on this option).&lt;br /&gt;
&lt;br /&gt;
'''Summary'''&lt;br /&gt;
&lt;br /&gt;
Routine update:&lt;br /&gt;
 $ download_and_compile.sh -pn -j$(nproc) ''COMPONENT...''&lt;br /&gt;
In case this fails, first update &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (see [[#getting-download-and-compile-sh-using-an-fgmeta-clone|above]]), then run&lt;br /&gt;
 $ download_and_compile.sh --cleanup&lt;br /&gt;
 $ download_and_compile.sh -j$(nproc) ''COMPONENT...''&lt;br /&gt;
where ''COMPONENT...'' stands for the space-separated list of selected components, and defaults to &amp;lt;tt&amp;gt;SIMGEAR FGFS DATA OSG&amp;lt;/tt&amp;gt; if you don't specify any.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;examining-download-and-compile-sh-history&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Examining the history of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Looking at the latest commits that affected &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is quite easy with your FGMeta clone:&lt;br /&gt;
 $ cd ~/flightgear/fgmeta&lt;br /&gt;
 $ git log -- download_and_compile.sh&lt;br /&gt;
(then quit by typing &amp;lt;tt&amp;gt;q&amp;lt;/tt&amp;gt;, assuming your &amp;lt;tt&amp;gt;$GIT_PAGER&amp;lt;/tt&amp;gt; is &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt;)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to do the same, but also see the patch for each commit:&lt;br /&gt;
 $ cd ~/flightgear/fgmeta&lt;br /&gt;
 $ git log -p -- download_and_compile.sh&lt;br /&gt;
&lt;br /&gt;
=== For the curious: the SSH way ===&lt;br /&gt;
&lt;br /&gt;
The method described below is not necessary anymore since {{fgmeta commit | 420034d5b51ff2d32fc0c3716b17a2d862841e0f}} (May 2020). What it does is teach you how to clone [[FGData]] using SSH, then change the Git remote setup in your clone of that repository to retrieve further updates using https—which is convenient, as it does not require you to provide a password. This technique used to be necessary to securely retrieve FGData because of a problem in the [https://sourceforge.net/ SourceForge] infrastructure (namely, &amp;lt;code&amp;gt;git clone&amp;lt;/code&amp;gt; from SourceForge doesn't work for the big FGData repository using https). Current versions of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; avoid the problem by proposing the user to automatically clone FGData from its [https://gitlab.com/flightgear/fgdata official mirror at GitLab], then change the Git remote setup to fetch further updates using https from SourceForge.&lt;br /&gt;
&lt;br /&gt;
Because the following method will make you connect to [https://sourceforge.net/ SourceForge] using the SSH protocol, you'll need an account on that site. If you don't already have one, go to the [https://sourceforge.net/user/registration registration page] and create an account. In all this section, we'll assume that your account name at SourceForge is ''SFusername''.&lt;br /&gt;
&lt;br /&gt;
{{Note|As explained in [[#getting-started-with-download-and-compile-sh-notations|Notations]], we assume that your Unix user name (login) is &amp;lt;tt&amp;gt;toto&amp;lt;/tt&amp;gt;. Don't confuse the &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt; password prompt (where you need to enter &amp;lt;tt&amp;gt;toto&amp;lt;/tt&amp;gt;'s password) with the password prompt for your SourceForge account! The former appears as&lt;br /&gt;
 [sudo] password for toto:&lt;br /&gt;
whereas the latter is just:&lt;br /&gt;
 Password:&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|For some commands, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; may use &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;. In case you want to run some other program instead of &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;, this can be done with the &amp;lt;code&amp;gt;--sudo&amp;lt;/code&amp;gt; option of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. For instance, in order to see the commands that would be run with sudo without actually running them, you can pass &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;--sudo=echo&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. Like all other options, &amp;lt;code&amp;gt;--sudo&amp;lt;/code&amp;gt; must be given ''before'' all arguments that are component names (such as &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, etc.).}}&lt;br /&gt;
&lt;br /&gt;
{{Note|The commands given below will build the ''next'' suite, which contains the bleeding-edge development version of FlightGear. This is likely to be unstable, possibly unsuitable for flying. If you'd rather build the latest stable release or the latest Long Term Stable release, add option &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; to all &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; commands given below (or &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; for the previous LTS release). You may add the chosen option right after the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command name (in any case, the option should come before non-option arguments such as SIMGEAR, FGFS, DATA, etc.). See [[#Release selection|Release selection]] for more explanations on options &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
Now the instructions. You have chosen a dedicated directory where all the stuff that is downloaded and built by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; will be stored. This is &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; in our example, and should be empty before you run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; for the first time. However, it is quite correct to start &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; from the same directory for subsequent runs, even when non-empty (otherwise, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; would automatically reclone the repositories every time you run it; that would be a sheer waste of time and bandwidth).&lt;br /&gt;
&lt;br /&gt;
Ready? Let's go!&lt;br /&gt;
&amp;lt;pre&amp;gt;$ mkdir -p ~/flightgear/dnc-managed&lt;br /&gt;
$ cd ~/flightgear/dnc-managed&lt;br /&gt;
$ download_and_compile.sh --git-clone-site-params SourceForge=ssh:SFusername DATA&lt;br /&gt;
**********************************************************************&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Warning: a typical SimGear + FlightGear + FGData build requires    *&lt;br /&gt;
* about 12 GiB of disk space. The compilation part may last from a   *&lt;br /&gt;
* few minutes to hours, depending on your computer.                  *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Hint: use the -j option if your CPU has several cores, as in:      *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
*         download_and_compile.sh -j$(nproc)                         *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
**********************************************************************&lt;br /&gt;
Running 'apt-get update'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
Considering a package alternative: libcurl4-openssl-dev libcurl4-gnutls-dev&lt;br /&gt;
Package alternative matched for libcurl4-openssl-dev&lt;br /&gt;
Running 'apt-get install build-essential git libcurl4-openssl-dev cmake'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
****************************************&lt;br /&gt;
**************** DATA ******************&lt;br /&gt;
****************************************&lt;br /&gt;
Fetching DATA with 'git clone ssh://SFusername@git.code.sf.net/p/flightgear/fgdata'&lt;br /&gt;
Cloning into '.'...&lt;br /&gt;
The authenticity of host 'git.code.sf.net (216.105.38.16)' can't be established.&lt;br /&gt;
ECDSA key fingerprint is SHA256:FeVkoYYBjuQzb5QVAgm3BkmeN5TTgL2qfmqz9tCPRL4.&lt;br /&gt;
Are you sure you want to continue connecting (yes/no)?&lt;br /&gt;
Warning: Permanently added 'git.code.sf.net,216.105.38.16' (ECDSA) to the list of known hosts.&lt;br /&gt;
Connection closed by 216.105.38.16 port 22&lt;br /&gt;
fatal: Could not read from remote repository.&lt;br /&gt;
&lt;br /&gt;
Please make sure you have the correct access rights&lt;br /&gt;
and the repository exists.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above messages are perfectly normal but deserve a little explanation. Here, &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt; asked us to confirm that the fingerprint sent by the remote host is that of the real &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;, as opposed to that of some malicious server ''pretending'' to be &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;. This confirmation only has to be done once, after which it is remembered thanks to &amp;lt;tt&amp;gt;~/.ssh/known_hosts&amp;lt;/tt&amp;gt;. You should visit the [https://sourceforge.net/p/forge/documentation/SSH%20Key%20Fingerprints/#fingerprint-listing page that gives the host key fingerprint of every publically-accessible SSH server at SourceForge] and carefully check that the fingerprint appearing on your terminal is listed on that page for &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;, or some matching pattern such as &amp;lt;tt&amp;gt;*.code.sf.net&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the fingerprint that is printed on your terminal is not listed on that page, answer &amp;lt;tt&amp;gt;no&amp;lt;/tt&amp;gt; to the question ''Are you sure you want to continue connecting (yes/no)?'' and copy/paste to flightgear-devel (see [[Mailing lists]]) the above message from &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt; that contains the fingerprint sent to you by the remote host which pretends to be &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;. If this happened, you should stop here and wait for answers from readers of flightgear-devel.&lt;br /&gt;
&lt;br /&gt;
From now on, we'll assume that the fingerprint you received was correct, and therefore that you have answered &amp;lt;tt&amp;gt;yes&amp;lt;/tt&amp;gt; to the ''Are you sure you want to continue connecting (yes/no)?'' question.&lt;br /&gt;
&lt;br /&gt;
In this example, it took us several minutes to verify the fingerprint of the &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt; server and confirm it to &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt;. Because of this delay, &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt; hung up on us and closed the connection. This is absolutely ''not a problem:'' we can just rerun the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command with the same arguments as the first time. Since we answered &amp;lt;tt&amp;gt;yes&amp;lt;/tt&amp;gt; to the ''Are you sure you want to continue connecting (yes/no)?'' prompt, the fingerprint of &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;'s key has been stored in &amp;lt;tt&amp;gt;~/.ssh/known_hosts&amp;lt;/tt&amp;gt;, therefore we won't get this prompt anymore. But if some server claiming to be &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt; presents a host key that has a different fingerprint in the future, &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt; will print a big fat warning that the server may belong to an attacker trying to impersonate &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;. Therefore, this SSH host key verification is very useful to protect us from future attacks (which hopefully won't happen at all).&lt;br /&gt;
&lt;br /&gt;
As said, we just rerun the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command with the same arguments:&lt;br /&gt;
&amp;lt;pre&amp;gt;$ download_and_compile.sh --git-clone-site-params SourceForge=ssh:SFusername DATA&lt;br /&gt;
**********************************************************************&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Warning: a typical SimGear + FlightGear + FGData build requires    *&lt;br /&gt;
* about 12 GiB of disk space. The compilation part may last from a   *&lt;br /&gt;
* few minutes to hours, depending on your computer.                  *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Hint: use the -j option if your CPU has several cores, as in:      *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
*         download_and_compile.sh -j$(nproc)                         *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
**********************************************************************&lt;br /&gt;
Running 'apt-get update'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
Considering a package alternative: libcurl4-openssl-dev libcurl4-gnutls-dev&lt;br /&gt;
Package alternative matched for libcurl4-openssl-dev&lt;br /&gt;
Running 'apt-get install build-essential git libcurl4-openssl-dev cmake'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
****************************************&lt;br /&gt;
**************** DATA ******************&lt;br /&gt;
****************************************&lt;br /&gt;
Fetching DATA with 'git clone ssh://SFusername@git.code.sf.net/p/flightgear/fgdata'&lt;br /&gt;
Cloning into '.'...&lt;br /&gt;
Password:&amp;lt;/pre&amp;gt;&lt;br /&gt;
As explained above, the preceding prompt is for your SourceForge password (which you could guess from the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;git clone ssh://SFusername@git.code.sf.net/p/flightgear/fgdata&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; command).&lt;br /&gt;
&amp;lt;pre&amp;gt;remote: Enumerating objects: 67011, done.&lt;br /&gt;
remote: Counting objects: 100% (67011/67011), done.&lt;br /&gt;
remote: Compressing objects: 100% (31342/31342), done.&lt;br /&gt;
remote: Total 67011 (delta 38776), reused 59640 (delta 33570)&lt;br /&gt;
Receiving objects: 100% (67011/67011), 2.60 GiB | 313.00 KiB/s, done.&lt;br /&gt;
Resolving deltas: 100% (38776/38776), done.&lt;br /&gt;
Checking out files: 100% (12959/12959), done.&lt;br /&gt;
Password:&amp;lt;/pre&amp;gt;&lt;br /&gt;
(It will take a fair amount of time to get there, because this is the complete download of [[FGData]].)&amp;lt;br /&amp;gt;&lt;br /&gt;
This is again a prompt for your SourceForge password, because &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; wants to run &amp;lt;code&amp;gt;git pull --rebase&amp;lt;/code&amp;gt; in the repository (admittedly, it's a bit dumb after a &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; operation—please forgive us). In case you were not monitoring the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; operation, you probably saw the password prompt way after &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt; got bored waiting for you and closed our second connection:&lt;br /&gt;
&amp;lt;pre&amp;gt;Connection closed by 216.105.38.16 port 22&lt;br /&gt;
fatal: Could not read from remote repository.&lt;br /&gt;
&lt;br /&gt;
Please make sure you have the correct access rights&lt;br /&gt;
and the repository exists.&amp;lt;/pre&amp;gt;&lt;br /&gt;
(if not, there should be no error message and you should have a clean FGData clone)&amp;lt;br /&amp;gt;&lt;br /&gt;
No worries. Just as before, simply rerun the command with the same arguments:&lt;br /&gt;
&amp;lt;pre&amp;gt;$ download_and_compile.sh --git-clone-site-params SourceForge=ssh:SFusername DATA&lt;br /&gt;
**********************************************************************&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Warning: a typical SimGear + FlightGear + FGData build requires    *&lt;br /&gt;
* about 12 GiB of disk space. The compilation part may last from a   *&lt;br /&gt;
* few minutes to hours, depending on your computer.                  *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Hint: use the -j option if your CPU has several cores, as in:      *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
*         download_and_compile.sh -j$(nproc)                         *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
**********************************************************************&lt;br /&gt;
Running 'apt-get update'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
Considering a package alternative: libcurl4-openssl-dev libcurl4-gnutls-dev&lt;br /&gt;
Package alternative matched for libcurl4-openssl-dev&lt;br /&gt;
Running 'apt-get install build-essential git libcurl4-openssl-dev cmake'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
****************************************&lt;br /&gt;
**************** DATA ******************&lt;br /&gt;
****************************************&lt;br /&gt;
DATA: the repository already exists&lt;br /&gt;
Password:&lt;br /&gt;
Already up to date.&lt;br /&gt;
Current branch next is up to date.&lt;br /&gt;
Already on 'next'&lt;br /&gt;
Your branch is up to date with 'origin/next'.&lt;br /&gt;
All optional package alternatives have found a matching package.&lt;br /&gt;
&lt;br /&gt;
download_and_compile.sh has finished to work.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There we are! You now have a clean, up-to-date [[FGData]] clone in &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata&amp;lt;/tt&amp;gt; (remember: &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; is the directory from which you ran &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;). Note this place: the full path of the &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata&amp;lt;/tt&amp;gt; directory is your [[$FG_ROOT]].&lt;br /&gt;
&lt;br /&gt;
Now, change the protocol to use for future updates of your FGData clone:&amp;lt;ref name=&amp;quot;changing-the-protocol-for-a-git-remote-manual-method&amp;quot;&amp;gt;Another way would be to manually change the relevant line starting with &amp;lt;code&amp;gt;url = &amp;lt;nowiki&amp;gt;ssh://SFusername@&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;origin&amp;lt;/code&amp;gt; remote in the &amp;lt;tt&amp;gt;.git/config&amp;lt;/tt&amp;gt; file that lives inside your repository clone (i.e., &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata/.git/config&amp;lt;/tt&amp;gt; in our example).&amp;lt;/ref&amp;gt;&lt;br /&gt;
 (cd install/flightgear/fgdata &amp;amp;&amp;amp; \&lt;br /&gt;
 git remote set-url origin &amp;lt;nowiki&amp;gt;https://git.code.sf.net/p/flightgear/fgdata&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
(you can check at any time the protocol(s) in use with the command &amp;lt;code&amp;gt;git remote -v&amp;lt;/code&amp;gt; run inside a Git repository—in this case, inside the folder &amp;lt;tt&amp;gt;install/flightgear/fgdata&amp;lt;/tt&amp;gt;). As a consequence of this change, all future updates of your FGData clone will use the &amp;lt;tt&amp;gt;https&amp;lt;/tt&amp;gt; protocol, therefore you won't be prompted anymore for your SourceForge password.&lt;br /&gt;
&lt;br /&gt;
All that remains to do is to run, from the same directory as before (&amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; in our example):&lt;br /&gt;
 $ download_and_compile.sh -j$(nproc)&lt;br /&gt;
The &amp;lt;code&amp;gt;-j$(nproc)&amp;lt;/code&amp;gt; option is not necessary, but is likely to save you a lot of time; with it, all available CPU cores will be used when compiling—see [[#Multicore acceleration| Multicore acceleration]].&lt;br /&gt;
&lt;br /&gt;
Assuming the compilation was successful, you can now start the [[FlightGear Qt launcher|FlightGear built-in launcher]] using for instance:&lt;br /&gt;
 $ ./run_fgfs.sh --launcher&lt;br /&gt;
See [[#Building FlightGear|Building FlightGear]] for more details.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span id=&amp;quot;list-of-available-components&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; List of available components ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; script is able to download, compile (when applicable) and install the following components:&lt;br /&gt;
&lt;br /&gt;
* ATCPIE (for the [[ATC-pie]] air traffic control simulation program)&lt;br /&gt;
* CMAKE (for the [https://cmake.org/ CMake] build tool—this can be useful in case CMake is too old in your distribution)&lt;br /&gt;
* DATA (for [[FGData]], the main set of data files used by FlightGear)&lt;br /&gt;
* FGFS (for FlightGear itself)&lt;br /&gt;
* FFGO (for the [[FFGo]] FlightGear launcher)&lt;br /&gt;
* FGRUN (for the [[Fgrun|FGRun]] FlightGear launcher)&lt;br /&gt;
* FGX (for the [[FGX|FGx]] FlightGear launcher&amp;lt;ref name=&amp;quot;note-on-the-status-of-FGx-support-in-download-and-compile-sh&amp;quot;&amp;gt;Support for FGx in &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; would probably benefit from a code review.&amp;lt;/ref&amp;gt;)&lt;br /&gt;
* OPENRADAR (for the [[OpenRadar]] air traffic control simulation program)&lt;br /&gt;
* OPENRTI (for [[FlightGear HLA support (High Level Architecture)#OpenRTI | OpenRTI]]&amp;lt;ref name=&amp;quot;note-on-the-status-of-OpenRTI-support-in-FG&amp;quot;&amp;gt;Note that OpenRTI is just an optional dependency for [[FlightGear high-level architecture support | HLA support]]. For the time being, you should be just fine building without it. Eventually, the idea is for HLA to replace the existing MP system and even increasingly distribute the FlightGear architecture such that more and more components can be more easily run in separate threads or even separate processes, possibly even on different machines. So this is going to be an important feature for professional users, using several computers and screens to create a comprehensive and immersive simulation environment.&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
At the moment, it is probably safe to say that HLA is only of interest to developers and people willing to play with experimental features.&amp;lt;/ref&amp;gt;)&lt;br /&gt;
* OSG (for the [[OpenSceneGraph]] library)&lt;br /&gt;
* PLIB (for the [[PLIB]] library)&lt;br /&gt;
* SIMGEAR (for the [[SimGear]] library—foundation for FlightGear and TerraGear)&lt;br /&gt;
* TERRAGEAR (for the [[TerraGear]] terrain building toolchain)&lt;br /&gt;
* TERRAGEARGUI (for [[TerraGear GUI]], a graphical interface for TerraGear)&lt;br /&gt;
* ZLIB (for the [http://www.zlib.net/ zlib] compression library)&lt;br /&gt;
&lt;br /&gt;
Each of the items listed above is a ''component'' in &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; terminology. Components are written in uppercase by convention.&lt;br /&gt;
&lt;br /&gt;
{{Note|The preceding list might not be up-to-date. The up-to-date list of components supported by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; can always be obtained by running &amp;lt;code&amp;gt;download_and_compile.sh --help&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
What is the point of knowing this? Because you may pass component names to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in order to tell it what you want to download, build and install. By default, only the components [[SimGear|SIMGEAR]], [[FlightGear|FGFS]], [[FGData|DATA]] and [[OpenSceneGraph|OSG]] are taken care of, which means that the command:&lt;br /&gt;
 $ download_and_compile.sh&lt;br /&gt;
is equivalent to:&lt;br /&gt;
 $ download_and_compile.sh SIMGEAR FGFS DATA OSG&lt;br /&gt;
&lt;br /&gt;
In case you'd like to do the same build with just [[PLIB]] added, you could use:&lt;br /&gt;
 $ download_and_compile.sh SIMGEAR FGFS DATA OSG PLIB&lt;br /&gt;
&lt;br /&gt;
You get the idea. When several components are passed on the same command line, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; chooses a reasonable order for processing, so don't worry about that.&lt;br /&gt;
&lt;br /&gt;
== When building ''next'', you may encounter problems ==&lt;br /&gt;
&lt;br /&gt;
Keeping in mind that this script compiles sometimes bleeding edge software, it can happen that what was successfully compiling last week, does not compile anymore today. Building the latest stable version (option &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;) or the latest Long Term Stable release (option &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;) should always work, unless there is a problem with the script (well, in some cases, there may be packages of your distribution that are too recent for &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;; for instance, in July 2020, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; didn't build with OpenSceneGraph 3.6, but simply passing the OSG component on the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command solved the problem, because at that time, option &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; selected OpenSceneGraph 3.4).&lt;br /&gt;
&lt;br /&gt;
That said, you may want to build the development version (called ''next''): this is the one developers use all the time, so kindly asking on the flightgear-devel [[Mailing_lists|mailing list]] in case a problem popped up&amp;lt;ref name=&amp;quot;what-to-provide-when-asking-for-help&amp;quot;&amp;gt;Don't forget in this case to precisely tell what you did and include the &amp;lt;tt&amp;gt;compilation_log.txt&amp;lt;/tt&amp;gt; file written by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;.&amp;lt;/ref&amp;gt; should allow you to find good advice and get the problem quickly fixed, if it's a new one.&lt;br /&gt;
&lt;br /&gt;
{{Warning|As of July 2020, heavy development will be done on ''next'', the development branch of FlightGear. It is expected to be rather unstable for several months. Unless you are really interested in FlightGear development or in providing feedback to the developers, you're probably better off building either the latest stable version (option &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;) or the latest Long Term Stable release (option &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;). In case you want something even older, the previous LTS release can be selected with option &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
== Task-specific instructions ==&lt;br /&gt;
&lt;br /&gt;
{{Note|In this section, we assume you've read and followed the advice given in [[#getting-started-with-download-and-compile-sh|Getting started with &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;]].}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;selecting-the-components-to-work-on&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Selecting the components to build ===&lt;br /&gt;
&lt;br /&gt;
By default, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; downloads or updates, then compiles, [[SimGear]], FlightGear, [[FGData]] and [[OpenSceneGraph|OSG]] (more precisely, FGData is downloaded but not compiled—that wouldn't make sense). This is what happens when running:&lt;br /&gt;
 $ download_and_compile.sh&lt;br /&gt;
The preceding command is therefore equivalent to:&lt;br /&gt;
 $ download_and_compile.sh SIMGEAR FGFS DATA OSG&lt;br /&gt;
&lt;br /&gt;
To make &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; take care of other programs or libraries, use non-option arguments naming the ''components'' you want, for instance:&lt;br /&gt;
 $ download_and_compile.sh SIMGEAR FGFS DATA OSG CMAKE&lt;br /&gt;
SIMGEAR, FGFS, DATA, OSG and CMAKE are the component names respectively corresponding to [[SimGear]], FlightGear, [[FGData]], [[OpenSceneGraph]] and [https://cmake.org/ CMake] in &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;'s terminology.&lt;br /&gt;
&lt;br /&gt;
A [[#list-of-available-components|list of available components]] is provided on this page, but the fully up-to-date list can always be obtained by running &amp;lt;code&amp;gt;download_and_compile.sh --help&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Choosing between stable and development versions ===&lt;br /&gt;
&lt;br /&gt;
By default, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; fetches code and data from development branches of the source repositories (which sometimes causes compilation or runtime errors). However, it is possible to tell the script to download the latest “stable” version of each component, for some suitable definition of “stable”. This is by means of the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; options:&lt;br /&gt;
 $ download_and_compile.sh -s ''COMPONENT1 COMPONENT2...''&lt;br /&gt;
or&lt;br /&gt;
 $ download_and_compile.sh --lts ''COMPONENT1 COMPONENT2...''&lt;br /&gt;
or&lt;br /&gt;
 $ download_and_compile.sh --old-lts ''COMPONENT1 COMPONENT2...''&lt;br /&gt;
&lt;br /&gt;
How does it work?&lt;br /&gt;
* For [[SimGear]], FlightGear and [[FGData]], &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; uses the most recent stable release branch of the corresponding Git repository, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; uses the most recent Long Term Stable release (LTS) and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; uses the previous LTS release.&lt;br /&gt;
* For other components, a known-stable version is selected by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, which may be influenced by the use of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
So, as far as the SIMGEAR, FGFS and DATA components are concerned, you can:&lt;br /&gt;
* build the latest stable release (&amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;);&lt;br /&gt;
* build the latest Long Term Stable release (&amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;);&lt;br /&gt;
* build the previous Long Term Stable release (&amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;);&lt;br /&gt;
* build the current development version (bleeding edge), which lives in the {{flightgear source&lt;br /&gt;
| branch = next&lt;br /&gt;
| text = next&lt;br /&gt;
}} branch of the FlightGear repository.&lt;br /&gt;
The use of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; also influences the version of other components you may have selected (this can be overridden using &amp;lt;code&amp;gt;--component-branch&amp;lt;/code&amp;gt; for advanced users—see [[#Component-specific settings|Component-specific settings]]).&lt;br /&gt;
&lt;br /&gt;
{{Note|In a given folder where &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is run, you should normally either always use the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option, or always use &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;, or always use &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;, or always none of these (in other words, stick to the same suite: latest stable, latest LTS, previous LTS or ''next'', consistently accross all components).}}&lt;br /&gt;
&lt;br /&gt;
Actually, it ''is'' possible to switch between suites but you have to use the &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; option when doing the switch (see [[#Cleaning built and installed files|Cleaning built and installed files]] for information on this option). For instance:&lt;br /&gt;
* Build with &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; as many times as you want.&lt;br /&gt;
* Want to try ''next''? Okay, then build once with &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; (no &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option anymore).&lt;br /&gt;
* You can then perform as many builds of ''next'' as you want; no need to use &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; unless something special went wrong.&lt;br /&gt;
* If you later decide to switch back to the stable release, build once with &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt;, then only with &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; for further builds.&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
This way, ''you don't need to download the repositories again'' when trying the various suites. In particular, you can switch between ''next'', stable, LTS and old LTS without downloading nor having several copies of [[FGData]] on your hard drive. (This works because a Git repository may internally contain data for several branches, even if only one is “normally visible” in the filesystem at a given time.)&lt;br /&gt;
&lt;br /&gt;
==== Building the latest Long Term Stable release of FlightGear ====&lt;br /&gt;
&lt;br /&gt;
When executing &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, use the &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; option to build the latest Long Term Stable release: &lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh --lts&lt;br /&gt;
(In this example, the implicitly-selected components are SIMGEAR, FGFS and DATA, as explained [[#selecting-the-components-to-work-on | above]].)&lt;br /&gt;
&lt;br /&gt;
{{Note|If you decide to use the &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; option in a given directory tree, you should use it for all components in that directory tree (SIMGEAR, FGFS, DATA, etc.). Running &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in a given directory with the &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; option for some components and not for others is not supported.}}&lt;br /&gt;
&lt;br /&gt;
==== Building the latest stable release of FlightGear ====&lt;br /&gt;
&lt;br /&gt;
When executing &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, use the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option to build the latest stable release: &lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh -s&lt;br /&gt;
&lt;br /&gt;
{{Note|If you decide to use the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option in a given directory tree, you should use it for all components in that directory tree (SIMGEAR, FGFS, DATA, etc.). Running &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in a given directory with the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option for some components and not for others is not supported.}}&lt;br /&gt;
&lt;br /&gt;
==== Building the current FlightGear development version ====&lt;br /&gt;
&lt;br /&gt;
When executing &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; without any option, the development version of every selected component is built:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh&lt;br /&gt;
&lt;br /&gt;
{{Note|The development version of FlightGear changes on an almost daily basis. It provides the latest features, but is not guaranteed to always work reliably. If you don't want to take the risk of finding new bugs when updating, you may prefer to use the latest stable release.}}&lt;br /&gt;
&lt;br /&gt;
==== Building the previous Long Term Stable release of FlightGear ====&lt;br /&gt;
&lt;br /&gt;
When executing &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, use the &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; option to build the previous Long Term Stable release (i.e., oldish code): &lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh --old-lts&lt;br /&gt;
(In this example, the implicitly-selected components are SIMGEAR, FGFS and DATA, as explained [[#selecting-the-components-to-work-on | above]].)&lt;br /&gt;
&lt;br /&gt;
{{Note|If you decide to use the &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; option in a given directory tree, you should use it for all components in that directory tree (SIMGEAR, FGFS, DATA, etc.). Running &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in a given directory with the &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; option for some components and not for others is not supported.}}&lt;br /&gt;
&lt;br /&gt;
=== Overriding the source repository or branch for a component ===&lt;br /&gt;
&lt;br /&gt;
This section shows how to override the location and/or branch from which a given component will be downloaded.&lt;br /&gt;
&lt;br /&gt;
{{Warning|The rest of this section is for people who know what they are doing. Don't use the following unless you trust the person who publishes the repository and have good reasons to believe that it has been kept up-to-date.}}&lt;br /&gt;
&lt;br /&gt;
==== A short example ====&lt;br /&gt;
&lt;br /&gt;
Let's start with an example to make it easier to understand to following paragraphs. Suppose we want to build the current stable release of FlightGear, linked against an [[OpenSceneGraph]] library whose source code is to be retrieved from branch &amp;lt;tt&amp;gt;fgfs-osg-36-2&amp;lt;/tt&amp;gt; of the Git repository located at [https://gitlab.com/flightgear/openscenegraph.git https://gitlab.com/flightgear/openscenegraph.git] (this is actually the default in September 2024). Since the default protocol used when &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; clones a repository is [https://en.wikipedia.org/wiki/HTTPS HTTPS], this can be done with&lt;br /&gt;
 download_and_compile.sh --cleanup -s \&lt;br /&gt;
 --override-repo OSG=GitLab:gitlab.com/flightgear/openscenegraph.git \&lt;br /&gt;
 --component-branch OSG=fgfs-osg-36-2 SIMGEAR FGFS DATA OSG&lt;br /&gt;
&lt;br /&gt;
==== The site name ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; uses case-insensitive short names such as &amp;lt;tt&amp;gt;GitHub&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;SourceForge&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;gitlab.kitware.com&amp;lt;/tt&amp;gt; as keys in order to identify the settings describing where and how a given component will be initially fetched (these settings are effective at clone time; later updates simply use the settings recorded in the local repository). These names are referred to as ''site'' in the output of &amp;lt;code&amp;gt;download_and_compile.sh --help&amp;lt;/code&amp;gt;, in particular in the &amp;lt;tt&amp;gt;--git-clone-site-params&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;--override-repo&amp;lt;/tt&amp;gt; options we'll present below. These ''site'' keys are simply identifier strings; they are not used in the DNS queries.&lt;br /&gt;
&lt;br /&gt;
==== The protocol ====&lt;br /&gt;
&lt;br /&gt;
Current &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (from December 2022) fetches the source code of most components from Git repositories (earlier versions used Subversion for some components); a few non-core components (currently [[FGo!]] and [[OpenRadar]]) are fetched using &amp;lt;tt&amp;gt;wget&amp;lt;/tt&amp;gt; and are out-of-scope for this section.&lt;br /&gt;
&lt;br /&gt;
The default protocol used by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; when cloning a Git repository is [https://en.wikipedia.org/wiki/HTTPS HTTPS]. This can be overridden using the &amp;lt;tt&amp;gt;--git-clone-default-proto&amp;lt;/tt&amp;gt; option. In other words, the default is &amp;lt;tt&amp;gt;--git-clone-default-proto=https&amp;lt;/tt&amp;gt; (the protocol name is case-insensitive). Other possibilities for the protocol are &amp;lt;tt&amp;gt;git&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Warning|The &amp;lt;tt&amp;gt;git&amp;lt;/tt&amp;gt; protocol doesn't protect against man-in-the-middle attacks; use at your own risk! Unfortunately, “clever” people often recommend it on the forum without mentioning its downsides.}}&lt;br /&gt;
&lt;br /&gt;
Using the &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt; protocol as the argument of &amp;lt;tt&amp;gt;--git-clone-default-proto&amp;lt;/tt&amp;gt; has little use, because in general you'll want to specify a particular username when using SSH and this username is likely not to be the same for all components you intend to clone via SSH (right, &amp;lt;tt&amp;gt;~/.ssh/config&amp;lt;/tt&amp;gt; can be used to automatically provide a site-dependent username). That is why &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; offers the &amp;lt;tt&amp;gt;--git-clone-site-params&amp;lt;/tt&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
==== Site-specific settings ====&lt;br /&gt;
&lt;br /&gt;
Using&lt;br /&gt;
 --git-clone-site-params ''SITE''=''PROTOCOL''[:''USERNAME'']&lt;br /&gt;
you can tell &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; that every component fetched from ''SITE'' should be cloned with the specified protocol and username (allowed protocols are &amp;lt;tt&amp;gt;https&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;git&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
{{Note|In case you have several repositories at a given site (say, GitHub) and need to use different SSH usernames for these repositories, you can use different site names:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--override-repo COMPONENT_A=GitHubA:ADDRESS_A&lt;br /&gt;
--git-clone-site-params GitHubA=ssh:userA&lt;br /&gt;
--override-repo COMPONENT_B=GitHubB:ADDRESS_B&lt;br /&gt;
--git-clone-site-params GitHubB=ssh:userB&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here, the site names are &amp;lt;tt&amp;gt;GitHubA&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;GitHubB&amp;lt;/tt&amp;gt;; the &amp;lt;tt&amp;gt;--override-repo&amp;lt;/tt&amp;gt; option will be presented below.&lt;br /&gt;
&lt;br /&gt;
By default, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; case-insensitively uses the &amp;lt;tt&amp;gt;GitHub&amp;lt;/tt&amp;gt; (resp. &amp;lt;tt&amp;gt;SourceForge&amp;lt;/tt&amp;gt;) site name to identify the settings used when cloning a repository from github.com (resp. git.code.sf.net). Therefore, the settings for GitHubA and GitHubB in this example would only apply to components ''c'' for which --override-repo ''c''&amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt;GitHubA:... or --override-repo ''c''&amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt;GitHubB:... has been specified.}}&lt;br /&gt;
&lt;br /&gt;
==== Component-specific settings ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;--override-repo&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;--component-branch&amp;lt;/tt&amp;gt; options allow one to override the default settings used by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; for cloning the repository corresponding to the specified component (they only apply to components whose source code is retrieved with Git). The syntax of these options is&lt;br /&gt;
 --override-repo ''COMPONENT''=''SITE'':''ADDRESS''&lt;br /&gt;
and&lt;br /&gt;
 --component-branch ''COMPONENT''=''BRANCH''&lt;br /&gt;
In this syntax:&lt;br /&gt;
* ''COMPONENT'' represents the name of a component for &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (e.g., &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;—see [[#List of available components|List of available components]]);&lt;br /&gt;
* ''ADDRESS'' is something like &amp;lt;tt&amp;gt;git.code.sf.net/p/flightgear/simgear&amp;lt;/tt&amp;gt; (don't include any &amp;lt;tt&amp;gt;protocol://&amp;lt;/tt&amp;gt; part in ''ADDRESS'');&lt;br /&gt;
* ''BRANCH'' should be the name of an existing branch of the Git repository hosted at ''ADDRESS'';&lt;br /&gt;
* ''SITE'' is a string used as a key in a mapping; &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; uses it to find out how to connect to ''ADDRESS'' in order to clone the repository for ''COMPONENT'' (see [[#Site-specific settings|Site-specific settings]]).&lt;br /&gt;
See the [[#A short example|above example]] for a concrete example where these options are used.&lt;br /&gt;
&lt;br /&gt;
{{Note|The argument of any long option of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; that takes an argument may be introduced immediately after the option name using an equal sign. However, in the above cases, I find this way a bit confusing because the option value ''also'' uses an equal sign as separator. Hence the above use of separate command arguments: one for the option name, one for its argument.}}&lt;br /&gt;
&lt;br /&gt;
=== Passing custom arguments to CMake ===&lt;br /&gt;
&lt;br /&gt;
Sometimes, when building a program, you may want to enable a feature that is not enabled by default, or disable a feature that is enabled by default. With recent versions of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (October 2020 or later), this can be done for SimGear and FlightGear using the &amp;lt;code&amp;gt;--sg-cmake-arg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--fg-cmake-arg&amp;lt;/code&amp;gt; options (the environment variables &amp;lt;tt&amp;gt;SG_CMAKEARGS&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;FG_CMAKEARGS&amp;lt;/tt&amp;gt; are still supported, but they don't allow one to pass arguments containing spaces). For instance, in order to link SimGear with the system Expat library, you can do:&lt;br /&gt;
 $ download_and_compile.sh --sg-cmake-arg='-DSYSTEM_EXPAT=ON' SIMGEAR&lt;br /&gt;
Similarly, disabling HID-based input when building FlightGear can be achieved this way:&lt;br /&gt;
 $ download_and_compile.sh --fg-cmake-arg='-DENABLE_HID_INPUT=OFF' FGFS&lt;br /&gt;
&lt;br /&gt;
{{Note|Such options are typically defined in &amp;lt;tt&amp;gt;CMakeLists.txt&amp;lt;/tt&amp;gt; files, for example {{simgear source&lt;br /&gt;
| path = CMakeLists.txt&lt;br /&gt;
| text = here&lt;br /&gt;
}} for SimGear and {{flightgear source&lt;br /&gt;
| path = CMakeLists.txt&lt;br /&gt;
| text = here&lt;br /&gt;
}} for FlightGear.}}&lt;br /&gt;
&lt;br /&gt;
This can be useful, for instance, to work around bugs in a part of SimGear or FlightGear that you don't need, but causes a build or runtime failure (see {{forum link|t=35740|text=here}} for example). This is often convenient when using the development version of FlightGear, but doesn't mean such bugs shouldn't be reported!&lt;br /&gt;
&lt;br /&gt;
If you have several such options to pass, just use &amp;lt;code&amp;gt;--sg-cmake-arg&amp;lt;/code&amp;gt; and/or &amp;lt;code&amp;gt;--fg-cmake-arg&amp;lt;/code&amp;gt; several times:&lt;br /&gt;
 $ download_and_compile.sh --fg-cmake-arg='-DENABLE_SWIFT=ON' \&lt;br /&gt;
                           --fg-cmake-arg='-DENABLE_HID_INPUT=OFF' FGFS&lt;br /&gt;
It is even possible to pass arguments containing spaces to CMake, as in:&lt;br /&gt;
 $ download_and_compile.sh \&lt;br /&gt;
     --sg-cmake-arg='-DCMAKE_CXX_FLAGS=-Wno-deprecated-declarations -Wall' \&lt;br /&gt;
     SIMGEAR&lt;br /&gt;
(just a silly example to show a working syntax) or:&lt;br /&gt;
 $ download_and_compile.sh \&lt;br /&gt;
     --fg-cmake-arg=&amp;quot;-DCMAKE_CXX_FLAGS=$(pkg-config --cflags gl)&amp;quot; \&lt;br /&gt;
     FGFS&lt;br /&gt;
Note the use of double-quotes here to enable the &amp;lt;code&amp;gt;$(...)&amp;lt;/code&amp;gt; command substitution.&lt;br /&gt;
&lt;br /&gt;
Using the (half-deprecated) environment variables &amp;lt;tt&amp;gt;SG_CMAKEARGS&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;FG_CMAKEARGS&amp;lt;/tt&amp;gt;, it is also possible to define CMake arguments in a single place that are going to be used for both SimGear and FlightGear. However, this technique doesn't allow one to pass arguments containing spaces to CMake.&lt;br /&gt;
 $ export SG_CMAKEARGS='-DSYSTEM_EXPAT=ON'&lt;br /&gt;
 $ export FG_CMAKEARGS='-DENABLE_SWIFT=ON -DENABLE_HID_INPUT=OFF'&lt;br /&gt;
 $ download_and_compile.sh&lt;br /&gt;
&lt;br /&gt;
=== Seeing the compilation commands run by Make ===&lt;br /&gt;
&lt;br /&gt;
As a simple application of the previous section, the following options are often useful. When passed to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, these options cause the compilation commands run via Make to be printed on the terminal and recorded in the compilation_log.txt file:&lt;br /&gt;
  --sg-cmake-arg='-DCMAKE_VERBOSE_MAKEFILE=1' \&lt;br /&gt;
  --fg-cmake-arg='-DCMAKE_VERBOSE_MAKEFILE=1'&lt;br /&gt;
(the backslash is unneeded if you put both options on the same line). Passing the value 0 instead of 1 would explicitly request the default, non-verbose behavior.&lt;br /&gt;
&lt;br /&gt;
=== Launching FlightGear ===&lt;br /&gt;
&lt;br /&gt;
When using &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, apart from those installed with the package manager, the FlightGear dependencies (which are typically libraries) are not installed system-wide but under the directory from which &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; was run. This makes it possible to easily use, for instance, different [[OpenSceneGraph]], [[SimGear]] and FlightGear versions on a single system—e.g., for testing purposes—but also to have separate build trees (optimized/debug). This is also why you either need to set LD_LIBRARY_PATH to run the built programs, or simply use the scripts created by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in the directory where it is run, such as &amp;lt;tt&amp;gt;run_fgfs.sh&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;run_fgfs_debug.sh&amp;lt;/tt&amp;gt;: these scripts automatically set up the required environment variables according to your build settings before firing the desired program (e.g., &amp;lt;tt&amp;gt;fgfs&amp;lt;/tt&amp;gt;) with the arguments you provided. &lt;br /&gt;
&lt;br /&gt;
Therefore, the simplest way to run a FlightGear program built by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is to launch the &amp;lt;tt&amp;gt;run_fgfs.sh&amp;lt;/tt&amp;gt; script that &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; created in the directory from which it was run, for example:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgfs.sh --launcher&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;./run_fgfs.sh --launcher&amp;lt;/code&amp;gt; starts FlightGear with its built-in launcher. If you just do &amp;lt;code&amp;gt;./run_fgfs.sh&amp;lt;/code&amp;gt;, FlightGear will be started without any launcher, at the default airport and with the default aircraft.}}&lt;br /&gt;
&lt;br /&gt;
In order to start FlightGear without any launcher, at a given airport (say, [https://en.wikipedia.org/wiki/Paro_Airport Paro airport], whose ICAO code is VQPR) and with a chosen aircraft, you can do:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgfs.sh --airport=VQPR --aircraft=dhc6&lt;br /&gt;
Actually, the directory change is not needed, we only gave it here for readability. Therefore, the following single command does the same:&lt;br /&gt;
 $ ~/flightgear/dnc-managed/run_fgfs.sh --airport=VQPR --aircraft=dhc6&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;avoiding-multiple-downloads-of-fgdata&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Avoiding multiple downloads of FGData ===&lt;br /&gt;
&lt;br /&gt;
Some people use &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to maintain several directory trees such as the tree starting at &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; in [[#getting-started-with-download-and-compile-sh|Getting started with &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;]] (this can be useful if you want to have one tree with programs compiled in Release mode and another tree where they are built in Debug mode, for instance). This can easily be done by running &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in each of the directories. But since [[FGData]] is so large, it may be tempting to share a single instance of this repository among several trees. This is not officially supported, but apparently can be made to work with symbolic links.&lt;br /&gt;
&lt;br /&gt;
Let's show how this can be done on an example. Suppose your master copy of FGData is in &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata&amp;lt;/tt&amp;gt;. Then the following appears to work:&lt;br /&gt;
 $ mkdir -p ~/flightgear/other-dnc-managed-tree/install/flightgear&lt;br /&gt;
 $ cd ~/flightgear/other-dnc-managed-tree/install/flightgear&lt;br /&gt;
 $ ln -s ../../../dnc-managed/install/flightgear/fgdata&lt;br /&gt;
 $ cd ~/flightgear/other-dnc-managed-tree&lt;br /&gt;
 $ download_and_compile.sh&lt;br /&gt;
&lt;br /&gt;
The last of these commands will use and update the FGData repository present in &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Warning|This can only work simply if all trees that share a given FGData repository are from the same release (e.g., current stable or development). Running a “stable“ FlightGear with FGData from the ''next'' branch or the other way round, a development version of FlightGear with FGData from a release branch, doesn't work—and FlightGear should tell you when you start it in such a situation.&lt;br /&gt;
&lt;br /&gt;
That said, people comfortable with Git can check out the correct FGData branch before building or starting FlightGear, for instance:&lt;br /&gt;
 $ cd /path/to/fgdata &amp;amp;&amp;amp; git checkout release/2019.1&lt;br /&gt;
or&lt;br /&gt;
 $ cd /path/to/fgdata &amp;amp;&amp;amp; git checkout next&lt;br /&gt;
So, this is possible but somewhat acrobatic. You've been warned.}}&lt;br /&gt;
&lt;br /&gt;
Note: there is a [[Avoiding multiple downloads of FGData on Linux|wiki article about this subject]], but it is severely outdated as of April 2019.&lt;br /&gt;
&lt;br /&gt;
== Additional programs ==&lt;br /&gt;
&lt;br /&gt;
{{Note|In this section, we assume you've read and followed the advice given in [[#getting-started-with-download-and-compile-sh|Getting started with &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;]].}}&lt;br /&gt;
&lt;br /&gt;
If you wish to get other programs (precisely: download, build and install them), you need to launch &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; with the desired component names as arguments. For instance:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh SIMGEAR FGFS DATA OSG&lt;br /&gt;
&lt;br /&gt;
See [[#list-of-available-components|above]] for the list of available components.&lt;br /&gt;
&lt;br /&gt;
=== TerraGear ===&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; with the TERRAGEAR component in order to build and install the [[TerraGear]] terrain building toolchain:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh TERRAGEAR&lt;br /&gt;
&lt;br /&gt;
This creates the following scripts in &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt;:&lt;br /&gt;
* &amp;lt;tt&amp;gt;run_genapts850.sh&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;run_ogr-decode.sh&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;run_tg-construct.sh&amp;lt;/tt&amp;gt;&lt;br /&gt;
These scripts themselves run the corresponding TerraGear tools, as expected.&lt;br /&gt;
&lt;br /&gt;
=== TerraGear GUI ===&lt;br /&gt;
&lt;br /&gt;
[[TerraGear GUI]] is a graphical interface for [[TerraGear]] written with the Qt toolkit (still Qt 4 in 2019, but it works). In order to install it, run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; with the TERRAGEARGUI component:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh TERRAGEARGUI&lt;br /&gt;
This will create a &amp;lt;tt&amp;gt;run_terrageargui.sh&amp;lt;/tt&amp;gt; script in &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt;, and also a default configuration file &amp;lt;tt&amp;gt;~/.config/TerraGear/TerraGearGUI.conf&amp;lt;/tt&amp;gt;, unless you already have one. This default configuration file contains paths to the TerraGear and [[$FG_ROOT]] directories, assuming you have installed the TERRAGEAR and DATA components.&lt;br /&gt;
&lt;br /&gt;
To run TerraGear GUI:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_terrageargui.sh&lt;br /&gt;
&lt;br /&gt;
=== FGCom ===&lt;br /&gt;
&lt;br /&gt;
{{Note|[[FGCom]] has been integrated into FlightGear long ago, therefore the following is not needed in general.}}&lt;br /&gt;
&lt;br /&gt;
[[FGCom]] is the system used by FlightGear to simulate radio communications between users. It is automatically built and installed when you tell &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to take care of the FGFS component. You can launch the standalone FGCom program by using the &amp;lt;tt&amp;gt;run_fgcom.sh&amp;lt;/tt&amp;gt; script:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgcom.sh&lt;br /&gt;
&lt;br /&gt;
=== FGRun ===&lt;br /&gt;
&lt;br /&gt;
{{Note|As of 2019, FGRun has been superseded by the [[FlightGear Qt launcher|FlightGear built-in launcher]]. The built-in launcher is the most actively maintained launcher for FlightGear. Other launchers are [[FFGo]] and [[FGX|FGx]].}}&lt;br /&gt;
&lt;br /&gt;
[[File:fgrun-page2.jpg|thumb|right]]&lt;br /&gt;
Before FlightGear had its built-in launcher (the one you get with &amp;lt;code&amp;gt;run_fgfs.sh --launcher&amp;lt;/code&amp;gt;), many users found comfortable having FlightGear launched by the graphical utility [[Fgrun|FGRun]]. This program is built and installed when &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is run with the FGRUN component. You then have to launch the &amp;lt;tt&amp;gt;run_fgrun.sh&amp;lt;/tt&amp;gt; command, for example:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgrun.sh&lt;br /&gt;
&lt;br /&gt;
FGRun will save its settings in &amp;lt;tt&amp;gt;~/.fltk/flightgear.org/fgrun.prefs&amp;lt;/tt&amp;gt;. You may want to save copies of the preferences customized for stable and next.&lt;br /&gt;
&lt;br /&gt;
=== FGo! ===&lt;br /&gt;
&lt;br /&gt;
{{Note|As of 2019, FGo! is not maintained anymore. You may want to try the built-in launcher (started with &amp;lt;code&amp;gt;run_fgfs.sh --launcher&amp;lt;/code&amp;gt;) or [[FFGo]].}}&lt;br /&gt;
&lt;br /&gt;
[[File:Fgo01.jpg|thumb|left]]&lt;br /&gt;
FGo! is a graphical utility written in [[python]]. It is downloaded and installed when &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is run with the FGO component. You then have to launch the &amp;lt;tt&amp;gt;run_fgo.sh&amp;lt;/tt&amp;gt; command, for example:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgo.sh&lt;br /&gt;
&lt;br /&gt;
Remember that the first time you run it, you have to go to open the ''Preferences'' dialog and set the paths to the &amp;lt;tt&amp;gt;fgfs&amp;lt;/tt&amp;gt; executable and to FGData.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Compilation errors ===&lt;br /&gt;
Here we are, no fear, if you wish to use programs from the cvs/svn/git repositories, you might face compilation errors that will prevent you to have a working copy of one or more of the programs provided by this script. What can be the causes that prevent us from successfully compiling? As far as I know those:&lt;br /&gt;
# Software developers introduce a new functionality with a new piece of code that prevents the compilation under your architecture, this can happen working with cvs/svn/git sources.&lt;br /&gt;
# The program refuses to compile because of a divergence in the libraries on which it depends. For example FlightGear might not compile because OSG has been modified, while OSG itself compiles fine, FG won't.&lt;br /&gt;
# One or more repositories are down and you can't get the library you need. (Both from cvs/svn/git or apt-get)&lt;br /&gt;
&lt;br /&gt;
There is a simple solution to the above errors: wait and relaunch the script after some time (hours or days), if software developers repair or synchronize their code with the newly updated libraries (which generally happens eventually), your FlightGear will compile fine as if the previous error never took place.&lt;br /&gt;
&lt;br /&gt;
Sometimes it happens that the script fails to compile only [[Fgrun|FGRun]], [[FGCom]] or atlas, if you then see the run_fgfs.sh file it means that FlightGear installation was successful and you can safely run it.&lt;br /&gt;
&lt;br /&gt;
=== OpenRTI undefined reference errors ===&lt;br /&gt;
&lt;br /&gt;
Sometimes, due to the way &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; builds projects, linking errors might occur. This is the case with the error “libRTI-NG.so: undefined reference to xxx”. You might want to patch the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; script to clean OpenRTI with &amp;lt;code&amp;gt;rm -f CMakeCache.txt &amp;amp;&amp;amp; rm -rf CMakeFiles/&amp;lt;/code&amp;gt;, or just restart the build in a clean environment. Assuming you are in the base directory from which you ran &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, you can run &amp;lt;code&amp;gt;download_and_compile.sh --cleanup&amp;lt;/code&amp;gt; (see [[#Cleaning built and installed files|Cleaning built and installed files]]). Alternatively, the following command could be used:&lt;br /&gt;
 $ rm -rf build/* install/simgear/ install/openrti/ install/flightgear/share/ install/flightgear/bin/&lt;br /&gt;
&lt;br /&gt;
See {{forum link|t=26244|text=this thread}} for more details. Note that &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; didn't have the &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; option at that time!&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
=== Release selection ===&lt;br /&gt;
&lt;br /&gt;
* Build the latest stable release: &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build the latest Long Term Stable release: &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build the previous Long Term Stable release: &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Long Term Stable (&amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;) is supposed to yield a more stable setup than what you would obtain with option &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, however it will generally be older. Both of these options are suitable for users.&lt;br /&gt;
&lt;br /&gt;
If you pass none of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; in a &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; invocation, you'll build the the ''next'' suite, which contains the development version of FlightGear. The corresponding FlightGear code will be very recent but may well be unstable—this is particularly the case starting from July 2020. This is therefore mostly intended for developers.&lt;br /&gt;
&lt;br /&gt;
=== Skipping most prompts ===&lt;br /&gt;
&lt;br /&gt;
For some important things, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; asks for confirmation in order to be sure that you are well informed about what will be done. When you have a good understanding of these informations, you may want to use the &amp;lt;code&amp;gt;--non-interactive&amp;lt;/code&amp;gt; option in order to suppress these prompts (technically, this causes the default answer to be automatically used).&lt;br /&gt;
&lt;br /&gt;
=== Cleaning built and installed files ===&lt;br /&gt;
&lt;br /&gt;
Option &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; causes &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to remove everything that was built and installed in the directory it is run from. The Git repositories will not be removed, so this is good if you want to restart a compilation from a clean state.&lt;br /&gt;
&lt;br /&gt;
If you use &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; without specifying any component, only this removal will be done (nothing will be compiled nor installed). Otherwise, the usual rules concerning components apply.&lt;br /&gt;
&lt;br /&gt;
=== Multicore acceleration ===&lt;br /&gt;
&lt;br /&gt;
Passing option &amp;lt;code&amp;gt;-j x&amp;lt;/code&amp;gt; to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (where ''x'' is the number of your CPU cores you wish to assign to the job) will considerably speed up the compilation steps. Passing &amp;lt;code&amp;gt;-j$(nproc)&amp;lt;/code&amp;gt; is a convenient way to automatically use all available cores.&lt;br /&gt;
&lt;br /&gt;
=== Advanced options ===&lt;br /&gt;
&lt;br /&gt;
* Build a release version: &amp;lt;code&amp;gt;-b Release&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build a version that should run as fast as a release build, yet has debug information that can be used to post backtraces: &amp;lt;code&amp;gt;-b RelWithDebInfo&amp;lt;/code&amp;gt; (this is the default)&lt;br /&gt;
* Build a full debug version for very complete bug reporting: &amp;lt;code&amp;gt;-b Debug&amp;lt;/code&amp;gt;&lt;br /&gt;
* Skip download of distro packages (i.e., by default: &amp;lt;tt&amp;gt;apt-get install ...&amp;lt;/tt&amp;gt;): &amp;lt;code&amp;gt;-p n&amp;lt;/code&amp;gt;&lt;br /&gt;
* Skip retrieving of component downloads and updates (which typically use Git or wget): &amp;lt;code&amp;gt;-d n&amp;lt;/code&amp;gt;&lt;br /&gt;
* Skip the configure step (like running [https://cmake.org/ CMake] or [https://www.gnu.org/software/autoconf/ autoconf]'s &amp;lt;tt&amp;gt;./configure&amp;lt;/tt&amp;gt;): &amp;lt;code&amp;gt;-r n&amp;lt;/code&amp;gt;&lt;br /&gt;
* Skip compilation of programs: &amp;lt;code&amp;gt;-c n&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build with compositor: &amp;lt;code&amp;gt;--compositor&amp;lt;/code&amp;gt;&lt;br /&gt;
* Force the use of a particular branch for a given component: &amp;lt;code&amp;gt;--component-branch ''COMPONENT=BRANCH''&amp;lt;/code&amp;gt; (e.g., &amp;lt;code&amp;gt;--component-branch OSG=OpenSceneGraph-3.6&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--component-branch FGFS=next&amp;lt;/code&amp;gt;, etc.—but remember that components FGFS, SIMGEAR and DATA must ''always'' be in sync). See [[#Component-specific settings|Component-specific settings]] for details.&lt;br /&gt;
* Override the repository from which a given component is initially fetched: &amp;lt;code&amp;gt;--override-repo ''COMPONENT''=''SITE'':''ADDRESS''&amp;lt;/code&amp;gt; (see [[#Component-specific settings|Component-specific settings]]).&lt;br /&gt;
* Generate build.ninja files and build using Ninja: &amp;lt;code&amp;gt;-G Ninja&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run CMake in verbose mode: &amp;lt;code&amp;gt;--verbose&amp;lt;/code&amp;gt; (this shows compilation commands)&lt;br /&gt;
&lt;br /&gt;
For example, if you are a developer and wish to quickly recompile and reinstall only your own modifications for FlightGear, you can do this:&lt;br /&gt;
 $ download_and_compile.sh -j$(nproc) -p n -d n -r n FGFS&lt;br /&gt;
&lt;br /&gt;
Note that this is the same as:&lt;br /&gt;
 $ download_and_compile.sh -j$(nproc) -pn -dn -rn FGFS&lt;br /&gt;
&lt;br /&gt;
This command will only rebuild modified files and reinstall FlightGear. Note that depending on the kind of changes you made, reconfiguring and thus dropping the &amp;lt;code&amp;gt;-rn&amp;lt;/code&amp;gt; option may be necessary, though (this is the case in particular if you added or removed C++ files).&lt;br /&gt;
&lt;br /&gt;
=== ccache ===&lt;br /&gt;
{{wikipedia|Ccache|ccache}} is a compiler cache that can help speed up subsequent re-compilations. Even if &amp;lt;code&amp;gt;ccache&amp;lt;/code&amp;gt; is installed and in the &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;download_and_compile.sh&amp;lt;/code&amp;gt; won't use it by default. To use it, install it, such as via &amp;lt;code&amp;gt;apt install ccache&amp;lt;/code&amp;gt;. Then enable it when building with &amp;lt;code&amp;gt;download_and_compile.sh&amp;lt;/code&amp;gt; by one of the below methods.&lt;br /&gt;
&lt;br /&gt;
Export in environment:&lt;br /&gt;
 export CMAKE_CXX_COMPILER_LAUNCHER=ccache&lt;br /&gt;
&lt;br /&gt;
Or when running &amp;lt;code&amp;gt;download_and_compile.sh&amp;lt;/code&amp;gt; add this option (does not work on 2024.1, but works with -next branch):&lt;br /&gt;
 --cmake-arg=ALL=&amp;quot;CMAKE_CXX_COMPILER_LAUNCHER=ccache&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Optimus technology ==&lt;br /&gt;
If your computer has a GPU with Optimus technology, you need a dedicated script in order to make FlightGear run with the powerful GPU.&lt;br /&gt;
&lt;br /&gt;
After having installed required tools (Bumblebee) you just need to run this command line in your FlightGear installation directory (where you executed &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;):&lt;br /&gt;
 $ sed  's|\./fgfs|optirun ./fgfs|' run_fgfs.sh &amp;gt; run_fgfs_optirun.sh &amp;amp;&amp;amp; chmod +x run_fgfs_optirun.sh&lt;br /&gt;
Now you can run FlightGear with &amp;lt;code&amp;gt;./run_fgfs_optirun.sh&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The same can be done for the [[FlightGear_Launch_Control|FGRun]] launcher:&lt;br /&gt;
 $ sed  's|\./fgrun|optirun ./fgrun|' run_fgrun.sh &amp;gt; run_fgrun_optirun.sh &amp;amp;&amp;amp; chmod +x run_fgrun_optirun.sh&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* {{fgmeta source&lt;br /&gt;
| path = compile-scripts&lt;br /&gt;
| text = Other FlightGear build scripts&lt;br /&gt;
}} present in [[FGMeta]]&lt;br /&gt;
* {{fgmeta source&lt;br /&gt;
| path = fg-from-scratch&lt;br /&gt;
| simplepath = true&lt;br /&gt;
}}&lt;br /&gt;
* [http://geoffmclane.com/fg/fgfs-052.htm Another script] for building FlightGear and all its dependencies in an automated fashion. The page seems a bit oldish, though (as of 2019).&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Building from source]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Script de compilation sous Linux Debian/Ubuntu]]&lt;br /&gt;
[[nl:Compileren met een Script op Linux Debian/Ubuntu]]&lt;/div&gt;</summary>
		<author><name>Jebba</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Howto:Syntax_highlighting_for_Nasal&amp;diff=141124</id>
		<title>Howto:Syntax highlighting for Nasal</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Howto:Syntax_highlighting_for_Nasal&amp;diff=141124"/>
		<updated>2024-12-23T20:45:29Z</updated>

		<summary type="html">&lt;p&gt;Jebba: /* Vim */ setup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There's '''[[Nasal]] syntax-highlighting''' support available for some editors, which is a big advantage, as it makes Nasal coding much easier.&lt;br /&gt;
&lt;br /&gt;
Syntax highlighting can often point to syntax errors and so reduce the number of tedious time-consuming and unproductive [[FlightGear]] runs. It can also be a sort of &amp;quot;guide&amp;quot; to the language, highlighting functions or keywords that are builtin, so you can quickly check if it is &amp;quot;type&amp;quot; or &amp;quot;typeof&amp;quot; by typing each. In addition makes understanding other people's code easier, since you have all of the parts visually separated out, like loops, strings, constants, and builtin functions.&lt;br /&gt;
&lt;br /&gt;
== Atom ==&lt;br /&gt;
Script is available from [https://github.com/www2000/atom-language-nasal Github] and can also be found in the [https://atom.io/packages/language-nasal Atom's packages repository].&lt;br /&gt;
&lt;br /&gt;
Manual installation:&lt;br /&gt;
&lt;br /&gt;
# Download the latest release from https://github.com/www2000/atom-language-nasal&lt;br /&gt;
# Unpack the tar.bz2&lt;br /&gt;
# Copy/move the language-nasal package to ~/.atom/packages&lt;br /&gt;
&lt;br /&gt;
For installation from atom's packages repository:&lt;br /&gt;
&lt;br /&gt;
# Open Atom&lt;br /&gt;
# Go to Preferences Edit -&amp;gt; Preferences or {{key press|Ctrl|+}},&lt;br /&gt;
# Click on packages and search for nasal&lt;br /&gt;
# Click install for Language Nasal&lt;br /&gt;
&lt;br /&gt;
== Emacs ==&lt;br /&gt;
[[File:Emacs-nasal-syntax-highlighting.png|400px|thumb|Nasal syntax highlighting in GNU Emacs]]&lt;br /&gt;
&lt;br /&gt;
There is an Emacs major mode for Nasal available in SimGear, that is based on Andy Ross' [https://github.com/andyross/nasal/blob/master/misc/nasal-mode.el original version]. In order to use it, you can copy the {{simgear source&lt;br /&gt;
| path = simgear/nasal/misc/nasal-mode.el&lt;br /&gt;
| text = nasal-mode.el&lt;br /&gt;
}} file where you have the rest of your manually installed packages and add the following line to your [https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html Emacs initialization file]:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;(require 'nasal-mode)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In case you don't already have a directory to place your manually installed packages, put the file for instance in ''~/.emacs.d/manual-installs/'' (first create this directory if necessary) and insert the following in your Emacs initialization file before the above ''require'' line:&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;;; Tell Emacs it can load ELisp files from there&lt;br /&gt;
(add-to-list 'load-path &amp;quot;~/.emacs.d/manual-installs&amp;quot;)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once this is done, restart Emacs, check that no error is reported and open a .nas file.&lt;br /&gt;
&lt;br /&gt;
Optional step: in order to speed up loading of nasal-mode.el, you can open it and choose ''Byte-compile this file'' from the ''Emacs-Lisp'' menu (or equivalently, run M-x byte-compile-file).&lt;br /&gt;
&lt;br /&gt;
{{Tip|In case you have a clone of the {{simgear source&lt;br /&gt;
| text = SimGear repository&lt;br /&gt;
}} on your hard drive, you may create a symbolic link from ~/.emacs.d/manual-installs/nasal-mode.el to the file inside that repository; this way, you'll get automatic updates of nasal-mode.el when your SimGear repository is updated (Emacs will ignore the .elc file resulting from byte compilation if the corresponding .el file is more recent).}}&lt;br /&gt;
&lt;br /&gt;
The '''true''' and '''false''' keywords introduced in January 2023 are already supported.&amp;lt;ref&amp;gt;https://forum.flightgear.org/viewtopic.php?f=30&amp;amp;t=41115&amp;amp;p=409029#p409029&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Geany ==&lt;br /&gt;
&lt;br /&gt;
A syntax highlighting solution for [https://www.geany.org/ Geany], a lean text editor/IDE is available from [https://forum.flightgear.org/viewtopic.php?f=30&amp;amp;t=36838#p360677 this thread] in the FlightGear forum.&lt;br /&gt;
&lt;br /&gt;
== gedit ==&lt;br /&gt;
[[File:Philosopher's nasal highlighting in gEdit.jpeg|400px|thumb|Screen shot illustrating syntax highlighting in gedit]]&lt;br /&gt;
&lt;br /&gt;
'''Philosopher''' on the FlightGear Forum has created syntax highlighting for gedit, a popular and simple text editor for Mac OS X, Linux, and Windows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--http://theomegahangar.flymerlion.com/downloads/nasal.lang --&amp;gt;&lt;br /&gt;
To install, copy the ''nasal.lang'' file &amp;lt;!--from the link above or--&amp;gt; from the first post of the forum topic {{forum link|p=164133}} and:&lt;br /&gt;
&lt;br /&gt;
* If you use Mac, move it into your ''Applications/gedit/Contents/Resources/share/gtksourceview-X.0/language specs'' folder.&lt;br /&gt;
* For Linux, move it into your ''/usr/share/gtksourceview-X.0/language-specs'' folder.&lt;br /&gt;
&lt;br /&gt;
In the same post given above, there are instructions for how to edit ''xml.lang'' (in the same directory) to add the embedded XML content support (with this minor edit, Nasal highlighting will be used inside of certain tags, instead of plain text).&lt;br /&gt;
&lt;br /&gt;
For &amp;quot;snippets&amp;quot; support, nasal.xml from the above post has to be moved into ''/usr/share/gedit/plugins/snippets/'' folder or installed using the &amp;quot;import&amp;quot; feature. See this image for more details: &lt;br /&gt;
&lt;br /&gt;
[[:File:Install nasal snippets in gedit.png|how to import Nasal snippets]].&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
== jEdit ==&lt;br /&gt;
There's a syntax highlighting mode for jEdit, programmer's text editor&lt;br /&gt;
&lt;br /&gt;
Included are some of Nasal's internal functions and those functions currently implemented in NasalSys.cxx&lt;br /&gt;
To use, add the content of the catalog inside your own catalog (do NOT overwrite the file) and nasal.xml in /home/USER/.jedit/modes&lt;br /&gt;
&lt;br /&gt;
Restart jEdit and you can use it. Current extension is .nas, you can add your own extension and functions.&lt;br /&gt;
This mode is heavily based on the Javascript mode.&lt;br /&gt;
&lt;br /&gt;
Get it here: https://sourceforge.net/projects/fgscheduleview/files/jedit/catalog.zip/download&lt;br /&gt;
&lt;br /&gt;
== KDE Editors ==&lt;br /&gt;
There's a highlighting definition for nasal available at '''opendesktop.org''' (https://www.opendesktop.org/p/1187022/)&lt;br /&gt;
&lt;br /&gt;
Download the file and copy it into:&lt;br /&gt;
:~/.kde4/share/apps/katepart/syntax/ (for KDE4)&lt;br /&gt;
:or&lt;br /&gt;
:~/.local/share/katepart5/syntax/ (for KF5 pre 5.29) &lt;br /&gt;
:or &lt;br /&gt;
:~/.local/share/org.kde.syntax-highlighting/syntax/ (for current KF5 versions)&lt;br /&gt;
&lt;br /&gt;
(you can create the folders if they don't exist yet).&lt;br /&gt;
&lt;br /&gt;
Note that the syntax highlighting in KDE doesn't set colors, it just identifies structural elements, colors are defined by the '''schemas''' used by each editor, thus you get consistent highlighting between different languages.&lt;br /&gt;
&lt;br /&gt;
The highlighting file should work with all editors based on the katepart: KWrite, Kate, and the editor component of KDevelop.&lt;br /&gt;
&lt;br /&gt;
== Notepad++ ==&lt;br /&gt;
[[File:Highlight parse.png|400px|thumb|Screenshot of Nasal support for Notepad++]]&lt;br /&gt;
Provides comprehensive syntax highlighting and a function list parser with support for hierarchical display of both inline and out-of-body class member functions.&lt;br /&gt;
* [http://github.com/Slaiyer/nasal-npp &amp;lt;s&amp;gt;GitHub repository for download and instructions&amp;lt;/s&amp;gt;]  &lt;br /&gt;
&lt;br /&gt;
For Windows 10 and Windows 11 you can just follow these simplified instructions.&lt;br /&gt;
&lt;br /&gt;
Download the file userDefineLang.xml from https://github.com/slaiyer/nasal-npp.git and rename it to Nasal.xml. &lt;br /&gt;
&lt;br /&gt;
The other files are no longer necessary.&lt;br /&gt;
&lt;br /&gt;
Copy Nasal.xml to the directory  /home/users/username/Appdata/roaming/Notepad++/userDefineLangs.&lt;br /&gt;
&lt;br /&gt;
Close Notepad++. &lt;br /&gt;
&lt;br /&gt;
Open a nasal file with Notepad++.&lt;br /&gt;
&lt;br /&gt;
If the file is not highlighted (as in the image on the right) use the Language menu from the toolbar and select Nasal.&lt;br /&gt;
&lt;br /&gt;
'''Alternative (syntax highlighting only):'''&lt;br /&gt;
* [http://dl.dropbox.com/u/1463693/nasal.xml Download here]&lt;br /&gt;
** [http://superuser.com/questions/62474/notepad-custom-syntax-highlighting-setting-where-to-look-for-it Instructions are here]&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
== Sublime Text 2 ==&lt;br /&gt;
[[File:Sublime Text 2 syntax highlighting.png|400px|thumb|Sublime Text 2 syntax highlighting]]&lt;br /&gt;
&lt;br /&gt;
Scripts and installation instructions are here: https://github.com/freevryheid/nasal&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
== Sublime Text 4 ==&lt;br /&gt;
Scripts and installation instructions are here: https://github.com/NikolaiVChr/sublime-nasal&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
== Vim ==&lt;br /&gt;
[[File:Vim-nasal-syntax-highlighting.png|400px|thumb|Screen shot illustrating syntax highlighting in Vim]]&lt;br /&gt;
&lt;br /&gt;
One such editor is the free vim or its GUI variant gvim. &lt;br /&gt;
&lt;br /&gt;
It's not for everyone but it's free, and testing it doesn't hurt: http://www.vim.org/. &lt;br /&gt;
&lt;br /&gt;
The syntax definition file comes with the FlightGear code ({{flightgear file|scripts/syntax/nasal.vim}}). Highlighting works even for Nasal embedded in XML files (type &amp;quot;:set ft=nasal&amp;quot;, where ft stands for file-type)&lt;br /&gt;
&lt;br /&gt;
Here's an example, which demonstrates a short code segment with three syntax errors as well as the highlighting of a matching pair of parentheses (yellow) and trailing spaces (blue x). (The leading blue dots aren't on by default. They help to spot tab crimes.)&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
=== Vim Setup ===&lt;br /&gt;
Nasal highlighting in Vim can be set up thusly:&lt;br /&gt;
&lt;br /&gt;
 mkdir -p ~/.vim/syntax&lt;br /&gt;
&lt;br /&gt;
Download &amp;lt;code&amp;gt;nasal.vim&amp;lt;/code&amp;gt; such as from here:&lt;br /&gt;
https://sourceforge.net/p/flightgear/flightgear/ci/next/tree/scripts/syntax/nasal.vim?format=raw&lt;br /&gt;
&lt;br /&gt;
Or get &amp;lt;code&amp;gt;nasal.vim&amp;lt;/code&amp;gt; from your flightgear/flightgear git repo: &amp;lt;code&amp;gt;scripts/syntax/nasal.vim&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Copy that file to here:&lt;br /&gt;
&lt;br /&gt;
 ~/.vim/syntax/nasal.vim&lt;br /&gt;
&lt;br /&gt;
Then create a file named &amp;lt;code&amp;gt;~/.vim/filetype.vim&amp;lt;/code&amp;gt; and add this line:&lt;br /&gt;
&lt;br /&gt;
 au BufRead,BufNewFile *.nas            set filetype=nasal&lt;br /&gt;
&lt;br /&gt;
== Visual Studio Code ==&lt;br /&gt;
[[File:Vscode-sintaxhighlight.jpg|thumb|Screen shot illustrating syntax highlighting in VSCode]]&lt;br /&gt;
&lt;br /&gt;
[https://code.visualstudio.com Visual Studio Code] is a source-code editor developed by Microsoft for Windows, Linux and macOS. Its open source and free.&lt;br /&gt;
&lt;br /&gt;
The nasal extension is available from [https://github.com/RenanMsV/nasal-vscode Github] and can also be found in the [https://marketplace.visualstudio.com/items?itemName=Renan-MsV.nasal-lang VSCode's marketplace].&lt;br /&gt;
It supports basic syntax highlighting and snippets to improve development speed.&lt;br /&gt;
&lt;br /&gt;
For installation from the marketplace:&lt;br /&gt;
&lt;br /&gt;
# Open VSCode&lt;br /&gt;
# Go to File -&amp;gt; Preferences -&amp;gt; Extensions or {{key press|Ctrl|Shift|X}},&lt;br /&gt;
# Search for nasal&lt;br /&gt;
# Click install for Nasal Language (FlightGear)&lt;br /&gt;
&lt;br /&gt;
Manual installation:&lt;br /&gt;
&lt;br /&gt;
# Download the latest release from the repository, it should be a .vsix file.&lt;br /&gt;
# Install the extension manually by doing the command 'code --install-extension path_to_extension.vsix'&lt;br /&gt;
&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
== TextMate==&lt;br /&gt;
[[File:Nasal syntax highlighting in TextMate.png|thumb|Screen shot illustrating syntax highlighting in TextMate]]&lt;br /&gt;
[https://macromates.com/ TextMate] is a general-purpose GUI text editor for macOS created by Allan Odgaard. It is open source and free to use.&lt;br /&gt;
&lt;br /&gt;
There is a TextMate Bundle for Nasal available on [https://github.com/BobDotCom/Nasal.tmbundle GitHub] which can be [https://macromates.com/manual/en/bundles#installing_a_bundle installed in TextMate] for basic syntax highlighting.&lt;br /&gt;
&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
==IntelliJ Family Editors (JetBrains)==&lt;br /&gt;
[[File:Nasal syntax highlighting in PyCharm.png|thumb|Screenshot illustrating syntax highlighting in PyCharm]]&lt;br /&gt;
[https://www.jetbrains.com/idea/ IntelliJ IDEA] is an integrated development environment written in Java for developing computer software written in Java, Kotlin, Groovy, and other JVM-based languages. It is developed by JetBrains and is available as an Apache 2 Licensed community edition, and in a proprietary commercial edition.&lt;br /&gt;
&lt;br /&gt;
Although there is not a native IntelliJ plugin for Nasal, IntelliJ supports [https://www.jetbrains.com/help/idea/textmate-bundles.html installing TextMate bundles] for syntax highlighting, so the [https://github.com/BobDotCom/Nasal.tmbundle Nasal TextMate Bundle] can be used. Installation instructions are available [https://www.jetbrains.com/help/webstorm/tutorial-using-textmate-bundles.html here].&lt;br /&gt;
&lt;br /&gt;
There are many [https://www.jetbrains.com/products/ JetBrains products] that are based on IntelliJ such as [https://www.jetbrains.com/pycharm/ PyCharm] (Python) and [https://www.jetbrains.com/webstorm/ WebStorm] (Javascript). These IDEs can also be used with nasal syntax highlighting, in the same way as above.&lt;br /&gt;
&lt;br /&gt;
{{-}}&lt;br /&gt;
&lt;br /&gt;
==Other editors==&lt;br /&gt;
Nasal being syntactically very close to other programming languages like C, Php or JavaScript, you can get some usable highlighting even without real Nasal support:&lt;br /&gt;
&lt;br /&gt;
* TextMate {{forum link|hilit=syntax+nasal|p=127828}}&lt;br /&gt;
*SciTe {{forum link|hilit=syntax+nasal|p=94521}}&lt;br /&gt;
&lt;br /&gt;
==FlightGear Wiki==&lt;br /&gt;
{{Note|As of 02/2016, we do not currently have a dedicated Nasal module available [http://wiki.flightgear.org/FlightGear_wiki:Village_pump/Archive_2016#Nasal_Syntaxhighlighting]}}&lt;br /&gt;
{{main article|Help:Formatting#Syntax highlighting}}&lt;br /&gt;
&lt;br /&gt;
Using the &amp;amp;lt;syntaxhighight&amp;amp;gt; tag with a lang=&amp;quot;nasal&amp;quot; attribute, we can have highlighting right here on the wiki. Use enclose=&amp;quot;div&amp;quot; to wrap the text, if it happens to be particularly wide.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;nasal&amp;quot;&amp;gt;&lt;br /&gt;
  # hello.nas&lt;br /&gt;
  print('Hello World!');&lt;br /&gt;
  &amp;lt;/syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which renders into:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;nasal&amp;quot;&amp;gt;&lt;br /&gt;
# hello.nas&lt;br /&gt;
print('Hello World!');&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Syntax highlighting test==&lt;br /&gt;
Just a collection of keywords, etc. to test whether highlighting works (you can copy this to test your own highlighting):&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;nasal&amp;quot;&amp;gt;&lt;br /&gt;
# this is a comment&lt;br /&gt;
# operators (if applicable):&lt;br /&gt;
!a ? a+b - c/d*e : f~g; expr1 and expr2 or expr3;&lt;br /&gt;
# Builtin functions, strings&lt;br /&gt;
print('Hello World!');&lt;br /&gt;
die(&amp;quot;We have an error, Houston!&amp;quot;, arg[0]);&lt;br /&gt;
cmdarg().getNode(&amp;quot;setting&amp;quot;).getValue();&lt;br /&gt;
streq(typeof(id(keys(hash))),10);&lt;br /&gt;
# Loopoids&lt;br /&gt;
foreach (var a; [&amp;quot;haha&amp;quot;, {command:&amp;quot;NASAL!&amp;quot;}, me]) {&lt;br /&gt;
    if(0) break;&lt;br /&gt;
    elsif(1) continue;&lt;br /&gt;
    else return;&lt;br /&gt;
    while(1) sprintf(&amp;quot;%s%s\n%s=%f&amp;quot;, &amp;quot;Spam&amp;quot;, &amp;quot;spam&amp;quot;, &amp;quot;spam&amp;quot;, 0e-0);&lt;br /&gt;
    for (var i=0; i &amp;lt; 0.00; i += 0x0) printf(&amp;quot;%d&amp;quot;, int(i));&lt;br /&gt;
    forindex(var o; a) (func {&lt;br /&gt;
        var o = o;&lt;br /&gt;
        setlistener(&amp;quot;/&amp;quot;, func print(o), 1, 2);&lt;br /&gt;
    })();&lt;br /&gt;
}&lt;br /&gt;
# String escaping stress tests:&lt;br /&gt;
'\a\b\c\&amp;quot;\\\?' # none of these&lt;br /&gt;
&amp;quot;\e\?\'\f\a&amp;quot; # none of these&lt;br /&gt;
'\'' # this one&lt;br /&gt;
&amp;quot;\&amp;quot;\r\n\t\\\t&amp;quot; # and all of these&lt;br /&gt;
# And optionally string formatting:&lt;br /&gt;
&amp;quot;%s%%s%.0f%8d&amp;quot; # the second &amp;quot;s&amp;quot; shouldn't be highlighted, otherwise everything else&lt;br /&gt;
# Syntax error!:&lt;br /&gt;
%$@&amp;amp;^|\`&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Related content==&lt;br /&gt;
*{{forum url|p=164155}}&lt;br /&gt;
*{{forum url|t=12495}}&lt;br /&gt;
*{{forum url|t=15972}}&lt;br /&gt;
*{{forum url|t=9812}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Nasal howto]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Jebba</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Scripted_Compilation_on_Linux_Debian/Ubuntu&amp;diff=141123</id>
		<title>Scripted Compilation on Linux Debian/Ubuntu</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Scripted_Compilation_on_Linux_Debian/Ubuntu&amp;diff=141123"/>
		<updated>2024-12-23T19:43:14Z</updated>

		<summary type="html">&lt;p&gt;Jebba: /* Options */ Ccache&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is a Bash script that takes care of downloading and compiling FlightGear and related software from their source code repositories with just one command execution&amp;lt;ref name=&amp;quot;just-one-command&amp;quot;&amp;gt;Due to technical problems on the [https://sourceforge.net/ SourceForge] side, this is currently only true once you have an [[FGData]] clone. See [[User:Rominet|here]] for details.&amp;lt;/ref&amp;gt; for both 32-bit and 64-bit [https://www.debian.org/ Debian]-based systems. Pre-existing versions (if any) of the software installed by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; are not touched at all since the script downloads, builds and installs everything under the directory in which it is launched. You can choose the particular components to download, build and install.&lt;br /&gt;
&lt;br /&gt;
Unless told not to do so, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; installs packages with &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt;. For this reason, it is primarily useful on Debian-based distributions. However, if one disables package installation (using &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;--sudo=echo&amp;lt;/code&amp;gt;) and installs the corresponding dependencies oneself, it can be useful on other Unix-like systems as well—one of the FlightGear developers apparently uses it under [https://www.openbsd.org/ OpenBSD].&lt;br /&gt;
&lt;br /&gt;
For hints on using &amp;lt;tt&amp;gt;rpm&amp;lt;/tt&amp;gt;-based distributions such as Redhat, Fedora and CentOS, please see [[CentOS]]. Please also see [[Superbuild]].&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is a [https://www.gnu.org/software/bash/ Bash] script written for [https://www.debian.org/ Debian]-derived distributions ([https://www.ubuntu.com/ Ubuntu], [https://devuan.org/ Devuan], [https://www.linuxmint.com/ Linux Mint], etc.). Its purpose is to automatically install dependencies using the package manager, then build and install FlightGear-related programs.&lt;br /&gt;
&lt;br /&gt;
By default, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; installs most dependencies with &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; run under &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;.&amp;lt;ref name=&amp;quot;disabling-installation-of-dependencies-via-package-manager&amp;quot;&amp;gt;If you think you already have the dependencies, this installation can be disabled either by using option &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; or by passing option &amp;lt;code&amp;gt;--sudo=echo&amp;lt;/code&amp;gt; (the latter results in printing the &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; command line without running it).&amp;lt;/ref&amp;gt; Other dependencies, either because they aren't available in the standard APT repositories, or because of non-option arguments passed to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, are downloaded and compiled on the fly (this can be the case for [[PLIB]], [[Simgear]] and [[OpenSceneGraph]], for instance—it all depends on the arguments passed to the script).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; works in the directory it is run from: apart from dependencies installed via the package manager, all programs built by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; are installed under the &amp;lt;tt&amp;gt;install&amp;lt;/tt&amp;gt; subdirectory of the directory from which the script was run. In other words, installation of programs by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is clean, very easy to undo and doesn't interfere with other programs on the system.&lt;br /&gt;
&lt;br /&gt;
It is possible to manage several directory trees with &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;; as far as it is concerned, such directory trees are completely independent from each other. For instance, if you run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;dir1&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;dir2&amp;lt;/tt&amp;gt;, the programs installed under &amp;lt;tt&amp;gt;dir1&amp;lt;/tt&amp;gt; won't “see” those installed under &amp;lt;tt&amp;gt;dir2&amp;lt;/tt&amp;gt;, and vice versa.&lt;br /&gt;
&lt;br /&gt;
Apart from its main purpose, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; can be used to find hopefully up-to-date build-dependency information for FlightGear and related software. You would do so by inspecting [https://sourceforge.net/p/flightgear/fgmeta/ci/next/tree/download_and_compile.sh the script] at the point where it installs packages.&amp;lt;ref name=&amp;quot;note-inspecting-download-and-compile-sh-to-gather-build-dependency-information&amp;quot;&amp;gt;Look for strings such as &amp;lt;tt&amp;gt;zlib1g-dev&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;libglew-dev&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;qt5-default&amp;lt;/tt&amp;gt;.&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
Before embarking on building your own FlightGear binaries, you need to install a few tools that &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; uses to retrieve and compile source code. These tools are found in the following packages on [https://www.debian.org/ Debian] systems (and presumably on most Debian derivatives too):&lt;br /&gt;
&lt;br /&gt;
* build-essential&lt;br /&gt;
* git&lt;br /&gt;
* cmake&lt;br /&gt;
&lt;br /&gt;
These packages can be installed by running a command such as:&lt;br /&gt;
 $ sudo apt-get install build-essential git cmake&lt;br /&gt;
Once this is done, the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; script can be run. Unless told otherwise, it will install additional tools and libraries as it runs, depending on the chosen components (this will be explained in further sections).&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span id=&amp;quot;disk-space-requirements-and-build-time&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Disk space requirements and build time ==&lt;br /&gt;
&lt;br /&gt;
As of April 2019, building FlightGear requires about 12 [https://en.wikipedia.org/wiki/Gibibyte GiB] of disk space. Note that this includes downloaded source code for [[SimGear]] and FlightGear, generated build files and the large [[FGData]] repository (about 6 GiB for that one).&lt;br /&gt;
&lt;br /&gt;
With an Intel Core i7 860 CPU (2.80 GHz) purchased in 2009, compiling [[SimGear]] and FlightGear 2019.2 with option &amp;lt;code&amp;gt;-j8&amp;lt;/code&amp;gt; takes about 14 minutes. If you don't have a fast machine and build using only one core, it may require several hours.&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
&lt;br /&gt;
You can get &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; {{fgmeta source&lt;br /&gt;
| path = download_and_compile.sh&lt;br /&gt;
| text = from FGMeta &lt;br /&gt;
}}. It is contained in the [[FGMeta]] repository, which is maintained by the FlightGear developers. The script can be downloaded from the link given above, however, for easier updates and in order to have the command &amp;lt;code&amp;gt;download_and_compile.sh --version&amp;lt;/code&amp;gt; work as intended, it is recommended to get it as explained [[#getting-download-and-compile-sh-using-an-fgmeta-clone|below]].&lt;br /&gt;
&lt;br /&gt;
In case you build stable versions of FlightGear using either of the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; options of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, remember to update the script before trying to build a new version of FlightGear (see [[#updating-download-and-compile-sh-using-an-fgmeta-clone|Updating &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;]] below). Of course, you can update it more often in order to benefit from new features or bug fixes; this is especially useful if you are building ''next''—that is, the development branch of FlightGear.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span id=&amp;quot;getting-started-with-download-and-compile-sh&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Getting started with &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== For the impatient ===&lt;br /&gt;
&lt;br /&gt;
So, you're in a hurry, want to build FlightGear but don't want to read any explanation? You can try what follows, but be aware that you may need to come back and read part of the the following sections if you encounter a problem. All commands should be run under a normal user account; however, unless you pass option &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; or something similar to disable installation of packages from your distribution, you'll be asked for your &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt; password during execution of the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command (&amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt; is used by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to run commands like &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt;). So, here is your quick recipe for getting &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; and using it to build FlightGear:&lt;br /&gt;
 mkdir -p ~/flightgear/dnc-managed&lt;br /&gt;
 cd ~/flightgear&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;git clone https://git.code.sf.net/p/flightgear/fgmeta&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 cd ~/flightgear/dnc-managed&lt;br /&gt;
 ~/flightgear/fgmeta/download_and_compile.sh -s -j$(nproc)&lt;br /&gt;
 ./run_fgfs.sh --launcher&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option passed to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; instructs it to build the latest stable release of FlightGear. Use option &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; instead if you want the latest Long Term Stable release (it may be older but possibly more stable), or &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; for the previous LTS release. If you pass none of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; will build the ''next'' suite, which contains the development version of FlightGear. For more details on these options, see [[#Release selection|Release selection]].&lt;br /&gt;
&lt;br /&gt;
The command &amp;lt;tt&amp;gt;run_fgfs.sh --launcher&amp;lt;/tt&amp;gt; starts the [[FlightGear Qt launcher|FlightGear built-in launcher]]. This is often convenient but not compulsory. Another way to start FlightGear could be &amp;lt;code&amp;gt;./run_fgfs.sh --airport=PHTO --aircraft=c172p&amp;lt;/code&amp;gt;. There are plenty of other options, which are listed by &amp;lt;code&amp;gt;./run_fgfs.sh --help --verbose&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
In some cases, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; stops and waits for your answer before continuing. This is done when there is something important that you should know. When you are used to these prompts and would rather not see them anymore, pass the &amp;lt;code&amp;gt;--non-interactive&amp;lt;/code&amp;gt; option to suppress them.&lt;br /&gt;
&lt;br /&gt;
More detailed instructions are given below. The following sections also explain how to update &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; and FlightGear.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;getting-started-with-download-and-compile-sh-notations&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Notations ===&lt;br /&gt;
&lt;br /&gt;
When a command should be run as an unpriviledged user, it will be preceded by a dollar sign:&lt;br /&gt;
 $ whoami&lt;br /&gt;
 toto&lt;br /&gt;
In contrast, a hash sign (#) means that the command must be run with superuser privileges to achieve the desired effect:&lt;br /&gt;
 # whoami&lt;br /&gt;
 root&lt;br /&gt;
&lt;br /&gt;
In order to make instructions easy to understand, two directories (= folders) will be consistently used for the same purpose below:&lt;br /&gt;
* &amp;lt;tt&amp;gt;~/flightgear/fgmeta&amp;lt;/tt&amp;gt; will contain a clone of the [[FGMeta]] repository; therefore, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; will reside in that directory;&lt;br /&gt;
* &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; will be the directory from which we run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. In other words, with this setup, a typical sequence of commands could be:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ~/flightgear/fgmeta/download_and_compile.sh&lt;br /&gt;
or&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ~/flightgear/fgmeta/download_and_compile.sh SIMGEAR FGFS DATA OSG&lt;br /&gt;
These are of course just examples. The aforementioned paths are not hardwired anywhere in the script; you are free to choose the directories you want for these purposes.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;getting-download-and-compile-sh-using-an-fgmeta-clone&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Getting &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; the “right way” ===&lt;br /&gt;
&lt;br /&gt;
There are several ways to obtain [https://sourceforge.net/p/flightgear/fgmeta/ci/next/tree/download_and_compile.sh download_and_compile.sh]. The method described here makes it very easy to update the script and causes the command &amp;lt;code&amp;gt;download_and_compile.sh --version&amp;lt;/code&amp;gt; to work as intended.&lt;br /&gt;
&lt;br /&gt;
As explained in [[#getting-started-with-download-and-compile-sh-notations|Notations]], we want to clone the [[FGMeta]] repository in &amp;lt;tt&amp;gt;~/flightgear/fgmeta&amp;lt;/tt&amp;gt; and work with its ''next'' branch. Let's go:&lt;br /&gt;
 $ mkdir -p ~/flightgear&lt;br /&gt;
 $ cd ~/flightgear&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;$ git clone -b next https://git.code.sf.net/p/flightgear/fgmeta&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
You now have a fresh FGMeta clone in &amp;lt;tt&amp;gt;~/flightgear/fgmeta&amp;lt;/tt&amp;gt; and your brand new &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; script is located in that directory. You can already try it to see the available options:&lt;br /&gt;
&amp;lt;pre&amp;gt;$ ~/flightgear/fgmeta/download_and_compile.sh --help&lt;br /&gt;
download_and_compile.sh [OPTION...] [--] [COMPONENT...]&lt;br /&gt;
Download and compile components belonging to the FlightGear ecosystem.&lt;br /&gt;
&lt;br /&gt;
Without any COMPONENT listed, or if ALL is specified, recompile all&lt;br /&gt;
components listed in the WHATTOBUILDALL variable. Each COMPONENT may&lt;br /&gt;
be one of the following words:&lt;br /&gt;
&lt;br /&gt;
  ALL, CMAKE, OSG, PLIB, OPENRTI, SIMGEAR, FGFS, DATA, FGRUN, FGO, FGX,&lt;br /&gt;
  OPENRADAR, ATCPIE, TERRAGEAR, TERRAGEARGUI, ZLIB.&lt;br /&gt;
&lt;br /&gt;
Available options:&lt;br /&gt;
  -h, --help    show this help message and exit&lt;br /&gt;
      --version print version and license information, then exit&lt;br /&gt;
&lt;br /&gt;
(...)&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;updating-download-and-compile-sh-using-an-fgmeta-clone&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Updating &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Now that you have &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; from the [[FGMeta]] repository, it is very easy to update (this assumes you didn't modify anything yourself inside &amp;lt;tt&amp;gt;~/flightgear/fgmeta&amp;lt;/tt&amp;gt;!):&lt;br /&gt;
 $ cd ~/flightgear/fgmeta &amp;amp;&amp;amp; git pull&lt;br /&gt;
&lt;br /&gt;
If you want to keep updates as easy as we just showed, it is best not to modify &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; yourself. &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; has plenty of options that usually make it unnecessary to modify the script. Just run &amp;lt;code&amp;gt;download_and_compile.sh --help&amp;lt;/code&amp;gt; and learn about the available options when you feel the need to change something. Unless you have special needs that can only be accomodated by modifying &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, you are invited to skip to the next section.&lt;br /&gt;
&lt;br /&gt;
If you really, ''really'' want to modify &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; while keeping updates easy, a good technique is to add your changes to your FGMeta clone in the form of one or more Git ''commits'' (no need to push them anywhere, commits can remain in your clone). How to do that is beyond the scope of this document, though; read Git tutorials if you want to learn it (there are plenty on the Internet). Once you have committed your changes to your FGMeta clone, make sure the repository is clean (use &amp;lt;code&amp;gt;git status&amp;lt;/code&amp;gt;), then update it with:&lt;br /&gt;
 $ cd ~/flightgear/fgmeta &amp;amp;&amp;amp; git pull --rebase&lt;br /&gt;
This will apply your commits on top of the latest commit of the branch that is currently checked out, which so far contained the official version of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. In case your changes conflict with the update, Git will tell you and you'll have to resolve the conflict manually (look for “Git resolve conflict” on your favorite search engine)... or start again from a pristine [[FGMeta]] clone.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;using-download-and-compile-sh-to-build-flightgear&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Building FlightGear ===&lt;br /&gt;
&lt;br /&gt;
In what follows, we won't give the full path to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; when showing commands to be run, but you should prepend it to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; whenever you see a &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command. For instance, if you used the same path as in [[#getting-started-with-download-and-compile-sh-notations|Notations]] and see the command:&lt;br /&gt;
 $ download_and_compile.sh --help&lt;br /&gt;
what you should actually run is:&lt;br /&gt;
 $ ~/flightgear/fgmeta/download_and_compile.sh --help&lt;br /&gt;
&lt;br /&gt;
Apart from this harmless command, ''do not'' run other &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; commands from an arbitrary directory, in particular ''don't'' run them from &amp;lt;tt&amp;gt;~/flightgear/fgmeta&amp;lt;/tt&amp;gt;. This is because '''most other &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; commands write to the current directory''' (&amp;lt;code&amp;gt;download_and_compile.sh --help&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;download_and_compile.sh --version&amp;lt;/code&amp;gt; are safe to run from any directory, though).&lt;br /&gt;
&lt;br /&gt;
Of course, it is always possible to make commands shorter by setting up aliases (see tips at the end of [https://sourceforge.net/p/flightgear/mailman/message/36634426/ this message]), by adding the directory containing &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to your &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt; or by creating a symbolink link pointing to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in a directory that is part of your &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt;. This is not necessary, though; do it only if you feel the need (when enabled, persistent shell history is often enough to obviate the need to extend the &amp;lt;tt&amp;gt;PATH&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
{{Note|The following commands should be run from an empty directory&amp;lt;ref name=&amp;quot;dedicated-directory-won-t-stay-empty-forever&amp;quot;&amp;gt;Well, empty before the first time; later, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is going to populate it with plenty of FlightGear files and subdirectories, of course.&amp;lt;/ref&amp;gt; in a partition that has enough free space (see [[#disk-space-requirements-and-build-time | Disk space requirements and build time]]). As explained in [[#getting-started-with-download-and-compile-sh-notations|Notations]], we are going to choose the directory &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; for this purpose, in order to express that the whole directory tree is managed by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. This is just an example; feel free to choose another directory if you want.&lt;br /&gt;
&lt;br /&gt;
'''Don't run the commands from a non-dedicated directory,''' because it will be filled with files and directories created by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; and the FlightGear, SimGear, etc. build systems. That would be a complete mess! In particular, ''don't'' run the commands from the directory containing your [[FGMeta]] clone.}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|For some commands, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; may use &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;. In case you want to run some other program instead of &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;, this can be done with the &amp;lt;code&amp;gt;--sudo&amp;lt;/code&amp;gt; option of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. For instance, in order to see the commands that would be run with sudo without actually running them, you can pass &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;--sudo=echo&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. Like all other options, &amp;lt;code&amp;gt;--sudo&amp;lt;/code&amp;gt; must be given ''before'' all arguments that are component names (such as &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, etc.).}}&lt;br /&gt;
&lt;br /&gt;
The package manager used by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; by default is &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt; (it won't be used if you pass &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; the &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; option). You can use another one if you wish, as long as it supports the following calls:&lt;br /&gt;
 ''pkg-mgr'' update&lt;br /&gt;
 ''pkg-mgr'' install ''pkg1 pkg2'' ...&lt;br /&gt;
This is the case for &amp;lt;tt&amp;gt;aptitude&amp;lt;/tt&amp;gt; as well as &amp;lt;tt&amp;gt;apt&amp;lt;/tt&amp;gt;. If you want &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to use &amp;lt;tt&amp;gt;aptitude&amp;lt;/tt&amp;gt;, give it the option &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;--package-manager=aptitude&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; before any of the ''COMPONENT'' arguments.&lt;br /&gt;
&lt;br /&gt;
All options of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; can be seen by running the following command:&lt;br /&gt;
 $ download_and_compile.sh --help&lt;br /&gt;
&lt;br /&gt;
Now the instructions. '''You have chosen a dedicated directory''' where all the stuff that is downloaded and built by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; will be stored. This is &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; if you followed the suggestions given in [[#getting-started-with-download-and-compile-sh-notations|Notations]], and should be empty before you run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; for the first time. However, it is quite correct to start &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; from the same directory for subsequent runs, even when non-empty (otherwise, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; would automatically reclone the repositories every time you run it; that would be a sheer waste of time and bandwidth). All that remains to do is to run:&lt;br /&gt;
 $ mkdir -p ~/flightgear/dnc-managed&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh -s -j$(nproc)&lt;br /&gt;
The &amp;lt;code&amp;gt;-j$(nproc)&amp;lt;/code&amp;gt; option is not necessary, but is likely to save you a lot of time; with it, all available CPU cores will be used when compiling—see [[#Multicore acceleration| Multicore acceleration]].&lt;br /&gt;
&lt;br /&gt;
{{Note|Because of the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option, the above &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command would build the latest stable release of FlightGear. If you want to build the latest Long Term Stable release, use &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; instead. For the previous LTS release, use &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;. If you want to build the development version of FlightGear, use none of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;, but be warned: it may very well be unstable and unsuitable for flying. For more details on these options, see [[#Release selection|Release selection]].}}&lt;br /&gt;
&lt;br /&gt;
When you don't pass any non-option argument to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; as done here, it takes care of the base components needed to run FlightGear in good conditions: &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;OSG&amp;lt;/tt&amp;gt; (these are the component names used by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, i.e., the final arguments one can optionally give in a &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command; in normal speech, they correspond to the {{simgear source&lt;br /&gt;
| text = SimGear&lt;br /&gt;
}}, {{flightgear source&lt;br /&gt;
| text = FlightGear&lt;br /&gt;
}} and {{fgdata source&lt;br /&gt;
| text = FGData&lt;br /&gt;
}} repositories as well as a suitable repository for [[OpenSceneGraph]]). Therefore, the above command is presently exactly equivalent to:&lt;br /&gt;
 $ download_and_compile.sh -s -j$(nproc) SIMGEAR FGFS DATA OSG&lt;br /&gt;
&lt;br /&gt;
In case you want to build another component such as, say, [[PLIB]], you can add it to the command, like this:&lt;br /&gt;
 $ download_and_compile.sh -s -j$(nproc) SIMGEAR FGFS DATA OSG PLIB&lt;br /&gt;
&lt;br /&gt;
When the command terminates, you should have a script called &amp;lt;tt&amp;gt;run_fgfs.sh&amp;lt;/tt&amp;gt; in the directory from which you ran &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (i.e., &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; in the suggested setup). This will be your script to run FlightGear. For instance, in order to start the [[FlightGear Qt launcher|built-in launcher]], you can run the following commands:&amp;lt;ref name=&amp;quot;no-need-to-change-to-dnc-managed-dir-before-starting-generated-scripts&amp;quot;&amp;gt;We give these commands because they are easy to read, but the &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; command is not needed if you use the correct path, as in &amp;lt;code&amp;gt;~/flightgear/dnc-managed/run_fgfs.sh --launcher&amp;lt;/code&amp;gt;.&amp;lt;/ref&amp;gt;&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgfs.sh --launcher&lt;br /&gt;
(You may omit the &amp;lt;code&amp;gt;--launcher&amp;lt;/code&amp;gt; option; this would simply start FlightGear without any launcher, at the default airport and with the default aircraft.)&amp;lt;br /&amp;gt;&lt;br /&gt;
In case you find this tedious to type or have more arguments to pass on a regular basis, you can follow the advice given at the end of [https://sourceforge.net/p/flightgear/mailman/message/36634426/ this message] or use another launcher such as [[FFGo]]—but the [[FlightGear Qt launcher|FlightGear built-in launcher]] started with &amp;lt;code&amp;gt;run_fgfs.sh --launcher&amp;lt;/code&amp;gt; is quite fine, be sure to try it first!&lt;br /&gt;
&lt;br /&gt;
{{Note|If you ran &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; from &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; as proposed above, the full path of the &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata&amp;lt;/tt&amp;gt; directory is your [[$FG_ROOT]]. This is a very important path for FlightGear; knowing this may be useful for troubleshooting or doing “advanced things.”}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;using-download-and-compile-sh-to-update-flightgear&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Updating FlightGear ===&lt;br /&gt;
&lt;br /&gt;
{{Note|If you built FlightGear with either of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;, you need to pass the ''same option'' to the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command given below that will update your FlightGear installation. Otherwise, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; will automatically build the ''next'' suite (bleeding-edge development version), which is probably not what you wish. Moreover, if you do want to switch from one suite to another (for instance from ''stable'' to ''next'', or from ''Long Term Stable'' to ''stable''), using the &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; option of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is heartily recommended.}}&lt;br /&gt;
&lt;br /&gt;
Keeping the above note in mind, go to the directory from which you previously ran &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (&amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; in the [[#Notations|suggested setup]]). This is the folder which, if you did a complete run of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; as shown in the previous section, contains the &amp;lt;tt&amp;gt;run_fgfs.sh&amp;lt;/tt&amp;gt; script and a log file named &amp;lt;tt&amp;gt;compilation_log.txt&amp;lt;/tt&amp;gt; that records what &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; did in its last run. If you wish to update, say, {{simgear source&lt;br /&gt;
| text = SimGear&lt;br /&gt;
}}, {{flightgear source&lt;br /&gt;
| text = FlightGear&lt;br /&gt;
}}, {{fgdata source&lt;br /&gt;
| text = FGData&lt;br /&gt;
}} and [[OpenSceneGraph|OSG]], simply execute this:&lt;br /&gt;
 $ download_and_compile.sh -pn -j$(nproc) SIMGEAR FGFS DATA OSG&lt;br /&gt;
The &amp;lt;code&amp;gt;-j$(nproc)&amp;lt;/code&amp;gt; option is not necessary, but is likely to save you a lot of time; with it, all available CPU cores will be used when compiling—see [[#Multicore acceleration| Multicore acceleration]].&lt;br /&gt;
&lt;br /&gt;
We'll explain the &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; in a minute. &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;OSG&amp;lt;/tt&amp;gt; are called ''components'' in &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; terminology. A component generally corresponds to a software repository, or something close. In fact, since &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;OSG&amp;lt;/tt&amp;gt; are often precisely the components people wish to update, they form the default component set, so that the previous command is equivalent (as of Sept. 2024) to:&lt;br /&gt;
 $ download_and_compile.sh -pn -j$(nproc)&lt;br /&gt;
Now about this &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt;. It is equivalent to &amp;lt;code&amp;gt;-p n&amp;lt;/code&amp;gt; and means “don't install packages from my (Linux) distribution” (&amp;lt;code&amp;gt;y&amp;lt;/code&amp;gt; means ''yes, please install'', &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; means ''no, don't install''). In case you forgot that, simply run:&lt;br /&gt;
 $ download_and_compile.sh --help&lt;br /&gt;
What does it imply to pass &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt;? This tells &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to completely skip the step where it checks for needed packages from your distribution and installs them, by default using &amp;lt;tt&amp;gt;apt-get&amp;lt;/tt&amp;gt;. It thus goes straight to the following steps:&lt;br /&gt;
* update each repository corresponding to one of the selected components (&amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;OSG&amp;lt;/tt&amp;gt; in our example);&lt;br /&gt;
* compile each selected component that requires compilation;&lt;br /&gt;
* install each selected component in the appropriate place (under &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; according to our [[#getting-started-with-download-and-compile-sh-notations|Notations]]).&lt;br /&gt;
In case you don't have all required dependencies for the selected components, one of them is likely to fail, of course, since by passing &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, you forbid it to install these dependencies for you. So, you can also very well update without passing the &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt; option, it will simply take a little longer (the time to check if all dependencies of the selected components are available with &amp;lt;tt&amp;gt;APT&amp;lt;/tt&amp;gt;). In fact, this is '''what you should do if the previous &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; run failed:''' first update &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (see [[#getting-download-and-compile-sh-using-an-fgmeta-clone|above]]) then run it ''without'' &amp;lt;code&amp;gt;-pn&amp;lt;/code&amp;gt;&amp;lt;ref name=&amp;quot;passing-no-pn-option-equals-passing-py&amp;quot;&amp;gt;Which is the same as passing &amp;lt;code&amp;gt;-py&amp;lt;/code&amp;gt;.&amp;lt;/ref&amp;gt; in case new dependencies have been recently added and you don't have them on your system yet—this would be a very likely cause for the failure. In this case, running &amp;lt;code&amp;gt;download_and_compile.sh --cleanup&amp;lt;/code&amp;gt; to restart the build from a clean state is probably a good idea (see [[#Cleaning built and installed files|Cleaning built and installed files]] for details on this option).&lt;br /&gt;
&lt;br /&gt;
'''Summary'''&lt;br /&gt;
&lt;br /&gt;
Routine update:&lt;br /&gt;
 $ download_and_compile.sh -pn -j$(nproc) ''COMPONENT...''&lt;br /&gt;
In case this fails, first update &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (see [[#getting-download-and-compile-sh-using-an-fgmeta-clone|above]]), then run&lt;br /&gt;
 $ download_and_compile.sh --cleanup&lt;br /&gt;
 $ download_and_compile.sh -j$(nproc) ''COMPONENT...''&lt;br /&gt;
where ''COMPONENT...'' stands for the space-separated list of selected components, and defaults to &amp;lt;tt&amp;gt;SIMGEAR FGFS DATA OSG&amp;lt;/tt&amp;gt; if you don't specify any.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;examining-download-and-compile-sh-history&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Examining the history of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Looking at the latest commits that affected &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is quite easy with your FGMeta clone:&lt;br /&gt;
 $ cd ~/flightgear/fgmeta&lt;br /&gt;
 $ git log -- download_and_compile.sh&lt;br /&gt;
(then quit by typing &amp;lt;tt&amp;gt;q&amp;lt;/tt&amp;gt;, assuming your &amp;lt;tt&amp;gt;$GIT_PAGER&amp;lt;/tt&amp;gt; is &amp;lt;tt&amp;gt;less&amp;lt;/tt&amp;gt;)&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In order to do the same, but also see the patch for each commit:&lt;br /&gt;
 $ cd ~/flightgear/fgmeta&lt;br /&gt;
 $ git log -p -- download_and_compile.sh&lt;br /&gt;
&lt;br /&gt;
=== For the curious: the SSH way ===&lt;br /&gt;
&lt;br /&gt;
The method described below is not necessary anymore since {{fgmeta commit | 420034d5b51ff2d32fc0c3716b17a2d862841e0f}} (May 2020). What it does is teach you how to clone [[FGData]] using SSH, then change the Git remote setup in your clone of that repository to retrieve further updates using https—which is convenient, as it does not require you to provide a password. This technique used to be necessary to securely retrieve FGData because of a problem in the [https://sourceforge.net/ SourceForge] infrastructure (namely, &amp;lt;code&amp;gt;git clone&amp;lt;/code&amp;gt; from SourceForge doesn't work for the big FGData repository using https). Current versions of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; avoid the problem by proposing the user to automatically clone FGData from its [https://gitlab.com/flightgear/fgdata official mirror at GitLab], then change the Git remote setup to fetch further updates using https from SourceForge.&lt;br /&gt;
&lt;br /&gt;
Because the following method will make you connect to [https://sourceforge.net/ SourceForge] using the SSH protocol, you'll need an account on that site. If you don't already have one, go to the [https://sourceforge.net/user/registration registration page] and create an account. In all this section, we'll assume that your account name at SourceForge is ''SFusername''.&lt;br /&gt;
&lt;br /&gt;
{{Note|As explained in [[#getting-started-with-download-and-compile-sh-notations|Notations]], we assume that your Unix user name (login) is &amp;lt;tt&amp;gt;toto&amp;lt;/tt&amp;gt;. Don't confuse the &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt; password prompt (where you need to enter &amp;lt;tt&amp;gt;toto&amp;lt;/tt&amp;gt;'s password) with the password prompt for your SourceForge account! The former appears as&lt;br /&gt;
 [sudo] password for toto:&lt;br /&gt;
whereas the latter is just:&lt;br /&gt;
 Password:&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Tip|For some commands, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; may use &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;. In case you want to run some other program instead of &amp;lt;tt&amp;gt;sudo&amp;lt;/tt&amp;gt;, this can be done with the &amp;lt;code&amp;gt;--sudo&amp;lt;/code&amp;gt; option of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. For instance, in order to see the commands that would be run with sudo without actually running them, you can pass &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;--sudo=echo&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;. Like all other options, &amp;lt;code&amp;gt;--sudo&amp;lt;/code&amp;gt; must be given ''before'' all arguments that are component names (such as &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;FGFS&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;DATA&amp;lt;/tt&amp;gt;, etc.).}}&lt;br /&gt;
&lt;br /&gt;
{{Note|The commands given below will build the ''next'' suite, which contains the bleeding-edge development version of FlightGear. This is likely to be unstable, possibly unsuitable for flying. If you'd rather build the latest stable release or the latest Long Term Stable release, add option &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; to all &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; commands given below (or &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; for the previous LTS release). You may add the chosen option right after the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command name (in any case, the option should come before non-option arguments such as SIMGEAR, FGFS, DATA, etc.). See [[#Release selection|Release selection]] for more explanations on options &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
Now the instructions. You have chosen a dedicated directory where all the stuff that is downloaded and built by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; will be stored. This is &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; in our example, and should be empty before you run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; for the first time. However, it is quite correct to start &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; from the same directory for subsequent runs, even when non-empty (otherwise, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; would automatically reclone the repositories every time you run it; that would be a sheer waste of time and bandwidth).&lt;br /&gt;
&lt;br /&gt;
Ready? Let's go!&lt;br /&gt;
&amp;lt;pre&amp;gt;$ mkdir -p ~/flightgear/dnc-managed&lt;br /&gt;
$ cd ~/flightgear/dnc-managed&lt;br /&gt;
$ download_and_compile.sh --git-clone-site-params SourceForge=ssh:SFusername DATA&lt;br /&gt;
**********************************************************************&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Warning: a typical SimGear + FlightGear + FGData build requires    *&lt;br /&gt;
* about 12 GiB of disk space. The compilation part may last from a   *&lt;br /&gt;
* few minutes to hours, depending on your computer.                  *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Hint: use the -j option if your CPU has several cores, as in:      *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
*         download_and_compile.sh -j$(nproc)                         *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
**********************************************************************&lt;br /&gt;
Running 'apt-get update'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
Considering a package alternative: libcurl4-openssl-dev libcurl4-gnutls-dev&lt;br /&gt;
Package alternative matched for libcurl4-openssl-dev&lt;br /&gt;
Running 'apt-get install build-essential git libcurl4-openssl-dev cmake'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
****************************************&lt;br /&gt;
**************** DATA ******************&lt;br /&gt;
****************************************&lt;br /&gt;
Fetching DATA with 'git clone ssh://SFusername@git.code.sf.net/p/flightgear/fgdata'&lt;br /&gt;
Cloning into '.'...&lt;br /&gt;
The authenticity of host 'git.code.sf.net (216.105.38.16)' can't be established.&lt;br /&gt;
ECDSA key fingerprint is SHA256:FeVkoYYBjuQzb5QVAgm3BkmeN5TTgL2qfmqz9tCPRL4.&lt;br /&gt;
Are you sure you want to continue connecting (yes/no)?&lt;br /&gt;
Warning: Permanently added 'git.code.sf.net,216.105.38.16' (ECDSA) to the list of known hosts.&lt;br /&gt;
Connection closed by 216.105.38.16 port 22&lt;br /&gt;
fatal: Could not read from remote repository.&lt;br /&gt;
&lt;br /&gt;
Please make sure you have the correct access rights&lt;br /&gt;
and the repository exists.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The above messages are perfectly normal but deserve a little explanation. Here, &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt; asked us to confirm that the fingerprint sent by the remote host is that of the real &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;, as opposed to that of some malicious server ''pretending'' to be &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;. This confirmation only has to be done once, after which it is remembered thanks to &amp;lt;tt&amp;gt;~/.ssh/known_hosts&amp;lt;/tt&amp;gt;. You should visit the [https://sourceforge.net/p/forge/documentation/SSH%20Key%20Fingerprints/#fingerprint-listing page that gives the host key fingerprint of every publically-accessible SSH server at SourceForge] and carefully check that the fingerprint appearing on your terminal is listed on that page for &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;, or some matching pattern such as &amp;lt;tt&amp;gt;*.code.sf.net&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
If the fingerprint that is printed on your terminal is not listed on that page, answer &amp;lt;tt&amp;gt;no&amp;lt;/tt&amp;gt; to the question ''Are you sure you want to continue connecting (yes/no)?'' and copy/paste to flightgear-devel (see [[Mailing lists]]) the above message from &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt; that contains the fingerprint sent to you by the remote host which pretends to be &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;. If this happened, you should stop here and wait for answers from readers of flightgear-devel.&lt;br /&gt;
&lt;br /&gt;
From now on, we'll assume that the fingerprint you received was correct, and therefore that you have answered &amp;lt;tt&amp;gt;yes&amp;lt;/tt&amp;gt; to the ''Are you sure you want to continue connecting (yes/no)?'' question.&lt;br /&gt;
&lt;br /&gt;
In this example, it took us several minutes to verify the fingerprint of the &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt; server and confirm it to &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt;. Because of this delay, &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt; hung up on us and closed the connection. This is absolutely ''not a problem:'' we can just rerun the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command with the same arguments as the first time. Since we answered &amp;lt;tt&amp;gt;yes&amp;lt;/tt&amp;gt; to the ''Are you sure you want to continue connecting (yes/no)?'' prompt, the fingerprint of &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;'s key has been stored in &amp;lt;tt&amp;gt;~/.ssh/known_hosts&amp;lt;/tt&amp;gt;, therefore we won't get this prompt anymore. But if some server claiming to be &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt; presents a host key that has a different fingerprint in the future, &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt; will print a big fat warning that the server may belong to an attacker trying to impersonate &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt;. Therefore, this SSH host key verification is very useful to protect us from future attacks (which hopefully won't happen at all).&lt;br /&gt;
&lt;br /&gt;
As said, we just rerun the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command with the same arguments:&lt;br /&gt;
&amp;lt;pre&amp;gt;$ download_and_compile.sh --git-clone-site-params SourceForge=ssh:SFusername DATA&lt;br /&gt;
**********************************************************************&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Warning: a typical SimGear + FlightGear + FGData build requires    *&lt;br /&gt;
* about 12 GiB of disk space. The compilation part may last from a   *&lt;br /&gt;
* few minutes to hours, depending on your computer.                  *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Hint: use the -j option if your CPU has several cores, as in:      *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
*         download_and_compile.sh -j$(nproc)                         *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
**********************************************************************&lt;br /&gt;
Running 'apt-get update'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
Considering a package alternative: libcurl4-openssl-dev libcurl4-gnutls-dev&lt;br /&gt;
Package alternative matched for libcurl4-openssl-dev&lt;br /&gt;
Running 'apt-get install build-essential git libcurl4-openssl-dev cmake'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
****************************************&lt;br /&gt;
**************** DATA ******************&lt;br /&gt;
****************************************&lt;br /&gt;
Fetching DATA with 'git clone ssh://SFusername@git.code.sf.net/p/flightgear/fgdata'&lt;br /&gt;
Cloning into '.'...&lt;br /&gt;
Password:&amp;lt;/pre&amp;gt;&lt;br /&gt;
As explained above, the preceding prompt is for your SourceForge password (which you could guess from the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;git clone ssh://SFusername@git.code.sf.net/p/flightgear/fgdata&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; command).&lt;br /&gt;
&amp;lt;pre&amp;gt;remote: Enumerating objects: 67011, done.&lt;br /&gt;
remote: Counting objects: 100% (67011/67011), done.&lt;br /&gt;
remote: Compressing objects: 100% (31342/31342), done.&lt;br /&gt;
remote: Total 67011 (delta 38776), reused 59640 (delta 33570)&lt;br /&gt;
Receiving objects: 100% (67011/67011), 2.60 GiB | 313.00 KiB/s, done.&lt;br /&gt;
Resolving deltas: 100% (38776/38776), done.&lt;br /&gt;
Checking out files: 100% (12959/12959), done.&lt;br /&gt;
Password:&amp;lt;/pre&amp;gt;&lt;br /&gt;
(It will take a fair amount of time to get there, because this is the complete download of [[FGData]].)&amp;lt;br /&amp;gt;&lt;br /&gt;
This is again a prompt for your SourceForge password, because &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; wants to run &amp;lt;code&amp;gt;git pull --rebase&amp;lt;/code&amp;gt; in the repository (admittedly, it's a bit dumb after a &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; operation—please forgive us). In case you were not monitoring the &amp;lt;tt&amp;gt;clone&amp;lt;/tt&amp;gt; operation, you probably saw the password prompt way after &amp;lt;tt&amp;gt;git.code.sf.net&amp;lt;/tt&amp;gt; got bored waiting for you and closed our second connection:&lt;br /&gt;
&amp;lt;pre&amp;gt;Connection closed by 216.105.38.16 port 22&lt;br /&gt;
fatal: Could not read from remote repository.&lt;br /&gt;
&lt;br /&gt;
Please make sure you have the correct access rights&lt;br /&gt;
and the repository exists.&amp;lt;/pre&amp;gt;&lt;br /&gt;
(if not, there should be no error message and you should have a clean FGData clone)&amp;lt;br /&amp;gt;&lt;br /&gt;
No worries. Just as before, simply rerun the command with the same arguments:&lt;br /&gt;
&amp;lt;pre&amp;gt;$ download_and_compile.sh --git-clone-site-params SourceForge=ssh:SFusername DATA&lt;br /&gt;
**********************************************************************&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Warning: a typical SimGear + FlightGear + FGData build requires    *&lt;br /&gt;
* about 12 GiB of disk space. The compilation part may last from a   *&lt;br /&gt;
* few minutes to hours, depending on your computer.                  *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
* Hint: use the -j option if your CPU has several cores, as in:      *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
*         download_and_compile.sh -j$(nproc)                         *&lt;br /&gt;
*                                                                    *&lt;br /&gt;
**********************************************************************&lt;br /&gt;
Running 'apt-get update'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
Considering a package alternative: libcurl4-openssl-dev libcurl4-gnutls-dev&lt;br /&gt;
Package alternative matched for libcurl4-openssl-dev&lt;br /&gt;
Running 'apt-get install build-essential git libcurl4-openssl-dev cmake'...&lt;br /&gt;
[sudo] password for toto:&lt;br /&gt;
&lt;br /&gt;
(...)&lt;br /&gt;
&lt;br /&gt;
****************************************&lt;br /&gt;
**************** DATA ******************&lt;br /&gt;
****************************************&lt;br /&gt;
DATA: the repository already exists&lt;br /&gt;
Password:&lt;br /&gt;
Already up to date.&lt;br /&gt;
Current branch next is up to date.&lt;br /&gt;
Already on 'next'&lt;br /&gt;
Your branch is up to date with 'origin/next'.&lt;br /&gt;
All optional package alternatives have found a matching package.&lt;br /&gt;
&lt;br /&gt;
download_and_compile.sh has finished to work.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
There we are! You now have a clean, up-to-date [[FGData]] clone in &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata&amp;lt;/tt&amp;gt; (remember: &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; is the directory from which you ran &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;). Note this place: the full path of the &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata&amp;lt;/tt&amp;gt; directory is your [[$FG_ROOT]].&lt;br /&gt;
&lt;br /&gt;
Now, change the protocol to use for future updates of your FGData clone:&amp;lt;ref name=&amp;quot;changing-the-protocol-for-a-git-remote-manual-method&amp;quot;&amp;gt;Another way would be to manually change the relevant line starting with &amp;lt;code&amp;gt;url = &amp;lt;nowiki&amp;gt;ssh://SFusername@&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; for the &amp;lt;code&amp;gt;origin&amp;lt;/code&amp;gt; remote in the &amp;lt;tt&amp;gt;.git/config&amp;lt;/tt&amp;gt; file that lives inside your repository clone (i.e., &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata/.git/config&amp;lt;/tt&amp;gt; in our example).&amp;lt;/ref&amp;gt;&lt;br /&gt;
 (cd install/flightgear/fgdata &amp;amp;&amp;amp; \&lt;br /&gt;
 git remote set-url origin &amp;lt;nowiki&amp;gt;https://git.code.sf.net/p/flightgear/fgdata&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
(you can check at any time the protocol(s) in use with the command &amp;lt;code&amp;gt;git remote -v&amp;lt;/code&amp;gt; run inside a Git repository—in this case, inside the folder &amp;lt;tt&amp;gt;install/flightgear/fgdata&amp;lt;/tt&amp;gt;). As a consequence of this change, all future updates of your FGData clone will use the &amp;lt;tt&amp;gt;https&amp;lt;/tt&amp;gt; protocol, therefore you won't be prompted anymore for your SourceForge password.&lt;br /&gt;
&lt;br /&gt;
All that remains to do is to run, from the same directory as before (&amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; in our example):&lt;br /&gt;
 $ download_and_compile.sh -j$(nproc)&lt;br /&gt;
The &amp;lt;code&amp;gt;-j$(nproc)&amp;lt;/code&amp;gt; option is not necessary, but is likely to save you a lot of time; with it, all available CPU cores will be used when compiling—see [[#Multicore acceleration| Multicore acceleration]].&lt;br /&gt;
&lt;br /&gt;
Assuming the compilation was successful, you can now start the [[FlightGear Qt launcher|FlightGear built-in launcher]] using for instance:&lt;br /&gt;
 $ ./run_fgfs.sh --launcher&lt;br /&gt;
See [[#Building FlightGear|Building FlightGear]] for more details.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span id=&amp;quot;list-of-available-components&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; List of available components ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; script is able to download, compile (when applicable) and install the following components:&lt;br /&gt;
&lt;br /&gt;
* ATCPIE (for the [[ATC-pie]] air traffic control simulation program)&lt;br /&gt;
* CMAKE (for the [https://cmake.org/ CMake] build tool—this can be useful in case CMake is too old in your distribution)&lt;br /&gt;
* DATA (for [[FGData]], the main set of data files used by FlightGear)&lt;br /&gt;
* FGFS (for FlightGear itself)&lt;br /&gt;
* FFGO (for the [[FFGo]] FlightGear launcher)&lt;br /&gt;
* FGRUN (for the [[Fgrun|FGRun]] FlightGear launcher)&lt;br /&gt;
* FGX (for the [[FGX|FGx]] FlightGear launcher&amp;lt;ref name=&amp;quot;note-on-the-status-of-FGx-support-in-download-and-compile-sh&amp;quot;&amp;gt;Support for FGx in &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; would probably benefit from a code review.&amp;lt;/ref&amp;gt;)&lt;br /&gt;
* OPENRADAR (for the [[OpenRadar]] air traffic control simulation program)&lt;br /&gt;
* OPENRTI (for [[FlightGear HLA support (High Level Architecture)#OpenRTI | OpenRTI]]&amp;lt;ref name=&amp;quot;note-on-the-status-of-OpenRTI-support-in-FG&amp;quot;&amp;gt;Note that OpenRTI is just an optional dependency for [[FlightGear high-level architecture support | HLA support]]. For the time being, you should be just fine building without it. Eventually, the idea is for HLA to replace the existing MP system and even increasingly distribute the FlightGear architecture such that more and more components can be more easily run in separate threads or even separate processes, possibly even on different machines. So this is going to be an important feature for professional users, using several computers and screens to create a comprehensive and immersive simulation environment.&lt;br /&gt;
&amp;lt;p&amp;gt;&lt;br /&gt;
At the moment, it is probably safe to say that HLA is only of interest to developers and people willing to play with experimental features.&amp;lt;/ref&amp;gt;)&lt;br /&gt;
* OSG (for the [[OpenSceneGraph]] library)&lt;br /&gt;
* PLIB (for the [[PLIB]] library)&lt;br /&gt;
* SIMGEAR (for the [[SimGear]] library—foundation for FlightGear and TerraGear)&lt;br /&gt;
* TERRAGEAR (for the [[TerraGear]] terrain building toolchain)&lt;br /&gt;
* TERRAGEARGUI (for [[TerraGear GUI]], a graphical interface for TerraGear)&lt;br /&gt;
* ZLIB (for the [http://www.zlib.net/ zlib] compression library)&lt;br /&gt;
&lt;br /&gt;
Each of the items listed above is a ''component'' in &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; terminology. Components are written in uppercase by convention.&lt;br /&gt;
&lt;br /&gt;
{{Note|The preceding list might not be up-to-date. The up-to-date list of components supported by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; can always be obtained by running &amp;lt;code&amp;gt;download_and_compile.sh --help&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
What is the point of knowing this? Because you may pass component names to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in order to tell it what you want to download, build and install. By default, only the components [[SimGear|SIMGEAR]], [[FlightGear|FGFS]], [[FGData|DATA]] and [[OpenSceneGraph|OSG]] are taken care of, which means that the command:&lt;br /&gt;
 $ download_and_compile.sh&lt;br /&gt;
is equivalent to:&lt;br /&gt;
 $ download_and_compile.sh SIMGEAR FGFS DATA OSG&lt;br /&gt;
&lt;br /&gt;
In case you'd like to do the same build with just [[PLIB]] added, you could use:&lt;br /&gt;
 $ download_and_compile.sh SIMGEAR FGFS DATA OSG PLIB&lt;br /&gt;
&lt;br /&gt;
You get the idea. When several components are passed on the same command line, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; chooses a reasonable order for processing, so don't worry about that.&lt;br /&gt;
&lt;br /&gt;
== When building ''next'', you may encounter problems ==&lt;br /&gt;
&lt;br /&gt;
Keeping in mind that this script compiles sometimes bleeding edge software, it can happen that what was successfully compiling last week, does not compile anymore today. Building the latest stable version (option &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;) or the latest Long Term Stable release (option &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;) should always work, unless there is a problem with the script (well, in some cases, there may be packages of your distribution that are too recent for &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;; for instance, in July 2020, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; didn't build with OpenSceneGraph 3.6, but simply passing the OSG component on the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; command solved the problem, because at that time, option &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; selected OpenSceneGraph 3.4).&lt;br /&gt;
&lt;br /&gt;
That said, you may want to build the development version (called ''next''): this is the one developers use all the time, so kindly asking on the flightgear-devel [[Mailing_lists|mailing list]] in case a problem popped up&amp;lt;ref name=&amp;quot;what-to-provide-when-asking-for-help&amp;quot;&amp;gt;Don't forget in this case to precisely tell what you did and include the &amp;lt;tt&amp;gt;compilation_log.txt&amp;lt;/tt&amp;gt; file written by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;.&amp;lt;/ref&amp;gt; should allow you to find good advice and get the problem quickly fixed, if it's a new one.&lt;br /&gt;
&lt;br /&gt;
{{Warning|As of July 2020, heavy development will be done on ''next'', the development branch of FlightGear. It is expected to be rather unstable for several months. Unless you are really interested in FlightGear development or in providing feedback to the developers, you're probably better off building either the latest stable version (option &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;) or the latest Long Term Stable release (option &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;). In case you want something even older, the previous LTS release can be selected with option &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;.}}&lt;br /&gt;
&lt;br /&gt;
== Task-specific instructions ==&lt;br /&gt;
&lt;br /&gt;
{{Note|In this section, we assume you've read and followed the advice given in [[#getting-started-with-download-and-compile-sh|Getting started with &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;]].}}&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;selecting-the-components-to-work-on&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Selecting the components to build ===&lt;br /&gt;
&lt;br /&gt;
By default, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; downloads or updates, then compiles, [[SimGear]], FlightGear, [[FGData]] and [[OpenSceneGraph|OSG]] (more precisely, FGData is downloaded but not compiled—that wouldn't make sense). This is what happens when running:&lt;br /&gt;
 $ download_and_compile.sh&lt;br /&gt;
The preceding command is therefore equivalent to:&lt;br /&gt;
 $ download_and_compile.sh SIMGEAR FGFS DATA OSG&lt;br /&gt;
&lt;br /&gt;
To make &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; take care of other programs or libraries, use non-option arguments naming the ''components'' you want, for instance:&lt;br /&gt;
 $ download_and_compile.sh SIMGEAR FGFS DATA OSG CMAKE&lt;br /&gt;
SIMGEAR, FGFS, DATA, OSG and CMAKE are the component names respectively corresponding to [[SimGear]], FlightGear, [[FGData]], [[OpenSceneGraph]] and [https://cmake.org/ CMake] in &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;'s terminology.&lt;br /&gt;
&lt;br /&gt;
A [[#list-of-available-components|list of available components]] is provided on this page, but the fully up-to-date list can always be obtained by running &amp;lt;code&amp;gt;download_and_compile.sh --help&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Choosing between stable and development versions ===&lt;br /&gt;
&lt;br /&gt;
By default, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; fetches code and data from development branches of the source repositories (which sometimes causes compilation or runtime errors). However, it is possible to tell the script to download the latest “stable” version of each component, for some suitable definition of “stable”. This is by means of the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; options:&lt;br /&gt;
 $ download_and_compile.sh -s ''COMPONENT1 COMPONENT2...''&lt;br /&gt;
or&lt;br /&gt;
 $ download_and_compile.sh --lts ''COMPONENT1 COMPONENT2...''&lt;br /&gt;
or&lt;br /&gt;
 $ download_and_compile.sh --old-lts ''COMPONENT1 COMPONENT2...''&lt;br /&gt;
&lt;br /&gt;
How does it work?&lt;br /&gt;
* For [[SimGear]], FlightGear and [[FGData]], &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; uses the most recent stable release branch of the corresponding Git repository, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; uses the most recent Long Term Stable release (LTS) and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; uses the previous LTS release.&lt;br /&gt;
* For other components, a known-stable version is selected by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, which may be influenced by the use of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
So, as far as the SIMGEAR, FGFS and DATA components are concerned, you can:&lt;br /&gt;
* build the latest stable release (&amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;);&lt;br /&gt;
* build the latest Long Term Stable release (&amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;);&lt;br /&gt;
* build the previous Long Term Stable release (&amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;);&lt;br /&gt;
* build the current development version (bleeding edge), which lives in the {{flightgear source&lt;br /&gt;
| branch = next&lt;br /&gt;
| text = next&lt;br /&gt;
}} branch of the FlightGear repository.&lt;br /&gt;
The use of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; also influences the version of other components you may have selected (this can be overridden using &amp;lt;code&amp;gt;--component-branch&amp;lt;/code&amp;gt; for advanced users—see [[#Component-specific settings|Component-specific settings]]).&lt;br /&gt;
&lt;br /&gt;
{{Note|In a given folder where &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is run, you should normally either always use the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option, or always use &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;, or always use &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;, or always none of these (in other words, stick to the same suite: latest stable, latest LTS, previous LTS or ''next'', consistently accross all components).}}&lt;br /&gt;
&lt;br /&gt;
Actually, it ''is'' possible to switch between suites but you have to use the &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; option when doing the switch (see [[#Cleaning built and installed files|Cleaning built and installed files]] for information on this option). For instance:&lt;br /&gt;
* Build with &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; as many times as you want.&lt;br /&gt;
* Want to try ''next''? Okay, then build once with &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; (no &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option anymore).&lt;br /&gt;
* You can then perform as many builds of ''next'' as you want; no need to use &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; unless something special went wrong.&lt;br /&gt;
* If you later decide to switch back to the stable release, build once with &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt;, then only with &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; for further builds.&lt;br /&gt;
* etc.&lt;br /&gt;
&lt;br /&gt;
This way, ''you don't need to download the repositories again'' when trying the various suites. In particular, you can switch between ''next'', stable, LTS and old LTS without downloading nor having several copies of [[FGData]] on your hard drive. (This works because a Git repository may internally contain data for several branches, even if only one is “normally visible” in the filesystem at a given time.)&lt;br /&gt;
&lt;br /&gt;
==== Building the latest Long Term Stable release of FlightGear ====&lt;br /&gt;
&lt;br /&gt;
When executing &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, use the &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; option to build the latest Long Term Stable release: &lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh --lts&lt;br /&gt;
(In this example, the implicitly-selected components are SIMGEAR, FGFS and DATA, as explained [[#selecting-the-components-to-work-on | above]].)&lt;br /&gt;
&lt;br /&gt;
{{Note|If you decide to use the &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; option in a given directory tree, you should use it for all components in that directory tree (SIMGEAR, FGFS, DATA, etc.). Running &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in a given directory with the &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; option for some components and not for others is not supported.}}&lt;br /&gt;
&lt;br /&gt;
==== Building the latest stable release of FlightGear ====&lt;br /&gt;
&lt;br /&gt;
When executing &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, use the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option to build the latest stable release: &lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh -s&lt;br /&gt;
&lt;br /&gt;
{{Note|If you decide to use the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option in a given directory tree, you should use it for all components in that directory tree (SIMGEAR, FGFS, DATA, etc.). Running &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in a given directory with the &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt; option for some components and not for others is not supported.}}&lt;br /&gt;
&lt;br /&gt;
==== Building the current FlightGear development version ====&lt;br /&gt;
&lt;br /&gt;
When executing &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; without any option, the development version of every selected component is built:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh&lt;br /&gt;
&lt;br /&gt;
{{Note|The development version of FlightGear changes on an almost daily basis. It provides the latest features, but is not guaranteed to always work reliably. If you don't want to take the risk of finding new bugs when updating, you may prefer to use the latest stable release.}}&lt;br /&gt;
&lt;br /&gt;
==== Building the previous Long Term Stable release of FlightGear ====&lt;br /&gt;
&lt;br /&gt;
When executing &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, use the &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; option to build the previous Long Term Stable release (i.e., oldish code): &lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh --old-lts&lt;br /&gt;
(In this example, the implicitly-selected components are SIMGEAR, FGFS and DATA, as explained [[#selecting-the-components-to-work-on | above]].)&lt;br /&gt;
&lt;br /&gt;
{{Note|If you decide to use the &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; option in a given directory tree, you should use it for all components in that directory tree (SIMGEAR, FGFS, DATA, etc.). Running &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in a given directory with the &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; option for some components and not for others is not supported.}}&lt;br /&gt;
&lt;br /&gt;
=== Overriding the source repository or branch for a component ===&lt;br /&gt;
&lt;br /&gt;
This section shows how to override the location and/or branch from which a given component will be downloaded.&lt;br /&gt;
&lt;br /&gt;
{{Warning|The rest of this section is for people who know what they are doing. Don't use the following unless you trust the person who publishes the repository and have good reasons to believe that it has been kept up-to-date.}}&lt;br /&gt;
&lt;br /&gt;
==== A short example ====&lt;br /&gt;
&lt;br /&gt;
Let's start with an example to make it easier to understand to following paragraphs. Suppose we want to build the current stable release of FlightGear, linked against an [[OpenSceneGraph]] library whose source code is to be retrieved from branch &amp;lt;tt&amp;gt;fgfs-osg-36-2&amp;lt;/tt&amp;gt; of the Git repository located at [https://gitlab.com/flightgear/openscenegraph.git https://gitlab.com/flightgear/openscenegraph.git] (this is actually the default in September 2024). Since the default protocol used when &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; clones a repository is [https://en.wikipedia.org/wiki/HTTPS HTTPS], this can be done with&lt;br /&gt;
 download_and_compile.sh --cleanup -s \&lt;br /&gt;
 --override-repo OSG=GitLab:gitlab.com/flightgear/openscenegraph.git \&lt;br /&gt;
 --component-branch OSG=fgfs-osg-36-2 SIMGEAR FGFS DATA OSG&lt;br /&gt;
&lt;br /&gt;
==== The site name ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; uses case-insensitive short names such as &amp;lt;tt&amp;gt;GitHub&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;SourceForge&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;gitlab.kitware.com&amp;lt;/tt&amp;gt; as keys in order to identify the settings describing where and how a given component will be initially fetched (these settings are effective at clone time; later updates simply use the settings recorded in the local repository). These names are referred to as ''site'' in the output of &amp;lt;code&amp;gt;download_and_compile.sh --help&amp;lt;/code&amp;gt;, in particular in the &amp;lt;tt&amp;gt;--git-clone-site-params&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;--override-repo&amp;lt;/tt&amp;gt; options we'll present below. These ''site'' keys are simply identifier strings; they are not used in the DNS queries.&lt;br /&gt;
&lt;br /&gt;
==== The protocol ====&lt;br /&gt;
&lt;br /&gt;
Current &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (from December 2022) fetches the source code of most components from Git repositories (earlier versions used Subversion for some components); a few non-core components (currently [[FGo!]] and [[OpenRadar]]) are fetched using &amp;lt;tt&amp;gt;wget&amp;lt;/tt&amp;gt; and are out-of-scope for this section.&lt;br /&gt;
&lt;br /&gt;
The default protocol used by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; when cloning a Git repository is [https://en.wikipedia.org/wiki/HTTPS HTTPS]. This can be overridden using the &amp;lt;tt&amp;gt;--git-clone-default-proto&amp;lt;/tt&amp;gt; option. In other words, the default is &amp;lt;tt&amp;gt;--git-clone-default-proto=https&amp;lt;/tt&amp;gt; (the protocol name is case-insensitive). Other possibilities for the protocol are &amp;lt;tt&amp;gt;git&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Warning|The &amp;lt;tt&amp;gt;git&amp;lt;/tt&amp;gt; protocol doesn't protect against man-in-the-middle attacks; use at your own risk! Unfortunately, “clever” people often recommend it on the forum without mentioning its downsides.}}&lt;br /&gt;
&lt;br /&gt;
Using the &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt; protocol as the argument of &amp;lt;tt&amp;gt;--git-clone-default-proto&amp;lt;/tt&amp;gt; has little use, because in general you'll want to specify a particular username when using SSH and this username is likely not to be the same for all components you intend to clone via SSH (right, &amp;lt;tt&amp;gt;~/.ssh/config&amp;lt;/tt&amp;gt; can be used to automatically provide a site-dependent username). That is why &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; offers the &amp;lt;tt&amp;gt;--git-clone-site-params&amp;lt;/tt&amp;gt; option.&lt;br /&gt;
&lt;br /&gt;
==== Site-specific settings ====&lt;br /&gt;
&lt;br /&gt;
Using&lt;br /&gt;
 --git-clone-site-params ''SITE''=''PROTOCOL''[:''USERNAME'']&lt;br /&gt;
you can tell &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; that every component fetched from ''SITE'' should be cloned with the specified protocol and username (allowed protocols are &amp;lt;tt&amp;gt;https&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;ssh&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;git&amp;lt;/tt&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
{{Note|In case you have several repositories at a given site (say, GitHub) and need to use different SSH usernames for these repositories, you can use different site names:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--override-repo COMPONENT_A=GitHubA:ADDRESS_A&lt;br /&gt;
--git-clone-site-params GitHubA=ssh:userA&lt;br /&gt;
--override-repo COMPONENT_B=GitHubB:ADDRESS_B&lt;br /&gt;
--git-clone-site-params GitHubB=ssh:userB&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here, the site names are &amp;lt;tt&amp;gt;GitHubA&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;GitHubB&amp;lt;/tt&amp;gt;; the &amp;lt;tt&amp;gt;--override-repo&amp;lt;/tt&amp;gt; option will be presented below.&lt;br /&gt;
&lt;br /&gt;
By default, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; case-insensitively uses the &amp;lt;tt&amp;gt;GitHub&amp;lt;/tt&amp;gt; (resp. &amp;lt;tt&amp;gt;SourceForge&amp;lt;/tt&amp;gt;) site name to identify the settings used when cloning a repository from github.com (resp. git.code.sf.net). Therefore, the settings for GitHubA and GitHubB in this example would only apply to components ''c'' for which --override-repo ''c''&amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt;GitHubA:... or --override-repo ''c''&amp;lt;nowiki&amp;gt;=&amp;lt;/nowiki&amp;gt;GitHubB:... has been specified.}}&lt;br /&gt;
&lt;br /&gt;
==== Component-specific settings ====&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;--override-repo&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;--component-branch&amp;lt;/tt&amp;gt; options allow one to override the default settings used by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; for cloning the repository corresponding to the specified component (they only apply to components whose source code is retrieved with Git). The syntax of these options is&lt;br /&gt;
 --override-repo ''COMPONENT''=''SITE'':''ADDRESS''&lt;br /&gt;
and&lt;br /&gt;
 --component-branch ''COMPONENT''=''BRANCH''&lt;br /&gt;
In this syntax:&lt;br /&gt;
* ''COMPONENT'' represents the name of a component for &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (e.g., &amp;lt;tt&amp;gt;SIMGEAR&amp;lt;/tt&amp;gt;—see [[#List of available components|List of available components]]);&lt;br /&gt;
* ''ADDRESS'' is something like &amp;lt;tt&amp;gt;git.code.sf.net/p/flightgear/simgear&amp;lt;/tt&amp;gt; (don't include any &amp;lt;tt&amp;gt;protocol://&amp;lt;/tt&amp;gt; part in ''ADDRESS'');&lt;br /&gt;
* ''BRANCH'' should be the name of an existing branch of the Git repository hosted at ''ADDRESS'';&lt;br /&gt;
* ''SITE'' is a string used as a key in a mapping; &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; uses it to find out how to connect to ''ADDRESS'' in order to clone the repository for ''COMPONENT'' (see [[#Site-specific settings|Site-specific settings]]).&lt;br /&gt;
See the [[#A short example|above example]] for a concrete example where these options are used.&lt;br /&gt;
&lt;br /&gt;
{{Note|The argument of any long option of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; that takes an argument may be introduced immediately after the option name using an equal sign. However, in the above cases, I find this way a bit confusing because the option value ''also'' uses an equal sign as separator. Hence the above use of separate command arguments: one for the option name, one for its argument.}}&lt;br /&gt;
&lt;br /&gt;
=== Passing custom arguments to CMake ===&lt;br /&gt;
&lt;br /&gt;
Sometimes, when building a program, you may want to enable a feature that is not enabled by default, or disable a feature that is enabled by default. With recent versions of &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (October 2020 or later), this can be done for SimGear and FlightGear using the &amp;lt;code&amp;gt;--sg-cmake-arg&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--fg-cmake-arg&amp;lt;/code&amp;gt; options (the environment variables &amp;lt;tt&amp;gt;SG_CMAKEARGS&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;FG_CMAKEARGS&amp;lt;/tt&amp;gt; are still supported, but they don't allow one to pass arguments containing spaces). For instance, in order to link SimGear with the system Expat library, you can do:&lt;br /&gt;
 $ download_and_compile.sh --sg-cmake-arg='-DSYSTEM_EXPAT=ON' SIMGEAR&lt;br /&gt;
Similarly, disabling HID-based input when building FlightGear can be achieved this way:&lt;br /&gt;
 $ download_and_compile.sh --fg-cmake-arg='-DENABLE_HID_INPUT=OFF' FGFS&lt;br /&gt;
&lt;br /&gt;
{{Note|Such options are typically defined in &amp;lt;tt&amp;gt;CMakeLists.txt&amp;lt;/tt&amp;gt; files, for example {{simgear source&lt;br /&gt;
| path = CMakeLists.txt&lt;br /&gt;
| text = here&lt;br /&gt;
}} for SimGear and {{flightgear source&lt;br /&gt;
| path = CMakeLists.txt&lt;br /&gt;
| text = here&lt;br /&gt;
}} for FlightGear.}}&lt;br /&gt;
&lt;br /&gt;
This can be useful, for instance, to work around bugs in a part of SimGear or FlightGear that you don't need, but causes a build or runtime failure (see {{forum link|t=35740|text=here}} for example). This is often convenient when using the development version of FlightGear, but doesn't mean such bugs shouldn't be reported!&lt;br /&gt;
&lt;br /&gt;
If you have several such options to pass, just use &amp;lt;code&amp;gt;--sg-cmake-arg&amp;lt;/code&amp;gt; and/or &amp;lt;code&amp;gt;--fg-cmake-arg&amp;lt;/code&amp;gt; several times:&lt;br /&gt;
 $ download_and_compile.sh --fg-cmake-arg='-DENABLE_SWIFT=ON' \&lt;br /&gt;
                           --fg-cmake-arg='-DENABLE_HID_INPUT=OFF' FGFS&lt;br /&gt;
It is even possible to pass arguments containing spaces to CMake, as in:&lt;br /&gt;
 $ download_and_compile.sh \&lt;br /&gt;
     --sg-cmake-arg='-DCMAKE_CXX_FLAGS=-Wno-deprecated-declarations -Wall' \&lt;br /&gt;
     SIMGEAR&lt;br /&gt;
(just a silly example to show a working syntax) or:&lt;br /&gt;
 $ download_and_compile.sh \&lt;br /&gt;
     --fg-cmake-arg=&amp;quot;-DCMAKE_CXX_FLAGS=$(pkg-config --cflags gl)&amp;quot; \&lt;br /&gt;
     FGFS&lt;br /&gt;
Note the use of double-quotes here to enable the &amp;lt;code&amp;gt;$(...)&amp;lt;/code&amp;gt; command substitution.&lt;br /&gt;
&lt;br /&gt;
Using the (half-deprecated) environment variables &amp;lt;tt&amp;gt;SG_CMAKEARGS&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;FG_CMAKEARGS&amp;lt;/tt&amp;gt;, it is also possible to define CMake arguments in a single place that are going to be used for both SimGear and FlightGear. However, this technique doesn't allow one to pass arguments containing spaces to CMake.&lt;br /&gt;
 $ export SG_CMAKEARGS='-DSYSTEM_EXPAT=ON'&lt;br /&gt;
 $ export FG_CMAKEARGS='-DENABLE_SWIFT=ON -DENABLE_HID_INPUT=OFF'&lt;br /&gt;
 $ download_and_compile.sh&lt;br /&gt;
&lt;br /&gt;
=== Seeing the compilation commands run by Make ===&lt;br /&gt;
&lt;br /&gt;
As a simple application of the previous section, the following options are often useful. When passed to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, these options cause the compilation commands run via Make to be printed on the terminal and recorded in the compilation_log.txt file:&lt;br /&gt;
  --sg-cmake-arg='-DCMAKE_VERBOSE_MAKEFILE=1' \&lt;br /&gt;
  --fg-cmake-arg='-DCMAKE_VERBOSE_MAKEFILE=1'&lt;br /&gt;
(the backslash is unneeded if you put both options on the same line). Passing the value 0 instead of 1 would explicitly request the default, non-verbose behavior.&lt;br /&gt;
&lt;br /&gt;
=== Launching FlightGear ===&lt;br /&gt;
&lt;br /&gt;
When using &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, apart from those installed with the package manager, the FlightGear dependencies (which are typically libraries) are not installed system-wide but under the directory from which &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; was run. This makes it possible to easily use, for instance, different [[OpenSceneGraph]], [[SimGear]] and FlightGear versions on a single system—e.g., for testing purposes—but also to have separate build trees (optimized/debug). This is also why you either need to set LD_LIBRARY_PATH to run the built programs, or simply use the scripts created by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in the directory where it is run, such as &amp;lt;tt&amp;gt;run_fgfs.sh&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;run_fgfs_debug.sh&amp;lt;/tt&amp;gt;: these scripts automatically set up the required environment variables according to your build settings before firing the desired program (e.g., &amp;lt;tt&amp;gt;fgfs&amp;lt;/tt&amp;gt;) with the arguments you provided. &lt;br /&gt;
&lt;br /&gt;
Therefore, the simplest way to run a FlightGear program built by &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is to launch the &amp;lt;tt&amp;gt;run_fgfs.sh&amp;lt;/tt&amp;gt; script that &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; created in the directory from which it was run, for example:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgfs.sh --launcher&lt;br /&gt;
&lt;br /&gt;
{{Note|&amp;lt;code&amp;gt;./run_fgfs.sh --launcher&amp;lt;/code&amp;gt; starts FlightGear with its built-in launcher. If you just do &amp;lt;code&amp;gt;./run_fgfs.sh&amp;lt;/code&amp;gt;, FlightGear will be started without any launcher, at the default airport and with the default aircraft.}}&lt;br /&gt;
&lt;br /&gt;
In order to start FlightGear without any launcher, at a given airport (say, [https://en.wikipedia.org/wiki/Paro_Airport Paro airport], whose ICAO code is VQPR) and with a chosen aircraft, you can do:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgfs.sh --airport=VQPR --aircraft=dhc6&lt;br /&gt;
Actually, the directory change is not needed, we only gave it here for readability. Therefore, the following single command does the same:&lt;br /&gt;
 $ ~/flightgear/dnc-managed/run_fgfs.sh --airport=VQPR --aircraft=dhc6&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span id=&amp;quot;avoiding-multiple-downloads-of-fgdata&amp;quot;&amp;gt;&amp;lt;/span&amp;gt; Avoiding multiple downloads of FGData ===&lt;br /&gt;
&lt;br /&gt;
Some people use &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to maintain several directory trees such as the tree starting at &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt; in [[#getting-started-with-download-and-compile-sh|Getting started with &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;]] (this can be useful if you want to have one tree with programs compiled in Release mode and another tree where they are built in Debug mode, for instance). This can easily be done by running &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; in each of the directories. But since [[FGData]] is so large, it may be tempting to share a single instance of this repository among several trees. This is not officially supported, but apparently can be made to work with symbolic links.&lt;br /&gt;
&lt;br /&gt;
Let's show how this can be done on an example. Suppose your master copy of FGData is in &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata&amp;lt;/tt&amp;gt;. Then the following appears to work:&lt;br /&gt;
 $ mkdir -p ~/flightgear/other-dnc-managed-tree/install/flightgear&lt;br /&gt;
 $ cd ~/flightgear/other-dnc-managed-tree/install/flightgear&lt;br /&gt;
 $ ln -s ../../../dnc-managed/install/flightgear/fgdata&lt;br /&gt;
 $ cd ~/flightgear/other-dnc-managed-tree&lt;br /&gt;
 $ download_and_compile.sh&lt;br /&gt;
&lt;br /&gt;
The last of these commands will use and update the FGData repository present in &amp;lt;tt&amp;gt;~/flightgear/dnc-managed/install/flightgear/fgdata&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
{{Warning|This can only work simply if all trees that share a given FGData repository are from the same release (e.g., current stable or development). Running a “stable“ FlightGear with FGData from the ''next'' branch or the other way round, a development version of FlightGear with FGData from a release branch, doesn't work—and FlightGear should tell you when you start it in such a situation.&lt;br /&gt;
&lt;br /&gt;
That said, people comfortable with Git can check out the correct FGData branch before building or starting FlightGear, for instance:&lt;br /&gt;
 $ cd /path/to/fgdata &amp;amp;&amp;amp; git checkout release/2019.1&lt;br /&gt;
or&lt;br /&gt;
 $ cd /path/to/fgdata &amp;amp;&amp;amp; git checkout next&lt;br /&gt;
So, this is possible but somewhat acrobatic. You've been warned.}}&lt;br /&gt;
&lt;br /&gt;
Note: there is a [[Avoiding multiple downloads of FGData on Linux|wiki article about this subject]], but it is severely outdated as of April 2019.&lt;br /&gt;
&lt;br /&gt;
== Additional programs ==&lt;br /&gt;
&lt;br /&gt;
{{Note|In this section, we assume you've read and followed the advice given in [[#getting-started-with-download-and-compile-sh|Getting started with &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;]].}}&lt;br /&gt;
&lt;br /&gt;
If you wish to get other programs (precisely: download, build and install them), you need to launch &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; with the desired component names as arguments. For instance:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh SIMGEAR FGFS DATA OSG&lt;br /&gt;
&lt;br /&gt;
See [[#list-of-available-components|above]] for the list of available components.&lt;br /&gt;
&lt;br /&gt;
=== TerraGear ===&lt;br /&gt;
&lt;br /&gt;
Run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; with the TERRAGEAR component in order to build and install the [[TerraGear]] terrain building toolchain:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh TERRAGEAR&lt;br /&gt;
&lt;br /&gt;
This creates the following scripts in &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt;:&lt;br /&gt;
* &amp;lt;tt&amp;gt;run_genapts850.sh&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;run_ogr-decode.sh&amp;lt;/tt&amp;gt;&lt;br /&gt;
* &amp;lt;tt&amp;gt;run_tg-construct.sh&amp;lt;/tt&amp;gt;&lt;br /&gt;
These scripts themselves run the corresponding TerraGear tools, as expected.&lt;br /&gt;
&lt;br /&gt;
=== TerraGear GUI ===&lt;br /&gt;
&lt;br /&gt;
[[TerraGear GUI]] is a graphical interface for [[TerraGear]] written with the Qt toolkit (still Qt 4 in 2019, but it works). In order to install it, run &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; with the TERRAGEARGUI component:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ download_and_compile.sh TERRAGEARGUI&lt;br /&gt;
This will create a &amp;lt;tt&amp;gt;run_terrageargui.sh&amp;lt;/tt&amp;gt; script in &amp;lt;tt&amp;gt;~/flightgear/dnc-managed&amp;lt;/tt&amp;gt;, and also a default configuration file &amp;lt;tt&amp;gt;~/.config/TerraGear/TerraGearGUI.conf&amp;lt;/tt&amp;gt;, unless you already have one. This default configuration file contains paths to the TerraGear and [[$FG_ROOT]] directories, assuming you have installed the TERRAGEAR and DATA components.&lt;br /&gt;
&lt;br /&gt;
To run TerraGear GUI:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_terrageargui.sh&lt;br /&gt;
&lt;br /&gt;
=== FGCom ===&lt;br /&gt;
&lt;br /&gt;
{{Note|[[FGCom]] has been integrated into FlightGear long ago, therefore the following is not needed in general.}}&lt;br /&gt;
&lt;br /&gt;
[[FGCom]] is the system used by FlightGear to simulate radio communications between users. It is automatically built and installed when you tell &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to take care of the FGFS component. You can launch the standalone FGCom program by using the &amp;lt;tt&amp;gt;run_fgcom.sh&amp;lt;/tt&amp;gt; script:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgcom.sh&lt;br /&gt;
&lt;br /&gt;
=== FGRun ===&lt;br /&gt;
&lt;br /&gt;
{{Note|As of 2019, FGRun has been superseded by the [[FlightGear Qt launcher|FlightGear built-in launcher]]. The built-in launcher is the most actively maintained launcher for FlightGear. Other launchers are [[FFGo]] and [[FGX|FGx]].}}&lt;br /&gt;
&lt;br /&gt;
[[File:fgrun-page2.jpg|thumb|right]]&lt;br /&gt;
Before FlightGear had its built-in launcher (the one you get with &amp;lt;code&amp;gt;run_fgfs.sh --launcher&amp;lt;/code&amp;gt;), many users found comfortable having FlightGear launched by the graphical utility [[Fgrun|FGRun]]. This program is built and installed when &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is run with the FGRUN component. You then have to launch the &amp;lt;tt&amp;gt;run_fgrun.sh&amp;lt;/tt&amp;gt; command, for example:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgrun.sh&lt;br /&gt;
&lt;br /&gt;
FGRun will save its settings in &amp;lt;tt&amp;gt;~/.fltk/flightgear.org/fgrun.prefs&amp;lt;/tt&amp;gt;. You may want to save copies of the preferences customized for stable and next.&lt;br /&gt;
&lt;br /&gt;
=== FGo! ===&lt;br /&gt;
&lt;br /&gt;
{{Note|As of 2019, FGo! is not maintained anymore. You may want to try the built-in launcher (started with &amp;lt;code&amp;gt;run_fgfs.sh --launcher&amp;lt;/code&amp;gt;) or [[FFGo]].}}&lt;br /&gt;
&lt;br /&gt;
[[File:Fgo01.jpg|thumb|left]]&lt;br /&gt;
FGo! is a graphical utility written in [[python]]. It is downloaded and installed when &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; is run with the FGO component. You then have to launch the &amp;lt;tt&amp;gt;run_fgo.sh&amp;lt;/tt&amp;gt; command, for example:&lt;br /&gt;
 $ cd ~/flightgear/dnc-managed&lt;br /&gt;
 $ ./run_fgo.sh&lt;br /&gt;
&lt;br /&gt;
Remember that the first time you run it, you have to go to open the ''Preferences'' dialog and set the paths to the &amp;lt;tt&amp;gt;fgfs&amp;lt;/tt&amp;gt; executable and to FGData.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
=== Compilation errors ===&lt;br /&gt;
Here we are, no fear, if you wish to use programs from the cvs/svn/git repositories, you might face compilation errors that will prevent you to have a working copy of one or more of the programs provided by this script. What can be the causes that prevent us from successfully compiling? As far as I know those:&lt;br /&gt;
# Software developers introduce a new functionality with a new piece of code that prevents the compilation under your architecture, this can happen working with cvs/svn/git sources.&lt;br /&gt;
# The program refuses to compile because of a divergence in the libraries on which it depends. For example FlightGear might not compile because OSG has been modified, while OSG itself compiles fine, FG won't.&lt;br /&gt;
# One or more repositories are down and you can't get the library you need. (Both from cvs/svn/git or apt-get)&lt;br /&gt;
&lt;br /&gt;
There is a simple solution to the above errors: wait and relaunch the script after some time (hours or days), if software developers repair or synchronize their code with the newly updated libraries (which generally happens eventually), your FlightGear will compile fine as if the previous error never took place.&lt;br /&gt;
&lt;br /&gt;
Sometimes it happens that the script fails to compile only [[Fgrun|FGRun]], [[FGCom]] or atlas, if you then see the run_fgfs.sh file it means that FlightGear installation was successful and you can safely run it.&lt;br /&gt;
&lt;br /&gt;
=== OpenRTI undefined reference errors ===&lt;br /&gt;
&lt;br /&gt;
Sometimes, due to the way &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; builds projects, linking errors might occur. This is the case with the error “libRTI-NG.so: undefined reference to xxx”. You might want to patch the &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; script to clean OpenRTI with &amp;lt;code&amp;gt;rm -f CMakeCache.txt &amp;amp;&amp;amp; rm -rf CMakeFiles/&amp;lt;/code&amp;gt;, or just restart the build in a clean environment. Assuming you are in the base directory from which you ran &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;, you can run &amp;lt;code&amp;gt;download_and_compile.sh --cleanup&amp;lt;/code&amp;gt; (see [[#Cleaning built and installed files|Cleaning built and installed files]]). Alternatively, the following command could be used:&lt;br /&gt;
 $ rm -rf build/* install/simgear/ install/openrti/ install/flightgear/share/ install/flightgear/bin/&lt;br /&gt;
&lt;br /&gt;
See {{forum link|t=26244|text=this thread}} for more details. Note that &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; didn't have the &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; option at that time!&lt;br /&gt;
&lt;br /&gt;
== Options ==&lt;br /&gt;
&lt;br /&gt;
=== Release selection ===&lt;br /&gt;
&lt;br /&gt;
* Build the latest stable release: &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build the latest Long Term Stable release: &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build the previous Long Term Stable release: &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Long Term Stable (&amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt;) is supposed to yield a more stable setup than what you would obtain with option &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, however it will generally be older. Both of these options are suitable for users.&lt;br /&gt;
&lt;br /&gt;
If you pass none of &amp;lt;code&amp;gt;-s&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--lts&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--old-lts&amp;lt;/code&amp;gt; in a &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; invocation, you'll build the the ''next'' suite, which contains the development version of FlightGear. The corresponding FlightGear code will be very recent but may well be unstable—this is particularly the case starting from July 2020. This is therefore mostly intended for developers.&lt;br /&gt;
&lt;br /&gt;
=== Skipping most prompts ===&lt;br /&gt;
&lt;br /&gt;
For some important things, &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; asks for confirmation in order to be sure that you are well informed about what will be done. When you have a good understanding of these informations, you may want to use the &amp;lt;code&amp;gt;--non-interactive&amp;lt;/code&amp;gt; option in order to suppress these prompts (technically, this causes the default answer to be automatically used).&lt;br /&gt;
&lt;br /&gt;
=== Cleaning built and installed files ===&lt;br /&gt;
&lt;br /&gt;
Option &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; causes &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; to remove everything that was built and installed in the directory it is run from. The Git repositories will not be removed, so this is good if you want to restart a compilation from a clean state.&lt;br /&gt;
&lt;br /&gt;
If you use &amp;lt;code&amp;gt;--cleanup&amp;lt;/code&amp;gt; without specifying any component, only this removal will be done (nothing will be compiled nor installed). Otherwise, the usual rules concerning components apply.&lt;br /&gt;
&lt;br /&gt;
=== Multicore acceleration ===&lt;br /&gt;
&lt;br /&gt;
Passing option &amp;lt;code&amp;gt;-j x&amp;lt;/code&amp;gt; to &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt; (where ''x'' is the number of your CPU cores you wish to assign to the job) will considerably speed up the compilation steps. Passing &amp;lt;code&amp;gt;-j$(nproc)&amp;lt;/code&amp;gt; is a convenient way to automatically use all available cores.&lt;br /&gt;
&lt;br /&gt;
=== Advanced options ===&lt;br /&gt;
&lt;br /&gt;
* Build a release version: &amp;lt;code&amp;gt;-b Release&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build a version that should run as fast as a release build, yet has debug information that can be used to post backtraces: &amp;lt;code&amp;gt;-b RelWithDebInfo&amp;lt;/code&amp;gt; (this is the default)&lt;br /&gt;
* Build a full debug version for very complete bug reporting: &amp;lt;code&amp;gt;-b Debug&amp;lt;/code&amp;gt;&lt;br /&gt;
* Skip download of distro packages (i.e., by default: &amp;lt;tt&amp;gt;apt-get install ...&amp;lt;/tt&amp;gt;): &amp;lt;code&amp;gt;-p n&amp;lt;/code&amp;gt;&lt;br /&gt;
* Skip retrieving of component downloads and updates (which typically use Git or wget): &amp;lt;code&amp;gt;-d n&amp;lt;/code&amp;gt;&lt;br /&gt;
* Skip the configure step (like running [https://cmake.org/ CMake] or [https://www.gnu.org/software/autoconf/ autoconf]'s &amp;lt;tt&amp;gt;./configure&amp;lt;/tt&amp;gt;): &amp;lt;code&amp;gt;-r n&amp;lt;/code&amp;gt;&lt;br /&gt;
* Skip compilation of programs: &amp;lt;code&amp;gt;-c n&amp;lt;/code&amp;gt;&lt;br /&gt;
* Build with compositor: &amp;lt;code&amp;gt;--compositor&amp;lt;/code&amp;gt;&lt;br /&gt;
* Force the use of a particular branch for a given component: &amp;lt;code&amp;gt;--component-branch ''COMPONENT=BRANCH''&amp;lt;/code&amp;gt; (e.g., &amp;lt;code&amp;gt;--component-branch OSG=OpenSceneGraph-3.6&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;--component-branch FGFS=next&amp;lt;/code&amp;gt;, etc.—but remember that components FGFS, SIMGEAR and DATA must ''always'' be in sync). See [[#Component-specific settings|Component-specific settings]] for details.&lt;br /&gt;
* Override the repository from which a given component is initially fetched: &amp;lt;code&amp;gt;--override-repo ''COMPONENT''=''SITE'':''ADDRESS''&amp;lt;/code&amp;gt; (see [[#Component-specific settings|Component-specific settings]]).&lt;br /&gt;
* Generate build.ninja files and build using Ninja: &amp;lt;code&amp;gt;-G Ninja&amp;lt;/code&amp;gt;&lt;br /&gt;
* Run CMake in verbose mode: &amp;lt;code&amp;gt;--verbose&amp;lt;/code&amp;gt; (this shows compilation commands)&lt;br /&gt;
&lt;br /&gt;
For example, if you are a developer and wish to quickly recompile and reinstall only your own modifications for FlightGear, you can do this:&lt;br /&gt;
 $ download_and_compile.sh -j$(nproc) -p n -d n -r n FGFS&lt;br /&gt;
&lt;br /&gt;
Note that this is the same as:&lt;br /&gt;
 $ download_and_compile.sh -j$(nproc) -pn -dn -rn FGFS&lt;br /&gt;
&lt;br /&gt;
This command will only rebuild modified files and reinstall FlightGear. Note that depending on the kind of changes you made, reconfiguring and thus dropping the &amp;lt;code&amp;gt;-rn&amp;lt;/code&amp;gt; option may be necessary, though (this is the case in particular if you added or removed C++ files).&lt;br /&gt;
&lt;br /&gt;
=== ccache ===&lt;br /&gt;
{{wikipedia|Ccache|ccache}} is a compiler cache that can help speed up subsequent re-compilations. Even if &amp;lt;code&amp;gt;ccache&amp;lt;/code&amp;gt; is installed and in the &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;download_and_compile.sh&amp;lt;/code&amp;gt; won't use it by default. To use it, install it, such as via &amp;lt;code&amp;gt;apt install ccache&amp;lt;/code&amp;gt;. Then enable it when building with &amp;lt;code&amp;gt;download_and_compile.sh&amp;lt;/code&amp;gt; by one of the below methods.&lt;br /&gt;
&lt;br /&gt;
Export in environment:&lt;br /&gt;
 export CMAKE_CXX_COMPILER_LAUNCHER=ccache&lt;br /&gt;
&lt;br /&gt;
Or when running &amp;lt;code&amp;gt;download_and_compile.sh&amp;lt;/code&amp;gt; add this option:&lt;br /&gt;
 --cmake-arg=ALL=&amp;quot;CMAKE_CXX_COMPILER_LAUNCHER=ccache&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Optimus technology ==&lt;br /&gt;
If your computer has a GPU with Optimus technology, you need a dedicated script in order to make FlightGear run with the powerful GPU.&lt;br /&gt;
&lt;br /&gt;
After having installed required tools (Bumblebee) you just need to run this command line in your FlightGear installation directory (where you executed &amp;lt;tt&amp;gt;download_and_compile.sh&amp;lt;/tt&amp;gt;):&lt;br /&gt;
 $ sed  's|\./fgfs|optirun ./fgfs|' run_fgfs.sh &amp;gt; run_fgfs_optirun.sh &amp;amp;&amp;amp; chmod +x run_fgfs_optirun.sh&lt;br /&gt;
Now you can run FlightGear with &amp;lt;code&amp;gt;./run_fgfs_optirun.sh&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The same can be done for the [[FlightGear_Launch_Control|FGRun]] launcher:&lt;br /&gt;
 $ sed  's|\./fgrun|optirun ./fgrun|' run_fgrun.sh &amp;gt; run_fgrun_optirun.sh &amp;amp;&amp;amp; chmod +x run_fgrun_optirun.sh&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* {{fgmeta source&lt;br /&gt;
| path = compile-scripts&lt;br /&gt;
| text = Other FlightGear build scripts&lt;br /&gt;
}} present in [[FGMeta]]&lt;br /&gt;
* {{fgmeta source&lt;br /&gt;
| path = fg-from-scratch&lt;br /&gt;
| simplepath = true&lt;br /&gt;
}}&lt;br /&gt;
* [http://geoffmclane.com/fg/fgfs-052.htm Another script] for building FlightGear and all its dependencies in an automated fashion. The page seems a bit oldish, though (as of 2019).&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Building from source]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Script de compilation sous Linux Debian/Ubuntu]]&lt;br /&gt;
[[nl:Compileren met een Script op Linux Debian/Ubuntu]]&lt;/div&gt;</summary>
		<author><name>Jebba</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=User:Jebba&amp;diff=141028</id>
		<title>User:Jebba</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=User:Jebba&amp;diff=141028"/>
		<updated>2024-11-17T16:33:55Z</updated>

		<summary type="html">&lt;p&gt;Jebba: Initial stub&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Jeff Moe&lt;br /&gt;
&lt;br /&gt;
* [https://spacecruft.org Spacecruft]&lt;/div&gt;</summary>
		<author><name>Jebba</name></author>
	</entry>
</feed>