Converted README to markdown
[rox-filer.git] / ROX-Filer / AppRun
blob063ba6b1d6aa226caba3cb9e4e5847eb959f34be
1 #!/bin/sh
3 PROG=ROX-Filer
5 APP_DIR=`dirname "$0"`
6 APP_DIR=`cd "$APP_DIR";pwd`; export APP_DIR
8 DEBUGGER=""
10 if [ "x$MAKE" = x ]; then
11 MAKE=make export MAKE
14 case $1 in
15 --debug) shift ;
16 if [ "$#" = 0 ] ; then
17 DEBUGGER="gdb --args" ; DEBUG_OPTIONS="-n --g-fatal-warnings"
18 else
19 DEBUGGER="gdb"
20 fi ;;
21 --valgrind) shift ; DEBUGGER="valgrind --num-callers=8";;
22 --massif) shift ; DEBUGGER="valgrind --tool=massif --alloc-fn=g_malloc --alloc-fn=g_realloc --alloc-fn=g_malloc0 --alloc-fn=g_try_malloc --alloc-fn=g_mem_chunk_alloc";;
23 --calltree) shift ; DEBUGGER="calltree";;
24 --leaks) shift ; DEBUGGER="valgrind --num-callers=8 --leak-check=yes";;
25 --compile)
26 shift
27 if [ ! -d "$APP_DIR/src" ] ; then
28 echo "ERROR from $0:" >&2
29 echo "Cannot compile - source code is missing!" >&2
30 exit 1
32 echo "Compiling $APP_DIR... please wait..." >&2
33 if [ ! -x "$APP_DIR/src/configure" ]; then
34 echo "No 'configure' script! Trying to run autoconf..."
35 (cd "$APP_DIR/src"; autoconf)
37 BUILDDIR="$APP_DIR/build"
38 [ ! -d "$BUILDDIR" ] && mkdir "$BUILDDIR"
39 rm -f "$BUILDDIR/config.cache"
40 rm -f "$APP_DIR/src/config.h" # (for upgrading)
41 cd "$BUILDDIR" && "$APP_DIR/src/configure" "$@" \
42 && $MAKE clean && $MAKE && echo Done >&2 && exit 0
43 echo Compile failed >&2
44 echo Press Return... >&2
45 read WAIT
46 exit 1
47 esac
49 BIN="$APP_DIR/$PROG"
51 if [ -x "$BIN" ]; then
52 exec $DEBUGGER "$BIN" $DEBUG_OPTIONS "$@"
53 else
54 echo "ERROR from $0:" >&2
55 echo "I cannot find an executable binary." >&2
56 echo "Trying to compile..." >&2
57 if [ -n "$DISPLAY" ]; then
58 xterm -e "$0" --compile
59 else
60 "$0" --compile
62 if [ -x "$BIN" ]; then
63 exec "$BIN" "$@"
65 exit 1