-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathAppRun
executable file
·158 lines (144 loc) · 4.27 KB
/
AppRun
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
#!/bin/sh
PROG=roxterm
APP_DIR=`dirname "$0"`
APP_DIR=`cd "$APP_DIR";pwd`; export APP_DIR
APPRUN="${APP_DIR}/AppRun"
[ -d "${APP_DIR}/Help" ] || ln -nfs "docs" "${APP_DIR}/Help"
for f in AUTHORS COPYING NEWS README ; do
[ -f "$APP_DIR/Help/$f" ] || ln -nfs ../$f "$APP_DIR/Help/$f"
done
[ -f "$APP_DIR/Help/Changes" ] || ln -nfs ../debian/changeLog \
"$APP_DIR/Help/Changes"
MAINTAIN="--enable-maintainer-mode"
if [ -f "$APP_DIR/tony" ]; then
cd $APP_DIR
DEV_LDFLAGS="-L/usr/lib/debug $LDFLAGS"
ulimit -c unlimited
else
LOGFILE=
fi
PREFIX="--prefix=/usr/local/stow/roxterm"
DEBUGGER=""
DBGENV=""
FATAL=""
configure() {
if [ ! -d "$APP_DIR/src" ] ; then
echo "ERROR from $APPRUN:" >&2
echo "Cannot configure/compile - source code is missing!" >&2
exit 1
fi
echo "Configuring/compiling $APP_DIR... please wait..." >&2
mkdir -p "$APP_DIR/build"
cd "$APP_DIR/build"
export CFLAGS="-Wall -Wextra"
cmake "$@" ..
}
RECOGNISED=1
while [ "$RECOGNISED" = "1" ] ; do
case $1 in
--opt-vte)
shift
CVTELIB=~/opt/vte/lib
PCP=$CVTELIB/pkgconfig
if [ -f $CVTELIB/libvte-2.91.so -a $PCP/vte-2.91.pc ] ; then
echo "Enabling custom vte in ~/opt"
if echo "$PKG_CONFIG_PATH" | grep -qv $PCP ; then
export PKG_CONFIG_PATH="$PCP:${PKG_CONFIG_PATH}"
fi
if echo "$LD_LIBRARY_PATH" | grep -qv $CVTELIB ; then
export LD_LIBRARY_PATH="$CVTELIB:${LD_LIBRARY_PATH}"
fi
else
echo "vte not found in ~/opt"
fi
;;
--verbose)
shift
DBGENV='G_MESSAGES_DEBUG=all'
;;
--debug)
shift
DEBUGGER="gdb --args"
DBGENV='G_MESSAGES_DEBUG=all'
;;
--fatal)
shift
G_DEBUG=fatal-warnings
;;
--config)
shift
PROG=roxterm-config
;;
--valgrind)
shift
ulimit -c unlimited
DEBUGGER="valgrind --freelist-vol=50000000"
DBGENV='G_SLICE=always-malloc G_MESSAGES_DEBUG=all'
;;
--leaks)
shift
DEBUGGER="valgrind --freelist-vol=50000000 "
DEBUGGER="$DEBUGGER --leak-check=full --num-callers=80"
DBGENV='G_SLICE=always-malloc G_MESSAGES_DEBUG=all'
;;
--compile|--configure)
cmd="$1"
shift
configure -DCMAKE_BUILD_TYPE=RELWITHDEBINFO "$@" && \
( [ "$cmd" = "--compile" ] && make || true ) && \
echo Done >&2 && exit 0
echo Compile/configure failed >&2
echo Press Return... >&2
read WAIT
exit 1 ;;
# Counterparts to compile/configure with developer flags etc
--build|--develop)
cmd="$1"
shift
export CFLAGS="-Wall -Wextra"
export CC='clang'
configure -DCMAKE_BUILD_TYPE=DEBUG \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 "$@" \
-G Ninja && \
( [ "$cmd" = "--build" ] && ninja || true ) && \
echo Done >&2 && exit 0
echo Configure failed >&2
echo Press Return... >&2
read WAIT
exit 1 ;;
*)
RECOGNISED=0
;;
esac
done
exitcode=1
if [ -d "${APP_DIR}/src" ] ; then
BIN="${APP_DIR}/build/src/$PROG"
if [ ! -x "$BIN" ]; then
echo "ERROR from $APPRUN:" >&2
echo "I cannot find an executable file." >&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
[ -n "$G_DEBUG" ] && export G_DEBUG
exec $DEBUGGER "$BIN" "--appdir=$APP_DIR" "$@"
else
echo "No roxterm executable found" >&2
fi
exit $exitcode