r3983: Made --top, --bottom, --left and --right work as before. -b is now short
[rox-filer.git] / ROX-Filer / AppRun
blob763418ff1145f1fdc1ce194a8ff1129be72e03b8
1 #!/bin/sh
3 PROG=ROX-Filer
5 APP_DIR=`dirname "$0"`
6 APP_DIR=`cd "$APP_DIR";pwd`; export APP_DIR
8 if [ "x$PLATFORM" = x ]; then
9 ARCH=`uname -m`
10 case "$ARCH" in
11 i?86) ARCH=ix86 ;;
12 esac
14 PLATFORM=`uname -s`-"$ARCH" export PLATFORM
17 DEBUGGER=""
19 case $1 in
20 --debug) shift ;
21 if [ "$#" = 0 ] ; then
22 DEBUGGER="gdb --args" ; DEBUG_OPTIONS="-n --g-fatal-warnings"
23 else
24 DEBUGGER="gdb"
25 fi ;;
26 --valgrind) shift ; DEBUGGER="valgrind --num-callers=8";;
27 --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";;
28 --calltree) shift ; DEBUGGER="calltree";;
29 --leaks) shift ; DEBUGGER="valgrind --num-callers=8 --leak-check=yes";;
30 --compile)
31 shift
32 if [ ! -d "$APP_DIR/src" ] ; then
33 echo "ERROR from $0:" >&2
34 echo "Cannot compile - source code is missing!" >&2
35 exit 1
37 echo "Compiling $APP_DIR... please wait..." >&2
38 if [ ! -x "$APP_DIR/src/configure" ]; then
39 echo "No 'configure' script! Trying to run autoconf..."
40 (cd "$APP_DIR/src"; autoconf)
42 BUILDDIR="$APP_DIR/build"
43 [ ! -d "$BUILDDIR" ] && mkdir "$BUILDDIR"
44 rm -f "$BUILDDIR/config.cache"
45 rm -f "$APP_DIR/src/config.h" # (for upgrading)
46 cd "$BUILDDIR" && "$APP_DIR/src/configure" --enable-rox \
47 --with-platform="$PLATFORM" \
48 "$@" \
49 && make clean && make && echo Done >&2 && exit 0
50 echo Compile failed >&2
51 echo Press Return... >&2
52 read WAIT
53 exit 1
54 esac
56 if [ -z "$XDG_DATA_DIRS" -a -d /uri/0install/zero-install.sourceforge.net ]; then
57 # Try to get MIME database through Zero Install, if possible
58 0refresh zero-install.sourceforge.net/share/mime 2003-08-07
59 XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/uri/0install/zero-install.sourceforge.net/share
60 export XDG_DATA_DIRS
63 BIN="$APP_DIR/$PLATFORM/$PROG"
65 if [ -x "$BIN" ]; then
66 exec $DEBUGGER "$BIN" $DEBUG_OPTIONS "$@"
67 else
68 echo "ERROR from $0:" >&2
69 echo "I cannot find an executable file for your host type ($PLATFORM)." >&2
70 echo "Trying to compile..." >&2
71 if [ -n "$DISPLAY" ]; then
72 xterm -e "$0" --compile
73 else
74 "$0" --compile
76 if [ -x "$BIN" ]; then
77 exec "$BIN" "$@"
79 exit 1