r3399: Set Type UI.
[rox-filer.git] / ROX-Filer / AppRun
blob910ed149989659e64eacfc4f60370c0237506299
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 --compile)
28 shift
29 if [ ! -d "$APP_DIR/src" ] ; then
30 echo "ERROR from $0:" >&2
31 echo "Cannot compile - source code is missing!" >&2
32 exit 1
34 echo "Compiling $APP_DIR... please wait..." >&2
35 if [ ! -x "$APP_DIR/src/configure" ]; then
36 echo "No 'configure' script! Trying to run autoconf..."
37 (cd "$APP_DIR/src"; autoconf)
39 rm -f "$APP_DIR/src/config.cache"
40 cd "$APP_DIR/src" && ./configure --enable-rox \
41 --with-platform="$PLATFORM" \
42 "$@" \
43 && make clean && make && echo Done >&2 && exit 0
44 echo Compile failed >&2
45 echo Press Return... >&2
46 read WAIT
47 exit 1
48 esac
50 if [ -z "$XDG_DATA_DIRS" -a -d /uri/0install/zero-install.sourceforge.net ]; then
51 # Try to get MIME database through Zero Install, if possible
52 0refresh zero-install.sourceforge.net/share/mime 2003-08-07
53 XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/uri/0install/zero-install.sourceforge.net/share
54 export XDG_DATA_DIRS
57 BIN="$APP_DIR/$PLATFORM/$PROG"
59 if [ -x "$BIN" ]; then
60 exec $DEBUGGER "$BIN" $DEBUG_OPTIONS "$@"
61 else
62 echo "ERROR from $0:" >&2
63 echo "I cannot find an executable file for your host type ($PLATFORM)." >&2
64 echo "Trying to compile..." >&2
65 if [ -n "$DISPLAY" ]; then
66 xterm -e "$0" --compile
67 else
68 "$0" --compile
70 if [ -x "$BIN" ]; then
71 exec "$BIN" "$@"
73 exit 1