#! /bin/sh

GXINE_ROOT="`expr match "$GXINE_ROOT" '[^/]' >/dev/null || pwd`/`dirname "$0"`"

if test "$1" = -h || test "$1" = --help; then
  cat <<EOF
Usage:
  $0 ...
  $0 --gdb ...
In the latter form, options and MRLs are passed to gdb via 'set args'.

EOF
  exec "$GXINE_ROOT/src/gxine" --help
fi

unset USEGDB
if test "$1" = --gdb; then
  USEGDB=y
  shift
fi

export GXINE_PLUGINDIR="$GXINE_ROOT/browser_plugin"
export GXINE_BINDIR="$GXINE_ROOT/src"
export GXINE_LOGODIR="$GXINE_ROOT/pixmaps"
export GXINE_PIXMAPDIR="$GXINE_ROOT/pixmaps"
export GXINE_ICONDIR="$GXINE_ROOT/pixmaps"
export GXINE_MISCDIR="$GXINE_ROOT/misc"
export GXINE_CONFDIR="$GXINE_ROOT/misc"

if test "$USEGDB" = y; then
  gdb --args "$GXINE_ROOT/src/gxine" "$@"
else
  exec "$GXINE_ROOT/src/gxine" "$@"
fi
