Scripted Compilation on Linux Debian/Ubuntu: Difference between revisions

Jump to navigation Jump to search
→‎Getting started with download_and_compile.sh: Move the SSH method to a dedicated section, last. The recommended method should now be simple enough.
m (Add ZLIB to --help output)
(→‎Getting started with download_and_compile.sh: Move the SSH method to a dedicated section, last. The recommended method should now be simple enough.)
Line 129: Line 129:
Apart from this harmless command, ''do not'' run other <tt>download_and_compile.sh</tt> commands from an arbitrary directory, in particular ''don't'' run them from <tt>~/flightgear/fgmeta</tt>. This is because '''most other <tt>download_and_compile.sh</tt> commands write to the current directory''' (<code>download_and_compile.sh --help</code> and <code>download_and_compile.sh --version</code> are safe to run from any directory, though).
Apart from this harmless command, ''do not'' run other <tt>download_and_compile.sh</tt> commands from an arbitrary directory, in particular ''don't'' run them from <tt>~/flightgear/fgmeta</tt>. This is because '''most other <tt>download_and_compile.sh</tt> commands write to the current directory''' (<code>download_and_compile.sh --help</code> and <code>download_and_compile.sh --version</code> are safe to run from any directory, though).


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 <tt>download_and_compile.sh</tt> to your <tt>PATH</tt> or by creating a symbolink link pointing to <tt>download_and_compile.sh</tt> in a directory that is part of your <tt>PATH</tt>. This is not necessary, though; do it only if you feel the need (when enabled, persistent shell history is often enough for such things).
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 <tt>download_and_compile.sh</tt> to your <tt>PATH</tt> or by creating a symbolink link pointing to <tt>download_and_compile.sh</tt> in a directory that is part of your <tt>PATH</tt>. 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 <tt>PATH</tt>).


{{Note|The following commands should be run from an empty directory<ref name="dedicated-directory-won-t-stay-empty-forever">Well, empty before the first time; later, <tt>download_and_compile.sh</tt> is going to populate it with plenty of FlightGear files and subdirectories, of course.</ref> 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 <tt>~/flightgear/dnc-managed</tt> for this purpose, in order to express that the whole directory tree is managed by <tt>download_and_compile.sh</tt>. This is just an example; feel free to choose another directory if you want.
{{Note|The following commands should be run from an empty directory<ref name="dedicated-directory-won-t-stay-empty-forever">Well, empty before the first time; later, <tt>download_and_compile.sh</tt> is going to populate it with plenty of FlightGear files and subdirectories, of course.</ref> 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 <tt>~/flightgear/dnc-managed</tt> for this purpose, in order to express that the whole directory tree is managed by <tt>download_and_compile.sh</tt>. This is just an example; feel free to choose another directory if you want.
Line 135: Line 135:
'''Don't run the commands from a non-dedicated directory,''' because it will be filled with files and directories created by <tt>download_and_compile.sh</tt> 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.}}
'''Don't run the commands from a non-dedicated directory,''' because it will be filled with files and directories created by <tt>download_and_compile.sh</tt> 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.}}


