author | wenzelm |
Wed, 18 Aug 1999 17:31:53 +0200 | |
changeset 7259 | e75aa311788c |
parent 7226 | 1a4ed2eb48f3 |
child 7275 | 3a001f2148f7 |
permissions | -rwxr-xr-x |
3007 | 1 |
#!/bin/bash |
2808 | 2 |
# |
3 |
# $Id$ |
|
4 |
# |
|
5 |
# DESCRIPTION: build object-logic or run examples |
|
6 |
||
7 |
||
8 |
## diagnostics |
|
9 |
||
10 |
PRG=$(basename $0) |
|
11 |
||
12 |
function usage() |
|
13 |
{ |
|
14 |
echo |
|
15 |
echo "Usage: $PRG LOGIC NAME" |
|
16 |
echo |
|
17 |
echo " Options are:" |
|
6940 | 18 |
echo " -B build mode with THIS_IS_ISABELLE_BUILD indication" |
19 |
echo " -P PATH set path for remote theory browsing information" |
|
6212 | 20 |
echo " -b build mode (output heap image, using current dir)" |
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
21 |
echo " -i BOOL generate theory browsing information," |
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
22 |
echo " i.e. HTML / graph data (default false)" |
7226 | 23 |
echo " -m BOOL multi line output (default false)" |
6212 | 24 |
echo " -r reset session path" |
2808 | 25 |
echo " -s NAME override session NAME" |
26 |
echo |
|
27 |
echo " Build object-logic or run examples. Also creates browsing" |
|
28 |
echo " information (HTML etc.) according to settings." |
|
29 |
echo |
|
30 |
exit 1 |
|
31 |
} |
|
32 |
||
33 |
||
34 |
## process command line |
|
35 |
||
36 |
# options |
|
37 |
||
38 |
BUILD="" |
|
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
39 |
INFO=false |
7226 | 40 |
MULTI=false |
6212 | 41 |
RESET=false |
2808 | 42 |
SESSION="" |
6652
401f14f25648
usedir now recognizes additional option -P which is used to
berghofe
parents:
6249
diff
changeset
|
43 |
RPATH="" |
2808 | 44 |
|
2917 | 45 |
function getoptions() |
46 |
{ |
|
47 |
OPTIND=1 |
|
7226 | 48 |
while getopts "BP:bi:m:rs:" OPT |
2917 | 49 |
do |
50 |
case "$OPT" in |
|
6940 | 51 |
B) |
52 |
BUILD=true |
|
53 |
export THIS_IS_ISABELLE_BUILD=true |
|
54 |
;; |
|
2917 | 55 |
b) |
56 |
BUILD=true |
|
57 |
;; |
|
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
58 |
i) |
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
59 |
INFO="$OPTARG" |
2917 | 60 |
;; |
7226 | 61 |
m) |
62 |
MULTI="$OPTARG" |
|
63 |
;; |
|
6212 | 64 |
r) |
65 |
RESET=true |
|
66 |
;; |
|
2917 | 67 |
s) |
68 |
SESSION="$OPTARG" |
|
69 |
;; |
|
6652
401f14f25648
usedir now recognizes additional option -P which is used to
berghofe
parents:
6249
diff
changeset
|
70 |
P) |
401f14f25648
usedir now recognizes additional option -P which is used to
berghofe
parents:
6249
diff
changeset
|
71 |
RPATH="$OPTARG" |
401f14f25648
usedir now recognizes additional option -P which is used to
berghofe
parents:
6249
diff
changeset
|
72 |
;; |
2917 | 73 |
\?) |
74 |
usage |
|
75 |
;; |
|
76 |
esac |
|
77 |
done |
|
78 |
} |
|
2808 | 79 |
|
2917 | 80 |
getoptions $ISABELLE_USEDIR_OPTIONS |
81 |
||
82 |
getoptions "$@" |
|
2808 | 83 |
shift $(($OPTIND - 1)) |
84 |
||
85 |
||
86 |
# args |
|
87 |
||
88 |
[ $# -ne 2 ] && usage |
|
89 |
||
90 |
LOGIC="$1"; shift |
|
91 |
NAME="$1"; shift |
|
92 |
||
4419 | 93 |
[ -z "$SESSION" ] && SESSION=$(basename $NAME) |
2808 | 94 |
|
4419 | 95 |
|
96 |
||
97 |
## main |
|
3636
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
98 |
|
4451 | 99 |
# prepare browser info dir |
4419 | 100 |
|
4586 | 101 |
if [ "$INFO" = "true" -a ! -f $ISABELLE_BROWSER_INFO/index.html ]; then |
4419 | 102 |
|
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
103 |
mkdir -p $ISABELLE_BROWSER_INFO/gif |
3848 | 104 |
cp $ISABELLE_HOME/lib/logo/isabelle.gif $ISABELLE_BROWSER_INFO/gif/isabelle.gif |
3747
cd9b6c86926c
There is now one single option -i for generating theory browsing
berghofe
parents:
3636
diff
changeset
|
105 |
cp $ISABELLE_HOME/lib/html/index1.html $ISABELLE_BROWSER_INFO/index.html |
4419 | 106 |
|
3636
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
107 |
mkdir -p $ISABELLE_BROWSER_INFO/graph |
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
108 |
cp $ISABELLE_HOME/lib/html/index2.html $ISABELLE_BROWSER_INFO/graph/index.html |
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
109 |
mkdir $ISABELLE_BROWSER_INFO/graph/GraphBrowser |
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
110 |
mkdir $ISABELLE_BROWSER_INFO/graph/awtUtilities |
4419 | 111 |
cp $ISABELLE_HOME/lib/browser/GraphBrowser/*.class $ISABELLE_BROWSER_INFO/graph/GraphBrowser |
112 |
cp $ISABELLE_HOME/lib/browser/awtUtilities/*.class $ISABELLE_BROWSER_INFO/graph/awtUtilities |
|
113 |
||
3636
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
114 |
fi |
3f2e55e5bacc
Added some code for generating theory browsing data.
berghofe
parents:
3504
diff
changeset
|
115 |
|
2808 | 116 |
|
4451 | 117 |
# prepare log dir |
118 |
||
119 |
LOGDIR="$ISABELLE_OUTPUT/log" |
|
120 |
mkdir -p "$LOGDIR" |
|
121 |
||
122 |
||
123 |
# run isabelle |
|
124 |
||
125 |
SECONDS=0 |
|
126 |
||
6249 | 127 |
PARENT=$(basename "$LOGIC") |
128 |
||
7226 | 129 |
ECHO_LINE="echo -n" |
130 |
[ "$MULTI" = "true" ] && ECHO_LINE="echo" |
|
131 |
||
2808 | 132 |
if [ -n "$BUILD" ]; then |
4451 | 133 |
ITEM="$SESSION" |
7226 | 134 |
$ECHO_LINE "Building $ITEM ..." |
4451 | 135 |
LOG="$LOGDIR/$ITEM" |
136 |
||
137 |
$ISABELLE \ |
|
6652
401f14f25648
usedir now recognizes additional option -P which is used to
berghofe
parents:
6249
diff
changeset
|
138 |
-e "Session.use_dir $RESET $INFO \"$PARENT\" \"$SESSION\" \"$RPATH\";" \ |
4492 | 139 |
-q -w $LOGIC $NAME > $LOG 2>&1 |
6249 | 140 |
RC=$? |
2808 | 141 |
else |
4451 | 142 |
ITEM=$(basename $LOGIC)-"$SESSION" |
7226 | 143 |
$ECHO_LINE "Running $ITEM ..." |
4451 | 144 |
LOG="$LOGDIR/$ITEM" |
145 |
||
6212 | 146 |
cd "$NAME" |
4451 | 147 |
$ISABELLE \ |
6652
401f14f25648
usedir now recognizes additional option -P which is used to
berghofe
parents:
6249
diff
changeset
|
148 |
-e "Session.use_dir $RESET $INFO \"$PARENT\" \"$SESSION\" \"$RPATH\"; quit();" \ |
4492 | 149 |
-r -q $LOGIC > $LOG 2>&1 |
6249 | 150 |
RC=$? |
6212 | 151 |
cd .. |
2808 | 152 |
fi |
4451 | 153 |
|
154 |
ELAPSED=$($ISABELLE_HOME/lib/scripts/showtime $SECONDS) |
|
155 |
||
156 |
||
157 |
# exit status |
|
158 |
||
159 |
if [ $RC -eq 0 ]; then |
|
7259 | 160 |
if [ "$MULTI" = "true" ]; then |
161 |
echo "Finished $ITEM ($ELAPSED elapsed time)" |
|
162 |
else |
|
163 |
echo " OK ($ELAPSED elapsed time)" |
|
164 |
fi |
|
4451 | 165 |
gzip --force "$LOG" |
166 |
else |
|
7259 | 167 |
[ "$MULTI" = "true" ] || echo |
168 |
echo "$ITEM FAILED" |
|
4451 | 169 |
echo "(see also $LOG)" |
170 |
echo; tail $LOG; echo |
|
171 |
fi |
|
172 |
||
173 |
exit $RC |