Commit Graph

151 Commits

Author SHA1 Message Date
Florent Rougon
d8a16058bf download_and_compile.sh: remove some unnecessary quoting
Only in a few "crowded" places where this improves readability. Note
that in these cases, the quote removal does *not* prevent the parameter
values from containing spaces, tabs or newlines.
2022-12-15 23:10:13 +01:00
Florent Rougon
5e6276bd30 download_and_compile.sh: improve the --help output
Reorder options (most basic and important options first; related options
together; experimental or deprecated options last). Explain a bit more
in some cases. Use the https protocol in the URL of the FlightGear wiki.
2022-12-15 22:27:01 +01:00
Florent Rougon
fe33acae74 download_and_compile.sh: add option --override-repo
This option allows one to override the repository from which a given
component is to be cloned (it doesn't do anything when the repository
for a component is simply updated).

Example that downloads OSG 3.4.2 from James' repository (it has
FlightGear-specific patches applied):

  download_and_compile.sh -j$(nproc) -s --cleanup \
    --override-repo OSG=GitHub:github.com/zakalawe/osg.git \
    --component-branch OSG=fgfs-342-1 SIMGEAR FGFS DATA OSG
2022-12-15 22:18:12 +01:00
Florent Rougon
aa17379ae0 download_and_compile.sh: simplify the definition of _usage() 2022-12-15 22:17:42 +01:00
Florent Rougon
5e71ae60fe download_and_compile.sh: minor change to the --help output
Amend wording to avoid confusion (some people interpret "latest release"
as meaning "development branch"; use "latest stable release" to avoid
this confusion).
2022-12-05 18:23:07 +01:00
Florent Rougon
7469b39cad download_and_compile.sh: changes to the generated scripts
The first goal of this commit was to ensure that the LD_LIBRARY_PATH
setting performed in some of the generated scripts uses absolute paths,
otherwise if a process (such as ctest) changes the current directory
before starting an executable that needs our LD_LIBRARY_PATH setting, we
can have problems (thanks to Patrick Callahan for the report).

Some refactoring of the automated script generation plus a few other
fixes concerning these scripts were done along the way (use here
documents for better readability; don't use 'echo' with options as this
is non-portable; etc.).
2022-11-30 22:13:25 +01:00
Florent Rougon
1e65f0e144 download_and_compile.sh: little optimization 2022-11-25 09:56:14 +01:00
Florent Rougon
14e27756b1 download_and_compile.sh: new generated wrapper script named 'run'
This new script is created by download_and_compile.sh in the same way as
run_fgfs.sh and friends. It changes the current directory to $d/install,
where $d is the directory containing the 'run' script. Then it sets
LD_LIBRARY_PATH in the same way as run_fgfs.sh. Finally, it runs the
command formed of all arguments passed to it.

This can be used for instance to run SimGear tests with the proper
LD_LIBRARY_PATH setting: assuming SimGear has been built by
download_and_compile.sh and you are in the directory from which
download_and_compile.sh was run, you can do:

  cd build/simgear
  ../../run ctest --output-on-failure
2022-11-25 09:03:50 +01:00
Florent Rougon
11949b1e8e download_and_compile.sh: add core file support to run_fgfs_debug.sh
Usage of run_fgfs_debug.sh is slightly changed: you now need to put a
'--' argument before all arguments that you want to pass to fgfs. For
instance:

  ./run_fgfs_debug.sh -- --aircraft=ufo --airport=PMDY

There is also a new option: -c, alias --core-file. This option allows
one to start gdb from an existing fgfs core dump, with appropriate
LD_LIBRARY_PATH setting and --directory options; in this case, don't
specify any fgfs argument (the fgfs arguments used when the core file
was produced have been recorded therein). Example:

  ./run_fgfs_debug.sh -c /path/to/core

