author | Cezary Kaliszyk <cezarykaliszyk@gmail.com> |
Sun, 05 Feb 2012 07:05:34 +0100 | |
changeset 46416 | 5f5665a0b973 |
parent 40775 | ed7a4eadb2f6 |
permissions | -rwxr-xr-x |
10555 | 1 |
#!/usr/bin/env bash |
2755 | 2 |
# |
9817 | 3 |
# Author: Markus Wenzel, TU Muenchen |
2755 | 4 |
# |
2902 | 5 |
# build - compile the Isabelle system and object-logics |
2755 | 6 |
|
15844 | 7 |
if [ -L "$0" ]; then |
8 |
TARGET="$(LC_ALL=C ls -l "$0" | sed 's/.* -> //')" |
|
15967 | 9 |
exec "$(cd "$(dirname "$0")"; cd "$(pwd -P)"; cd "$(dirname "$TARGET")"; pwd)/$(basename "$TARGET")" "$@" |
15844 | 10 |
fi |
11 |
||
2755 | 12 |
|
4457 | 13 |
## global settings |
14 |
||
40775
ed7a4eadb2f6
remove HOLCF from build script, since it no longer works
huffman
parents:
34238
diff
changeset
|
15 |
ALL_LOGICS="Pure FOL HOL ZF CCL CTT Cube FOLP LCF Sequents" |
4457 | 16 |
|
17 |
||
2789 | 18 |
## settings |
19 |
||
15967 | 20 |
PRG="$(basename "$0")" |
21 |
||
22 |
ISABELLE_HOME="$(cd "$(dirname "$0")"; pwd -P)" |
|
23 |
source "$ISABELLE_HOME/lib/scripts/getsettings" || exit 2 |
|
2755 | 24 |
|
26211
ffd91f7a78a2
removed obsolete THIS_IS_ISABELLE_BUILD feature: change environment after getsettings (works due to static scoping);
wenzelm
parents:
18321
diff
changeset
|
25 |
ISABELLE_OUTPUT="$ISABELLE_HOME/heaps/$ML_IDENTIFIER" |
ffd91f7a78a2
removed obsolete THIS_IS_ISABELLE_BUILD feature: change environment after getsettings (works due to static scoping);
wenzelm
parents:
18321
diff
changeset
|
26 |
ISABELLE_BROWSER_INFO="$ISABELLE_HOME/browser_info" |
ffd91f7a78a2
removed obsolete THIS_IS_ISABELLE_BUILD feature: change environment after getsettings (works due to static scoping);
wenzelm
parents:
18321
diff
changeset
|
27 |
|
2789 | 28 |
|
2879 | 29 |
## diagnostics |
30 |
||
31 |
function usage() |
|
32 |
{ |
|
33 |
echo |
|
34 |
echo "Usage: $PRG [OPTIONS] [LOGICS ...]" |
|
35 |
echo |
|
36 |
echo " Options are:" |
|
37 |
echo " -a all logics" |
|
2902 | 38 |
echo " -b batch mode" |
6256 | 39 |
echo " -i make images" |
7889 | 40 |
echo " -m TARGET make this target" |
6256 | 41 |
echo " -t make test" |
2879 | 42 |
echo |
3184 | 43 |
echo " Compile the named LOGICS (default $ISABELLE_LOGIC), or all object logics" |
2879 | 44 |
echo " in the distribution." |
45 |
echo |
|
46 |
exit 1 |
|
47 |
} |
|
48 |
||
49 |
function fail() |
|
50 |
{ |
|
51 |
echo "$1" >&2 |
|
52 |
exit 2 |
|
53 |
} |
|
54 |
||
55 |
||
56 |
## process command line |
|
57 |
||
58 |
# options |
|
59 |
||
60 |
ALL="" |
|
2902 | 61 |
BATCH="" |
7889 | 62 |
TARGETS="" |
2755 | 63 |
|
15844 | 64 |
while getopts "abim:t" OPT |
2879 | 65 |
do |
66 |
case "$OPT" in |
|
67 |
a) |
|
68 |
ALL=true |
|
69 |
;; |
|
2902 | 70 |
b) |
71 |
BATCH=true |
|
72 |
;; |
|
6256 | 73 |
i) |
7889 | 74 |
TARGETS="$TARGETS images" |
75 |
;; |
|
76 |
m) |
|
77 |
TARGETS="$TARGETS $OPTARG" |
|
6256 | 78 |
;; |
2918 | 79 |
t) |
7889 | 80 |
TARGETS="$TARGETS test" |
2918 | 81 |
;; |
2879 | 82 |
\?) |
83 |
usage |
|
84 |
;; |
|
85 |
esac |
|
86 |
done |
|
87 |
||
88 |
shift $(($OPTIND - 1)) |
|
89 |
||
90 |
||
91 |
# args |
|
92 |
||
93 |
LOGICS="$@" |
|
94 |
||
4457 | 95 |
[ -n "$ALL" ] && LOGICS="$LOGICS $ALL_LOGICS" |
96 |
[ -z "$LOGICS" ] && LOGICS="$ISABELLE_LOGIC" |
|
97 |
||
2879 | 98 |
|
99 |
## main |
|
100 |
||
101 |
# tell the user about current values |
|
102 |
||
2902 | 103 |
if [ -z "$BATCH" ]; then |
104 |
echo |
|
105 |
echo " *****************************" |
|
106 |
echo " * Welcome to Isabelle build *" |
|
107 |
echo " *****************************" |
|
108 |
echo |
|
109 |
echo "Please check $ISABELLE_HOME/etc/settings" |
|
9789 | 110 |
[ -f "$ISABELLE_HOME_USER/etc/settings" ] && echo "AND $ISABELLE_HOME_USER/etc/settings" |
5386 | 111 |
echo "to make sure that Isabelle's ML system settings and compilation options" |
112 |
echo "are appropriate." |
|
2902 | 113 |
echo |
5386 | 114 |
echo "The current values are:" |
2902 | 115 |
echo |
116 |
echo " ML_SYSTEM=$ML_SYSTEM" |
|
117 |
echo " ML_HOME=$ML_HOME" |
|
118 |
echo " ML_OPTIONS=$ML_OPTIONS" |
|
7277 | 119 |
echo " ML_PLATFORM=$ML_PLATFORM" |
5386 | 120 |
echo |
121 |
echo " ISABELLE_USEDIR_OPTIONS=$ISABELLE_USEDIR_OPTIONS" |
|
2902 | 122 |
fi |
2789 | 123 |
|
124 |
||
2879 | 125 |
# check logics |
2755 | 126 |
|
2902 | 127 |
if [ -z "$BATCH" ]; then |
128 |
echo |
|
129 |
echo |
|
9817 | 130 |
echo "Press RETURN to compilation of" |
2902 | 131 |
echo |
132 |
fi |
|
2879 | 133 |
|
4457 | 134 |
|
135 |
MAKE_LOGICS="" |
|
2879 | 136 |
|
4457 | 137 |
for L in $LOGICS |
138 |
do |
|
9789 | 139 |
DIR="$ISABELLE_HOME/src/$L" |
140 |
if [ -f "$DIR/IsaMakefile" ]; then |
|
4457 | 141 |
MAKE_LOGICS="$MAKE_LOGICS $L" |
142 |
else |
|
143 |
echo "No such logic: $L" |
|
144 |
fi |
|
145 |
done |
|
146 |
||
2879 | 147 |
|
2902 | 148 |
if [ -z "$BATCH" ]; then |
9789 | 149 |
echo " $MAKE_LOGICS" |
9817 | 150 |
[ -n "$TARGETS" ] && echo " (targets:$TARGETS)" |
2902 | 151 |
echo |
152 |
read |
|
153 |
else |
|
154 |
echo |
|
9789 | 155 |
echo "Isabelle build: $MAKE_LOGICS" |
9817 | 156 |
[ -n "$TARGETS" ] && echo "(targets:$TARGETS)" |
2914 | 157 |
echo |
2902 | 158 |
echo "ML_SYSTEM=$ML_SYSTEM" |
159 |
echo "ML_HOME=$ML_HOME" |
|
160 |
echo "ML_OPTIONS=$ML_OPTIONS" |
|
7311 | 161 |
echo "ML_PLATFORM=$ML_PLATFORM" |
2902 | 162 |
echo |
5393 | 163 |
echo "ISABELLE_USEDIR_OPTIONS=$ISABELLE_USEDIR_OPTIONS" |
164 |
echo |
|
2902 | 165 |
fi |
2755 | 166 |
|
167 |
||
2879 | 168 |
# build it |
169 |
||
10511 | 170 |
echo "Started at $(date) ($ML_IDENTIFIER on $(hostname))" |
18321
3414557c2dda
replaced lib/scripts/showtime by more advanced lib/scripts/timestart|stop.bash;
wenzelm
parents:
17649
diff
changeset
|
171 |
. "$ISABELLE_HOME/lib/scripts/timestart.bash" |
2914 | 172 |
|
4457 | 173 |
for L in $MAKE_LOGICS |
2755 | 174 |
do |
28500 | 175 |
( cd "$ISABELLE_HOME/src/$L"; "$ISABELLE_TOOL" make $TARGETS ) |
2755 | 176 |
done |
2902 | 177 |
|
2914 | 178 |
echo -n "Finished at "; date |
4457 | 179 |
|
18321
3414557c2dda
replaced lib/scripts/showtime by more advanced lib/scripts/timestart|stop.bash;
wenzelm
parents:
17649
diff
changeset
|
180 |
. "$ISABELLE_HOME/lib/scripts/timestop.bash" |
3414557c2dda
replaced lib/scripts/showtime by more advanced lib/scripts/timestart|stop.bash;
wenzelm
parents:
17649
diff
changeset
|
181 |
echo "$TIMES_REPORT" |