Scripted Compilation on Linux Debian/Ubuntu: Difference between revisions

Jump to navigation Jump to search
add prerequisites section since dnc doesn't automatically pull these needed tools if they are not already installed.
(→‎Options: Fix title case and reorder: present advanced options last)
(add prerequisites section since dnc doesn't automatically pull these needed tools if they are not already installed.)
(6 intermediate revisions by 2 users not shown)
Line 17: Line 17:
Apart from its main purpose, <tt>download_and_compile.sh</tt> 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.<ref name="note-inspecting-download-and-compile-sh-to-gather-build-dependency-information">Look for strings such as <tt>zlib1g-dev</tt>, <tt>libglew-dev</tt> or <tt>qt5-default</tt>.</ref>
Apart from its main purpose, <tt>download_and_compile.sh</tt> 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.<ref name="note-inspecting-download-and-compile-sh-to-gather-build-dependency-information">Look for strings such as <tt>zlib1g-dev</tt>, <tt>libglew-dev</tt> or <tt>qt5-default</tt>.</ref>


== Disk space requirements and build time ==
== Prerequisites ==
 
Before embarking on building your own FlightGear binaries, you must have already installed the necessary tools to compile the source code with. These preliminary tools are
 
* build-essential
* git
* subversion
* cmake
* automake
 
They can be installed quite simply by running the following command line.
 
$ sudo apt-get install build-essential git subversion cmake automake
 
Once these tools are installed, the download_and_compile.sh script can be run. It will install possibly needed additional tools and libraries as it runs.
 
== <span id="disk-space-requirements-and-build-time"></span> Disk space requirements and build time ==


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).
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).
Line 104: Line 120:
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 for such things).