All this is documented with './run_fgfs_debug.sh --help'.
2022-11-25 00:38:21 +01:00
Florent Rougon
0ee880c5dc download_and_compile.sh: install libqt5quick5 if available
This should solve a bug where some launcher icons aren't displayed
properly. So far, we had an optional dependency on qml-module-qtquick2,
which depends on libqt5quick5 or libqt5quick5-gles, however only the
former ensures a proper display in the built-in launcher (when
libqt5quick5-gles is installed instead of libqt5quick5, users see black
squares instead of the icons on the left).
2022-10-23 10:08:13 +02:00
Julian Smith
52c0efedb7 download_and_compile.sh: also install ffmpeg libraries for video encoding support. 2021-12-27 10:31:47 +00:00
Florent Rougon
aaf52f0628 download_and_compile.sh: accept qtchooser as an alternative to qt5-default
This should be more user-friendly, as qt5-default isn't part of recent
Debian/Ubuntu distros.

List discussion: https://sourceforge.net/p/flightgear/mailman/message/37281536/
2021-05-13 14:29:49 +02:00
Florent Rougon
79642b4d29 download_and_compile.sh: add dependency liblzma-dev for SIMGEAR 2021-01-09 18:53:58 +01:00
Florent Rougon
fa9550e5e7 download_and_compile.sh: don't install OSG or plib packages if these are built
If the OSG component has been specified, don't attempt to install a
libopenscenegraph...-dev package from the distro. Ditto for the
libplib-dev package when the PLIB component has been specified.
2020-11-16 21:24:07 +01:00
Florent Rougon
4a82d5e8bc download_and_compile.sh: qml-module-qtquick-controls2 for everything but --old-lts
Require qml-module-qtquick-controls2 when building 'next', or using -s,
or --lts.
2020-11-16 15:06:09 +01:00
Florent Rougon
c6dde7ecc5 download_and_compile.sh: make --lts use release/2020.3 and add --old-lts
For SimGear, FlightGear and FGData (i.e., the SIMGEAR, FGFS and DATA
components in download_and_compile.sh-speak), option --lts now means
release/2020.3 and the new option --old-lts means release/2018.3.
2020-11-14 19:08:15 +01:00
Florent Rougon
c731caa23d download_and_compile.sh: rename --sg-cmake-args to --sg-cmake-arg and --fg-cmake-args to --fg-cmake-arg
This is more logical this way, since every use of such an option
specifies exactly *one* additional argument to pass to CMake.
2020-10-20 10:29:41 +02:00
Florent Rougon
2618144e24 download_and_compile.sh: add support for --sg-cmake-args and --fg-cmake-args
Each of these options may be passed multiple times. The advantage over
the previous interface (environment variables SG_CMAKEARGS and
FG_CMAKEARGS) is that the new interface allows one to pass arguments
containing spaces to CMake, for instance:

  --sg-cmake-args='-DCMAKE_CXX_FLAGS=-Wno-deprecated-declarations -Wall'

(the single quotes here would be interpreted by the user's shell, and
removed before download_and_compile.sh can see them). Setting the
environment variables SG_CMAKEARGS and FG_CMAKEARGS should still work as
before but is now deprecated.

The implementation uses Bash arrays named SG_CMAKE_ARGS and
FG_CMAKE_ARGS, but in order to avoid confusing users about the
deprecated variable names, the log file continues to print
'SG_CMAKEARGS=...' and 'FG_CMAKEARGS=...' (note the different use of
underscores in the names).
2020-10-20 01:39:27 +02:00
Florent Rougon
56ae978017 download_and_compile.sh: allow '_', '-' and '.' in usernames
With this commit, option --git-clone-site-params accepts '_', '-' and
'.' in usernames. Thanks to Keith Paterson for the report.
2020-09-02 11:06:05 +02:00
Florent Rougon
e78b239597 download_and_compile.sh: require qml-module-qtquick-controls2 when building next 2020-07-14 12:32:27 +02:00
Florent Rougon
cf95fc3530 download_and_compile.sh: more reliable test in _gitDownload()
Before this change, using OSG with download_and_compile.sh several times
in the same directory would fail because the upstream repo for OSG has
none of README, README.txt and README.rst at top-level (it has a
README.md). Testing for the .git dir is definitely more reliable.
2020-07-03 14:21:05 +02:00
Florent Rougon
25d9d717b5 download_and_compile.sh: no component and only --cleanup -> only do cleanup
If --cleanup is used and no component has been specified on the command
line, run the cleanup routine but don't process any component: no
download, no compilation, no installation. Previously(*), this used to
process the default set of components: SIMGEAR FGFS and DATA.

