The "DIRECTORY=..." was printed too late in the log file (after the apt
stuff). Fix that and make some code a bit easier to follow (e.g.,
LOGFILE is assigned only once now).
Introduce a new function _log() that allows one to factor out the
remaining explicit appends to $LOGFILE. Summary:
_log writes its arguments to $LOGFILE
_printLog ditto, and also prints them to the terminal
_logOutput echoes its standard input to the terminal and/or to $LOGFILE
(depending on its first argument). Typically used in the
last component of a pipeline.
Use this function for all commands that produce output we want to see on
the terminal and in the log file. Actually, the first parmeter of the
function, which is optional, allows one to choose where we want the
output to be written to: the terminal and/or the log file (three
possibilities, since for none of these, '>/dev/null' redirection can be
used directly).
Fix for commit 8a7fd33b2b: in argument to --git-clone-site-params,
take the username exactly as provided instead of converting it to
lowercase (the site and protocol are still converted to lowercase, but
*that* is intentional).
This commit adds two new options:
--git-clone-default-proto=PROTO
Default protocol to use for 'git clone' ('ssh', 'https' or git'). If
the option is not specified, the default is still 'https'.
--git-clone-site-params=SITE=PROTOCOL[:USERNAME]
Connect as USERNAME with PROTOCOL when cloning a Git repository hosted
at SITE (sample sites: 'SourceForge', 'GitHub'; valid protocols:
'ssh', 'https' and git'). USERNAME is required when using the 'ssh'
protocol. The hosting site and protocol are matched in a
case-insensitive way.
This option may be passed several times with different sites, e.g.
download_and_compile.sh --git-clone-default-proto=ssh \
--git-clone-site-params SourceForge=ssh:frougon \
--git-clone-site-params=GitHub=https
(replace 'frougon' with your username at SourceForge)
For repositories located at a hosting site specified with
--git-clone-site-params, the protocol indicated with this option
overrides the default protocol, be it the script default or the one
given with --git-clone-default-proto.
The above example shows that the argument of a long option, namely
--git-clone-site-params in the example, may be given either separately
or in the same shell argument as the option name, in which case an '='
separator is needed.
When using the 'ssh' protocol, ssh-agent may be used to avoid having to
type the password once for each repository fetched with this protocol.
Also note that gpg-agent(1) can act as an SSH agent.
The main advantage of getopt is that it allows one to define long
options. Help can now be obtained with 'download_and_compile.sh --help',
in addition to the already-existing '-h' option.
[ This is the getopt tool shipped in Debian's util-linux package,
which is marked as Essential, therefore should always be present
on a Debian system. ]
Try to improve formatting of the --help message, so that it is better
suited to document options that have a short as well as a long form.
Make the presentation of this help message a bit more standard.
Since James' recent FG work, the Qt private headers are not needed
anymore for the Qt launcher; clarify this in the comments (they are
still needed for FGQCANVAS, but it is disabled by default).
The qml-module-qtquick-dialogs package is needed for the built-in
launcher's Settings dialog since FlightGear commit
37dc418ce1978a55281cdedf6983e0e3ffea0108.
Forum user daweed reported[1] a nasty error[2] when doing 'git clone' or
'git pull' for FGData with the HTTPS protocol. This error disappeared as
soon as he replaced libcurl4-gnutls-dev with libcurl4-openssl-dev on his
system.
-> favor installation of libcurl4-openssl-dev over libcurl4-gnutls-dev
[1] https://forum.flightgear.org/viewtopic.php?f=20&p=329326#p329324
[2] "RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection
was non-properly terminated"
Typical output of:
dpkg-query --showformat='${Status}\n' --show dctrl-tools
is:
install ok installed
(three words, not one). Thanks to wkitty42 for the report.
Declare qtdeclarative5-private-dev and qml-module-qtquick2 as optional
dependencies, because they are needed for the built-in launcher,
starting from FG commit 3a8d3506d651b770e3173841a034e6203528f465
(committed to FG on 2017-09-26). People who can't install these packages
(oldish systems, etc.) should still be able to build and run FlightGear,
but without the built-in launcher.
See discussion around this message:
https://sourceforge.net/p/flightgear/mailman/message/36059892/
- Rename _package_alternative_inner() to _find_package_alternative() and
modify it to make it more useful when called from other functions. If
a package is found that matches one of the alternatives, its name is
printed on stdout, otherwise nothing is printed (empty output).
- Adapt _package_alternative() accordingly and rename it
to _mandatory_pkg_alternative().
- New function _optional_pkg_alternative() based on
_find_package_alternative(). Contrary to _mandatory_pkg_alternative(),
if no match is found in _optional_pkg_alternative(), a message is
printed to stdout but the script doesn't abort.
By setting the 'ident' attribute for /download_and_compile.sh, this
replacement will be automatic whenever the file is checked out.
Note: the ID is the 40-character hexadecimal blob object name in Git, it
is *not* the commit ID. 'git show <id>' can be used to obtain the
script contents from its blob object name (id).
This will avoid spoiling every diff with the version number change, or
alternatively having different versions of the same file displaying and
logging the same version number.
If download_and_compile.sh is moved to a different directory in FGMeta
(or even renamed), then the path in .gitattributes must be adapted for
the substitution to work (the '/' in .gitattributes anchors the match at
the containing directory; I did this because download_and_compile.sh is
a rather generic name, and there *might* be different scripts with the
same name in other dirs...).
- Add function _package_alternative() to select between alternative
packages (idea of Pat Callahan).
- Split the 'apt-get update' and 'apt-get install' steps to arrange for
installation of the 'dctrl-tools' prerequisite of
_package_alternative().
- Add and use functions _aptUpdate() and _aptInstall() for good
factoring (makes testing easier for people not using sudo, allows one
to easily switch from 'apt-get' to 'apt' or 'aptitude' if wanted,
etc.).
Changes 1.9.5 through 1.9.10
Multiple changes restructuring parts of the script
FGRUN added to ALL list
Regular expression used to determine if a component is to be built
OPENRTI added
Fixes and changes in 1.9.10
url for plib has / at the end to prevent problems with svn
url for osg has been updated to http://svn.openscenegraph.org/osg/OpenSceneGraph/tags/OpenSceneGraph-3.0.1/
x and v options added to aid in script debugging
w option added to aid in cmake debugging
Pick up 2.4.0 release tag for stable version (Note: specifying commit IDs
alone doesn't work - since the same commits are on different branches =>
either use commitID+branch or preferably the release-tag).
Update FGRUN stable version for FG2.4.0
Conflicts:
download_and_compile.sh