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
This commit is contained in:
Florent Rougon 2022-11-25 09:03:50 +01:00
parent 11949b1e8e
commit 14e27756b1

View File

@ -1621,6 +1621,17 @@ ldd "\$@"
EndOfScriptText
chmod 755 "$SCRIPT"
# Generic wrapper for whatever the user wants to run (ctest, make...)
SCRIPT=run
cat >"$SCRIPT" <<EndOfScriptText
#! /bin/sh
d="\$(dirname "\$0")/$SUB_INSTALL_DIR"
export LD_LIBRARY_PATH="\$d/simgear/lib:\$d/openscenegraph/lib:\$d/openrti/lib:\$d/plib/lib\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH}"
"\$@"
EndOfScriptText
chmod 755 "$SCRIPT"
SCRIPT=run_fgcom.sh
echo "#!/bin/sh" > $SCRIPT
echo "cd \"\$(dirname \"\$0\")\"" >> $SCRIPT