author | paulson |
Mon, 19 Sep 2005 15:12:13 +0200 | |
changeset 17484 | f6a225f97f0a |
parent 15971 | c0c4088edccf |
child 17571 | 5f83a635dce0 |
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 |
||
10 |
DISTBASE=~/tmp/isadist |
|
12427
37cfec8dfe8e
use /var/tmp (which happens to be more spacious on atbroy37);
wenzelm
parents:
11576
diff
changeset
|
11 |
TMP="/var/tmp/isabelle-makebin$$" |
10082 | 12 |
|
13 |
TAR=tar |
|
14 |
type -path gtar >/dev/null && TAR=gtar |
|
15 |
||
10097 | 16 |
export THIS_IS_ISABELLE_BUILD=true |
17 |
||
10082 | 18 |
|
19 |
## diagnostics |
|
20 |
||
21 |
PRG=$(basename "$0") |
|
22 |
||
23 |
function usage() |
|
24 |
{ |
|
25 |
echo |
|
12827 | 26 |
echo "Usage: $PRG [OPTIONS] ARCHIVE" |
10082 | 27 |
echo |
12827 | 28 |
echo " Options are:" |
13001 | 29 |
echo " -l produce library" |
30 |
echo " -n dry run" |
|
12827 | 31 |
echo |
32 |
echo " Precompile Isabelle for the current platform." |
|
10082 | 33 |
echo |
34 |
exit 1 |
|
35 |
} |
|
36 |
||
37 |
function fail() |
|
38 |
{ |
|
39 |
echo "$1" >&2 |
|
40 |
exit 2 |
|
41 |
} |
|
42 |
||
43 |
||
44 |
## process command line |
|
45 |
||
12827 | 46 |
# options |
47 |
||
48 |
DO_LIBRARY="" |
|
13001 | 49 |
DRY_RUN="" |
12827 | 50 |
|
13001 | 51 |
while getopts "ln" OPT |
12827 | 52 |
do |
53 |
case "$OPT" in |
|
54 |
l) |
|
55 |
DO_LIBRARY=true |
|
56 |
;; |
|
13001 | 57 |
n) |
58 |
DRY_RUN=true |
|
12827 | 59 |
;; |
60 |
\?) |
|
61 |
usage |
|
62 |
;; |
|
63 |
esac |
|
64 |
done |
|
65 |
||
66 |
shift $(($OPTIND - 1)) |
|
67 |
||
68 |
||
69 |
# args |
|
70 |
||
10082 | 71 |
[ "$#" -gt 1 ] && usage |
72 |
||
73 |
ARCHIVE="$1"; shift |
|
74 |
||
75 |
||
76 |
## main |
|
77 |
||
78 |
[ ! -f "$ARCHIVE" ] && fail "Bad archive file $ARCHIVE" |
|
79 |
ARCHIVE_BASE=$(basename "$ARCHIVE") |
|
80 |
ARCHIVE_DIR=$(cd $(dirname "$ARCHIVE"); echo "$PWD") |
|
81 |
ARCHIVE_FULL="$ARCHIVE_DIR/$ARCHIVE_BASE" |
|
82 |
||
83 |
ISABELLE_NAME=$(basename "$ARCHIVE_BASE" .tar.gz) |
|
84 |
ISABELLE_HOME="$TMP/$ISABELLE_NAME" |
|
85 |
||
86 |
||
87 |
# build logics |
|
88 |
||
89 |
mkdir "$TMP" || fail "Cannot create directory $TMP" |
|
90 |
||
91 |
cd "$TMP" |
|
10087 | 92 |
"$TAR" xzf "$ARCHIVE_FULL" |
10082 | 93 |
cd "$ISABELLE_NAME" |
94 |
||
14633 | 95 |
# FIXME: ugly hack to get proper HOL4 image |
96 |
# needs HOL4 proof terms installed in ~/isabelle/proofs |
|
97 |
# desperately needs fix for next release! |
|
98 |
cat > src/HOL/Import/HOL/ROOT.ML <<EOF |
|
99 |
with_path ".." use_thy "HOL4Compat"; |
|
100 |
with_path ".." use_thy "HOL4Syntax"; |
|
101 |
use_thy "HOL4Prob"; |
|
102 |
use_thy "HOL4"; |
|
103 |
EOF |
|
104 |
||
13001 | 105 |
if [ -n "$DO_LIBRARY" ]; then |
106 |
perl -pi -e 's/^ISABELLE_USEDIR_OPTIONS=.*$/ISABELLE_USEDIR_OPTIONS="-i true -d pdf"/' \ |
|
107 |
etc/settings |
|
108 |
else |
|
109 |
perl -pi -e 's/^ISABELLE_USEDIR_OPTIONS=.*$/ISABELLE_USEDIR_OPTIONS="-p 2"/' \ |
|
110 |
etc/settings |
|
111 |
fi |
|
11576
c418146c4763
activate default ISABELLE_USEDIR_OPTIONS for precompiled distribution;
wenzelm
parents:
10307
diff
changeset
|
112 |
|
10082 | 113 |
ISABELLE_HOME_USER=$(./bin/isatool getenv -b ISABELLE_HOME_USER) |
114 |
[ -f "$ISABELLE_HOME_USER/etc/settings" ] && \ |
|
115 |
echo "### WARNING! Personal Isabelle settings present. " >&2 |
|
116 |
||
117 |
COMPILER=$(./bin/isatool getenv -b ML_IDENTIFIER) |
|
118 |
PLATFORM=$(./bin/isatool getenv -b ML_PLATFORM) |
|
119 |
||
13001 | 120 |
if [ -n "$DRY_RUN" ]; then |
12827 | 121 |
mkdir -p "heaps/$COMPILER/log" |
10082 | 122 |
touch "heaps/$COMPILER/HOL" |
12827 | 123 |
touch "heaps/$COMPILER/log/HOL.gz" |
14024 | 124 |
touch "heaps/$COMPILER/HOL-Complex" |
125 |
touch "heaps/$COMPILER/log/HOL-Complex.gz" |
|
14633 | 126 |
touch "heaps/$COMPILER/HOL4" |
127 |
touch "heaps/$COMPILER/log/HOL4.gz" |
|
10082 | 128 |
touch "heaps/$COMPILER/ZF" |
12827 | 129 |
touch "heaps/$COMPILER/log/ZF.gz" |
130 |
mkdir browser_info |
|
13001 | 131 |
elif [ -n "$DO_LIBRARY" ]; then |
132 |
./build -bait |
|
10082 | 133 |
else |
14024 | 134 |
./build -b -m HOL-Complex HOL |
10082 | 135 |
./build -b ZF |
14633 | 136 |
perl -pi -e 's/^ISABELLE_USEDIR_OPTIONS=.*$/ISABELLE_USEDIR_OPTIONS="-p 1"/' \ |
137 |
etc/settings |
|
138 |
./build -b -m HOL4 HOL |
|
10082 | 139 |
rm -f "heaps/$COMPILER/Pure" "heaps/$COMPILER/FOL" |
140 |
fi |
|
141 |
||
142 |
||
143 |
# prepare result |
|
144 |
||
145 |
cd "$TMP" |
|
146 |
||
147 |
chmod -R g=o "$TMP" |
|
148 |
chgrp -R isabelle "$TMP" |
|
149 |
||
13001 | 150 |
if [ -n "$DO_LIBRARY" ]; then |
151 |
"$TAR" cf "${ISABELLE_NAME}_library.tar" $ISABELLE_NAME/browser_info && \ |
|
152 |
gzip -f "${ISABELLE_NAME}_library.tar" |
|
153 |
cp -f "${ISABELLE_NAME}_library.tar.gz" "$ARCHIVE_DIR" |
|
154 |
else |
|
14633 | 155 |
for IMG in HOL HOL-Complex HOL4 ZF |
13001 | 156 |
do |
157 |
"$TAR" cf "${IMG}_$PLATFORM.tar" \ |
|
158 |
"$ISABELLE_NAME/heaps/$COMPILER/$IMG" \ |
|
159 |
"$ISABELLE_NAME/heaps/$COMPILER/log/$IMG.gz" |
|
160 |
gzip -f "${IMG}_$PLATFORM.tar" |
|
161 |
cp -f "${IMG}_$PLATFORM.tar.gz" "$ARCHIVE_DIR" |
|
162 |
done |
|
163 |
fi |
|
10082 | 164 |
|
165 |
||
166 |
# clean up |
|
167 |
cd /tmp |
|
168 |
rm -rf "$TMP" |