author | huffman |
Fri, 24 Mar 2006 19:30:01 +0100 | |
changeset 19327 | 4565e230e6eb |
parent 18321 | 3414557c2dda |
child 20776 | cc436bcdd5fc |
permissions | -rwxr-xr-x |
11391 | 1 |
#!/usr/bin/env bash |
2339 | 2 |
# |
3 |
# $Id$ |
|
9789 | 4 |
# Author: Markus Wenzel, TU Muenchen |
2339 | 5 |
# |
6 |
# mk - build Pure Isabelle. |
|
7 |
# |
|
10102 | 8 |
# Requires proper Isabelle settings environment (cf. IsaMakefile). |
2339 | 9 |
|
10 |
||
11 |
## diagnostics |
|
12 |
||
3774 | 13 |
function usage() |
14 |
{ |
|
15 |
echo |
|
16 |
echo "Usage: $PRG [OPTIONS]" |
|
17 |
echo |
|
18 |
echo " Make Pure Isabelle." |
|
19 |
echo |
|
10102 | 20 |
echo " -C tell ML system to copy output image" |
21 |
echo " -r prepare RAW image only" |
|
3774 | 22 |
echo |
23 |
exit 1 |
|
24 |
} |
|
25 |
||
2339 | 26 |
function fail() |
27 |
{ |
|
28 |
echo "$1" >&2 |
|
29 |
exit 2 |
|
30 |
} |
|
31 |
||
32 |
||
3774 | 33 |
## process command line |
34 |
||
35 |
# options |
|
36 |
||
10102 | 37 |
COPY="" |
3774 | 38 |
RAW="" |
39 |
||
10102 | 40 |
while getopts "Cr" OPT |
3774 | 41 |
do |
42 |
case "$OPT" in |
|
10102 | 43 |
C) |
44 |
COPY="-C" |
|
45 |
;; |
|
3774 | 46 |
r) |
47 |
RAW=true |
|
48 |
;; |
|
49 |
\?) |
|
50 |
usage |
|
51 |
;; |
|
52 |
esac |
|
53 |
done |
|
54 |
||
55 |
shift $(($OPTIND - 1)) |
|
56 |
||
57 |
||
58 |
# args |
|
59 |
||
9789 | 60 |
[ "$#" -ne 0 ] && usage |
3774 | 61 |
|
62 |
||
2339 | 63 |
## main |
64 |
||
4442 | 65 |
# get compatibility file |
66 |
||
9789 | 67 |
ML_SYSTEM_BASE=$(echo "$ML_SYSTEM" | cut -f1 -d-) |
16131 | 68 |
[ -z "$ML_SYSTEM" ] && fail "Missing ML_SYSTEM settings!" |
2339 | 69 |
|
70 |
COMPAT="" |
|
71 |
[ -f "ML-Systems/$ML_SYSTEM_BASE.ML" ] && COMPAT="ML-Systems/$ML_SYSTEM_BASE.ML" |
|
72 |
[ -f "ML-Systems/$ML_SYSTEM.ML" ] && COMPAT="ML-Systems/$ML_SYSTEM.ML" |
|
73 |
[ -z "$COMPAT" ] && fail "Missing compatibility file for ML system \"$ML_SYSTEM\"!" |
|
74 |
||
4442 | 75 |
|
76 |
# prepare log dir |
|
77 |
||
78 |
LOGDIR="$ISABELLE_OUTPUT/log" |
|
79 |
mkdir -p "$LOGDIR" |
|
80 |
||
81 |
||
82 |
# run isabelle |
|
83 |
||
18321
3414557c2dda
replaced lib/scripts/showtime by more advanced lib/scripts/timestart|stop.bash;
wenzelm
parents:
16376
diff
changeset
|
84 |
. "$ISABELLE_HOME/lib/scripts/timestart.bash" |
4442 | 85 |
|
3774 | 86 |
if [ -z "$RAW" ]; then |
4442 | 87 |
ITEM="Pure" |
7277 | 88 |
echo "Building $ITEM ..." |
4442 | 89 |
LOG="$LOGDIR/$ITEM" |
90 |
||
10102 | 91 |
"$ISABELLE" $COPY \ |
3774 | 92 |
-e "val ml_system = \"$ML_SYSTEM\";" \ |
16376 | 93 |
-e "val ml_platform = \"$ML_PLATFORM\";" \ |
4495 | 94 |
-e "(use\"$COMPAT\"; use\"ROOT.ML\") handle _ => exit 1;" \ |
10900 | 95 |
-f -c -q -w RAW_ML_SYSTEM Pure > "$LOG" 2>&1 |
9789 | 96 |
RC="$?" |
3774 | 97 |
else |
4442 | 98 |
ITEM="RAW" |
7277 | 99 |
echo "Building $ITEM ..." |
4442 | 100 |
LOG="$LOGDIR/$ITEM" |
101 |
||
10102 | 102 |
"$ISABELLE" $COPY \ |
3774 | 103 |
-e "val ml_system = \"$ML_SYSTEM\";" \ |
16376 | 104 |
-e "val ml_platform = \"$ML_PLATFORM\";" \ |
10900 | 105 |
-e "use\"$COMPAT\" handle _ => exit 1;" \ |
9789 | 106 |
-q -w RAW_ML_SYSTEM RAW > "$LOG" 2>&1 |
107 |
RC="$?" |
|
3774 | 108 |
fi |
4442 | 109 |
|
18321
3414557c2dda
replaced lib/scripts/showtime by more advanced lib/scripts/timestart|stop.bash;
wenzelm
parents:
16376
diff
changeset
|
110 |
. "$ISABELLE_HOME/lib/scripts/timestop.bash" |
4442 | 111 |
|
112 |
||
113 |
# exit status |
|
114 |
||
9789 | 115 |
if [ "$RC" -eq 0 ]; then |
18321
3414557c2dda
replaced lib/scripts/showtime by more advanced lib/scripts/timestart|stop.bash;
wenzelm
parents:
16376
diff
changeset
|
116 |
echo "Finished $ITEM ($TIMES_REPORT)" |
4442 | 117 |
gzip --force "$LOG" |
118 |
else |
|
7263 | 119 |
echo "$ITEM FAILED" |
4442 | 120 |
echo "(see also $LOG)" |
9789 | 121 |
echo; tail "$LOG"; echo |
4442 | 122 |
fi |
123 |
||
9789 | 124 |
exit "$RC" |