{{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 ([[FGData]] currently takes about 5 [https://en.wikipedia.org/wiki/Gibibyte GiB] and you'll need several more gibibytes to download the [[SimGear]] plus FlightGear sources, and build them. As of April 2019, a complete build including SimGear, FlightGear and FGData requires approximately 12 GiB of disk space). 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.


'''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.}}
Line 264: Line 280:
There we are! You now have a clean, up-to-date [[FGData]] clone in <tt>~/flightgear/dnc-managed/install/flightgear/fgdata</tt> (remember: <tt>~/flightgear/dnc-managed</tt> is the directory from which you ran <tt>download_and_compile.sh</tt>). Note this place: the full path of the <tt>~/flightgear/dnc-managed/install/flightgear/fgdata</tt> directory is your [[$FG_ROOT]].
There we are! You now have a clean, up-to-date [[FGData]] clone in <tt>~/flightgear/dnc-managed/install/flightgear/fgdata</tt> (remember: <tt>~/flightgear/dnc-managed</tt> is the directory from which you ran <tt>download_and_compile.sh</tt>). Note this place: the full path of the <tt>~/flightgear/dnc-managed/install/flightgear/fgdata</tt> directory is your [[$FG_ROOT]].


Now open the <tt>[[$FG_ROOT]]/.git/config</tt> file that lives inside your FGData clone (i.e., <tt>~/flightgear/dnc-managed/install/flightgear/fgdata/.git/config</tt> in our example). You should see a paragraph resembling this:
Now, change the protocol to use for future updates of your FGData clone:<ref name="changing-the-protocol-for-a-git-remote-manual-method">Another way would be to manually change the relevant line starting with <code><nowiki>url = ssh://SFusername@</nowiki></code> for the <code>origin</code> remote in the <tt>.git/config</tt> file that lives inside your repository clone (i.e., <tt>~/flightgear/dnc-managed/install/flightgear/fgdata/.git/config</tt> in our example).</ref>
  [remote "origin"]
(cd install/flightgear/fgdata && \
        url = ssh://''SFusername''@git.code.sf.net/p/flightgear/fgdata
  git remote set-url origin <nowiki>https://git.code.sf.net/p/flightgear/fgdata</nowiki>)
        fetch = +refs/heads/*:refs/remotes/origin/*
(you can check at any time the protocol(s) in use with the command <code>git remote -v</code> run inside a Git repository—in this case, inside the folder <tt>install/flightgear/fgdata</tt>). As a consequence of this change, all future updates of your FGData clone will use the <tt>https</tt> protocol, therefore you won't be prompted anymore for your SourceForge password.
Replace <code>ssh://''SFusername''@</code> with <code>https://</code> and save the file. As a consequence of this change, all future updates of your FGData clone will use the <tt>https</tt> protocol, therefore you won't be prompted anymore for your SourceForge password.


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):
Line 386: Line 401:
By default, <tt>download_and_compile.sh</tt> downloads or updates, then compiles, [[SimGear]] and FlightGear, and downloads or updates [[FGData]] (by nature, FGData can't be compiled). This is what happens when running:
By default, <tt>download_and_compile.sh</tt> downloads or updates, then compiles, [[SimGear]] and FlightGear, and downloads or updates [[FGData]] (by nature, FGData can't be compiled). This is what happens when running:
  $ download_and_compile.sh
  $ download_and_compile.sh
To make it download or update and compile something else, you may pass non-option arguments naming the ''components'' you want, for instance:
The preceding command is therefore equivalent to:
$ download_and_compile.sh SIMGEAR FGFS DATA
 
To make <tt>download_and_compile.sh</tt> take care of other programs or libraries, use non-option arguments naming the ''components'' you want, for instance:
  $ download_and_compile.sh SIMGEAR FGFS DATA OSG
  $ download_and_compile.sh SIMGEAR FGFS DATA OSG
SIMGEAR, FGFS, DATA and OSG are the component names respectively corresponding to [[SimGear]], FlightGear, [[FGData]] and [[OpenSceneGraph]] in <tt>download_and_compile.sh</tt>'s terminology.
SIMGEAR, FGFS, DATA and OSG are the component names respectively corresponding to [[SimGear]], FlightGear, [[FGData]] and [[OpenSceneGraph]] in <tt>download_and_compile.sh</tt>'s terminology.
Line 443: Line 461:
}} for FlightGear.}}
}} for FlightGear.}}


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 [https://forum.flightgear.org/viewtopic.php?f=45&t=35740 here] for example). This is often convenient when using the development version of FlightGear, but doesn't mean such bugs shouldn't be reported!
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!


If you have several such options to pass, just use spaces to separate them inside the quotes:
If you have several such options to pass, just use spaces to separate them inside the quotes:
Line 574: Line 592:
  $ rm -rf build/* install/simgear/ install/openrti/ install/flightgear/share/ install/flightgear/bin/
  $ rm -rf build/* install/simgear/ install/openrti/ install/flightgear/share/ install/flightgear/bin/


See [https://forum.flightgear.org/viewtopic.php?f=45&t=26244 this thread] for more details.
See {{forum link|t=26244|text=this thread}} for more details.


== Options ==
== Options ==
Line 610: Line 628:
The same can be done for the [[FlightGear_Launch_Control|FGRun]] launcher:
The same can be done for the [[FlightGear_Launch_Control|FGRun]] launcher:
  $ sed  's|\./fgrun|optirun ./fgrun|' run_fgrun.sh > run_fgrun_optirun.sh && chmod +x run_fgrun_optirun.sh
  $ sed  's|\./fgrun|optirun ./fgrun|' run_fgrun.sh > run_fgrun_optirun.sh && chmod +x run_fgrun_optirun.sh
== Remove warning message for DDS files ==
You can remove the warning message displayed when DDS files are parsed by SimGear by adding the following line just after '''cd "simgear"''' line :
$ sed -i s/SG_ALERT,\ \"Image/SG_WARN,\ \"Image/g simgear/scene/model/ModelRegistry.cxx


== See also ==
== See also ==
Line 632: Line 646:
[[Category:Building from source]]
[[Category:Building from source]]


[[fr:Script de compilation sous Linux Debian/Ubuntu]]
[[nl:Compileren met een Script op Linux Debian/Ubuntu]]
[[nl:Compileren met een Script op Linux Debian/Ubuntu]]
[[fr:Script de compilation sous Linux Debian/Ubuntu]]
185

edits

Navigation menu