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