Therefore, if all you want to do is to remove compiled and installed
files, you can now run:

  download_and_compile.sh --cleanup

(*) During less than 24 hours, as --cleanup was added yesterday.
2020-06-30 15:11:02 +02:00
Florent Rougon
aa563cb5cb download_and_compile.sh: refactoring
Move several chunks of code to their own function. This will make the
code easier to follow when largish chunks are executed only under
certain conditions.

Minor changes unrelated to the refactoring:
  - make _logSep print a larger separator (78 chars);
  - write the SELECTED_SUITE at the top of the log file.
2020-06-30 15:11:02 +02:00
Florent Rougon
9f710a8c84 download_and_compile.sh: add safety net in _cleanup()
Make sure $INSTALL_DIR is really a harmless 'install' directory before
calling 'rm -rf' on it.
2020-06-29 16:07:09 +02:00
Florent Rougon
3099633675 download_and_compile.sh: fix the order of operations in _gitUpdate()
_gitUpdate() used to call 'git pull' then 'git checkout'. If the latter
command really did a branch switch, this could leave the local branch
behind its remote counterpart (that was hopefully fetched by the
'git pull'). From now on, we do:

  git fetch origin
  git checkout --force "$branch"
  git pull --rebase

(the --force option was already there before in the form of -f). This
way, we can be sure that the local branch we check out is up-to-date
when the function returns.

Also replace short options by long ones for better readability of the
code, and use Bash's [[ ... ]] conditional construct instead of [ ... ]
for more efficiency---I think.

Note: 'git stash save' is documented as deprecated in favor of
      'git stash push', however the latter appears to have been
      introduced in 2017, therefore I believe it is too early to use it
      in download_and_compile.sh.
2020-06-29 15:23:53 +02:00
Florent Rougon
21c13c0886 download_and_compile.sh: add option --cleanup
This option recursively deletes build and install directories, but
preserves FGData if present (FGData is in
<base_dir>/install/flightgear/fgdata, hence the need to take special
care of it).

There is currently no way to trigger this cleanup routine whithout
pretending to act on at least one component, since "no components
specified" implies "SIMGEAR FGFS DATA". That said, using -pn -dn -rn -cn
with one of the components you already have should be close enough to
"only do the cleanup".
2020-06-29 14:23:18 +02:00
Florent Rougon
0972e57a5b download_and_compile.sh: use the set_ld_library_path variable
This improves readability a little bit. set_ld_library_path was defined
but unused since commit a5e4c47f. Note that this variable must be set
*after* the OpenBSD-specific code block because its definition relies on
the value of 'paths', which is modified in said block.
2020-06-23 19:22:45 +02:00
Florent Rougon
3bce994ea8 download_and_compile.sh: prompt when building 'next' and logfile not already present
This ensures that users building 'next' have seen the message that warns
about possible instability and are aware of the other options (--lts for
the latest Long Term Support release, -s for the latest release).

The default answer is to continue. If --non-interactive has been given,
the prompt is skipped and download_and_compile.sh proceeds as usual.

