ember/ember.in
Erik Ogenvik a6907b29ba Handle CEGUI module subdir for relocation.
If the binary is executed from a location different from the one it's
compiled from we need to use a relative location for the CEGUI module
directory too.
2014-03-02 23:08:59 +01:00

51 lines
1.3 KiB
Bash
Executable file

#!/bin/sh -eu
# Store away original args before they are overwritten
orig_args=$@
: ${bindir:="$( cd -P "$( dirname "$0" )" && pwd )"}
: ${prefix:="$( cd -P "$( dirname "$0" )/.." && pwd )"}
homedata="$HOME/.ember"
debugging=0
while [ $# -gt 0 ]; do
case "$1" in
--home)
shift
homedata="$1"
;;
--debug)
debugging=1
;;
--help)
echo "--debug - start in debugger (requires that 'gdb' is installed)"
exec $bindir/ember.bin --help >&2
exit 1
esac
shift
done
# Rely on built-in paths for installed binaries.
# Note that because of an issue with how CEGUI 0.8.2 detects dynamic libraries we need to include the CEGUI_MODULEDIR path
if [ "$prefix" != "@prefix@" ]; then
prefix_arg="--prefix $prefix"
export LD_LIBRARY_PATH=$prefix/lib:$prefix@CEGUI_MODULE_SUBDIR@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
else
prefix_arg=
export LD_LIBRARY_PATH=@prefix@/lib:@CEGUI_MODULEDIR@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
fi
cd $bindir
if [ $debugging = 1 ] ; then
# Execute real ember binary
echo "Starting Ember in debugger...."
gdb --batch -ex "run" -ex "backtrace" -ex "quit" \
--args $bindir/ember.bin $prefix_arg --config general:logginglevel verbose --home $homedata $orig_args
else
# Execute real ember binary
echo "Starting Ember...."
exec $bindir/ember.bin $prefix_arg --home $homedata $orig_args
fi