{{Note|This section will be reorganized. Reading the following is likely to be useful, but since {{fgmeta commit | 420034d5b51ff2d32fc0c3716b17a2d862841e0f}}, the initial setup has been greatly simplified. Having a [https://sourceforge.net/ SourceForge] account is not needed anymore for secure operation. Running
{{Tip|For some commands, <tt>download_and_compile.sh</tt> may use <tt>sudo</tt>. In case you want to run some other program instead of <tt>sudo</tt>, this can be done with the <code>--sudo</code> option of <tt>download_and_compile.sh</tt>. For instance, in order to see the commands that would be run with sudo without actually running them, you can pass <code><nowiki>--sudo=echo</nowiki></code> to <tt>download_and_compile.sh</tt>. Like all other options, <code>--sudo</code> must be given ''before'' all arguments that are component names (such as <tt>SIMGEAR</tt>, <tt>FGFS</tt>, <tt>DATA</tt>, etc.).}}
$ download_and_compile.sh
in the appropriate directory (initially empty) should be enough (don't forget that by convention here, <code>download_and_compile.sh</code> stands for <code>~/flightgear/fgmeta/download_and_compile.sh</code> or something like that). You'll probably want to pass the <code>-j</code> option with a value, as in <code>-j$(nproc)</code> (see below for explanations). If [[FGData]] hasn't been cloned yet, there will be a prompt. You may want to use, for instance:
$ download_and_compile.sh -j$(nproc) --non-interactive
if you want the default answer to be automatically used (you might still be prompted for your <tt>sudo</tt> password though, unless you disabled package installation with <code>-pn</code> or specified an alternative program with the <code>--sudo</code> option).}}


For the method described below (not necessary anymore as of May 2020, but still working), you'll need an account at [https://sourceforge.net/ SourceForge]. 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''.
The package manager used by <tt>download_and_compile.sh</tt> by default is <tt>apt-get</tt> (it won't be used if you pass <tt>download_and_compile.sh</tt> the <code>-pn</code> option). You can use another one if you wish, as long as it supports the following calls:
''pkg-mgr'' update
''pkg-mgr'' install ''pkg1 pkg2'' ...
This is the case for <tt>aptitude</tt> as well as <tt>apt</tt>. If you want <tt>download_and_compile.sh</tt> to use <tt>aptitude</tt>, give it the option <code><nowiki>--package-manager=aptitude</nowiki></code> before any of the ''COMPONENT'' arguments.
 
All options of <tt>download_and_compile.sh</tt> can be seen by running the following command:
$ download_and_compile.sh --help
 
Now the instructions. '''You have chosen a dedicated directory''' where all the stuff that is downloaded and built by <tt>download_and_compile.sh</tt> will be stored. This is <tt>~/flightgear/dnc-managed</tt> if you followed the suggestions given in [[#getting-started-with-download-and-compile-sh-notations|Notations]], and should be empty before you run <tt>download_and_compile.sh</tt> for the first time. However, it is quite correct to start <tt>download_and_compile.sh</tt> from the same directory for subsequent runs, even when non-empty (otherwise, <tt>download_and_compile.sh</tt> 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:
$ mkdir -p ~/flightgear/dnc-managed
$ cd ~/flightgear/dnc-managed
$ download_and_compile.sh -s -j$(nproc)
The <code>-j$(nproc)</code> 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]].
 
{{Note|Because of the <code>-s</code> option, the above <tt>download_and_compile.sh</tt> command would build the latest stable release of FlightGear. If you want to build the latest Long Term Support release, use <code>--lts</code> instead. If you want to build the development version of FlightGear, use neither <code>-s</code> nor <code>--lts</code>, but be warned: it may very well be unstable and unsuitable for flying. For more details on these options, see [[#Release selection|Release selection]].}}
 
When you don't pass any non-option argument to <tt>download_and_compile.sh</tt> as done here, it takes care of the three base components needed to run FlightGear: <tt>SIMGEAR</tt>, <tt>FGFS</tt> and <tt>DATA</tt> (these are the component names used by <tt>download_and_compile.sh</tt>, i.e., the final arguments one can optionally give in a <tt>download_and_compile.sh</tt> command; in normal speech, they correspond to the {{simgear source
| text = SimGear
}}, {{flightgear source
| text = FlightGear
}} and {{fgdata source
| text = FGData
}} repositories). Therefore, the above command is presently exactly equivalent to:
$ download_and_compile.sh -s -j$(nproc) SIMGEAR FGFS DATA
 
In case you want to build another component such as [[OpenSceneGraph|OSG]], you can add it to the command, like this:
$ download_and_compile.sh -s -j$(nproc) SIMGEAR FGFS DATA OSG
(explicitly specifying OSG like this is necessary as of July 10, 2020 if you build with <code>--lts</code> instead of <code>-s</code> and the version of the [[OpenSceneGraph]] library in your distribution is 3.5 or later).
 
When the command terminates, you should have a script called <tt>run_fgfs.sh</tt> in the directory from which you ran <tt>download_and_compile.sh</tt> (i.e., <tt>~/flightgear/dnc-managed</tt> 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:<ref name="no-need-to-change-to-dnc-managed-dir-before-starting-generated-scripts">We give these commands because they are easy to read, but the <code>cd</code> command is not needed if you use the correct path, as in <code>~/flightgear/dnc-managed/run_fgfs.sh --launcher</code>.</ref>
$ cd ~/flightgear/dnc-managed
$ ./run_fgfs.sh --launcher
(You may omit the <code>--launcher</code> option; this would simply start FlightGear without any launcher, at the default airport and with the default aircraft.)<br />
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 <code>run_fgfs.sh --launcher</code> is quite fine, be sure to try it first!
 
{{Note|If you ran <tt>download_and_compile.sh</tt> from <tt>~/flightgear/dnc-managed</tt> as proposed above, the full path of the <tt>~/flightgear/dnc-managed/install/flightgear/fgdata</tt> directory is your [[$FG_ROOT]]. This is a very important path for FlightGear; knowing this may be useful for troubleshooting or doing “advanced things.”}}
 
=== <span id="using-download-and-compile-sh-to-update-flightgear"></span> Updating FlightGear ===
 
{{Note|If you built FlightGear with either <code>-s</code> or <code>--lts</code>, you need to pass the ''same option'' to the <tt>download_and_compile.sh</tt> command given below that will update your FlightGear installation. Otherwise, <tt>download_and_compile.sh</tt> 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 Support'' to ''stable''), using the <code>--cleanup</code> option of <tt>download_and_compile.sh</tt> is heartily recommended.}}
 
Keeping the above note in mind, go to the directory from which you previously ran <tt>download_and_compile.sh</tt> (<tt>~/flightgear/dnc-managed</tt> in our example). This is the folder which, if you did a complete run of <tt>download_and_compile.sh</tt> as shown in the previous section, contains the <tt>run_fgfs.sh</tt> script and a log file named <tt>compilation_log.txt</tt> that records what <tt>download_and_compile.sh</tt> did in its last run. If you wish to update, say, {{simgear source
| text = SimGear
}}, {{flightgear source
| text = FlightGear
}} and {{fgdata source
| text = FGData
}}, simply execute this:
$ download_and_compile.sh -pn SIMGEAR FGFS DATA
We'll explain the <code>-pn</code> in a minute. <tt>SIMGEAR</tt>, <tt>FGFS</tt> and <tt>DATA</tt> are called ''components'' in <tt>download_and_compile.sh</tt> terminology. A component generally corresponds to a software repository, or something close. In fact, since <tt>SIMGEAR</tt>, <tt>FGFS</tt> and <tt>DATA</tt> are often precisely the components people wish to update, they form the default components set, so that the previous command is equivalent to:
$ download_and_compile.sh -pn
Now about this <code>-pn</code>. It is equivalent to <code>-p n</code> and means “don't install packages from my (Linux) distribution” (<code>y</code> means ''yes, please install'', <code>n</code> means ''no, don't install''). In case you forgot that, simply run:
$ download_and_compile.sh --help
What does it imply to pass <code>-pn</code>? This tells <tt>download_and_compile.sh</tt> to completely skip the step where it checks for needed packages from your distribution and installs them, by default using <tt>apt-get</tt>. It thus goes straight to the following steps:
* update each repository corresponding to one of the selected components (<tt>SIMGEAR</tt>, <tt>FGFS</tt> and <tt>DATA</tt> in our example);
* compile each selected component that requires compilation;
* install each selected component in the appropriate place (under <tt>~/flightgear/dnc-managed</tt> according to our [[#getting-started-with-download-and-compile-sh-notations|Notations]]).
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 <code>-pn</code> to <tt>download_and_compile.sh</tt>, you forbid it to install these dependencies for you. So, you can also very well update without passing the <code>-pn</code> option, it will simply take a little longer (the time to check if all dependencies of the selected components are available with <tt>APT</tt>). In fact, this is '''what you should do if the previous <tt>download_and_compile.sh</tt> run failed:''' first update <tt>download_and_compile.sh</tt> (see [[#getting-download-and-compile-sh-using-an-fgmeta-clone|above]]) then run it ''without'' <code>-pn</code><ref name="passing-no-pn-option-equals-passing-py">Which is the same as passing <code>-py</code>.</ref> 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.
 
'''Summary'''
 
Routine update:
$ download_and_compile.sh -pn ''COMPONENT...''
In case this fails, first update <tt>download_and_compile.sh</tt> (see [[#getting-download-and-compile-sh-using-an-fgmeta-clone|above]]), then run
$ download_and_compile.sh ''COMPONENT...''
where ''COMPONENT...'' stands for the space-separated list of selected components, and defaults to <tt>SIMGEAR FGFS DATA</tt> if you don't specify any.
 
=== <span id="examining-download-and-compile-sh-history"></span> Examining the history of <tt>download_and_compile.sh</tt> ===
 
Looking at the latest commits that affected <tt>download_and_compile.sh</tt> is quite easy with your FGMeta clone:
$ cd ~/flightgear/fgmeta
$ git log -- download_and_compile.sh
(then quit by typing <tt>q</tt>, assuming your <tt>$GIT_PAGER</tt> is <tt>less</tt>)<br />
 
In order to do the same, but also see the patch for each commit:
$ cd ~/flightgear/fgmeta
$ git log -p -- download_and_compile.sh
 
=== For the curious: the SSH way ===
 
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, <code>git clone</code> from SourceForge doesn't work for the big FGData repository using https). Current versions of <tt>download_and_compile.sh</tt> 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.
 
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''.


{{Note|As explained in [[#getting-started-with-download-and-compile-sh-notations|Notations]], we assume that your Unix user name (login) is <tt>toto</tt>. Don't confuse the <tt>sudo</tt> password prompt (where you need to enter <tt>toto</tt>'s password) with the password prompt for your SourceForge account! The former appears as
{{Note|As explained in [[#getting-started-with-download-and-compile-sh-notations|Notations]], we assume that your Unix user name (login) is <tt>toto</tt>. Don't confuse the <tt>sudo</tt> password prompt (where you need to enter <tt>toto</tt>'s password) with the password prompt for your SourceForge account! The former appears as
Line 149: Line 227:
}}
}}


{{Tip|In case you want to run some other program instead of <tt>sudo</tt>, this can be done with the <code>--sudo</code> option of <tt>download_and_compile.sh</tt>. For instance, in order to see the commands that would be run with sudo without actually running them, you can pass <code><nowiki>--sudo=echo</nowiki></code> to <tt>download_and_compile.sh</tt>. Like all other options, <code><nowiki>--sudo</nowiki></code> must be given ''before'' all arguments that are component names (such as <tt>SIMGEAR</tt>, <tt>FGFS</tt>, <tt>DATA</tt>, etc.).}}
{{Tip|For some commands, <tt>download_and_compile.sh</tt> may use <tt>sudo</tt>. In case you want to run some other program instead of <tt>sudo</tt>, this can be done with the <code>--sudo</code> option of <tt>download_and_compile.sh</tt>. For instance, in order to see the commands that would be run with sudo without actually running them, you can pass <code><nowiki>--sudo=echo</nowiki></code> to <tt>download_and_compile.sh</tt>. Like all other options, <code>--sudo</code> must be given ''before'' all arguments that are component names (such as <tt>SIMGEAR</tt>, <tt>FGFS</tt>, <tt>DATA</tt>, etc.).}}


The package manager used by <tt>download_and_compile.sh</tt> by default is <tt>apt-get</tt>. You can use another one if you want, as long as it supports the following calls:
{{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 Support release, add option <code>-s</code> or <code>--lts</code> to all <tt>download_and_compile.sh</tt> commands given below. You may add the chosen option right after the <tt>download_and_compile.sh</tt> 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 <code>-s</code> and <code>--lts</code>.}}
''pkg-mgr'' update
''pkg-mgr'' install ''pkg1 pkg2'' ...
This is the case for <tt>aptitude</tt> as well as <tt>apt</tt>. If you want <tt>download_and_compile.sh</tt> to use <tt>aptitude</tt>, give it the option <code><nowiki>--package-manager=aptitude</nowiki></code> before any of the ''COMPONENT'' arguments.


All options of <tt>download_and_compile.sh</tt> can be seen by running the following command:
Now the instructions. You have chosen a dedicated directory where all the stuff that is downloaded and built by <tt>download_and_compile.sh</tt> will be stored. This is <tt>~/flightgear/dnc-managed</tt> in our example, and should be empty before you run <tt>download_and_compile.sh</tt> for the first time. However, it is quite correct to start <tt>download_and_compile.sh</tt> from the same directory for subsequent runs, even when non-empty (otherwise, <tt>download_and_compile.sh</tt> would automatically reclone the repositories every time you run it; that would be a sheer waste of time and bandwidth).
$ download_and_compile.sh --help
Now the instructions we promised you. You have chosen a dedicated directory where all the stuff that is downloaded and built by <tt>download_and_compile.sh</tt> will be stored. This is <tt>~/flightgear/dnc-managed</tt> in our example, and should be empty before you run <tt>download_and_compile.sh</tt> for the first time. However, it is quite correct to start <tt>download_and_compile.sh</tt> from the same directory for subsequent runs, even when non-empty (otherwise, <tt>download_and_compile.sh</tt> would automatically reclone the repositories every time you run it; that would be a sheer waste of time and bandwidth).


Ready? Let's go!
Ready? Let's go!
Line 305: Line 378:


All that remains to do is to run, from the same directory as before (<tt>~/flightgear/dnc-managed</tt> in our example):
All that remains to do is to run, from the same directory as before (<tt>~/flightgear/dnc-managed</tt> in our example):
$ download_and_compile.sh
or
  $ download_and_compile.sh -j$(nproc)
  $ download_and_compile.sh -j$(nproc)
(<code>-j$(nproc)</code> is “only” useful to save time—see the tip below).
The <code>-j$(nproc)</code> 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]].
 
When you don't pass any non-option argument to <tt>download_and_compile.sh</tt> as done here, it takes care of the three base components needed to run FlightGear: <tt>SIMGEAR</tt>, <tt>FGFS</tt> and <tt>DATA</tt> (these are the component names used by <tt>download_and_compile.sh</tt>, i.e., the final arguments one can optionally give in a <tt>download_and_compile.sh</tt> command; in normal speech, they correspond to the {{simgear source
| text = SimGear
}}, {{flightgear source
| text = FlightGear
}} and {{fgdata source
| text = FGData
}} repositories). Therefore, the above command is presently exactly equivalent to:
$ download_and_compile.sh SIMGEAR FGFS DATA
 
In case you wanted to build another component such as [[OpenSceneGraph|OSG]], you could add it to the command, like this:
$ download_and_compile.sh SIMGEAR FGFS DATA OSG
 
(With current Debian stable, this is not necessary because it has OpenSceneGraph 3.4. But if your distribution only has an older version, you'll certainly need to select the <tt>OSG</tt> component like this.)


When the command terminates, you should have a script called <tt>run_fgfs.sh</tt> in the directory <tt>~/flightgear/dnc-managed</tt> from which you ran <tt>download_and_compile.sh</tt>. This will be your script to run FlightGear. For instance, in order to start the built-in launcher, you can run the following commands:<ref name="no-need-to-change-to-dnc-managed-dir-before-starting-generated-scripts">We give these commands because they are easy to read, but the <code>cd</code> command is not needed if you use the correct path, as in <code>~/flightgear/dnc-managed/run_fgfs.sh --launcher</code>.</ref>
Assuming the compilation was successful, you can now start the [[FlightGear Qt launcher|FlightGear built-in launcher]] using for instance:
$ cd ~/flightgear/dnc-managed
  $ ./run_fgfs.sh --launcher
  $ ./run_fgfs.sh --launcher
(You may omit the <code>--launcher</code> option; this would simply start FlightGear without any launcher, at the default airport and with the default aircraft.)<br />
See [[#Building FlightGear|Building FlightGear]] for more details.
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 <code>run_fgfs.sh --launcher</code> is quite fine, be sure to try it first!).
 
{{Tip|You can considerably speed up the build process—literally, save hours—by telling <tt>download_and_compile.sh</tt> to use several cores simultaneously when compiling. With option <code>-j$(nproc)</code>, compilations will use all cores available on your processor; thus, a typical <tt>download_and_compile.sh</tt> command is <code>download_and_compile.sh -j$(nproc)</code>. If you want to use, say, 4 cores, replace <code>-j$(nproc)</code> with <code>-j4</code>.}}
 
=== <span id="using-download-and-compile-sh-to-update-flightgear"></span> Updating FlightGear ===
 
{{Note|If you built FlightGear with either <code>-s</code> or <code>--lts</code>, you need to pass the ''same option'' to the <tt>download_and_compile.sh</tt> command given below that will update your FlightGear installation. Otherwise, <tt>download_and_compile.sh</tt> 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 Support'' to ''stable''), using the <code>--cleanup</code> option of <tt>download_and_compile.sh</tt> is heartily recommended.}}
 
Keeping the above note in mind, go to the directory from which you previously ran <tt>download_and_compile.sh</tt> (<tt>~/flightgear/dnc-managed</tt> in our example). This is the folder which, if you did a complete run of <tt>download_and_compile.sh</tt> as shown in the previous section, contains the <tt>run_fgfs.sh</tt> script and a log file named <tt>compilation_log.txt</tt> that records what <tt>download_and_compile.sh</tt> did in its last run. If you wish to update, say, {{simgear source
| text = SimGear
}}, {{flightgear source
| text = FlightGear
}} and {{fgdata source
| text = FGData
}}, simply execute this:
$ download_and_compile.sh -pn SIMGEAR FGFS DATA
We'll explain the <code>-pn</code> in a minute. <tt>SIMGEAR</tt>, <tt>FGFS</tt> and <tt>DATA</tt> are called ''components'' in <tt>download_and_compile.sh</tt> terminology. A component generally corresponds to a software repository, or something close. In fact, since <tt>SIMGEAR</tt>, <tt>FGFS</tt> and <tt>DATA</tt> are often precisely the components people wish to update, they form the default components set, so that the previous command is equivalent to:
$ download_and_compile.sh -pn
Now about this <code>-pn</code>. It is equivalent to <code>-p n</code> and means “don't install packages from my (Linux) distribution” (<code>y</code> means ''yes, please install'', <code>n</code> means ''no, don't install''). In case you forgot that, simply run:
$ download_and_compile.sh --help
What does it imply to pass <code>-pn</code>? This tells <tt>download_and_compile.sh</tt> to completely skip the step where it checks for needed packages from your distribution and installs them, by default using <tt>apt-get</tt>. It thus goes straight to the following steps:
* update each repository corresponding to one of the selected components (<tt>SIMGEAR</tt>, <tt>FGFS</tt> and <tt>DATA</tt> in our example);
* compile each selected component that requires compilation;
* install each selected component in the appropriate place (under <tt>~/flightgear/dnc-managed</tt> according to our [[#getting-started-with-download-and-compile-sh-notations|Notations]]).
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 <code>-pn</code> to <tt>download_and_compile.sh</tt>, you forbid it to install these dependencies for you. So, you can also very well update without passing the <code>-pn</code> option, it will simply take a little longer (the time to check if all dependencies of the selected components are available with <tt>APT</tt>). In fact, this is '''what you should do if the previous <tt>download_and_compile.sh</tt> run failed:''' first update <tt>download_and_compile.sh</tt> (see [[#getting-download-and-compile-sh-using-an-fgmeta-clone|above]]) then run it ''without'' <code>-pn</code><ref name="passing-no-pn-option-equals-passing-py">Which is the same as passing <code>-py</code>.</ref> 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.
 
'''Summary'''
 
Routine update:
$ download_and_compile.sh -pn ''COMPONENT...''
In case this fails, first update <tt>download_and_compile.sh</tt> (see [[#getting-download-and-compile-sh-using-an-fgmeta-clone|above]]), then run
$ download_and_compile.sh ''COMPONENT...''
where ''COMPONENT...'' stands for the space-separated list of selected components, and defaults to <tt>SIMGEAR FGFS DATA</tt> if you don't specify any.
 
=== <span id="examining-download-and-compile-sh-history"></span> Examining the history of <tt>download_and_compile.sh</tt> ===
 
Looking at the latest commits that affected <tt>download_and_compile.sh</tt> is quite easy with your FGMeta clone:
$ cd ~/flightgear/fgmeta
$ git log -- download_and_compile.sh
(then quit by typing <tt>q</tt>, assuming your <tt>$GIT_PAGER</tt> is <tt>less</tt>)<br />
 
In order to do the same, but also see the patch for each commit:
$ cd ~/flightgear/fgmeta
$ git log -p -- download_and_compile.sh


== <span id="list-of-available-components"></span> List of available components ==
== <span id="list-of-available-components"></span> List of available components ==
377

edits

Navigation menu