File: AppRun

package info (click to toggle)
roxterm 1.11.1-1.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 2,468 kB
  • ctags: 1,057
  • sloc: ansic: 10,482; sh: 9,085; xml: 305; makefile: 166
file content (94 lines) | stat: -rwxr-xr-x 2,203 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#!/bin/sh

PROG=roxterm

APP_DIR=`dirname "$0"`
APP_DIR=`cd "$APP_DIR";pwd`; export APP_DIR
APPRUN="${APP_DIR}/AppRun"

MAINTAIN="--enable-maintainer-mode"
if [ -f "$APP_DIR/tony" ]; then
	#DEV_LDFLAGS="-L/usr/lib/debug -lmcheck $LDFLAGS"
	DEV_LDFLAGS="-L/usr/lib/debug $LDFLAGS"
	DEV_CFLAGS="-g -Wall -Wwrite-strings -Wunused"
	PREFIX="--prefix=/usr/local/stow/roxterm"
	#TABDRAG="--enable-gtk-native-tab-dragging"
	ulimit -c unlimited
	#DBGENV='G_SLICE=always-malloc'
else
	LOGFILE=
fi

DEBUGGER=""

case $1 in
	--debug) shift
		if [ "$#" = 0 ] ; then
			DEBUGGER="gdb --args" ; DEBUG_OPTIONS="-n --g-fatal-warnings"
		else
			DEBUGGER="gdb"
		fi ;;
	--config) shift ; PROG=roxterm-config ;;
	--valgrind) shift ;
		DEBUGGER="valgrind --freelist-vol=50000000"
		DBGENV='G_SLICE=always-malloc'
		;;
	--leaks) shift ;
		DEBUGGER="valgrind --freelist-vol=50000000 --leak-check=yes"
		DBGENV='G_SLICE=always-malloc'
		;;
	--compile)
		shift
		if [ ! -d "$APP_DIR/src" ] ; then
			echo "ERROR from $APPRUN:" >&2
			echo "Cannot compile - source code is missing!" >&2
			exit 1
		fi
		echo "Compiling $APP_DIR... please wait..." >&2
		cd "$APP_DIR"
		if [ ! -x configure ] ; then
			echo "No configure script; running bootstrap.sh"
			./bootstrap.sh
		fi
		rm -f config.cache
		LDFLAGS="$DEV_LDFLAGS" CFLAGS="$DEV_CFLAGS" \
			./configure $MAINTAIN $TABDRAG "$PREFIX" "$@" && \
			make && \
			echo Done >&2 && exit 0
		echo Compile failed >&2
		echo Press Return... >&2
		read WAIT
		exit 1 ;;
esac

exitcode=1

if [ -d "${APP_DIR}/src" ] ; then
	BIN="${APP_DIR}/src/$PROG"
	if [ ! -x "$BIN" ]; then
		echo "ERROR from $APPRUN:" >&2
		echo "I cannot find an executable file for your host type ($PLATFORM)." >&2
		echo "Trying to compile..." >&2
		if [ -n "$DISPLAY" ] && echo $TERM | egrep -q -v 'term|rxvt' ; then
			xterm -e "$APPRUN" --compile
		else
			"$APPRUN" --compile
		fi
	fi
else
	old_ifs="$IFS"
	IFS=':'
	for i in $PATH ; do
		BIN="$i/$PROG"
		[ -x "$BIN" ] && exec $DEBUGGER "$BIN" "$@"
	done
	IFS="$old_ifs"
fi
if [ -x "$BIN" ]; then
	exitcode=0
	[ -n "$DBGENV" ] && export $DBGENV
	exec $DEBUGGER "$BIN" "--appdir=$APP_DIR" "$@"
else
	echo "No roxterm executable found" >&2
fi
exit $exitcode