Should behave better in case one of these variables contains whitespace.
Note: I didn't look inside the generated scripts such as run_fgfs.sh,
they may have similar issues.
For instance, don't attempt to install TerraGear dependencies unless
TERRAGEAR is in WHATTOBUILD. This should significantly reduce the number
of packages downloaded by the first use of download_and_compile.sh that
doesn't have -pn in the options.
We may get reports of missing dependencies for some components as a side
effect of this change; we'll just have to add the missing dependencies
wherever they are required (this can happen if, for instance, some
particular dependency was so far listed in the comments only as a
TERRAGEAR dependency, but was actually required by *another component*
such as FGFS). Incorrect dependency information needs to be fixed,
that's all there is to it.
The dependency is optional because CppUnit is shipped with the FG
sources. However, when installed via the distro package manager as we
are attempting here:
- the FG build will be quicker;
- libcppunit-dev will be updated like other distro packages (e.g.,
it will receive security updates).
-----------------------
* merge contribution of eatdirt <chris@ringeval.com>
add download, conversion and generation of normalmaps
Big thanks Chris!
* update README and some minor updates to the script
- When -pn has been passed (i.e., the user wants the 'apt-get install'
step to be skipped), don't waste time checking the available
dependencies. Rationale: someone using -pn has probably already
installed the required packages either manually or during a previous
run of download_and_compile.sh, and anything missing couldn't be fixed
under -pn regime anyway, by definition. Assume that users passing -pn
want to build with the packages they already have, and let them spare
some time and CPU cycles.
- New options --package-manager and --sudo. The former defaults to
'apt-get' as usual, but 'aptitude' can be used as well. The --sudo
option specifies the sudo-like program to use. Passing --sudo=echo
allows one to see the apt-get or aptitude commands without running
them. Passing --sudo= or --sudo="" (i.e., giving an empty value)
causes the package manager to be called directly, without any
intermediate sudo-like program.
- The PKG variable is now a Bash array, which is a bit cleaner and
blends better with the new, array-based implementations of
_aptUpdate() and _aptInstall() (whose purpose is to allow the
newly-added flexibility without multiplying the code paths).
This class isn't needed anymore now that
$FG_ROOT/Translations/default/sys.xml has a flat structure, like the
other FG XML i18n files that define the default translation. This is
related to
6d6e1809f0/
and more specifically to
587c601345/
qtbase5-dev-tools contains the 'rcc' tool, and qttools5-dev-tools
contains 'lrelease'. Unless I'm mistaken, both are needed to compile the
Qt resources containing translations in the QM format for FlightGear's
built-in launcher.
Translation.__setitem__() from flightgear/meta/i18n.py isn't used
anywhere here (it is not very useful), so no harm done, but that could
have confused potential readers.
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.