This commit also adds _yes_no_prompt() which makes more sense than
_yes_no_quit_prompt() here, since the 'no' answer implies that the user
wants to quit.
2020-06-23 11:10:25 +02:00
Florent Rougon
fdf98d0ef3 download_and_compile.sh: consistent indentation for long options in _usage() 2020-06-22 20:38:47 +02:00
Florent Rougon
041dc98c9c download_and_compile.sh: don't hardcode the address of the FG repo
When doing the 'git ls-remote' request to find the latest FG release,
d&c was using a hardcoded address for the FG repo. Use
${REPO_ADDRESS[FGFS]} instead.
2020-06-22 20:05:26 +02:00
Florent Rougon
1f3f4ea353 download_and_compile.sh: only print COMPONENT_BRANCH[foo]=bar for built components
Only those components present in WHATTOBUILD are really interesting when
printing and logging COMPONENT_BRANCH[foo]=bar. Inter-component deps are
taken into account before doing that, since they may add components to
WHATTOBUILD.
2020-06-22 19:13:58 +02:00
Florent Rougon
c4c8f0a099 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 18:26:39 +02:00
Florent Rougon
3810a31230 download_and_compile.sh: improve user-interaction
Since the prompt is repeated by _yes_no_quit_prompt() every time an
invalid answer is given, a short sentence is better than the empty
string.
2020-05-24 16:31:26 +02:00
Florent Rougon
00710497b0 download_and_compile.sh: add missing quoting
This is needed because $answer will be empty in case the default $2 is
empty and the user hits Enter at the prompt.
2020-05-24 11:39:27 +02:00
Florent Rougon
420034d5b5 download_and_compile.sh: make initial cloning of FGData easy and secure
Because cloning FGData from SourceForge using https does not work (this
has been the case for *years*) whereas normal updates of an existing
clone do work, and so does cloning the repository from its official
GitLab mirror using https, this commits implements a special case in
_gitDownload():

  If the assembled clone URL is
  <https://git.code.sf.net/p/flightgear/fgdata>, then ask the user if he
  agrees to automatically clone FGData from GitLab and arrange the
  repository setup to fetch subsequent updates from SourceForge. This
  should be fine because <https://gitlab.com/flightgear/fgdata> is an
  official mirror of FGData. The default answer is thus to do so. It is
  automatically chosen when download_and_compile.sh is called with
  --non-interactive (new option).

This implies that the initial use of download_and_compile.sh is again as
easy as subsequent ones.

This commits also adds the utility function _yes_no_quit_prompt() to
repeatedly ask a question ($1) until a valid answer has been provided.
The function automatically uses the default answer ($2) if
--non-interactive has been passed to download_and_compile.sh. See the
“discussion” at
<https://sourceforge.net/p/flightgear/mailman/message/37017469/>.
2020-05-24 11:14:36 +02:00
Florent Rougon
fa0dcb5d4d download_and_compile.sh: add libssl-dev as mandatory dep for CMake
Unless SSL support is turned off, libssl-dev is needed to build CMake.
Thanks to Jeff Davis for the report.
2020-05-01 17:39:46 +02:00
Florent Rougon
ac504c70a2 download_and_compile.sh: fix typo in help text 2020-04-25 11:17:56 +02:00
Florent Rougon
2bb86ee6ea download_and_compile.sh: update address and branch for CMake
- The old URL for CMake's Git repository doesn't support https anymore;
  update it to match the one given at <https://cmake.org/>.

- Build the 'release' branch rather than 'master':
  download_and_compile.sh is not meant for CMake hackers!
2020-04-25 11:17:56 +02:00
Julian Smith
a2eb0d7b4c download_and_compile.sh: added --compositor option. 2020-03-24 22:21:01 +00:00
Julian Smith
a5e4c47f1d download_and_compile.sh: improved generation of run_fgfs*.sh scripts.
Use common code for run_fgfs.sh and run_fgfs_debug.sh. If OpenBSD, also add a
ulimit -d command to increase data segment size.
2019-09-04 13:35:30 +01:00
Julian Smith
9804df24a1 download_and_compile.sh: Added support for building fgfs on OpenBSD.
Added support for building zlib, because current openbsd-6.5's zlib is too old.

If OpenBSD:
    Default to not attempting to update or download packages - for now packages
    have to be installed manually with pkg_add.

    Use gnugetopt.

    Use ZLIB build for simgear and fgfs.

    For fgfs, use -DENABLE_QT=OFF -DENABLE_FGCOM=OFF.

    For run_fgfs_debug.sh, use egdb because default gdb is too old.
