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.
This commit is contained in:
Julian Smith 2019-08-17 12:52:14 +01:00
parent 9804df24a1
commit a5e4c47f1d

View File

@ -1070,27 +1070,30 @@ if _elementIn "FGFS" "${WHATTOBUILD[@]}" || \
paths="../../$SIMGEAR_INSTALL_DIR/lib:../../$OSG_INSTALL_DIR/lib:../../$OPENRTI_INSTALL_DIR/lib:../../$PLIB_INSTALL_DIR/lib" paths="../../$SIMGEAR_INSTALL_DIR/lib:../../$OSG_INSTALL_DIR/lib:../../$OPENRTI_INSTALL_DIR/lib:../../$PLIB_INSTALL_DIR/lib"
gdb="gdb" gdb="gdb"
set_ld_library_path="export LD_LIBRARY_PATH='$paths'\"\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH}\""
common=""
common="${common}#!/bin/sh\n"
common="${common}cd \"\$(dirname \"\$0\")\"\n"
common="${common}cd '$SUB_INSTALL_DIR/$FGFS_INSTALL_DIR/bin'\n"
if [[ `uname` == 'OpenBSD' ]]; then if [[ `uname` == 'OpenBSD' ]]; then
# Force use of our zlib. # Force use of our zlib.
paths="$paths:../../$ZLIB_INSTALL_DIR/lib" paths="$paths:../../$ZLIB_INSTALL_DIR/lib"
# OpenBSD's base gdb is too old; `pkg_add egdb` gives one that we can use. # OpenBSD's base gdb is too old; `pkg_add egdb` gives one that we can use.
gdb="egdb" gdb="egdb"
common="${common}ulimit -d 4194304\n"
fi fi
set_ld_library_path="export LD_LIBRARY_PATH='$paths'\"\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH}\""
common="${common}export LD_LIBRARY_PATH='$paths'\"\${LD_LIBRARY_PATH:+:}\${LD_LIBRARY_PATH}\"\n"
SCRIPT=run_fgfs.sh SCRIPT=run_fgfs.sh
echo "#!/bin/sh" > $SCRIPT echo -en "$common" > $SCRIPT
echo "cd \"\$(dirname \"\$0\")\"" >> $SCRIPT
echo "cd '$SUB_INSTALL_DIR/$FGFS_INSTALL_DIR/bin'" >> $SCRIPT
echo "$set_ld_library_path" >> $SCRIPT
echo "./fgfs --fg-root=\"\$PWD/../fgdata\" \"\$@\"" >> $SCRIPT echo "./fgfs --fg-root=\"\$PWD/../fgdata\" \"\$@\"" >> $SCRIPT
chmod 755 $SCRIPT chmod 755 $SCRIPT
SCRIPT=run_fgfs_debug.sh SCRIPT=run_fgfs_debug.sh
echo "#!/bin/sh" > $SCRIPT echo -en "$common" > $SCRIPT
echo "cd \"\$(dirname \"\$0\")\"" >> $SCRIPT
echo "cd '$SUB_INSTALL_DIR/$FGFS_INSTALL_DIR/bin'" >> $SCRIPT
echo "$set_ld_library_path" >> $SCRIPT
echo "$gdb --directory='$CBD/flightgear/src' --args ./fgfs --fg-root=\"\$PWD/../fgdata\" \"\$@\"" >> $SCRIPT echo "$gdb --directory='$CBD/flightgear/src' --args ./fgfs --fg-root=\"\$PWD/../fgdata\" \"\$@\"" >> $SCRIPT
chmod 755 $SCRIPT chmod 755 $SCRIPT