author | haftmann |
Wed, 16 Dec 2009 14:15:24 +0100 | |
changeset 34091 | 3aea0882879f |
parent 33918 | 5945e023bab7 |
child 34238 | b28be884edda |
permissions | -rwxr-xr-x |
12721 | 1 |
#!/usr/bin/env bash |
10082 | 2 |
# |
30862 | 3 |
# makebin -- make Isabelle logic images for current platform |
10082 | 4 |
|
5 |
||
6 |
## global settings |
|
7 |
||
12427
37cfec8dfe8e
use /var/tmp (which happens to be more spacious on atbroy37);
wenzelm
parents:
11576
diff
changeset
|
8 |
TMP="/var/tmp/isabelle-makebin$$" |
10082 | 9 |
|
27030 | 10 |
export THIS_IS_ISABELLE_MAKEBIN=true |
11 |
||
10082 | 12 |
|
13 |
## diagnostics |
|
14 |
||
15 |
PRG=$(basename "$0") |
|
16 |
||
17 |
function usage() |
|
18 |
{ |
|
19 |
echo |
|
12827 | 20 |
echo "Usage: $PRG [OPTIONS] ARCHIVE" |
10082 | 21 |
echo |
12827 | 22 |
echo " Options are:" |
13001 | 23 |
echo " -l produce library" |
24 |
echo " -n dry run" |
|
12827 | 25 |
echo |
26 |
echo " Precompile Isabelle for the current platform." |
|
10082 | 27 |
echo |
28 |
exit 1 |
|
29 |
} |
|
30 |
||
31 |
function fail() |
|
32 |
{ |
|
33 |
echo "$1" >&2 |
|
34 |
exit 2 |
|
35 |
} |
|
36 |
||
37 |
||
38 |
## process command line |
|
39 |
||
12827 | 40 |
# options |
41 |
||
42 |
DO_LIBRARY="" |
|
13001 | 43 |
DRY_RUN="" |
12827 | 44 |
|
13001 | 45 |
while getopts "ln" OPT |
12827 | 46 |
do |
47 |
case "$OPT" in |
|
48 |
l) |
|
49 |
DO_LIBRARY=true |
|
50 |
;; |
|
13001 | 51 |
n) |
52 |
DRY_RUN=true |
|
12827 | 53 |
;; |
54 |
\?) |
|
55 |
usage |
|
56 |
;; |
|
57 |
esac |
|
58 |
done |
|
59 |
||
60 |
shift $(($OPTIND - 1)) |
|
61 |
||
62 |
||
63 |
# args |
|
64 |
||
10082 | 65 |
[ "$#" -gt 1 ] && usage |
66 |
||
67 |
ARCHIVE="$1"; shift |
|
68 |
||
69 |
||
70 |
## main |
|
71 |
||
72 |
[ ! -f "$ARCHIVE" ] && fail "Bad archive file $ARCHIVE" |
|
30862 | 73 |
ARCHIVE_BASE="$(basename "$ARCHIVE")" |
74 |
ARCHIVE_DIR="$(cd $(dirname "$ARCHIVE"); echo "$PWD")" |
|
10082 | 75 |
ARCHIVE_FULL="$ARCHIVE_DIR/$ARCHIVE_BASE" |
76 |
||
30862 | 77 |
ISABELLE_NAME="$(basename "$ARCHIVE_BASE" .tar.gz)" |
10082 | 78 |
ISABELLE_HOME="$TMP/$ISABELLE_NAME" |
79 |
||
80 |
||
81 |
# build logics |
|
82 |
||
83 |
mkdir "$TMP" || fail "Cannot create directory $TMP" |
|
84 |
||
85 |
cd "$TMP" |
|
30862 | 86 |
tar xzf "$ARCHIVE_FULL" |
10082 | 87 |
cd "$ISABELLE_NAME" |
88 |
||
17575 | 89 |
perl -pi \ |
30862 | 90 |
-e 's:^ISABELLE_USEDIR_OPTIONS=.*$:ISABELLE_USEDIR_OPTIONS="-M 1 -p 1":;' \ |
91 |
-e 's:^HOL_USEDIR_OPTIONS=.*$:HOL_USEDIR_OPTIONS="-M 1 -p 2":;' \ |
|
17575 | 92 |
etc/settings |
93 |
||
13001 | 94 |
if [ -n "$DO_LIBRARY" ]; then |
30862 | 95 |
perl -pi -e 's:^ISABELLE_USEDIR_OPTIONS=.*$:ISABELLE_USEDIR_OPTIONS="-M 1 -p 1 -i true -d pdf -V outline=/proof,/ML":;' \ |
13001 | 96 |
etc/settings |
97 |
fi |
|
11576
c418146c4763
activate default ISABELLE_USEDIR_OPTIONS for precompiled distribution;
wenzelm
parents:
10307
diff
changeset
|
98 |
|
28504
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents:
27588
diff
changeset
|
99 |
ISABELLE_HOME_USER=$(./bin/isabelle getenv -b ISABELLE_HOME_USER) |
10082 | 100 |
[ -f "$ISABELLE_HOME_USER/etc/settings" ] && \ |
101 |
echo "### WARNING! Personal Isabelle settings present. " >&2 |
|
102 |
||
28504
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents:
27588
diff
changeset
|
103 |
COMPILER=$(./bin/isabelle getenv -b ML_IDENTIFIER) |
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents:
27588
diff
changeset
|
104 |
PLATFORM=$(./bin/isabelle getenv -b ML_PLATFORM) |
10082 | 105 |
|
13001 | 106 |
if [ -n "$DRY_RUN" ]; then |
12827 | 107 |
mkdir -p "heaps/$COMPILER/log" |
10082 | 108 |
touch "heaps/$COMPILER/HOL" |
12827 | 109 |
touch "heaps/$COMPILER/log/HOL.gz" |
27587 | 110 |
touch "heaps/$COMPILER/HOL-Nominal" |
111 |
touch "heaps/$COMPILER/log/HOL-Nominal.gz" |
|
33918 | 112 |
touch "heaps/$COMPILER/HOLCF" |
113 |
touch "heaps/$COMPILER/log/HOLCF.gz" |
|
10082 | 114 |
touch "heaps/$COMPILER/ZF" |
12827 | 115 |
touch "heaps/$COMPILER/log/ZF.gz" |
116 |
mkdir browser_info |
|
13001 | 117 |
elif [ -n "$DO_LIBRARY" ]; then |
118 |
./build -bait |
|
10082 | 119 |
else |
27587 | 120 |
./build -b -m HOL-Nominal HOL |
33918 | 121 |
./build -b HOLCF |
10082 | 122 |
./build -b ZF |
123 |
rm -f "heaps/$COMPILER/Pure" "heaps/$COMPILER/FOL" |
|
124 |
fi |
|
125 |
||
126 |
||
127 |
# prepare result |
|
128 |
||
129 |
cd "$TMP" |
|
130 |
||
131 |
chmod -R g=o "$TMP" |
|
132 |
chgrp -R isabelle "$TMP" |
|
133 |
||
13001 | 134 |
if [ -n "$DO_LIBRARY" ]; then |
30862 | 135 |
tar cf "${ISABELLE_NAME}_library.tar" $ISABELLE_NAME/browser_info && \ |
13001 | 136 |
gzip -f "${ISABELLE_NAME}_library.tar" |
137 |
cp -f "${ISABELLE_NAME}_library.tar.gz" "$ARCHIVE_DIR" |
|
138 |
else |
|
33918 | 139 |
for IMG in HOL HOL-Nominal HOLCF ZF |
13001 | 140 |
do |
30862 | 141 |
tar cf "${IMG}_$PLATFORM.tar" \ |
13001 | 142 |
"$ISABELLE_NAME/heaps/$COMPILER/$IMG" \ |
143 |
"$ISABELLE_NAME/heaps/$COMPILER/log/$IMG.gz" |
|
144 |
gzip -f "${IMG}_$PLATFORM.tar" |
|
145 |
cp -f "${IMG}_$PLATFORM.tar.gz" "$ARCHIVE_DIR" |
|
146 |
done |
|
147 |
fi |
|
10082 | 148 |
|
149 |
||
150 |
# clean up |
|
151 |
cd /tmp |
|
152 |
rm -rf "$TMP" |