2019-09-04 13:34:27 +01:00
Florent Rougon
bad115cac0 download_and_compile.sh: add libopenal-dev as mandatory dependency of SimGear
Thanks to Clm76 for the report.
2019-07-06 12:19:42 +02:00
Florent Rougon
696829a260 download_and_compile.sh: add optional dependency on libevent-dev
This is needed for swift support (thanks to wkitty42 for the report).
2019-05-25 21:28:36 +02:00
Florent Rougon
ecd4b9aab3 download_and_compile.sh: fix path in generated default TerraGearGUI.conf
The 'flightgear' path in ~/.config/TerraGear/TerraGearGUI.conf is
supposed to point to $FG_ROOT, not to the FlightGear repository...
2019-05-02 01:36:00 +02:00
Florent Rougon
882ab6ae59 download_and_compile.sh: small fixes for TerraGear and TerraGear GUI
- make all generated scripts executable;
- use correct path for 'terragear' in the generated default config file
  ~/.config/TerraGear/TerraGearGUI.conf (not the 'bin' subdirectory);
- add default for the 'flightgear' path in the same file;
- don't write temporary TerraGearGUI.conf in $CBD (it's useless and
  might overwrite a user-created file);
- simplify a bit (esp. using a here document for generating
  run_terrageargui.sh).
2019-04-29 22:28:21 +02:00
Florent Rougon
f3423dba60 download_and_compile.sh: respect the selected build type for TerraGear
So far, TerraGear was always built by d&c with
-DCMAKE_BUILD_TYPE="Debug". Following [1], d&c will now use, for
TerraGear, the build type selected with its -b option---which by default
is 'RelWithDebInfo'.

(In short: the 'Debug' build type has a very high negative performance
impact, therefore it should only be done intentionally.)

[1] https://sourceforge.net/p/flightgear/mailman/message/36650766/
2019-04-26 23:01:58 +02:00
Florent Rougon
39c1754a7f download_and_compile.sh: improve management of intercomponent dependencies
- new function _depends() to allow declaring intercomponent dependencies
  using a declarative style;

- declare that FGFS depends on SIMGEAR (TERRAGEAR depends on SIMGEAR as
  well, but this was already there---just not in the new, declarative
  style);

- print and log automatically-added components; when this happens, give
  a hint about --ignore-intercomponent-deps;

- log the value of IGNORE_INTERCOMPONENT_DEPS, which reflects whether
  --ignore-intercomponent-deps was used.
2019-04-26 13:14:38 +02:00
Florent Rougon
f190773790 download_and_compile.sh: use proper string comparison in _elementIn()
In Bash, the [[ <foo> == <bar> ]] and [[ <foo> = <bar> ]] conditionals
interpret <bar> as a shell globbing pattern. This wasn't desired in
_elementIn(), where the <bar> string is provided by the caller, and
might contain pattern metacharacters. Replace this conditional with a
plain string comparison made with '[' (aka, the 'test' command).
2019-04-26 10:44:03 +02:00
Florent Rougon
5b34458439 download_and_compile.sh: add option --ignore-intercomponent-deps
Add option --ignore-intercomponent-deps which does the following:

  Ignore dependencies between components (default: don't).

  Example: TERRAGEAR depends on SIMGEAR. Because of this, running
  'download_and_compile.sh TERRAGEAR' would normally update, rebuild,
  etc. both SIMGEAR and TERRAGEAR. Passing the
  --ignore-intercomponent-deps option can be useful if you want to
  update, rebuild, etc. TERRAGEAR *without* doing the same for SIMGEAR
  (for instance, if you are doing repeated TERRAGEAR builds and you know
  your SIMGEAR is already fine and up-to-date).
2019-04-26 10:30:45 +02:00
Florent Rougon
59c9a55baa download_and_compile.sh: log whether this is a "stable build"
Log "Stable build: yes" or "Stable build: no" depending on whether
option -s has been passed.
2019-04-26 09:29:50 +02:00