2011-02-07 03:44:11 +08:00
|
|
|
#!/bin/bash
|
|
|
|
#* Written by Francesco Angelo Brisa, started January 2008.
|
|
|
|
#
|
2013-06-06 08:41:01 +08:00
|
|
|
# Copyright (C) 2013 Francesco Angelo Brisa
|
2011-05-20 02:20:53 +08:00
|
|
|
# email: fbrisa@gmail.com - fbrisa@yahoo.it
|
2011-02-07 03:44:11 +08:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2020-11-15 02:08:15 +08:00
|
|
|
CURRENT_LTS_BRANCH="release/2020.3"
|
|
|
|
OLD_LTS_BRANCH="release/2018.3"
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
|
2017-05-18 16:27:17 +08:00
|
|
|
script_blob_id='$Id$'
|
|
|
|
# Slightly tricky substitution to avoid our regexp being wildly replaced with
|
|
|
|
# the blob name (id) when the script is checked out:
|
|
|
|
#
|
|
|
|
# First extract the hexadecimal blob object name followed by a '$'
|
|
|
|
VERSION="$(echo "$script_blob_id" | sed 's@\$Id: *\([0-9a-f]\+\) *@\1@')"
|
|
|
|
# Then remove the trailing '$'
|
|
|
|
VERSION="${VERSION%\$}"
|
|
|
|
|
2017-10-03 13:58:31 +08:00
|
|
|
PROGNAME=$(basename "$0")
|
2011-02-07 03:44:11 +08:00
|
|
|
|
|
|
|
#######################################################
|
|
|
|
# THANKS TO
|
|
|
|
#######################################################
|
2018-09-26 16:02:09 +08:00
|
|
|
# Special thanks to Alessandro Garosi for FGComGui and
|
2011-02-07 03:44:11 +08:00
|
|
|
# other patches
|
2012-11-01 20:28:51 +08:00
|
|
|
# Thanks to "Pat Callahan" for patches for fgrun compilation
|
2012-04-21 01:28:06 +08:00
|
|
|
# Thanks to "F-JJTH" for bug fixes and suggestions
|
2018-09-26 16:02:09 +08:00
|
|
|
# Thanks again to "F-JJTH" for OpenRTI and FGX
|
2015-03-07 02:28:55 +08:00
|
|
|
# Thanks to André, (taureau89_9) for debian stable packages fixes
|
2011-02-07 03:44:11 +08:00
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
#############################################################"
|
2018-09-25 23:10:01 +08:00
|
|
|
# Some helper functions for redundant tasks
|
2013-11-25 05:57:21 +08:00
|
|
|
|
2018-09-25 23:29:58 +08:00
|
|
|
# Return 0 if $1 is identical to one of $2, $3, etc., else return 1.
|
|
|
|
_elementIn(){
|
|
|
|
local valueToCheck="$1"
|
|
|
|
local e
|
|
|
|
|
|
|
|
shift
|
|
|
|
for e; do
|
2019-04-26 16:44:03 +08:00
|
|
|
if [ "$e" = "$valueToCheck" ]; then
|
2018-09-25 23:29:58 +08:00
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
# Print $2, $3, ... using $1 as separator.
|
|
|
|
# From <https://stackoverflow.com/questions/1527049/how-can-i-join-elements-of-an-array-in-bash>
|
|
|
|
function _joinBy(){
|
|
|
|
local d="$1"; shift
|
|
|
|
echo -n "$1"; shift
|
|
|
|
printf "%s" "${@/#/$d}"
|
|
|
|
}
|
|
|
|
|
2018-10-11 18:34:25 +08:00
|
|
|
function _log(){
|
|
|
|
echo "$@" >> "$LOGFILE"
|
|
|
|
}
|
|
|
|
|
2018-10-11 18:45:01 +08:00
|
|
|
function _logSep(){
|
2020-06-30 17:44:01 +08:00
|
|
|
_log \
|
|
|
|
"******************************************************************************"
|
2018-10-11 18:45:01 +08:00
|
|
|
}
|
|
|
|
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
function _printLog(){
|
2018-10-11 18:45:01 +08:00
|
|
|
# Possible special case for the terminal: echo "${PROGNAME}: $@"
|
|
|
|
# That would be more precise but rather verbose, and not all output uses
|
|
|
|
# _printLog() for now, so it would look too inconsistent.
|
|
|
|
echo "$@" | tee -a "$LOGFILE"
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
}
|
|
|
|
|
2018-10-11 18:12:36 +08:00
|
|
|
# Echo the contents of stdin to the terminal and/or to $LOGFILE.
|
|
|
|
function _logOutput(){
|
|
|
|
case "$1" in
|
|
|
|
term)
|
|
|
|
cat ;;
|
|
|
|
file)
|
|
|
|
cat >> "$LOGFILE" ;;
|
|
|
|
""|term+file)
|
|
|
|
tee -a "$LOGFILE" ;;
|
|
|
|
*)
|
|
|
|
_printLog "Bug in ${PROGNAME}: unexpected value for the first parameter" \
|
|
|
|
"of _logOutput(): '$1'"
|
|
|
|
exit 1 ;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2020-06-23 17:10:25 +08:00
|
|
|
# Return code is 0 for 'yes' and 1 for 'no'.
|
|
|
|
function _yes_no_prompt(){
|
|
|
|
local prompt="$1"
|
|
|
|
local default="$2"
|
|
|
|
local choices res answer
|
|
|
|
|
|
|
|
case "$default" in
|
|
|
|
[yY]) choices='Y/n' ;;
|
|
|
|
[nN]) choices='y/N' ;;
|
|
|
|
"")
|
|
|
|
if [[ "$INTERACTIVE_MODE" -eq 0 ]]; then
|
|
|
|
_printLog "Non-interactive mode requested, but found a question with" \
|
|
|
|
"no default answer;"
|
|
|
|
_printLog "this can't work, aborting."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
choices='y/n'
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
_printLog \
|
|
|
|
"Invalid default choice for _yes_no_prompt(): this is a bug in the"
|
|
|
|
"script, aborting."
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
if [[ "$INTERACTIVE_MODE" -eq 0 ]]; then
|
|
|
|
answer="$default"
|
|
|
|
else
|
|
|
|
read -r -p "$prompt [$choices] " answer
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "$answer" ]]; then
|
|
|
|
answer="$default"
|
|
|
|
fi
|
|
|
|
|
|
|
|
case "$answer" in
|
|
|
|
[yY]) res=0; break ;;
|
|
|
|
[nN]) res=1; break ;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
return $res
|
|
|
|
}
|
|
|
|
|
|
|
|
# Return code is 0 for 'yes', 1 for 'no' and 2 for 'quit'.
|
2020-05-24 16:23:50 +08:00
|
|
|
function _yes_no_quit_prompt(){
|
|
|
|
local prompt="$1"
|
|
|
|
local default="$2"
|
|
|
|
local choices res answer
|
|
|
|
|
|
|
|
case "$default" in
|
|
|
|
[yY]) choices='Y/n/q' ;;
|
|
|
|
[nN]) choices='y/N/q' ;;
|
|
|
|
[qQ]) choices='y/n/Q' ;;
|
|
|
|
"")
|
|
|
|
if [[ "$INTERACTIVE_MODE" -eq 0 ]]; then
|
|
|
|
_printLog "Non-interactive mode requested, but found a question with" \
|
|
|
|
"no default answer;"
|
|
|
|
_printLog "this can't work, aborting."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
choices='y/n/q'
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
_printLog \
|
|
|
|
"Invalid default choice for _yes_no_quit_prompt(): this is a bug in the"
|
|
|
|
"script, aborting."
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
if [[ "$INTERACTIVE_MODE" -eq 0 ]]; then
|
|
|
|
answer="$default"
|
|
|
|
else
|
|
|
|
read -r -p "$prompt [$choices] " answer
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -z "$answer" ]]; then
|
|
|
|
answer="$default"
|
|
|
|
fi
|
|
|
|
|
2020-05-24 17:39:27 +08:00
|
|
|
case "$answer" in
|
2020-05-24 16:23:50 +08:00
|
|
|
[yY]) res=0; break ;;
|
|
|
|
[nN]) res=1; break ;;
|
|
|
|
[qQ]) res=2; break ;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
return $res
|
|
|
|
}
|
|
|
|
|
2020-06-29 20:23:18 +08:00
|
|
|
# Recursively delete build and install directories, but preserve FGData if
|
|
|
|
# present.
|
|
|
|
function _cleanup(){
|
|
|
|
if [[ -z "$CBD" || -z "$INSTALL_DIR" || -z "$INSTALL_DIR_FGFS" ]]; then
|
|
|
|
_printLog "${PROGNAME}:" '_cleanup() called while $CBD or $INSTALL_DIR or'
|
|
|
|
_printLog '$INSTALL_DIR_FGFS is empty.'
|
|
|
|
_printLog "\$CBD='$CBD'"
|
|
|
|
_printLog "\$INSTALL_DIR='$INSTALL_DIR'"
|
|
|
|
_printLog "\$INSTALL_DIR_FGFS='$INSTALL_DIR_FGFS'"
|
|
|
|
_printLog 'This is unexpected; please report.'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
local fgdata_backup="$CBD/fgdata.tmp.download_and_compile-cleanup"
|
|
|
|
local -i fgdata_moved=0
|
|
|
|
|
|
|
|
_printLog "Deleting build directories ($CBD/build)..."
|
|
|
|
rm -rf "$CBD/build"
|
|
|
|
|
|
|
|
if [[ -d "$INSTALL_DIR_FGFS/fgdata" ]]; then
|
|
|
|
_printLog "Moving FGData to $fgdata_backup..."
|
|
|
|
mv "$INSTALL_DIR_FGFS/fgdata" "$fgdata_backup"
|
|
|
|
fgdata_moved=1
|
|
|
|
fi
|
|
|
|
|
2020-06-29 22:04:23 +08:00
|
|
|
if [[ "$(basename "$INSTALL_DIR")" -eq "install" ]]; then
|
|
|
|
_printLog "Deleting install directories ($INSTALL_DIR)..."
|
|
|
|
rm -rf "$INSTALL_DIR"
|
|
|
|
else
|
|
|
|
_printLog "${PROGNAME}: unexpected value for \$INSTALL_DIR: '$INSTALL_DIR'."
|
|
|
|
_printLog "Refusing to recursively delete it. Aborting; please report."
|
|
|
|
exit 1
|
|
|
|
fi
|
2020-06-29 20:23:18 +08:00
|
|
|
|
|
|
|
if [[ $fgdata_moved -eq 1 ]]; then
|
|
|
|
mkdir -p "$INSTALL_DIR_FGFS"
|
|
|
|
_printLog "Moving FGData back to $INSTALL_DIR_FGFS/fgdata..."
|
|
|
|
mv "$fgdata_backup" "$INSTALL_DIR_FGFS/fgdata"
|
|
|
|
fi
|
|
|
|
|
|
|
|
_printLog
|
|
|
|
}
|
|
|
|
|
2017-05-02 17:22:39 +08:00
|
|
|
function _aptUpdate(){
|
download_and_compile.sh: improvements related to package installation
- 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).
2019-02-12 06:39:29 +08:00
|
|
|
local cmd=()
|
|
|
|
|
|
|
|
if [[ -n "$SUDO" ]]; then
|
|
|
|
cmd+=("$SUDO")
|
|
|
|
fi
|
|
|
|
|
|
|
|
cmd+=("$PKG_MGR" "update")
|
|
|
|
|
|
|
|
_printLog "Running '${cmd[*]}'..."
|
|
|
|
"${cmd[@]}"
|
2017-05-02 17:22:39 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function _aptInstall(){
|
download_and_compile.sh: improvements related to package installation
- 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).
2019-02-12 06:39:29 +08:00
|
|
|
local cmd=()
|
|
|
|
|
|
|
|
if [[ -n "$SUDO" ]]; then
|
|
|
|
cmd+=("$SUDO")
|
|
|
|
fi
|
|
|
|
|
|
|
|
cmd+=("$PKG_MGR" "install" "$@")
|
|
|
|
|
|
|
|
_printLog "Running '${cmd[*]}'..."
|
|
|
|
"${cmd[@]}"
|
2017-05-02 17:22:39 +08:00
|
|
|
}
|
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
function _gitUpdate(){
|
2015-03-07 02:28:55 +08:00
|
|
|
if [ "$DOWNLOAD" != "y" ]; then
|
|
|
|
return
|
|
|
|
fi
|
2020-06-29 20:59:11 +08:00
|
|
|
|
|
|
|
local branch="$1"
|
2015-03-07 02:28:55 +08:00
|
|
|
set +e
|
|
|
|
git diff --exit-code 2>&1 > /dev/null
|
2020-06-29 20:59:11 +08:00
|
|
|
if [[ $? != 1 ]]; then
|
2015-03-07 02:28:55 +08:00
|
|
|
set -e
|
2020-06-29 20:59:11 +08:00
|
|
|
git fetch origin
|
|
|
|
git checkout --force "$branch"
|
|
|
|
git pull --rebase
|
2015-03-07 02:28:55 +08:00
|
|
|
else
|
|
|
|
set -e
|
2020-06-29 20:59:11 +08:00
|
|
|
git fetch origin
|
|
|
|
git stash save --include-untracked --quiet
|
|
|
|
git checkout --force "$branch"
|
|
|
|
git pull --rebase
|
|
|
|
git stash pop --quiet
|
2015-03-07 02:28:55 +08:00
|
|
|
fi
|
2014-05-20 19:06:19 +08:00
|
|
|
}
|
2013-11-25 05:57:21 +08:00
|
|
|
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
function _gitProtoSpec(){
|
|
|
|
local proto="$1"
|
|
|
|
local username="$2"
|
|
|
|
local component="$3"
|
|
|
|
local complement
|
|
|
|
|
|
|
|
case "$proto" in
|
|
|
|
ssh)
|
|
|
|
if [[ -z "$username" ]]; then
|
|
|
|
if [[ -n "$component" ]]; then
|
|
|
|
complement=" (used to retrieve component $component)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
_printLog "Protocol ssh$complement requires a username,"
|
|
|
|
_printLog "but none was specified! Aborting."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
echo "${proto}://${username}@"
|
|
|
|
;;
|
|
|
|
https|git)
|
|
|
|
echo "${proto}://"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
_printLog "Unknown protocol in _gitProtoSpec(): '$proto'. Aborting."
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
function _gitDownload(){
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
local component="$1"
|
|
|
|
local clone_arg
|
|
|
|
|
2020-07-03 20:21:05 +08:00
|
|
|
if [[ "$DOWNLOAD" != "y" ]]; then
|
2015-03-07 02:28:55 +08:00
|
|
|
return
|
|
|
|
fi
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
|
2020-07-03 20:21:05 +08:00
|
|
|
if [[ -d ".git" ]]; then
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
_printLog "$component: the repository already exists"
|
2015-03-07 02:28:55 +08:00
|
|
|
else
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
proto_spec=$(_gitProtoSpec "${REPO_PROTO[$component]}" \
|
|
|
|
"${REPO_USERNAME[$component]}" \
|
|
|
|
"$component")
|
|
|
|
clone_arg="${proto_spec}${REPO_ADDRESS[$component]}"
|
2020-05-24 16:23:50 +08:00
|
|
|
|
|
|
|
# Test whether $clone_arg is 'https://git.code.sf.net/p/flightgear/fgdata'
|
|
|
|
if _check_clone_url_and_maybe_ask "$clone_arg"; then
|
|
|
|
_clone_fgdata # Work around a problem at SourceForge
|
|
|
|
else
|
|
|
|
_printLog "Fetching $component with 'git clone $clone_arg'"
|
|
|
|
git clone "$clone_arg" .
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
# Return 0 if _clone_fgdata() should be used, otherwise 1.
|
|
|
|
function _check_clone_url_and_maybe_ask(){
|
|
|
|
local -i retcode=1
|
|
|
|
|
|
|
|
if [[ "$1" = "https://git.code.sf.net/p/flightgear/fgdata" ]]; then
|
|
|
|
local prompt_res=-1
|
|
|
|
set +e
|
|
|
|
if [[ "$INTERACTIVE_MODE" -eq 1 ]]; then
|
|
|
|
printf "From experience, cloning FGData from SourceForge using https does \
|
|
|
|
not work\n(probably a problem at SourceForge), but updates do work. Thus, we \
|
|
|
|
propose to\nclone FGData from GitLab and change the repository setup so that \
|
|
|
|
subsequent\nupdates are fetched from SourceForge. This should be quite safe, \
|
|
|
|
because\n<https://gitlab.com/flightgear/fgdata> is an official mirror of \
|
|
|
|
FGData (it is\nmaintained by FlightGear developers). Answer 'y' to proceed \
|
|
|
|
this way. If you\nanswer 'n', we'll *try* to clone FGData from SourceForge \
|
2020-05-24 22:31:26 +08:00
|
|
|
using https. Answer 'q'\nif you want to quit. "
|
2020-05-24 16:23:50 +08:00
|
|
|
fi
|
2020-05-24 22:31:26 +08:00
|
|
|
_yes_no_quit_prompt "What is your choice?" y; prompt_res=$?
|
2020-05-24 16:23:50 +08:00
|
|
|
set -e
|
|
|
|
case $prompt_res in
|
|
|
|
0) retcode=0 ;;
|
|
|
|
1) retcode=1 ;;
|
|
|
|
2) exit 0 ;;
|
|
|
|
*) _printLog "Unexpected return code from _yes_no_quit_prompt() in" \
|
|
|
|
"_check_clone_url_and_maybe_ask(); aborting."
|
|
|
|
exit 1 ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [[ $retcode -eq 1 ]]; then
|
|
|
|
_printLog "Okay, will try to clone FGData from SourceForge using" \
|
|
|
|
"https, but be aware that"
|
|
|
|
_printLog "this is likely to fail."
|
|
|
|
fi
|
2015-03-07 02:28:55 +08:00
|
|
|
fi
|
2020-05-24 16:23:50 +08:00
|
|
|
|
|
|
|
return $retcode
|
|
|
|
}
|
|
|
|
|
|
|
|
# Special function for cloning FGData with https. This is needed because there
|
|
|
|
# seems to be a problem at SourceForge that doesn't allow the clone operation
|
|
|
|
# to succeed for FGData using https---presumably because of its large size.
|
|
|
|
function _clone_fgdata(){
|
|
|
|
local url="https://${REPO_ADDRESS[DATA_ALT]}"
|
|
|
|
_printLog "Starting special initialization routine for the DATA component..."
|
|
|
|
_printLog "Fetching FGData with 'git clone $url'"
|
|
|
|
git clone "$url" .
|
|
|
|
_printLog "Creating the 'next' local branch"
|
|
|
|
git checkout -b next origin/next
|
|
|
|
url="https://${REPO_ADDRESS[DATA]}"
|
|
|
|
_printLog "Setting FGData's 'origin' remote to $url"
|
|
|
|
git remote set-url origin "$url"
|
|
|
|
_printLog "Updating FGData from $url"
|
|
|
|
git pull --ff-only
|
|
|
|
_printLog "Special initialization routine for the DATA component: done."
|
2013-11-25 05:57:21 +08:00
|
|
|
}
|
2014-03-04 17:10:52 +08:00
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
function _make(){
|
2015-03-07 02:28:55 +08:00
|
|
|
if [ "$COMPILE" = "y" ]; then
|
2019-04-21 14:39:34 +08:00
|
|
|
pkg="$1"
|
|
|
|
cd "$CBD/build/$pkg"
|
2018-10-11 18:34:25 +08:00
|
|
|
_printLog "MAKE $pkg"
|
2018-10-11 18:12:36 +08:00
|
|
|
make $JOPTION $OOPTION 2>&1 | _logOutput
|
2018-10-11 18:34:25 +08:00
|
|
|
_printLog "INSTALL $pkg"
|
2018-10-11 18:12:36 +08:00
|
|
|
make install 2>&1 | _logOutput
|
2015-03-07 02:28:55 +08:00
|
|
|
fi
|
2014-05-20 19:06:19 +08:00
|
|
|
}
|
2011-08-17 03:42:51 +08:00
|
|
|
|
2017-10-02 15:27:56 +08:00
|
|
|
# Add an available, non-virtual package matching one of the given regexps.
|
2017-05-02 17:22:39 +08:00
|
|
|
#
|
|
|
|
# Each positional parameter is interpreted as a POSIX extended regular
|
|
|
|
# expression. These parameters are examined from left to right, and the first
|
|
|
|
# available matching package is added to the global PKG variable. If no match
|
|
|
|
# is found, the script aborts.
|
2017-10-02 15:27:56 +08:00
|
|
|
function _mandatory_pkg_alternative(){
|
|
|
|
local pkg
|
|
|
|
|
2017-05-02 17:22:39 +08:00
|
|
|
if [[ $# -lt 1 ]]; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog \
|
|
|
|
"Empty package alternative: this is a bug in the script, aborting."
|
2017-05-02 17:22:39 +08:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "Considering a package alternative: $*"
|
2017-10-02 15:27:56 +08:00
|
|
|
pkg=$(_find_package_alternative "$@")
|
|
|
|
|
|
|
|
if [[ -n "$pkg" ]]; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "Package alternative matched for $pkg"
|
download_and_compile.sh: improvements related to package installation
- 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).
2019-02-12 06:39:29 +08:00
|
|
|
PKG+=("$pkg")
|
2017-10-02 15:27:56 +08:00
|
|
|
else
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "No match found for the package alternative, aborting."
|
2017-10-02 15:27:56 +08:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
2017-05-02 17:22:39 +08:00
|
|
|
}
|
|
|
|
|
2017-10-02 15:27:56 +08:00
|
|
|
# If available, add a non-virtual package matching one of the given regexps.
|
|
|
|
#
|
|
|
|
# Returning 0 or 1 on success to indicate whether a match was found could be
|
2017-10-03 13:58:31 +08:00
|
|
|
# done, but would need to be specifically handled at the calling site,
|
2017-10-02 15:27:56 +08:00
|
|
|
# since the script is run under 'set -e' regime.
|
|
|
|
function _optional_pkg_alternative(){
|
2017-05-02 17:22:39 +08:00
|
|
|
local pkg
|
|
|
|
|
|
|
|
if [[ $# -lt 1 ]]; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "Empty optional package alternative: this is a bug in the" \
|
|
|
|
"script, aborting."
|
2017-05-02 17:22:39 +08:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "Considering an optional package alternative: $*"
|
2017-10-02 15:27:56 +08:00
|
|
|
pkg=$(_find_package_alternative "$@")
|
|
|
|
|
|
|
|
if [[ -n "$pkg" ]]; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "Optional package alternative matched for $pkg"
|
download_and_compile.sh: improvements related to package installation
- 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).
2019-02-12 06:39:29 +08:00
|
|
|
PKG+=("$pkg")
|
2017-10-02 15:27:56 +08:00
|
|
|
else
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "No match found for the optional package alternative," \
|
|
|
|
"continuing anyway."
|
2017-10-03 13:58:31 +08:00
|
|
|
# "$*" so that we only add one element to the array in this line
|
|
|
|
UNMATCHED_OPTIONAL_PKG_ALTERNATIVES+=("$*")
|
2017-10-02 15:27:56 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
# This function requires the 'dctrl-tools' package
|
|
|
|
function _find_package_alternative(){
|
|
|
|
local pkg
|
|
|
|
|
|
|
|
if [[ $# -lt 1 ]]; then
|
|
|
|
return 0 # Nothing could be found
|
|
|
|
fi
|
|
|
|
|
2017-05-02 17:22:39 +08:00
|
|
|
# This finds non-virtual packages only (on purpose)
|
|
|
|
pkg="$(apt-cache dumpavail | \
|
|
|
|
grep-dctrl -e -sPackage -FPackage \
|
|
|
|
"^[[:space:]]*($1)[[:space:]]*\$" - | \
|
|
|
|
sed -ne '1s/^Package:[[:space:]]*//gp')"
|
|
|
|
|
|
|
|
if [[ -n "$pkg" ]]; then
|
2017-10-02 15:27:56 +08:00
|
|
|
echo "$pkg"
|
2017-05-02 17:22:39 +08:00
|
|
|
return 0
|
|
|
|
else
|
|
|
|
# Try with the next regexp
|
|
|
|
shift
|
2017-10-02 15:27:56 +08:00
|
|
|
_find_package_alternative "$@"
|
2017-05-02 17:22:39 +08:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-04-26 19:14:38 +08:00
|
|
|
# If component $1 is in WHATTOBUILD, add components $2, $3, etc., to
|
|
|
|
# WHATTOBUILD unless they are already there.
|
|
|
|
function _depends(){
|
|
|
|
local component="$1"
|
|
|
|
shift
|
|
|
|
|
|
|
|
if _elementIn "$component" "${WHATTOBUILD[@]}"; then
|
|
|
|
for dependency in "$@"; do
|
|
|
|
if ! _elementIn "$dependency" "${WHATTOBUILD[@]}"; then
|
|
|
|
_printLog "$component: adding depended-on component $dependency"
|
|
|
|
WHATTOBUILD+=("$dependency")
|
|
|
|
nb_added_intercomponent_deps=$((nb_added_intercomponent_deps + 1))
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-06-23 01:13:58 +08:00
|
|
|
function _maybe_add_intercomponent_deps(){
|
|
|
|
local comp_word
|
|
|
|
|
|
|
|
if [[ "$IGNORE_INTERCOMPONENT_DEPS" = "y" ]]; then
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# FlightGear requires SimGear
|
|
|
|
_depends FGFS SIMGEAR
|
|
|
|
# TerraGear requires SimGear
|
|
|
|
_depends TERRAGEAR SIMGEAR
|
|
|
|
|
|
|
|
# Print a helpful message if some components were automatically added
|
|
|
|
if (( nb_added_intercomponent_deps > 0 )); then
|
|
|
|
if (( nb_added_intercomponent_deps > 1 )); then
|
|
|
|
comp_word='components'
|
|
|
|
else
|
|
|
|
comp_word='component'
|
|
|
|
fi
|
|
|
|
_printLog "$PROGNAME: automatically added $nb_added_intercomponent_deps" \
|
|
|
|
"$comp_word based on"
|
|
|
|
_printLog "intercomponent dependencies. Use option" \
|
|
|
|
"--ignore-intercomponent-deps if you"
|
|
|
|
_printLog "want to disable this behavior."
|
|
|
|
_printLog
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-06-30 17:44:01 +08:00
|
|
|
# Component dependencies on distribution packages
|
|
|
|
function _installOrUpdateDistroPackages(){
|
|
|
|
if [[ "$DOWNLOAD_PACKAGES" = "n" ]]; then
|
|
|
|
_printLog
|
|
|
|
_printLog "Note: option -p of $PROGNAME set to 'n' (no), therefore no"
|
|
|
|
_printLog " package will be installed via ${PKG_MGR}. Compilation of" \
|
|
|
|
"some components"
|
|
|
|
_printLog " may fail if mandatory dependencies are missing."
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$APT_GET_UPDATE" = "y" ]]; then
|
|
|
|
_aptUpdate
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Ensure 'dctrl-tools' is installed
|
|
|
|
if [[ "$(dpkg-query --showformat='${Status}\n' --show dctrl-tools \
|
|
|
|
2>/dev/null | awk '{print $3}')" != "installed" ]]; then
|
|
|
|
_aptInstall dctrl-tools
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Minimum
|
|
|
|
PKG=(build-essential git)
|
|
|
|
_mandatory_pkg_alternative libcurl4-openssl-dev libcurl4-gnutls-dev
|
|
|
|
|
|
|
|
# CMake
|
|
|
|
if _elementIn "CMAKE" "${WHATTOBUILD[@]}"; then
|
|
|
|
PKG+=(libarchive-dev libbz2-dev libexpat1-dev libjsoncpp-dev liblzma-dev
|
|
|
|
libncurses5-dev libssl-dev procps zlib1g-dev)
|
|
|
|
else
|
|
|
|
PKG+=(cmake)
|
|
|
|
fi
|
|
|
|
|
|
|
|
# TerraGear
|
|
|
|
if _elementIn "TERRAGEAR" "${WHATTOBUILD[@]}"; then
|
|
|
|
PKG+=(libboost-dev libcgal-dev libgdal-dev libtiff5-dev zlib1g-dev)
|
|
|
|
fi
|
|
|
|
|
|
|
|
# TerraGear GUI and OpenRTI
|
|
|
|
if _elementIn "TERRAGEARGUI" "${WHATTOBUILD[@]}" || \
|
|
|
|
_elementIn "OPENRTI" "${WHATTOBUILD[@]}"; then
|
|
|
|
PKG+=(libqt4-dev)
|
|
|
|
fi
|
|
|
|
|
|
|
|
# SimGear and FlightGear
|
|
|
|
if _elementIn "SIMGEAR" "${WHATTOBUILD[@]}" || \
|
|
|
|
_elementIn "FGFS" "${WHATTOBUILD[@]}"; then
|
2021-01-10 01:53:58 +08:00
|
|
|
PKG+=(zlib1g-dev freeglut3-dev libglew-dev libopenal-dev libboost-dev \
|
|
|
|
liblzma-dev)
|
2020-11-17 04:24:07 +08:00
|
|
|
|
|
|
|
if ! _elementIn "OSG" "${WHATTOBUILD[@]}"; then
|
|
|
|
_mandatory_pkg_alternative libopenscenegraph-3.4-dev \
|
|
|
|
libopenscenegraph-dev 'libopenscenegraph-[0-9]+\.[0-9]+-dev'
|
|
|
|
fi
|
2020-06-30 17:44:01 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
# FlightGear
|
|
|
|
if _elementIn "FGFS" "${WHATTOBUILD[@]}"; then
|
2020-11-17 04:24:07 +08:00
|
|
|
PKG+=(libudev-dev libdbus-1-dev)
|
|
|
|
if ! _elementIn "PLIB" "${WHATTOBUILD[@]}"; then
|
|
|
|
PKG+=(libplib-dev)
|
|
|
|
fi
|
2020-06-30 17:44:01 +08:00
|
|
|
_mandatory_pkg_alternative libpng-dev libpng12-dev libpng16-dev
|
|
|
|
# The following packages are needed for the built-in launcher
|
2021-05-13 20:29:49 +08:00
|
|
|
_optional_pkg_alternative qt5-default qtchooser
|
2020-06-30 17:44:01 +08:00
|
|
|
_optional_pkg_alternative qtdeclarative5-dev
|
|
|
|
_optional_pkg_alternative qttools5-dev
|
|
|
|
_optional_pkg_alternative qtbase5-dev-tools # for rcc
|
|
|
|
_optional_pkg_alternative qttools5-dev-tools # for lrelease
|
|
|
|
_optional_pkg_alternative qml-module-qtquick2
|
|
|
|
_optional_pkg_alternative qml-module-qtquick-window2
|
|
|
|
_optional_pkg_alternative qml-module-qtquick-dialogs
|
2020-07-14 18:31:56 +08:00
|
|
|
|
2020-11-16 22:04:22 +08:00
|
|
|
if [[ "$SELECTED_SUITE" != "old-lts" ]]; then
|
2020-07-14 18:31:56 +08:00
|
|
|
_optional_pkg_alternative qml-module-qtquick-controls2
|
|
|
|
fi
|
|
|
|
|
2020-06-30 17:44:01 +08:00
|
|
|
_optional_pkg_alternative libqt5opengl5-dev
|
|
|
|
_optional_pkg_alternative libqt5svg5-dev
|
|
|
|
_optional_pkg_alternative libqt5websockets5-dev
|
|
|
|
# The following packages are only needed for the Qt-based remote Canvas
|
|
|
|
# (comment written at the time of FG 2018.2).
|
|
|
|
_optional_pkg_alternative qtbase5-private-dev
|
|
|
|
_optional_pkg_alternative qtdeclarative5-private-dev
|
|
|
|
# FGPanel
|
|
|
|
PKG+=(fluid libbz2-dev libfltk1.3-dev libxi-dev libxmu-dev)
|
|
|
|
# FGAdmin
|
|
|
|
PKG+=(libxinerama-dev libjpeg-dev libxft-dev)
|
|
|
|
# swift
|
|
|
|
_optional_pkg_alternative libevent-dev
|
|
|
|
fi
|
|
|
|
|
|
|
|
# ATC-pie
|
|
|
|
if _elementIn "ATCPIE" "${WHATTOBUILD[@]}"; then
|
|
|
|
PKG+=(python3-pyqt5 python3-pyqt5.qtmultimedia libqt5multimedia5-plugins)
|
|
|
|
fi
|
|
|
|
|
|
|
|
# FGo!
|
|
|
|
if _elementIn "FGO" "${WHATTOBUILD[@]}"; then
|
|
|
|
PKG+=(python-tk)
|
|
|
|
fi
|
|
|
|
|
|
|
|
# if _elementIn "FGX" "${WHATTOBUILD[@]}"; then
|
|
|
|
# FGx (FGx is not compatible with Qt5, however we have installed Qt5 by
|
|
|
|
# default)
|
|
|
|
# PKG+=(libqt5xmlpatterns5-dev libqt5webkit5-dev)
|
|
|
|
# fi
|
|
|
|
|
|
|
|
_aptInstall "${PKG[@]}"
|
|
|
|
}
|
|
|
|
|
|
|
|
function _describeSelectedSuite(){
|
|
|
|
local prompt_res
|
|
|
|
|
|
|
|
_printLog "$SUITE_DESCRIPTION"
|
|
|
|
_printLog
|
|
|
|
_printLog "\
|
2020-11-15 02:08:15 +08:00
|
|
|
Note that options '-s', '--lts' and '--old-lts' apply in particular to the
|
|
|
|
SIMGEAR, FGFS and DATA components, but other components may be affected as
|
|
|
|
well. Use '--component-branch COMPONENT=BRANCH' (without the quotes) if you
|
|
|
|
want to override the defaults (i.e., manually choose the branches for
|
|
|
|
particular components)."
|
2020-06-30 17:44:01 +08:00
|
|
|
|
|
|
|
# Make sure users building 'next' are aware of the possible consequences. :-)
|
|
|
|
if [[ "$SELECTED_SUITE" = "next" && \
|
|
|
|
$logfile_was_already_present_when_starting -eq 0 ]]; then
|
|
|
|
set +e
|
|
|
|
_printLog
|
|
|
|
_yes_no_prompt "Are you sure you want to continue?" y; prompt_res=$?
|
|
|
|
set -e
|
|
|
|
if [[ $prompt_res -eq 1 ]]; then
|
|
|
|
_printLog "Aborting as requested."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
function _determineSuiteDescriptionAndBranchForEachComponent(){
|
|
|
|
local FG_BRANCH
|
|
|
|
|
|
|
|
case "$SELECTED_SUITE" in
|
|
|
|
next)
|
|
|
|
FG_BRANCH=next
|
|
|
|
COMPONENT_BRANCH[OPENRTI]=master
|
|
|
|
COMPONENT_BRANCH[OSG]=OpenSceneGraph-3.6
|
|
|
|
COMPONENT_BRANCH[TERRAGEAR]=next
|
|
|
|
SUITE_DESCRIPTION="\
|
|
|
|
!! You have selected the 'next' suite, which contains the development version
|
2020-11-15 02:08:15 +08:00
|
|
|
of FlightGear. The corresponding FlightGear code is very recent but may
|
|
|
|
well be unstable. Other possibilities are '--lts' for the 'LTS' suite (Long
|
|
|
|
Term Stable), '--old-lts' for the previous LTS suite and '-s' for the
|
|
|
|
latest release. '--lts' should provide the most stable setup. !!"
|
2020-06-30 17:44:01 +08:00
|
|
|
;;
|
|
|
|
latest-release)
|
|
|
|
FG_BRANCH="release/$(git ls-remote --heads "https://${REPO_ADDRESS[FGFS]}" | grep '\/release\/' | cut -f4 -d'/' | sort -t . -k 1,1n -k2,2n -k3,3n | tail -1)"
|
|
|
|
COMPONENT_BRANCH[OPENRTI]=release-0.7
|
|
|
|
COMPONENT_BRANCH[OSG]=OpenSceneGraph-3.4
|
|
|
|
COMPONENT_BRANCH[TERRAGEAR]=scenery/ws2.0
|
|
|
|
SUITE_DESCRIPTION="\
|
|
|
|
You have selected the latest release of FlightGear. This is supposedly less
|
2020-11-15 02:08:15 +08:00
|
|
|
stable than '--lts' (Long Term Stable) but more stable than the development
|
|
|
|
version (which would be obtained with none of '-s', '--lts' and '--old-lts')."
|
2020-06-30 17:44:01 +08:00
|
|
|
;;
|
|
|
|
latest-lts)
|
|
|
|
FG_BRANCH="$CURRENT_LTS_BRANCH"
|
|
|
|
COMPONENT_BRANCH[OPENRTI]=release-0.7
|
|
|
|
COMPONENT_BRANCH[OSG]=OpenSceneGraph-3.4
|
|
|
|
COMPONENT_BRANCH[TERRAGEAR]=scenery/ws2.0
|
|
|
|
SUITE_DESCRIPTION="\
|
2020-11-15 02:08:15 +08:00
|
|
|
You have selected the LTS suite (Long Term Stable). This is in principle the
|
|
|
|
most stable setup. Other possibilities are '--old-lts' for the previous LTS
|
|
|
|
suite, '-s' for the latest release and nothing (none of '-s', '--lts' and
|
|
|
|
'--old-lts' passed) for bleeding-edge development versions."
|
|
|
|
;;
|
|
|
|
old-lts)
|
|
|
|
FG_BRANCH="$OLD_LTS_BRANCH"
|
|
|
|
COMPONENT_BRANCH[OPENRTI]=release-0.7
|
|
|
|
COMPONENT_BRANCH[OSG]=OpenSceneGraph-3.4
|
|
|
|
COMPONENT_BRANCH[TERRAGEAR]=scenery/ws2.0
|
|
|
|
SUITE_DESCRIPTION="\
|
|
|
|
You have selected the old LTS suite (previous Long Term Stable). Other
|
|
|
|
possibilities are '--lts' for the current LTS suite, '-s' for the latest
|
|
|
|
release and nothing (none of '-s', '--lts' and '--old-lts' passed) for
|
|
|
|
bleeding-edge development versions. If you are in doubt and just want
|
|
|
|
something stable for flying or aircraft development, our suggestion is to use
|
|
|
|
'--lts'."
|
2020-06-30 17:44:01 +08:00
|
|
|
;;
|
|
|
|
*) _printLog "Unexpected value '$SELECTED_SUITE' for SELECTED_SUITE; " \
|
|
|
|
"please report a bug."
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
COMPONENT_BRANCH[PLIB]=master
|
|
|
|
COMPONENT_BRANCH[CMAKE]=release
|
|
|
|
COMPONENT_BRANCH[SIMGEAR]="$FG_BRANCH"
|
|
|
|
COMPONENT_BRANCH[FGFS]="$FG_BRANCH"
|
|
|
|
COMPONENT_BRANCH[DATA]="$FG_BRANCH"
|
|
|
|
COMPONENT_BRANCH[FGRUN]=next
|
|
|
|
COMPONENT_BRANCH[FGO]=1.5.5
|
|
|
|
COMPONENT_BRANCH[FGX]=master
|
|
|
|
COMPONENT_BRANCH[OPENRADAR]=OpenRadar.zip
|
|
|
|
COMPONENT_BRANCH[ATCPIE]=master
|
|
|
|
COMPONENT_BRANCH[TERRAGEARGUI]=master
|
|
|
|
COMPONENT_BRANCH[ZLIB]=master
|
|
|
|
|
|
|
|
for component in "${!COMPONENT_BRANCH_OVERRIDES[@]}"; do
|
|
|
|
COMPONENT_BRANCH[$component]="${COMPONENT_BRANCH_OVERRIDES[$component]}"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
function _determineProtocolAndUsernameForEachComponentRepository(){
|
|
|
|
local site
|
|
|
|
|
|
|
|
for component in "${WHATTOBUILD_AVAIL[@]}"; do
|
|
|
|
# First use the default download settings for each repository
|
|
|
|
REPO_PROTO[$component]="$REPO_DEFAULT_PROTO"
|
|
|
|
REPO_USERNAME[$component]="$REPO_DEFAULT_USERNAME"
|
|
|
|
|
|
|
|
site="${REPO_SITE[$component]}"
|
|
|
|
site="${site,,}" # convert to lowercase
|
|
|
|
|
|
|
|
# Is there a specific protocol for this repo's hosting site?
|
|
|
|
if [[ -n "$site" && -n "${PROTO_AT_SITE[$site]}" ]]; then
|
|
|
|
REPO_PROTO[$component]="${PROTO_AT_SITE[$site]}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Is there a specific username for this repo's hosting site?
|
|
|
|
if [[ -n "$site" && -n "${USERNAME_AT_SITE[$site]}" ]]; then
|
|
|
|
REPO_USERNAME[$component]="${USERNAME_AT_SITE[$site]}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
function _displayGeneralAdvice(){
|
|
|
|
echo '**********************************************************************'
|
|
|
|
echo '* *'
|
|
|
|
echo '* Warning: a typical SimGear + FlightGear + FGData build requires *'
|
|
|
|
echo '* about 12 GiB of disk space. The compilation part may last from a *'
|
|
|
|
echo '* few minutes to hours, depending on your computer. *'
|
|
|
|
echo '* *'
|
|
|
|
echo '* Hint: use the -j option if your CPU has several cores, as in: *'
|
|
|
|
echo '* *'
|
|
|
|
echo '* download_and_compile.sh -j$(nproc) *'
|
|
|
|
echo '* *'
|
|
|
|
echo '**********************************************************************'
|
|
|
|
echo
|
|
|
|
}
|
|
|
|
|
|
|
|
# $1: command line used to start the script
|
|
|
|
function _startLog(){
|
|
|
|
echo "$1" > "$LOGFILE"
|
|
|
|
_log "VERSION=$VERSION"
|
|
|
|
_log "SELECTED_SUITE=$SELECTED_SUITE"
|
|
|
|
_log "APT_GET_UPDATE=$APT_GET_UPDATE"
|
|
|
|
_log "DOWNLOAD_PACKAGES=$DOWNLOAD_PACKAGES"
|
|
|
|
_log "IGNORE_INTERCOMPONENT_DEPS=$IGNORE_INTERCOMPONENT_DEPS"
|
|
|
|
_log "COMPILE=$COMPILE"
|
|
|
|
_log "RECONFIGURE=$RECONFIGURE"
|
|
|
|
_log "DOWNLOAD=$DOWNLOAD"
|
|
|
|
_log "JOPTION=$JOPTION"
|
|
|
|
_log "OOPTION=$OOPTION"
|
|
|
|
_log "BUILD_TYPE=$BUILD_TYPE"
|
2020-10-20 07:39:27 +08:00
|
|
|
_log "SG_CMAKEARGS=${SG_CMAKE_ARGS[@]}"
|
|
|
|
_log "FG_CMAKEARGS=${FG_CMAKE_ARGS[@]}"
|
2020-06-30 17:44:01 +08:00
|
|
|
_log "COMPOSITOR=$COMPOSITOR"
|
|
|
|
_log "DIRECTORY=$CBD"
|
|
|
|
_log
|
|
|
|
}
|
|
|
|
|
|
|
|
function _showBranchForEachComponent(){
|
|
|
|
_printLog
|
|
|
|
_printLog "Branch used for each component:"
|
|
|
|
_printLog
|
|
|
|
# This method guarantees a stable order for the output
|
|
|
|
for component in "${WHATTOBUILD_AVAIL[@]}"; do
|
|
|
|
if _elementIn "$component" "${WHATTOBUILD[@]}"; then
|
|
|
|
_printLog " COMPONENT_BRANCH[$component]=${COMPONENT_BRANCH[$component]}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
_log
|
|
|
|
}
|
|
|
|
|
2018-09-26 06:10:24 +08:00
|
|
|
function _printVersion(){
|
|
|
|
echo "$PROGNAME version $VERSION"
|
|
|
|
echo
|
|
|
|
echo "This script is part of the FlightGear project."
|
|
|
|
echo
|
|
|
|
echo "This program is free software: you can redistribute it and/or modify"
|
|
|
|
echo "it under the terms of the GNU General Public License as published by"
|
|
|
|
echo "the Free Software Foundation, either version 3 of the License, or"
|
|
|
|
echo "(at your option) any later version."
|
|
|
|
echo
|
|
|
|
echo "This program is distributed in the hope that it will be useful,"
|
|
|
|
echo "but WITHOUT ANY WARRANTY; without even the implied warranty of"
|
|
|
|
echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
|
|
|
|
echo "GNU General Public License for more details."
|
|
|
|
echo
|
|
|
|
echo "You should have received a copy of the GNU General Public License"
|
|
|
|
echo "along with this program. If not, see <http://www.gnu.org/licenses/>."
|
|
|
|
}
|
|
|
|
|
2018-09-25 23:29:58 +08:00
|
|
|
function _usage() {
|
|
|
|
echo "$PROGNAME [OPTION...] [--] [COMPONENT...]"
|
|
|
|
echo "Download and compile components belonging to the FlightGear ecosystem."
|
|
|
|
echo
|
|
|
|
echo "Without any COMPONENT listed, or if ALL is specified, recompile all"
|
|
|
|
echo "components listed in the WHATTOBUILDALL variable. Each COMPONENT may"
|
|
|
|
echo "be one of the following words:"
|
|
|
|
echo
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
echo " ALL, $(_joinBy ', ' "${WHATTOBUILD_AVAIL[@]}")."
|
2018-09-25 23:29:58 +08:00
|
|
|
echo
|
|
|
|
echo "Available options:"
|
|
|
|
echo " -h, --help show this help message and exit"
|
2018-09-26 06:10:24 +08:00
|
|
|
echo " --version print version and license information, then exit"
|
2018-09-25 23:29:58 +08:00
|
|
|
echo " -e compile FlightGear with --with-eventinput option (experimental)"
|
|
|
|
echo " -i compile SimGear and FlightGear with -D ENABLE_RTI=ON option (experimental)"
|
|
|
|
echo " -b RELEASE_TYPE default=RelWithDebInfo"
|
|
|
|
echo " set build type to RELEASE_TYPE (Release|RelWithDebInfo|Debug)"
|
download_and_compile.sh: improvements related to package installation
- 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).
2019-02-12 06:39:29 +08:00
|
|
|
echo " -a y|n y=run 'PACKAGE_MANAGER update', n=don't default=y"
|
|
|
|
echo " (PACKAGE_MANAGER being a program like 'apt-get', see below)"
|
|
|
|
echo " -p y|n y=install packages using PACKAGE_MANAGER, n=don't default=y"
|
2018-09-25 23:29:58 +08:00
|
|
|
echo " -c y|n y=compile programs, n=don't default=y"
|
download_and_compile.sh: improvements related to package installation
- 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).
2019-02-12 06:39:29 +08:00
|
|
|
echo " -d y|n y=fetch programs from the Internet (Git, svn, etc.), n=don't default=y"
|
2020-06-29 20:23:18 +08:00
|
|
|
echo " --cleanup Remove all build and installation directories. Try this if a"
|
|
|
|
echo ' compilation fails and the "base directory" was not "fresh" when'
|
2020-06-30 21:01:40 +08:00
|
|
|
echo " you started ${PROGNAME}. If this option is given and no"
|
|
|
|
echo " component has been specified on the command line, then only the"
|
|
|
|
echo " cleanup routine is run."
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
echo " --git-clone-default-proto=PROTO default=https"
|
|
|
|
echo " default protocol to use for 'git clone' (https, git or ssh)"
|
|
|
|
echo " --git-clone-site-params=SITE=PROTOCOL[:USERNAME]"
|
|
|
|
echo " use PROTOCOL as USERNAME when cloning a Git repository located"
|
|
|
|
echo " at SITE (sample sites: 'sourceforge', 'github'; valid"
|
|
|
|
echo " protocols: 'ssh', 'https', 'git'; USERNAME is required when"
|
|
|
|
echo " using 'ssh'). You may pass this option several times with"
|
|
|
|
echo " different sites."
|
download_and_compile.sh: improvements related to package installation
- 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).
2019-02-12 06:39:29 +08:00
|
|
|
echo " --package-manager=PACKAGE_MANAGER default=apt-get"
|
|
|
|
echo " program used to install packages; must be compatible with"
|
|
|
|
echo " 'apt-get' for the operations performed by $PROGNAME."
|
|
|
|
echo " --sudo=SUDO_PROGRAM default=sudo"
|
|
|
|
echo " program used to run PACKAGE_MANAGER with appropriate rights"
|
|
|
|
echo " (pass an empty value to run the package manager directly)."
|
|
|
|
echo " Passing 'echo' as the SUDO_PROGRAM can be useful to see what"
|
|
|
|
echo " would be done with the package manager without actually running"
|
|
|
|
echo " the commands."
|
2018-09-25 23:29:58 +08:00
|
|
|
echo " -j X pass -jX to the Make program"
|
|
|
|
echo " -O X pass -OX to the Make program"
|
|
|
|
echo " -r y|n y=reconfigure programs before compiling them, n=don't reconfigure default=y"
|
2019-04-26 16:30:45 +08:00
|
|
|
echo " --ignore-intercomponent-deps"
|
|
|
|
echo " Ignore dependencies between components (default: don't)."
|
|
|
|
echo " Example: TERRAGEAR depends on SIMGEAR. Passing the option can be"
|
|
|
|
echo " useful if you want to update, rebuild, etc. TERRAGEAR without"
|
|
|
|
echo " doing the same for SIMGEAR (e.g., if doing repeated TERRAGEAR"
|
|
|
|
echo " builds and you know your SIMGEAR is already fine and up-to-date)."
|
2020-11-15 02:08:15 +08:00
|
|
|
echo " --lts compile the latest Long Term Stable release of FlightGear (and"
|
|
|
|
echo " corresponding versions for other components)"
|
|
|
|
echo " --old-lts compile the previous Long Term Stable release of FlightGear (and"
|
|
|
|
echo " corresponding versions for other components)"
|
|
|
|
echo " -s compile the latest release of FlightGear (and corresponding"
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
echo " versions for other components)"
|
|
|
|
echo " --component-branch=COMPONENT=BRANCH"
|
|
|
|
echo " Override the default branch for COMPONENT. For the specified"
|
2020-11-15 02:08:15 +08:00
|
|
|
echo " component, this overrides the effect of options -s, --lts and --old-lts."
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
echo " This option may be given several times."
|
2020-10-20 16:29:41 +08:00
|
|
|
echo " --sg-cmake-arg=ARGUMENT"
|
2020-10-20 07:39:27 +08:00
|
|
|
echo " Pass ARGUMENT to CMake when building SimGear."
|
|
|
|
echo " This option may be given several times."
|
2020-10-20 16:29:41 +08:00
|
|
|
echo " --fg-cmake-arg=ARGUMENT"
|
2020-10-20 07:39:27 +08:00
|
|
|
echo " Pass ARGUMENT to CMake when building FlightGear."
|
|
|
|
echo " This option may be given several times."
|
2020-06-23 02:38:47 +08:00
|
|
|
echo " --compositor"
|
|
|
|
echo " build FlightGear with compositor enabled"
|
|
|
|
echo " --non-interactive"
|
2020-05-24 16:23:50 +08:00
|
|
|
echo " don't ask any question; always assume the default answer in"
|
|
|
|
echo " situations where a question would normally be asked."
|
|
|
|
echo
|
|
|
|
echo "More detailed information can be found on the FlightGear wiki:"
|
|
|
|
echo ""
|
|
|
|
echo " http://wiki.flightgear.org/Scripted_Compilation_on_Linux_Debian/Ubuntu"
|
|
|
|
echo ""
|
|
|
|
echo "The wiki may sometimes be a bit outdated; if in doubt, consider this help text"
|
|
|
|
echo "as the reference."
|
2018-09-25 23:29:58 +08:00
|
|
|
}
|
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
#######################################################
|
|
|
|
# set script to stop if an error occours
|
|
|
|
set -e
|
2011-02-07 03:44:11 +08:00
|
|
|
|
2018-10-11 19:26:59 +08:00
|
|
|
CBD="$PWD"
|
|
|
|
LOGFILE="$CBD/compilation_log.txt"
|
2020-05-24 16:23:50 +08:00
|
|
|
INTERACTIVE_MODE=1
|
2018-09-25 23:29:58 +08:00
|
|
|
|
2020-06-23 17:10:25 +08:00
|
|
|
declare -i logfile_was_already_present_when_starting=0
|
|
|
|
if [[ -f "$LOGFILE" ]]; then
|
|
|
|
logfile_was_already_present_when_starting=1
|
|
|
|
fi
|
|
|
|
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
# Available values for WHATTOBUILD and WHATTOBUILDALL:
|
|
|
|
declare -a WHATTOBUILD_AVAIL=(
|
|
|
|
'CMAKE' 'PLIB' 'OPENRTI' 'OSG' 'SIMGEAR' 'FGFS' 'DATA' 'FGRUN' 'FGO' 'FGX'
|
2019-08-13 00:53:56 +08:00
|
|
|
'OPENRADAR' 'ATCPIE' 'TERRAGEAR' 'TERRAGEARGUI' 'ZLIB'
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
)
|
2018-09-25 23:10:01 +08:00
|
|
|
WHATTOBUILDALL=(SIMGEAR FGFS DATA)
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
SELECTED_SUITE=next
|
2020-06-29 20:23:18 +08:00
|
|
|
CLEANUP="n"
|
2018-09-25 23:10:01 +08:00
|
|
|
APT_GET_UPDATE="y"
|
|
|
|
DOWNLOAD_PACKAGES="y"
|
|
|
|
COMPILE="y"
|
|
|
|
RECONFIGURE="y"
|
|
|
|
DOWNLOAD="y"
|
2019-04-26 16:30:45 +08:00
|
|
|
IGNORE_INTERCOMPONENT_DEPS="n"
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
|
download_and_compile.sh: improvements related to package installation
- 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).
2019-02-12 06:39:29 +08:00
|
|
|
SUDO="sudo"
|
|
|
|
PKG_MGR="apt-get"
|
|
|
|
|
2020-10-20 07:39:27 +08:00
|
|
|
# Initial values: preserve compatibility with the previous interface
|
|
|
|
declare -a SG_CMAKE_ARGS=($SG_CMAKEARGS)
|
|
|
|
declare -a FG_CMAKE_ARGS=($FG_CMAKEARGS)
|
|
|
|
|
2019-08-13 00:53:56 +08:00
|
|
|
if [[ `uname` == 'OpenBSD' ]]; then
|
|
|
|
APT_GET_UPDATE="n"
|
|
|
|
DOWNLOAD_PACKAGES="n"
|
|
|
|
fi
|
|
|
|
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
# How to download Git repositories:
|
|
|
|
#
|
|
|
|
# - 'https' used to be fine, but is currently unreliable at SourceForge (esp.
|
|
|
|
# for FGData, see
|
2019-04-25 00:56:42 +08:00
|
|
|
# <https://forum.flightgear.org/viewtopic.php?f=20&t=33620&start=90>);
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
# - 'git' is insecure (no way to guarantee you are downloading what you expect
|
|
|
|
# to be downloading);
|
|
|
|
# - 'ssh' is secure, but requires an account at SourceForge (may be created at
|
|
|
|
# no cost, though).
|
|
|
|
#
|
|
|
|
# These are the default values but may be overridden via command-line options.
|
|
|
|
REPO_DEFAULT_PROTO='https'
|
|
|
|
REPO_DEFAULT_USERNAME=''
|
|
|
|
|
2018-09-25 23:10:01 +08:00
|
|
|
JOPTION=""
|
|
|
|
OOPTION=""
|
|
|
|
BUILD_TYPE="RelWithDebInfo"
|
|
|
|
|
2019-04-26 19:14:38 +08:00
|
|
|
# Non user-exposed variable used to decide whether to print a “helpful”
|
|
|
|
# message
|
|
|
|
declare -i nb_added_intercomponent_deps=0
|
|
|
|
|
2018-09-25 23:10:01 +08:00
|
|
|
declare -a UNMATCHED_OPTIONAL_PKG_ALTERNATIVES
|
|
|
|
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
# Will hold the per-repository download settings.
|
|
|
|
declare -A REPO_PROTO
|
|
|
|
declare -A REPO_USERNAME
|
|
|
|
|
|
|
|
# Allows one to set a default (username, protocol) combination for each hosting
|
|
|
|
# site (SouceForge, GitHub, GitLab, etc.) when cloning a new repository.
|
|
|
|
declare -A PROTO_AT_SITE
|
|
|
|
declare -A USERNAME_AT_SITE
|
|
|
|
|
|
|
|
# Most specific settings: per-repository (actually, one current assumes that
|
|
|
|
# there is at most one repository per component such as SIMGEAR, FGFS, DATA,
|
|
|
|
# etc.)
|
|
|
|
declare -A REPO_ADDRESS
|
|
|
|
declare -A REPO_SITE
|
|
|
|
|
2020-04-25 17:07:47 +08:00
|
|
|
REPO_ADDRESS[CMAKE]="gitlab.kitware.com/cmake/cmake.git"
|
|
|
|
REPO_SITE[CMAKE]="gitlab.kitware.com"
|
2019-08-13 00:53:56 +08:00
|
|
|
REPO_ADDRESS[ZLIB]="github.com/madler/zlib.git"
|
|
|
|
REPO_SITE[ZLIB]="GitHub"
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
REPO_ADDRESS[PLIB]="git.code.sf.net/p/libplib/code"
|
|
|
|
REPO_SITE[PLIB]="SourceForge"
|
|
|
|
REPO_ADDRESS[OPENRTI]="git.code.sf.net/p/openrti/OpenRTI"
|
|
|
|
REPO_SITE[OPENRTI]="SourceForge"
|
|
|
|
REPO_ADDRESS[OSG]="github.com/openscenegraph/osg.git"
|
|
|
|
REPO_SITE[OSG]="GitHub"
|
|
|
|
REPO_ADDRESS[SIMGEAR]="git.code.sf.net/p/flightgear/simgear"
|
|
|
|
REPO_SITE[SIMGEAR]="SourceForge"
|
|
|
|
REPO_ADDRESS[DATA]="git.code.sf.net/p/flightgear/fgdata"
|
|
|
|
REPO_SITE[DATA]="SourceForge"
|
2020-05-24 16:23:50 +08:00
|
|
|
# This is an official mirror of FGData
|
|
|
|
REPO_ADDRESS[DATA_ALT]="gitlab.com/flightgear/fgdata.git"
|
|
|
|
REPO_SITE[DATA_ALT]="GitLab"
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
REPO_ADDRESS[FGFS]="git.code.sf.net/p/flightgear/flightgear"
|
|
|
|
REPO_SITE[FGFS]="SourceForge"
|
|
|
|
REPO_ADDRESS[FGRUN]="git.code.sf.net/p/flightgear/fgrun"
|
|
|
|
REPO_SITE[FGRUN]="SourceForge"
|
|
|
|
REPO_ADDRESS[FGX]="github.com/fgx/fgx.git"
|
|
|
|
REPO_SITE[FGX]="GitHub"
|
|
|
|
REPO_ADDRESS[ATCPIE]="git.code.sf.net/p/atc-pie/code"
|
|
|
|
REPO_SITE[ATCPIE]="SourceForge"
|
|
|
|
REPO_ADDRESS[TERRAGEAR]="git.code.sf.net/p/flightgear/terragear"
|
|
|
|
REPO_SITE[TERRAGEAR]="SourceForge"
|
|
|
|
REPO_ADDRESS[TERRAGEARGUI]="git.code.sf.net/p/flightgear/fgscenery/terrageargui"
|
|
|
|
REPO_SITE[TERRAGEARGUI]="SourceForge"
|
|
|
|
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
# Allows one to choose the branch for each component instead of relying on the
|
|
|
|
# defaults.
|
|
|
|
declare -A COMPONENT_BRANCH_OVERRIDES
|
|
|
|
|
2018-09-25 23:29:58 +08:00
|
|
|
# getopt is from the util-linux package (in Debian). Contrary to bash's getopts
|
|
|
|
# built-in function, it allows one to define long options.
|
2019-08-13 00:53:56 +08:00
|
|
|
getopt=getopt
|
|
|
|
if [[ `uname` == 'OpenBSD' ]]; then
|
|
|
|
getopt=gnugetopt
|
|
|
|
fi
|
|
|
|
TEMP=$($getopt -o '+shc:p:a:d:r:j:O:ib:' \
|
2020-11-15 02:08:15 +08:00
|
|
|
--longoptions cleanup,git-clone-default-proto:,git-clone-site-params: \
|
2020-05-24 16:23:50 +08:00
|
|
|
--longoptions package-manager:,sudo:,ignore-intercomponent-deps,compositor \
|
2020-10-20 16:29:41 +08:00
|
|
|
--longoptions component-branch:,sg-cmake-arg:,fg-cmake-arg:,non-interactive \
|
2020-11-15 02:08:15 +08:00
|
|
|
--longoptions lts,old-lts,help,version \
|
2018-09-25 23:29:58 +08:00
|
|
|
-n "$PROGNAME" -- "$@")
|
|
|
|
|
|
|
|
case $? in
|
|
|
|
0) : ;;
|
|
|
|
1) _usage >&2; exit 1 ;;
|
|
|
|
*) exit 1 ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Don't remove the quotes around $TEMP!
|
|
|
|
eval set -- "$TEMP"
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
case "$1" in
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
-s) SELECTED_SUITE=latest-release; shift ;;
|
|
|
|
--lts) SELECTED_SUITE=latest-lts; shift ;;
|
2020-11-15 02:08:15 +08:00
|
|
|
--old-lts) SELECTED_SUITE=old-lts; shift ;;
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
--component-branch)
|
|
|
|
if [[ "$2" =~ ^([-_a-zA-Z0-9]+)=(.+)$ ]]; then
|
|
|
|
verbatim_component="${BASH_REMATCH[1]}"
|
|
|
|
component="${BASH_REMATCH[1]^^}" # convert the component to uppercase
|
|
|
|
branch="${BASH_REMATCH[2]}"
|
|
|
|
|
|
|
|
if ! _elementIn "$component" "${WHATTOBUILD_AVAIL[@]}"; then
|
|
|
|
echo "Invalid component passed to option --component-branch:" \
|
|
|
|
"'$verbatim_component'. Allowed" >&2
|
|
|
|
printf "components are:\n\n" >&2
|
|
|
|
echo " $(_joinBy ', ' "${WHATTOBUILD_AVAIL[@]}")." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
COMPONENT_BRANCH_OVERRIDES["$component"]="$branch"
|
|
|
|
unset -v verbatim_component component branch
|
|
|
|
else
|
|
|
|
echo "Invalid value passed to option --component-branch: '$2'." >&2
|
|
|
|
echo "The correct syntax is" \
|
|
|
|
"--component-branch COMPONENT=BRANCH" >&2
|
|
|
|
echo "(or equivalently, --component-branch=COMPONENT=BRANCH)." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
shift 2
|
|
|
|
;;
|
2020-10-20 16:29:41 +08:00
|
|
|
--sg-cmake-arg)
|
2020-10-20 07:39:27 +08:00
|
|
|
SG_CMAKE_ARGS+=("$2"); shift 2 ;;
|
2020-10-20 16:29:41 +08:00
|
|
|
--fg-cmake-arg)
|
2020-10-20 07:39:27 +08:00
|
|
|
FG_CMAKE_ARGS+=("$2"); shift 2 ;;
|
2018-09-25 23:29:58 +08:00
|
|
|
-a) APT_GET_UPDATE="$2"; shift 2 ;;
|
|
|
|
-c) COMPILE="$2"; shift 2 ;;
|
|
|
|
-p) DOWNLOAD_PACKAGES="$2"; shift 2 ;;
|
|
|
|
-d) DOWNLOAD="$2"; shift 2 ;;
|
2020-06-29 20:23:18 +08:00
|
|
|
--cleanup) CLEANUP="y"; shift ;;
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
--git-clone-default-proto)
|
|
|
|
proto="${2,,}" # convert to lowercase
|
|
|
|
|
|
|
|
if ! _elementIn "$proto" ssh https git; then
|
|
|
|
echo "Invalid protocol passed to option" \
|
|
|
|
"--git-clone-default-proto: '$2'." >&2
|
|
|
|
echo "Allowed protocols are 'ssh', 'https' and 'git'." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
REPO_DEFAULT_PROTO="$proto"
|
|
|
|
unset -v proto
|
|
|
|
shift 2
|
|
|
|
;;
|
|
|
|
--git-clone-site-params)
|
2020-09-02 17:02:14 +08:00
|
|
|
if [[ "$2" =~ ^([[:alnum:]]+)=([[:alpha:]]+)(:([-_.[:alnum:]]+))?$ ]]; then
|
2018-09-26 15:27:53 +08:00
|
|
|
site="${BASH_REMATCH[1],,}" # convert the site to lowercase
|
|
|
|
verbatim_proto="${BASH_REMATCH[2]}"
|
2018-09-26 16:02:09 +08:00
|
|
|
proto="${verbatim_proto,,}" # ditto for the protocol
|
2018-09-26 15:27:53 +08:00
|
|
|
username="${BASH_REMATCH[4]}" # but take the username verbatim
|
|
|
|
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
if ! _elementIn "$proto" ssh https git; then
|
|
|
|
echo "Invalid protocol passed to option --git-clone-site-params:" \
|
2018-09-26 15:27:53 +08:00
|
|
|
"'$verbatim_proto'." >&2
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
echo "Allowed protocols are 'ssh', 'https' and 'git'." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
PROTO_AT_SITE[$site]="$proto"
|
|
|
|
if [[ -n "$username" ]]; then
|
|
|
|
USERNAME_AT_SITE[$site]="$username"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$proto" == "ssh" && -z "$username" ]]; then
|
|
|
|
echo "Invalid value passed to option --git-clone-site-params: '$2'" >&2
|
|
|
|
echo "The 'ssh' protocol requires a username (use" >&2
|
|
|
|
echo "--git-clone-site-params SITE=ssh:USERNAME)." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-09-26 15:27:53 +08:00
|
|
|
unset -v site proto verbatim_proto username
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
else
|
|
|
|
echo "Invalid value passed to option --git-clone-site-params: '$2'." >&2
|
|
|
|
echo "The correct syntax is" \
|
|
|
|
"--git-clone-site-params SITE=PROTOCOL[:USERNAME]" >&2
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
echo "(or equivalently, --git-clone-site-params=SITE=PROTOCOL[:USERNAME])." >&2
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
shift 2
|
|
|
|
;;
|
download_and_compile.sh: improvements related to package installation
- 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).
2019-02-12 06:39:29 +08:00
|
|
|
--package-manager) PKG_MGR="$2"; shift 2 ;;
|
|
|
|
--sudo) SUDO="$2"; shift 2 ;;
|
2019-04-26 16:30:45 +08:00
|
|
|
--ignore-intercomponent-deps) IGNORE_INTERCOMPONENT_DEPS="y"; shift ;;
|
2018-09-25 23:29:58 +08:00
|
|
|
-r) RECONFIGURE="$2"; shift 2 ;;
|
|
|
|
-j) JOPTION=" -j$2"; shift 2 ;;
|
|
|
|
-O) OOPTION=" -O$2"; shift 2 ;;
|
|
|
|
-i) OPENRTI="OPENRTI"; shift ;;
|
|
|
|
-b) BUILD_TYPE="$2"; shift 2 ;;
|
2020-03-25 04:03:46 +08:00
|
|
|
--compositor) COMPOSITOR="-DENABLE_COMPOSITOR=ON"; shift ;;
|
2020-05-24 16:23:50 +08:00
|
|
|
--non-interactive) INTERACTIVE_MODE=0; shift ;;
|
2018-09-25 23:29:58 +08:00
|
|
|
-h|--help) _usage; exit 0 ;;
|
2018-09-26 06:10:24 +08:00
|
|
|
--version) _printVersion; exit 0 ;;
|
2018-09-25 23:29:58 +08:00
|
|
|
--) shift; break ;;
|
|
|
|
*) echo "$PROGNAME: unexpected option '$1'; please report a bug." >&2
|
|
|
|
exit 1 ;;
|
2018-09-25 23:10:01 +08:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2018-09-25 23:29:58 +08:00
|
|
|
declare -a WHATTOBUILD=()
|
2018-09-25 23:10:01 +08:00
|
|
|
|
2020-06-30 21:01:40 +08:00
|
|
|
if [[ $# == 0 && "$CLEANUP" == "n" ]] || _elementIn ALL "$@"; then
|
2018-09-25 23:10:01 +08:00
|
|
|
WHATTOBUILD=( "${WHATTOBUILDALL[@]}" )
|
2018-09-25 23:29:58 +08:00
|
|
|
else
|
|
|
|
WHATTOBUILD=( "$@" )
|
2018-09-25 23:10:01 +08:00
|
|
|
fi
|
|
|
|
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
# Name of the branch to check out for each component, depending on whether any
|
2020-11-15 02:08:15 +08:00
|
|
|
# of the options -s, --lts and --old-lts has been provided (for some projects
|
|
|
|
# which don't use a VCS, we may abuse this variable and store something else
|
|
|
|
# than a branch name).
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
declare -A COMPONENT_BRANCH
|
2020-06-30 17:44:01 +08:00
|
|
|
_determineSuiteDescriptionAndBranchForEachComponent
|
2018-09-25 23:10:01 +08:00
|
|
|
|
2020-10-20 07:39:27 +08:00
|
|
|
if [[ "$OPENRTI" = "OPENRTI" ]]; then
|
|
|
|
SG_CMAKE_ARGS+=("-DENABLE_RTI=ON")
|
|
|
|
FG_CMAKE_ARGS+=("-DENABLE_RTI=ON")
|
|
|
|
WHATTOBUILD+=("OPENRTI")
|
2011-02-07 03:44:11 +08:00
|
|
|
fi
|
|
|
|
|
2020-06-30 17:44:01 +08:00
|
|
|
_startLog "$0 $*"
|
2020-06-30 21:01:40 +08:00
|
|
|
|
|
|
|
# The following is skipped when only running the “cleanup” routine.
|
|
|
|
if [[ ${#WHATTOBUILD[@]} -gt 0 ]]; then
|
|
|
|
# Warn about compilation time and size (idea from Jester); give a hint about
|
|
|
|
# the -j option.
|
|
|
|
_displayGeneralAdvice
|
|
|
|
_determineProtocolAndUsernameForEachComponentRepository
|
|
|
|
_maybe_add_intercomponent_deps # this may add elements to WHATTOBUILD
|
|
|
|
# Among other things, this asks “Are you sure you want to continue?” if the
|
|
|
|
# user chose 'next', $LOGFILE wasn't present when the script was started and
|
|
|
|
# the --non-interactive option wasn't specified.
|
|
|
|
_describeSelectedSuite
|
|
|
|
_showBranchForEachComponent
|
|
|
|
_logSep
|
|
|
|
_installOrUpdateDistroPackages
|
|
|
|
fi
|
2011-02-07 03:44:11 +08:00
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
#######################################################
|
|
|
|
#######################################################
|
|
|
|
|
2011-02-07 03:44:11 +08:00
|
|
|
SUB_INSTALL_DIR=install
|
2020-06-29 20:23:18 +08:00
|
|
|
FGFS_INSTALL_DIR=flightgear
|
2018-10-11 18:45:01 +08:00
|
|
|
INSTALL_DIR="$CBD/$SUB_INSTALL_DIR"
|
2020-06-29 20:23:18 +08:00
|
|
|
INSTALL_DIR_FGFS="$INSTALL_DIR/$FGFS_INSTALL_DIR"
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
2018-10-11 19:26:59 +08:00
|
|
|
mkdir -p build install
|
2012-04-18 16:38:22 +08:00
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
#######################################################
|
|
|
|
# BACKWARD COMPATIBILITY WITH 1.9.14a
|
|
|
|
#######################################################
|
2013-07-30 10:06:20 +08:00
|
|
|
|
2014-05-20 19:06:19 +08:00
|
|
|
if [ -d "$CBD"/fgfs/flightgear ]; then
|
2018-10-11 19:26:59 +08:00
|
|
|
_logSep
|
|
|
|
_printLog "Move to the new folder structure"
|
2015-03-07 02:28:55 +08:00
|
|
|
rm -rf OpenSceneGraph
|
|
|
|
rm -rf plib
|
|
|
|
rm -rf build
|
|
|
|
rm -rf install/fgo
|
|
|
|
rm -rf install/fgx
|
|
|
|
rm -rf install/osg
|
|
|
|
rm -rf install/plib
|
|
|
|
rm -rf install/simgear
|
|
|
|
rm -f *.log*
|
|
|
|
rm -f run_*.sh
|
|
|
|
mv openrti/openrti tmp && rm -rf openrti && mv tmp openrti
|
|
|
|
mv fgfs/flightgear tmp && rm -rf fgfs && mv tmp flightgear
|
|
|
|
mv simgear/simgear tmp && rm -rf simgear && mv tmp simgear
|
|
|
|
mkdir -p install/flightgear && mv install/fgfs/fgdata install/flightgear/fgdata
|
|
|
|
echo "Done"
|
2014-05-20 19:06:19 +08:00
|
|
|
fi
|
2013-07-30 10:06:20 +08:00
|
|
|
|
2018-10-11 19:26:59 +08:00
|
|
|
_printLog
|
|
|
|
|
2020-06-29 20:23:18 +08:00
|
|
|
if [[ "$CLEANUP" = "y" ]]; then
|
|
|
|
_cleanup
|
|
|
|
fi
|
|
|
|
|
2016-10-21 05:42:18 +08:00
|
|
|
#######################################################
|
|
|
|
# cmake
|
|
|
|
#######################################################
|
|
|
|
CMAKE_INSTALL_DIR=cmake
|
2019-04-21 14:39:34 +08:00
|
|
|
INSTALL_DIR_CMAKE="$INSTALL_DIR/$CMAKE_INSTALL_DIR"
|
2016-10-21 05:42:18 +08:00
|
|
|
cd "$CBD"
|
2018-09-26 15:55:06 +08:00
|
|
|
if _elementIn "CMAKE" "${WHATTOBUILD[@]}"; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "****************************************"
|
|
|
|
_printLog "*************** CMAKE ******************"
|
|
|
|
_printLog "****************************************"
|
2016-10-21 05:42:18 +08:00
|
|
|
|
|
|
|
mkdir -p "cmake"
|
|
|
|
cd "$CBD"/cmake
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
_gitDownload CMAKE
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
_gitUpdate "${COMPONENT_BRANCH[CMAKE]}"
|
2016-10-21 05:42:18 +08:00
|
|
|
|
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
cd "$CBD"
|
|
|
|
mkdir -p build/cmake
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "CONFIGURING CMake"
|
2016-10-21 05:42:18 +08:00
|
|
|
cd "$CBD"/build/cmake
|
|
|
|
../../cmake/configure --prefix="$INSTALL_DIR_CMAKE" \
|
2018-10-11 18:12:36 +08:00
|
|
|
2>&1 | _logOutput
|
2016-10-21 05:42:18 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
_make cmake
|
|
|
|
CMAKE="$INSTALL_DIR_CMAKE/bin/cmake"
|
|
|
|
else
|
2016-10-30 05:15:32 +08:00
|
|
|
if [ -x "$INSTALL_DIR_CMAKE/bin/cmake" ]; then
|
|
|
|
CMAKE="$INSTALL_DIR_CMAKE/bin/cmake"
|
|
|
|
else
|
|
|
|
CMAKE=cmake
|
|
|
|
fi
|
2016-10-21 05:42:18 +08:00
|
|
|
fi
|
|
|
|
|
2019-08-13 00:53:56 +08:00
|
|
|
#######################################################
|
|
|
|
# ZLIB
|
|
|
|
#######################################################
|
|
|
|
ZLIB_INSTALL_DIR=zlib
|
|
|
|
INSTALL_DIR_ZLIB="$INSTALL_DIR/$ZLIB_INSTALL_DIR"
|
|
|
|
cd "$CBD"
|
|
|
|
if _elementIn "ZLIB" "${WHATTOBUILD[@]}"; then
|
|
|
|
_printLog "****************************************"
|
|
|
|
_printLog "**************** ZLIB ******************"
|
|
|
|
_printLog "****************************************"
|
|
|
|
|
|
|
|
mkdir -p "zlib"
|
|
|
|
cd "$CBD"/zlib
|
|
|
|
_gitDownload ZLIB
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
_gitUpdate "${COMPONENT_BRANCH[ZLIB]}"
|
2019-08-13 00:53:56 +08:00
|
|
|
|
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
cd "$CBD"
|
|
|
|
mkdir -p build/zlib
|
|
|
|
_log "CONFIGURING zlib"
|
|
|
|
cd "$CBD"/build/zlib
|
|
|
|
"$CMAKE" -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_ZLIB" \
|
|
|
|
../../zlib 2>&1 | _logOutput
|
|
|
|
fi
|
|
|
|
|
|
|
|
_make zlib
|
|
|
|
fi
|
|
|
|
|
2011-02-07 03:44:11 +08:00
|
|
|
#######################################################
|
|
|
|
# PLIB
|
|
|
|
#######################################################
|
2014-05-20 19:06:19 +08:00
|
|
|
PLIB_INSTALL_DIR=plib
|
2019-04-21 14:39:34 +08:00
|
|
|
INSTALL_DIR_PLIB="$INSTALL_DIR/$PLIB_INSTALL_DIR"
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
2018-09-26 15:55:06 +08:00
|
|
|
if _elementIn "PLIB" "${WHATTOBUILD[@]}"; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "****************************************"
|
|
|
|
_printLog "**************** PLIB ******************"
|
|
|
|
_printLog "****************************************"
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
mkdir -p "plib"
|
|
|
|
cd "$CBD"/plib
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
_gitDownload PLIB
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
_gitUpdate "${COMPONENT_BRANCH[PLIB]}"
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
cd "$CBD"
|
|
|
|
mkdir -p build/plib
|
2018-10-11 18:34:25 +08:00
|
|
|
_log "CONFIGURING plib"
|
2015-03-07 02:28:55 +08:00
|
|
|
cd "$CBD"/build/plib
|
2016-10-31 06:01:36 +08:00
|
|
|
"$CMAKE" -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_PLIB" \
|
2018-10-11 18:12:36 +08:00
|
|
|
../../plib 2>&1 | _logOutput
|
2015-03-07 02:28:55 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
_make plib
|
2011-02-07 03:44:11 +08:00
|
|
|
fi
|
|
|
|
|
2012-11-23 03:38:51 +08:00
|
|
|
#######################################################
|
|
|
|
# OPENRTI
|
|
|
|
#######################################################
|
|
|
|
OPENRTI_INSTALL_DIR=openrti
|
2019-04-21 14:39:34 +08:00
|
|
|
INSTALL_DIR_OPENRTI="$INSTALL_DIR/$OPENRTI_INSTALL_DIR"
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
2018-09-26 15:55:06 +08:00
|
|
|
if _elementIn "OPENRTI" "${WHATTOBUILD[@]}"; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "****************************************"
|
|
|
|
_printLog "**************** OPENRTI ***************"
|
|
|
|
_printLog "****************************************"
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
mkdir -p "openrti"
|
|
|
|
cd "$CBD"/openrti
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
_gitDownload OPENRTI
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
_gitUpdate "${COMPONENT_BRANCH[OPENRTI]}"
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
cd "$CBD"
|
|
|
|
mkdir -p build/openrti
|
|
|
|
cd "$CBD"/build/openrti
|
|
|
|
rm -f CMakeCache.txt
|
2016-10-31 06:01:36 +08:00
|
|
|
"$CMAKE" -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
2015-03-07 02:28:55 +08:00
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_OPENRTI" \
|
2018-10-11 18:12:36 +08:00
|
|
|
../../openrti 2>&1 | _logOutput
|
2015-03-07 02:28:55 +08:00
|
|
|
fi
|
2018-09-26 16:02:09 +08:00
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
_make openrti
|
2012-11-23 03:38:51 +08:00
|
|
|
fi
|
|
|
|
|
2015-05-11 14:16:25 +08:00
|
|
|
#######################################################
|
|
|
|
# OpenSceneGraph
|
|
|
|
#######################################################
|
|
|
|
OSG_INSTALL_DIR=openscenegraph
|
2019-04-21 14:39:34 +08:00
|
|
|
INSTALL_DIR_OSG="$INSTALL_DIR/$OSG_INSTALL_DIR"
|
2015-05-11 14:16:25 +08:00
|
|
|
cd "$CBD"
|
2018-09-26 15:55:06 +08:00
|
|
|
if _elementIn "OSG" "${WHATTOBUILD[@]}"; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "****************************************"
|
|
|
|
_printLog "**************** OSG *******************"
|
|
|
|
_printLog "****************************************"
|
|
|
|
|
2019-03-23 21:34:51 +08:00
|
|
|
mkdir -p "openscenegraph"
|
|
|
|
cd "openscenegraph"
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
_gitDownload OSG
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
_gitUpdate "${COMPONENT_BRANCH[OSG]}"
|
2017-05-02 18:46:00 +08:00
|
|
|
|
2016-10-31 06:01:36 +08:00
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
cd "$CBD"
|
|
|
|
mkdir -p build/openscenegraph
|
|
|
|
cd "$CBD"/build/openscenegraph
|
|
|
|
rm -f CMakeCache.txt
|
|
|
|
if [ "$BUILD_TYPE" = "Debug" ]; then
|
|
|
|
OSG_BUILD_TYPE=Debug
|
|
|
|
else
|
|
|
|
OSG_BUILD_TYPE=Release
|
|
|
|
fi
|
|
|
|
"$CMAKE" -DCMAKE_BUILD_TYPE="$OSG_BUILD_TYPE" \
|
2018-10-11 18:12:36 +08:00
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_OSG" ../../openscenegraph \
|
|
|
|
2>&1 | _logOutput
|
2016-10-31 06:01:36 +08:00
|
|
|
fi
|
2018-09-26 16:02:09 +08:00
|
|
|
|
2016-10-31 06:01:36 +08:00
|
|
|
_make openscenegraph
|
|
|
|
#FIX FOR 64 BIT COMPILATION
|
|
|
|
if [ -d "$INSTALL_DIR_OSG/lib64" ]; then
|
|
|
|
if [ -L "$INSTALL_DIR_OSG/lib" ]; then
|
|
|
|
echo "link already done"
|
|
|
|
else
|
|
|
|
ln -s "$INSTALL_DIR_OSG/lib64" "$INSTALL_DIR_OSG/lib"
|
|
|
|
fi
|
|
|
|
fi
|
2015-05-11 14:16:25 +08:00
|
|
|
fi
|
|
|
|
|
2011-02-07 03:44:11 +08:00
|
|
|
#######################################################
|
|
|
|
# SIMGEAR
|
|
|
|
#######################################################
|
|
|
|
SIMGEAR_INSTALL_DIR=simgear
|
2019-04-21 14:39:34 +08:00
|
|
|
INSTALL_DIR_SIMGEAR="$INSTALL_DIR/$SIMGEAR_INSTALL_DIR"
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
2018-09-26 15:55:06 +08:00
|
|
|
if _elementIn "SIMGEAR" "${WHATTOBUILD[@]}"; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "****************************************"
|
|
|
|
_printLog "**************** SIMGEAR ***************"
|
|
|
|
_printLog "****************************************"
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
mkdir -p "simgear"
|
|
|
|
cd "$CBD"/simgear
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
_gitDownload SIMGEAR
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
_gitUpdate "${COMPONENT_BRANCH[SIMGEAR]}"
|
2018-09-26 16:02:09 +08:00
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
cd "$CBD"
|
|
|
|
mkdir -p build/simgear
|
|
|
|
cd "$CBD"/build/simgear
|
|
|
|
rm -f CMakeCache.txt
|
2019-08-13 00:53:56 +08:00
|
|
|
extra=''
|
|
|
|
if [[ `uname` == 'OpenBSD' ]]; then
|
|
|
|
extra=-DZLIB_ROOT=$INSTALL_DIR_ZLIB
|
|
|
|
fi
|
2016-10-31 06:01:36 +08:00
|
|
|
"$CMAKE" -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
2015-03-07 02:28:55 +08:00
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_SIMGEAR" \
|
|
|
|
-DCMAKE_PREFIX_PATH="$INSTALL_DIR_OSG;$INSTALL_DIR_OPENRTI" \
|
2019-08-13 00:53:56 +08:00
|
|
|
$extra \
|
2020-10-20 07:39:27 +08:00
|
|
|
"${SG_CMAKE_ARGS[@]}" \
|
2018-10-11 18:12:36 +08:00
|
|
|
../../simgear 2>&1 | _logOutput
|
2015-03-07 02:28:55 +08:00
|
|
|
fi
|
2018-09-26 16:02:09 +08:00
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
_make simgear
|
2011-02-07 03:44:11 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
#######################################################
|
|
|
|
# FGFS
|
|
|
|
#######################################################
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
2018-09-26 15:55:06 +08:00
|
|
|
if _elementIn "FGFS" "${WHATTOBUILD[@]}" || \
|
|
|
|
_elementIn "DATA" "${WHATTOBUILD[@]}"; then
|
2018-09-15 22:50:07 +08:00
|
|
|
mkdir -p "$INSTALL_DIR_FGFS"/fgdata
|
|
|
|
cd "$INSTALL_DIR_FGFS"/fgdata
|
|
|
|
|
2018-09-26 15:55:06 +08:00
|
|
|
if _elementIn "DATA" "${WHATTOBUILD[@]}"; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "****************************************"
|
|
|
|
_printLog "**************** DATA ******************"
|
|
|
|
_printLog "****************************************"
|
2018-09-15 22:50:07 +08:00
|
|
|
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
_gitDownload DATA
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
_gitUpdate "${COMPONENT_BRANCH[DATA]}"
|
2018-09-15 22:50:07 +08:00
|
|
|
fi
|
2015-03-07 02:28:55 +08:00
|
|
|
|
2018-09-15 22:50:07 +08:00
|
|
|
mkdir -p "$CBD"/flightgear
|
2015-03-07 02:28:55 +08:00
|
|
|
cd "$CBD"/flightgear
|
|
|
|
|
2018-09-26 15:55:06 +08:00
|
|
|
if _elementIn "FGFS" "${WHATTOBUILD[@]}"; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "****************************************"
|
|
|
|
_printLog "************** FLIGHTGEAR **************"
|
|
|
|
_printLog "****************************************"
|
2018-09-15 22:50:07 +08:00
|
|
|
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
_gitDownload FGFS
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
_gitUpdate "${COMPONENT_BRANCH[FGFS]}"
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
cd "$CBD"
|
|
|
|
mkdir -p build/flightgear
|
|
|
|
cd "$CBD"/build/flightgear
|
|
|
|
rm -f CMakeCache.txt
|
2019-08-13 00:53:56 +08:00
|
|
|
extra=
|
|
|
|
if [[ `uname` == 'OpenBSD' ]]; then
|
|
|
|
extra="-DZLIB_ROOT=$INSTALL_DIR_ZLIB \
|
|
|
|
-DENABLE_QT=OFF \
|
|
|
|
-DENABLE_FGCOM=OFF \
|
|
|
|
-DVERBOSE=1"
|
|
|
|
fi
|
2016-10-31 06:01:36 +08:00
|
|
|
"$CMAKE" -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
2020-03-25 04:03:46 +08:00
|
|
|
$COMPOSITOR \
|
2015-03-07 02:28:55 +08:00
|
|
|
-DENABLE_FLITE=ON \
|
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_FGFS" \
|
2015-05-11 14:16:25 +08:00
|
|
|
-DCMAKE_PREFIX_PATH="$INSTALL_DIR_SIMGEAR;$INSTALL_DIR_OSG;$INSTALL_DIR_OPENRTI;$INSTALL_DIR_PLIB" \
|
2019-04-21 17:45:28 +08:00
|
|
|
-DFG_DATA_DIR:PATH="$INSTALL_DIR_FGFS/fgdata" \
|
|
|
|
-DTRANSLATIONS_SRC_DIR:PATH="$INSTALL_DIR_FGFS/fgdata/Translations" \
|
2019-08-13 00:53:56 +08:00
|
|
|
$extra \
|
2020-10-20 07:39:27 +08:00
|
|
|
"${FG_CMAKE_ARGS[@]}" \
|
2018-10-11 18:12:36 +08:00
|
|
|
../../flightgear 2>&1 | _logOutput
|
2015-03-07 02:28:55 +08:00
|
|
|
fi
|
|
|
|
|
2019-08-13 00:53:56 +08:00
|
|
|
if [[ `uname` == 'OpenBSD' ]]; then
|
|
|
|
# _make will end up running fgrcc, which was built with our zlib, so we
|
|
|
|
# need to set LD_LIBRARY_PATH, otherwise things will fail because the
|
|
|
|
# system zlib is too old.
|
|
|
|
LD_LIBRARY_PATH=$INSTALL_DIR_ZLIB/lib _make flightgear
|
|
|
|
else
|
|
|
|
_make flightgear
|
|
|
|
fi
|
2015-03-07 02:28:55 +08:00
|
|
|
fi
|
|
|
|
cd "$CBD"
|
2020-05-24 17:39:27 +08:00
|
|
|
|
2019-08-13 00:53:56 +08:00
|
|
|
paths="../../$SIMGEAR_INSTALL_DIR/lib:../../$OSG_INSTALL_DIR/lib:../../$OPENRTI_INSTALL_DIR/lib:../../$PLIB_INSTALL_DIR/lib"
|
|
|
|
gdb="gdb"
|
2020-05-24 17:39:27 +08:00
|
|
|
|
2019-08-17 19:52:14 +08:00
|
|
|
common=""
|
|
|
|
common="${common}#!/bin/sh\n"
|
|
|
|
common="${common}cd \"\$(dirname \"\$0\")\"\n"
|
|
|
|
common="${common}cd '$SUB_INSTALL_DIR/$FGFS_INSTALL_DIR/bin'\n"
|
|
|
|
|
2019-08-13 00:53:56 +08:00
|
|
|
if [[ `uname` == 'OpenBSD' ]]; then
|
|
|
|
# Force use of our zlib.
|
|
|
|
paths="$paths:../../$ZLIB_INSTALL_DIR/lib"
|
|
|
|
# OpenBSD's base gdb is too old; `pkg_add egdb` gives one that we can use.
|
|
|
|
gdb="egdb"
|
2019-08-17 19:52:14 +08:00
|
|
|
common="${common}ulimit -d 4194304\n"
|
2019-08-13 00:53:56 +08:00
|
|
|
fi
|
2019-08-17 19:52:14 +08:00
|
|
|
|
2020-06-24 01:22:45 +08:00
|
|
|
set_ld_library_path="export LD_LIBRARY_PATH='$paths'\"\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH}\""
|
|
|
|
common="${common}${set_ld_library_path}\n"
|
2019-08-17 19:52:14 +08:00
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
SCRIPT=run_fgfs.sh
|
2019-08-17 19:52:14 +08:00
|
|
|
echo -en "$common" > $SCRIPT
|
2019-04-21 19:30:22 +08:00
|
|
|
echo "./fgfs --fg-root=\"\$PWD/../fgdata\" \"\$@\"" >> $SCRIPT
|
2015-03-07 02:28:55 +08:00
|
|
|
chmod 755 $SCRIPT
|
|
|
|
|
|
|
|
SCRIPT=run_fgfs_debug.sh
|
2019-08-17 19:52:14 +08:00
|
|
|
echo -en "$common" > $SCRIPT
|
2019-08-13 00:53:56 +08:00
|
|
|
echo "$gdb --directory='$CBD/flightgear/src' --args ./fgfs --fg-root=\"\$PWD/../fgdata\" \"\$@\"" >> $SCRIPT
|
2015-03-07 02:28:55 +08:00
|
|
|
chmod 755 $SCRIPT
|
|
|
|
|
2019-04-25 14:25:00 +08:00
|
|
|
# Useful for debugging library problems.
|
|
|
|
SCRIPT=run_ldd.sh
|
|
|
|
cat >"$SCRIPT" <<EndOfScriptText
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
usage() {
|
|
|
|
echo "Usage: \$0 LDD_ARGUMENT..."
|
|
|
|
echo "Run 'ldd' with the same LD_LIBRARY_PATH setup as done inside run_fgfs.sh."
|
|
|
|
echo
|
|
|
|
echo "Examples: 'run_ldd.sh fgfs', 'run_ldd.sh fgcom', etc. (this can be used"
|
|
|
|
echo "for any binary in '$SUB_INSTALL_DIR/$FGFS_INSTALL_DIR/bin')."
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ \$# -eq 0 ] || [ "\$1" = "--help" ]; then
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd "\$(dirname "\$0")"
|
|
|
|
cd '$SUB_INSTALL_DIR/$FGFS_INSTALL_DIR/bin'
|
|
|
|
export LD_LIBRARY_PATH='../../$SIMGEAR_INSTALL_DIR/lib:../../$OSG_INSTALL_DIR/lib:../../$OPENRTI_INSTALL_DIR/lib:../../$PLIB_INSTALL_DIR/lib'"\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH}"
|
|
|
|
|
|
|
|
ldd "\$@"
|
|
|
|
EndOfScriptText
|
|
|
|
chmod 755 "$SCRIPT"
|
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
SCRIPT=run_fgcom.sh
|
|
|
|
echo "#!/bin/sh" > $SCRIPT
|
2019-04-21 19:30:22 +08:00
|
|
|
echo "cd \"\$(dirname \"\$0\")\"" >> $SCRIPT
|
|
|
|
echo "cd '$SUB_INSTALL_DIR/$FGFS_INSTALL_DIR/bin'" >> $SCRIPT
|
|
|
|
echo "./fgcom \"\$@\"" >> $SCRIPT
|
2015-03-07 02:28:55 +08:00
|
|
|
chmod 755 $SCRIPT
|
|
|
|
fi
|
|
|
|
|
|
|
|
#######################################################
|
|
|
|
# FGRUN
|
|
|
|
#######################################################
|
|
|
|
FGRUN_INSTALL_DIR=fgrun
|
2019-04-21 14:39:34 +08:00
|
|
|
INSTALL_DIR_FGRUN="$INSTALL_DIR/$FGRUN_INSTALL_DIR"
|
2015-03-07 02:28:55 +08:00
|
|
|
cd "$CBD"
|
2018-09-26 15:55:06 +08:00
|
|
|
if _elementIn "FGRUN" "${WHATTOBUILD[@]}"; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "****************************************"
|
|
|
|
_printLog "**************** FGRUN *****************"
|
|
|
|
_printLog "****************************************"
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
mkdir -p "fgrun"
|
|
|
|
cd "$CBD"/fgrun
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
_gitDownload FGRUN
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
_gitUpdate "${COMPONENT_BRANCH[FGRUN]}"
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
cd "$CBD"
|
|
|
|
mkdir -p build/fgrun
|
|
|
|
cd "$CBD"/build/fgrun
|
|
|
|
rm -f CMakeCache.txt
|
2016-10-31 06:01:36 +08:00
|
|
|
"$CMAKE" -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
2015-03-07 02:28:55 +08:00
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_FGRUN" \
|
|
|
|
-DCMAKE_PREFIX_PATH="$INSTALL_DIR_SIMGEAR" \
|
2018-10-11 18:12:36 +08:00
|
|
|
../../fgrun/ 2>&1 | _logOutput
|
2015-03-07 02:28:55 +08:00
|
|
|
fi
|
2018-09-26 16:02:09 +08:00
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
_make fgrun
|
|
|
|
|
|
|
|
cd "$CBD"
|
|
|
|
|
|
|
|
SCRIPT=run_fgrun.sh
|
|
|
|
echo "#!/bin/sh" > $SCRIPT
|
2019-04-21 19:30:22 +08:00
|
|
|
echo "cd \"\$(dirname \"\$0\")\"" >> $SCRIPT
|
|
|
|
echo "cd '$SUB_INSTALL_DIR/$FGRUN_INSTALL_DIR/bin'" >> $SCRIPT
|
|
|
|
echo "export LD_LIBRARY_PATH='../../$SIMGEAR_INSTALL_DIR/lib:../../$OSG_INSTALL_DIR/lib:../../$OPENRTI_INSTALL_DIR/lib:../../$PLIB_INSTALL_DIR/lib'\"\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH}\"" \
|
2018-10-24 17:56:39 +08:00
|
|
|
>> $SCRIPT
|
2019-04-21 19:30:22 +08:00
|
|
|
echo "./fgrun --fg-exe=\"\$PWD\"/../../'$FGFS_INSTALL_DIR/bin/fgfs' --fg-root=\"\$PWD\"/../../'$FGFS_INSTALL_DIR/fgdata' \"\$@\"" >> $SCRIPT
|
2015-03-07 02:28:55 +08:00
|
|
|
chmod 755 $SCRIPT
|
2011-02-07 03:44:11 +08:00
|
|
|
fi
|
|
|
|
|
2011-08-25 02:34:30 +08:00
|
|
|
#######################################################
|
|
|
|
# FGO!
|
|
|
|
#######################################################
|
|
|
|
FGO_INSTALL_DIR=fgo
|
2019-04-21 14:39:34 +08:00
|
|
|
INSTALL_DIR_FGO="$INSTALL_DIR/$FGO_INSTALL_DIR"
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
2018-09-26 15:55:06 +08:00
|
|
|
if _elementIn "FGO" "${WHATTOBUILD[@]}"; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "****************************************"
|
|
|
|
_printLog "***************** FGO ******************"
|
|
|
|
_printLog "****************************************"
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
if [ "$DOWNLOAD" = "y" ]; then
|
|
|
|
rm -rf fgo*.tar.gz
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
wget "https://sites.google.com/site/erobosprojects/flightgear/add-ons/fgo/download/fgo-${COMPONENT_BRANCH[FGO]}.tar.gz" -O fgo.tar.gz
|
2015-03-07 02:28:55 +08:00
|
|
|
cd install
|
|
|
|
tar -zxvf ../fgo.tar.gz
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd "$CBD"
|
|
|
|
|
|
|
|
SCRIPT=run_fgo.sh
|
|
|
|
echo "#!/bin/sh" > $SCRIPT
|
2019-04-21 19:30:22 +08:00
|
|
|
echo "cd \"\$(dirname \"\$0\")\"" >> $SCRIPT
|
|
|
|
echo "cd '$SUB_INSTALL_DIR'" >> $SCRIPT
|
|
|
|
echo "cd '$FGO_INSTALL_DIR'" >> $SCRIPT
|
|
|
|
echo "python ./fgo" >> $SCRIPT
|
2015-03-07 02:28:55 +08:00
|
|
|
chmod 755 $SCRIPT
|
2011-08-25 02:34:30 +08:00
|
|
|
fi
|
2011-02-07 03:44:11 +08:00
|
|
|
|
2012-11-23 03:38:51 +08:00
|
|
|
#######################################################
|
|
|
|
# FGx
|
|
|
|
#######################################################
|
|
|
|
FGX_INSTALL_DIR=fgx
|
2019-04-21 14:39:34 +08:00
|
|
|
INSTALL_DIR_FGX="$INSTALL_DIR/$FGX_INSTALL_DIR"
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
2018-09-26 15:55:06 +08:00
|
|
|
if _elementIn "FGX" "${WHATTOBUILD[@]}"; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "****************************************"
|
|
|
|
_printLog "***************** FGX ******************"
|
|
|
|
_printLog "****************************************"
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
mkdir -p "fgx"
|
|
|
|
cd "$CBD"/fgx
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
_gitDownload FGX
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
_gitUpdate "${COMPONENT_BRANCH[FGX]}"
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
cd "$CBD"/fgx/src/
|
|
|
|
#Patch in order to pre-setting paths
|
|
|
|
cd resources/default/
|
|
|
|
cp x_default.ini x_default.ini.orig
|
|
|
|
cat x_default.ini | sed s/\\/usr\\/bin\\/fgfs/INSTALL_DIR_FGXMY_SLASH_HERE..MY_SLASH_HEREfgfsMY_SLASH_HEREbinMY_SLASH_HEREfgfs/g > tmp1
|
|
|
|
cat tmp1 | sed s/\\/usr\\/share\\/flightgear/INSTALL_DIR_FGXMY_SLASH_HERE..MY_SLASH_HEREfgfsMY_SLASH_HEREfgdata/g > tmp2
|
|
|
|
cat tmp2 | sed s/\\/usr\\/bin\\/terrasync/INSTALL_DIR_FGXMY_SLASH_HERE..MY_SLASH_HEREfgfsMY_SLASH_HEREbinMY_SLASH_HEREterrasync/g > tmp3
|
|
|
|
cat tmp3 | sed s/\\/usr\\/bin\\/fgcom/INSTALL_DIR_FGXMY_SLASH_HERE..MY_SLASH_HEREfgcomMY_SLASH_HEREbinMY_SLASH_HEREfgcom/g > tmp4
|
|
|
|
cat tmp4 | sed s/\\/usr\\/bin\\/js_demo/INSTALL_DIR_FGXMY_SLASH_HERE..MY_SLASH_HEREfgfsMY_SLASH_HEREbinMY_SLASH_HEREjs_demo/g > tmp5
|
|
|
|
INSTALL_DIR_FGX_NO_SLASHS=$(echo "$INSTALL_DIR_FGX" | sed -e 's/\//MY_SLASH_HERE/g')
|
|
|
|
cat tmp5 | sed s/INSTALL_DIR_FGX/"$INSTALL_DIR_FGX_NO_SLASHS"/g > tmp
|
|
|
|
cat tmp | sed s/MY_SLASH_HERE/\\//g > x_default.ini
|
|
|
|
rm tmp*
|
|
|
|
|
|
|
|
cd ..
|
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
2019-04-21 14:39:34 +08:00
|
|
|
mkdir -p "$INSTALL_DIR_FGX"
|
|
|
|
cd "$INSTALL_DIR_FGX"
|
2015-03-07 02:28:55 +08:00
|
|
|
qmake ../../fgx/src
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$COMPILE" = "y" ]; then
|
2019-04-21 14:39:34 +08:00
|
|
|
cd "$INSTALL_DIR_FGX"
|
2018-10-11 18:34:25 +08:00
|
|
|
_printLog "MAKE AND INSTALL FGX"
|
|
|
|
_printLog "make $JOPTION $OOPTION"
|
2018-10-11 18:12:36 +08:00
|
|
|
make $JOPTION $OOPTION 2>&1 | _logOutput
|
2015-03-07 02:28:55 +08:00
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd "$CBD"
|
|
|
|
|
|
|
|
SCRIPT=run_fgx.sh
|
|
|
|
echo "#!/bin/sh" > $SCRIPT
|
2019-04-21 19:30:22 +08:00
|
|
|
echo "cd \"\$(dirname \"\$0\")\"" >> $SCRIPT
|
|
|
|
echo "cd '$FGX_INSTALL_DIR'" >> $SCRIPT
|
|
|
|
echo "./fgx \"\$@\"" >> $SCRIPT
|
2015-03-07 02:28:55 +08:00
|
|
|
chmod 755 $SCRIPT
|
2012-11-23 03:38:51 +08:00
|
|
|
fi
|
|
|
|
|
2011-02-07 03:44:11 +08:00
|
|
|
#######################################################
|
2015-03-07 02:28:55 +08:00
|
|
|
# ATC-PIE
|
2011-02-07 03:44:11 +08:00
|
|
|
#######################################################
|
2015-03-07 02:28:55 +08:00
|
|
|
ATCPIE_INSTALL_DIR=atc-pie
|
2019-04-21 14:39:34 +08:00
|
|
|
INSTALL_DIR_ATCPIE="$INSTALL_DIR/$ATCPIE_INSTALL_DIR"
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
2018-09-26 15:55:06 +08:00
|
|
|
if _elementIn "ATCPIE" "${WHATTOBUILD[@]}"; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "****************************************"
|
|
|
|
_printLog "**************** ATCPIE ***************"
|
|
|
|
_printLog "****************************************"
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
mkdir -p "$INSTALL_DIR_ATCPIE"
|
2019-04-21 14:39:34 +08:00
|
|
|
cd "$INSTALL_DIR_ATCPIE"
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
_gitDownload ATCPIE
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
_gitUpdate "${COMPONENT_BRANCH[ATCPIE]}"
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
cd "$CBD"
|
|
|
|
|
|
|
|
SCRIPT=run_atcpie.sh
|
|
|
|
echo "#!/bin/sh" > $SCRIPT
|
2019-04-21 19:30:22 +08:00
|
|
|
echo "cd \"\$(dirname \"\$0\")\"" >> $SCRIPT
|
|
|
|
echo "cd '$SUB_INSTALL_DIR/$ATCPIE_INSTALL_DIR'" >> $SCRIPT
|
|
|
|
echo "./ATC-pie.py \"\$@\"" >> $SCRIPT
|
2015-03-07 02:28:55 +08:00
|
|
|
chmod 755 $SCRIPT
|
2011-02-07 03:44:11 +08:00
|
|
|
fi
|
|
|
|
|
2013-07-30 10:06:20 +08:00
|
|
|
#######################################################
|
|
|
|
# OPENRADAR
|
|
|
|
#######################################################
|
|
|
|
OR_INSTALL_DIR=openradar
|
2019-04-21 14:39:34 +08:00
|
|
|
INSTALL_DIR_OR="$INSTALL_DIR/$OR_INSTALL_DIR"
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
2018-09-26 15:55:06 +08:00
|
|
|
if _elementIn "OPENRADAR" "${WHATTOBUILD[@]}"; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "****************************************"
|
|
|
|
_printLog "************** OPENRADAR ***************"
|
|
|
|
_printLog "****************************************"
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
if [ "$DOWNLOAD" = "y" ]; then
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
wget http://wagnerw.de/"${COMPONENT_BRANCH[OPENRADAR]}" -O OpenRadar.zip
|
2015-03-07 02:28:55 +08:00
|
|
|
cd install
|
|
|
|
unzip -o ../OpenRadar.zip
|
|
|
|
cd ..
|
|
|
|
fi
|
|
|
|
|
|
|
|
SCRIPT=run_openradar.sh
|
|
|
|
echo "#!/bin/sh" > $SCRIPT
|
2019-04-21 19:30:22 +08:00
|
|
|
echo "cd \"\$(dirname \"\$0\")\"" >> $SCRIPT
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "cd install/OpenRadar" >> $SCRIPT
|
|
|
|
echo "java -jar OpenRadar.jar" >> $SCRIPT
|
|
|
|
chmod 755 $SCRIPT
|
2013-07-30 10:06:20 +08:00
|
|
|
fi
|
|
|
|
|
2011-02-07 03:44:11 +08:00
|
|
|
#######################################################
|
2014-05-20 19:06:19 +08:00
|
|
|
# TERRAGEAR
|
|
|
|
#######################################################
|
|
|
|
|
|
|
|
TG_INSTALL_DIR=terragear
|
2019-04-21 14:39:34 +08:00
|
|
|
INSTALL_DIR_TG="$INSTALL_DIR/$TG_INSTALL_DIR"
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
2018-09-26 15:55:06 +08:00
|
|
|
if _elementIn "TERRAGEAR" "${WHATTOBUILD[@]}"; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "****************************************"
|
|
|
|
_printLog "*************** TERRAGEAR **************"
|
|
|
|
_printLog "****************************************"
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
mkdir -p "terragear"
|
|
|
|
cd "$CBD"/terragear
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
_gitDownload TERRAGEAR
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
_gitUpdate "${COMPONENT_BRANCH[TERRAGEAR]}"
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
cd "$CBD"
|
|
|
|
mkdir -p build/terragear
|
|
|
|
cd "$CBD"/build/terragear
|
|
|
|
rm -f CMakeCache.txt
|
2019-04-27 05:01:58 +08:00
|
|
|
"$CMAKE" -DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
|
2015-03-07 02:28:55 +08:00
|
|
|
-DCMAKE_INSTALL_PREFIX:PATH="$INSTALL_DIR_TG" \
|
|
|
|
-DCMAKE_PREFIX_PATH="$INSTALL_DIR_SIMGEAR;$INSTALL_DIR_CGAL" \
|
2018-10-11 18:12:36 +08:00
|
|
|
../../terragear/ 2>&1 | _logOutput
|
2015-03-07 02:28:55 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
_make terragear
|
|
|
|
|
|
|
|
cd "$CBD"
|
|
|
|
echo "#!/bin/sh" > run_tg-construct.sh
|
2019-04-21 19:30:22 +08:00
|
|
|
echo "cd \"\$(dirname \"\$0\")\"" >> run_tg-construct.sh
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "cd install/terragear/bin" >> run_tg-construct.sh
|
2019-04-21 19:30:22 +08:00
|
|
|
echo "export LD_LIBRARY_PATH='$INSTALL_DIR_SIMGEAR/lib'\"\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH}\"" \
|
2018-10-24 17:56:39 +08:00
|
|
|
>> run_tg-construct.sh
|
2019-04-21 19:30:22 +08:00
|
|
|
echo "./tg-construct \"\$@\"" >> run_tg-construct.sh
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
echo "#!/bin/sh" > run_ogr-decode.sh
|
2019-04-21 19:30:22 +08:00
|
|
|
echo "cd \"\$(dirname \"\$0\")\"" >> run_ogr-decode.sh
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "cd install/terragear/bin" >> run_ogr-decode.sh
|
2019-04-21 19:30:22 +08:00
|
|
|
echo "export LD_LIBRARY_PATH='$INSTALL_DIR_SIMGEAR/lib'\"\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH}\"" \
|
2018-10-24 17:56:39 +08:00
|
|
|
>> run_ogr-decode.sh
|
2019-04-21 19:30:22 +08:00
|
|
|
echo "./ogr-decode \"\$@\"" >> run_ogr-decode.sh
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
echo "#!/bin/sh" > run_genapts850.sh
|
2019-04-21 19:30:22 +08:00
|
|
|
echo "cd \"\$(dirname \"\$0\")\"" >> run_genapts850.sh
|
2015-03-07 02:28:55 +08:00
|
|
|
echo "cd install/terragear/bin" >> run_genapts850.sh
|
2019-04-21 19:30:22 +08:00
|
|
|
echo "export LD_LIBRARY_PATH='$INSTALL_DIR_SIMGEAR/lib'\"\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH}\"" \
|
2018-10-24 17:56:39 +08:00
|
|
|
>> run_genapts850.sh
|
2019-04-21 19:30:22 +08:00
|
|
|
echo "./genapts850 \"\$@\"" >> run_genapts850.sh
|
2019-04-30 04:28:21 +08:00
|
|
|
|
|
|
|
chmod 755 run_tg-construct.sh run_ogr-decode.sh run_genapts850.sh
|
2014-05-20 19:06:19 +08:00
|
|
|
fi
|
|
|
|
_logSep
|
|
|
|
|
|
|
|
#######################################################
|
|
|
|
# TERRAGEAR GUI
|
|
|
|
#######################################################
|
|
|
|
|
|
|
|
TGGUI_INSTALL_DIR=terrageargui
|
2019-04-21 14:39:34 +08:00
|
|
|
INSTALL_DIR_TGGUI="$INSTALL_DIR/$TGGUI_INSTALL_DIR"
|
2014-05-20 19:06:19 +08:00
|
|
|
cd "$CBD"
|
2018-09-26 15:55:06 +08:00
|
|
|
if _elementIn "TERRAGEARGUI" "${WHATTOBUILD[@]}"; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "****************************************"
|
|
|
|
_printLog "************* TERRAGEAR GUI ************"
|
|
|
|
_printLog "****************************************"
|
2015-03-07 02:28:55 +08:00
|
|
|
|
|
|
|
mkdir -p "terrageargui"
|
|
|
|
cd "$CBD"/terrageargui
|
download_and_compile.sh: give control over protocol and username for 'git clone'
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.
2018-09-26 01:30:53 +08:00
|
|
|
_gitDownload TERRAGEARGUI
|
download_and_compile.sh: add options --lts and --component-branch
Option --lts builds the latest LTS release of components SIMGEAR, FGFS
and DATA. The presence of option -s or --lts affects the version or
branch checked out for each component; however, passing none of these
options doesn't imply that development versions will be used for
everything---this selects development versions for FlightGear and
possibly closely-related software, but for the rest, we aim at something
reasonably usable, as in "current release".
For each component, the default version selected depending on whether
-s, --lts or none of these was given, can be overridden using
'--component-branch COMPONENT=BRANCH' (without the quotes). For
instance:
download_and_compile.sh --lts \
--component-branch OSG=OpenSceneGraph-3.6 SIMGEAR FGFS DATA OSG
will build the latest LTS release of FlightGear against the
OpenSceneGraph-3.6 branch of OpenSceneGraph. Option --component-branch
may be used several times and always overrides the defaults determined
by the presence or absence of -s or -lts. Thus, the relative order of
-s, --lts and --component-branch options does not matter.
This commit also adds text to the standard output and log file that
tells users:
- which "suite" they have selected (default=next, -s or --lts) and
what this implies;
- which branch will be checked out for each component (i.e., after
the overrides from all --component-branch options passed have been
applied).
It is nonsensical to provide both -s and --lts in the same invocation,
but the last one wins.
2020-06-22 23:57:32 +08:00
|
|
|
_gitUpdate "${COMPONENT_BRANCH[TERRAGEARGUI]}"
|
2013-11-25 05:57:21 +08:00
|
|
|
|
2015-03-07 02:28:55 +08:00
|
|
|
if [ "$RECONFIGURE" = "y" ]; then
|
|
|
|
cd "$CBD"
|
|
|
|
mkdir -p build/terrageargui
|
|
|
|
cd "$CBD"/build/terrageargui
|
|
|
|
rm -f ../../terrageargui/CMakeCache.txt
|
2016-10-21 05:42:18 +08:00
|
|
|
"$CMAKE" -DCMAKE_BUILD_TYPE="Release" \
|
2015-03-07 02:28:55 +08:00
|
|
|
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR_TGGUI" \
|
2018-10-11 18:12:36 +08:00
|
|
|
../../terrageargui 2>&1 | _logOutput
|
2015-03-07 02:28:55 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
_make terrageargui
|
|
|
|
|
|
|
|
cd "$CBD"
|
2019-04-30 04:28:21 +08:00
|
|
|
|
|
|
|
cfgFile="$HOME/.config/TerraGear/TerraGearGUI.conf"
|
|
|
|
if [ ! -f "$cfgFile" ]; then
|
|
|
|
_log "Writing a default config file for TerraGear GUI: $cfgFile"
|
2015-03-07 02:28:55 +08:00
|
|
|
mkdir -p ~/.config/TerraGear
|
2019-04-30 04:28:21 +08:00
|
|
|
echo "[paths]" > "$cfgFile"
|
|
|
|
echo "terragear=$INSTALL_DIR_TG" >> "$cfgFile"
|
2019-05-02 07:36:00 +08:00
|
|
|
echo "flightgear=$INSTALL_DIR_FGFS/fgdata" >> "$cfgFile"
|
2015-03-07 02:28:55 +08:00
|
|
|
fi
|
|
|
|
|
2019-04-30 04:28:21 +08:00
|
|
|
SCRIPT=run_terrageargui.sh
|
|
|
|
_log "Creating $SCRIPT"
|
|
|
|
cat >"$SCRIPT" <<EndOfScriptText
|
|
|
|
#! /bin/sh
|
|
|
|
cd "\$(dirname "\$0")"
|
|
|
|
cd '$SUB_INSTALL_DIR/$TGGUI_INSTALL_DIR/bin'
|
|
|
|
export LD_LIBRARY_PATH='$INSTALL_DIR_SIMGEAR/lib'"\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH}"
|
|
|
|
./TerraGUI "\$@"
|
|
|
|
EndOfScriptText
|
|
|
|
chmod 755 "$SCRIPT"
|
2015-03-07 02:28:55 +08:00
|
|
|
fi
|
2013-11-25 05:57:21 +08:00
|
|
|
|
2017-10-03 13:58:31 +08:00
|
|
|
# Print optional package alternatives that didn't match (this helps with
|
|
|
|
# troubleshooting)
|
|
|
|
if [[ ${#UNMATCHED_OPTIONAL_PKG_ALTERNATIVES[@]} -gt 0 ]]; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog
|
|
|
|
_printLog "The following optional package alternative(s) didn't match:"
|
|
|
|
_printLog
|
2017-10-03 13:58:31 +08:00
|
|
|
|
2018-10-11 17:47:39 +08:00
|
|
|
for alt in "${UNMATCHED_OPTIONAL_PKG_ALTERNATIVES[@]}"; do
|
|
|
|
_printLog " $alt"
|
|
|
|
done
|
2017-10-03 13:58:31 +08:00
|
|
|
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog
|
|
|
|
_printLog "This could explain missing optional features in FlightGear" \
|
|
|
|
"or other software"
|
|
|
|
_printLog "installed by $PROGNAME."
|
2020-06-30 21:01:40 +08:00
|
|
|
elif [[ ${#WHATTOBUILD[@]} -gt 0 ]]; then
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "All optional package alternatives have found a matching package."
|
2020-06-30 21:01:40 +08:00
|
|
|
# else we were only running the “cleanup” routine
|
2017-10-03 13:58:31 +08:00
|
|
|
fi
|
|
|
|
|
2020-06-30 21:01:40 +08:00
|
|
|
if [[ ${#WHATTOBUILD[@]} -gt 0 ]]; then
|
|
|
|
_printLog
|
|
|
|
fi
|
2018-10-11 17:47:39 +08:00
|
|
|
_printLog "$PROGNAME has finished to work."
|