author | wenzelm |
Thu, 28 Feb 2002 21:30:57 +0100 | |
changeset 12985 | 9db054a40247 |
parent 12830 | c037ff3e5ddf |
child 13001 | 40ba2eee948e |
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 |
12985 | 17 |
export THIS_IS_ISABELLE_ADMIN=true |
10097 | 18 |
|
10082 | 19 |
|
20 |
## diagnostics |
|
21 |
||
22 |
PRG=$(basename "$0") |
|
23 |
||
24 |
function usage() |
|
25 |
{ |
|
26 |
echo |
|
12827 | 27 |
echo "Usage: $PRG [OPTIONS] ARCHIVE" |
10082 | 28 |
echo |
12827 | 29 |
echo " Options are:" |
30 |
echo " -l include library" |
|
31 |
echo " -t test run -- no build phase" |
|
32 |
echo |
|
33 |
echo " Precompile Isabelle for the current platform." |
|
10082 | 34 |
echo |
35 |
exit 1 |
|
36 |
} |
|
37 |
||
38 |
function fail() |
|
39 |
{ |
|
40 |
echo "$1" >&2 |
|
41 |
exit 2 |
|
42 |
} |
|
43 |
||
44 |
||
45 |
## process command line |
|
46 |
||
12827 | 47 |
# options |
48 |
||
49 |
DO_LIBRARY="" |
|
50 |
TEST_RUN="" |
|
51 |
||
52 |
while getopts "lt" OPT |
|
53 |
do |
|
54 |
case "$OPT" in |
|
55 |
l) |
|
56 |
DO_LIBRARY=true |
|
57 |
;; |
|
58 |
t) |
|
59 |
TEST_RUN=true |
|
60 |
;; |
|
61 |
\?) |
|
62 |
usage |
|
63 |
;; |
|
64 |
esac |
|
65 |
done |
|
66 |
||
67 |
shift $(($OPTIND - 1)) |
|
68 |
||
69 |
||
70 |
# args |
|
71 |
||
10082 | 72 |
[ "$#" -gt 1 ] && usage |
73 |
||
74 |
ARCHIVE="$1"; shift |
|
75 |
||
76 |
||
77 |
## main |
|
78 |
||
79 |
[ ! -f "$ARCHIVE" ] && fail "Bad archive file $ARCHIVE" |
|
80 |
ARCHIVE_BASE=$(basename "$ARCHIVE") |
|
81 |
ARCHIVE_DIR=$(cd $(dirname "$ARCHIVE"); echo "$PWD") |
|
82 |
ARCHIVE_FULL="$ARCHIVE_DIR/$ARCHIVE_BASE" |
|
83 |
||
84 |
ISABELLE_NAME=$(basename "$ARCHIVE_BASE" .tar.gz) |
|
85 |
ISABELLE_HOME="$TMP/$ISABELLE_NAME" |
|
86 |
||
87 |
||
88 |
# build logics |
|
89 |
||
90 |
mkdir "$TMP" || fail "Cannot create directory $TMP" |
|
91 |
||
92 |
cd "$TMP" |
|
10087 | 93 |
"$TAR" xzf "$ARCHIVE_FULL" |
10082 | 94 |
cd "$ISABELLE_NAME" |
95 |
||
11576
c418146c4763
activate default ISABELLE_USEDIR_OPTIONS for precompiled distribution;
wenzelm
parents:
10307
diff
changeset
|
96 |
#activate default for precompiled distribution ... |
c418146c4763
activate default ISABELLE_USEDIR_OPTIONS for precompiled distribution;
wenzelm
parents:
10307
diff
changeset
|
97 |
perl -pi -e 's/#ISABELLE_USEDIR_OPTIONS/ISABELLE_USEDIR_OPTIONS/' etc/settings |
c418146c4763
activate default ISABELLE_USEDIR_OPTIONS for precompiled distribution;
wenzelm
parents:
10307
diff
changeset
|
98 |
|
10082 | 99 |
ISABELLE_HOME_USER=$(./bin/isatool getenv -b ISABELLE_HOME_USER) |
100 |
[ -f "$ISABELLE_HOME_USER/etc/settings" ] && \ |
|
101 |
echo "### WARNING! Personal Isabelle settings present. " >&2 |
|
102 |
||
103 |
COMPILER=$(./bin/isatool getenv -b ML_IDENTIFIER) |
|
104 |
PLATFORM=$(./bin/isatool getenv -b ML_PLATFORM) |
|
105 |
||
12827 | 106 |
if [ -n "$TEST_RUN" ]; then |
107 |
mkdir -p "heaps/$COMPILER/log" |
|
10082 | 108 |
touch "heaps/$COMPILER/HOL" |
12827 | 109 |
touch "heaps/$COMPILER/log/HOL.gz" |
10082 | 110 |
touch "heaps/$COMPILER/HOL-Real" |
12827 | 111 |
touch "heaps/$COMPILER/log/HOL-Real.gz" |
10082 | 112 |
touch "heaps/$COMPILER/ZF" |
12827 | 113 |
touch "heaps/$COMPILER/log/ZF.gz" |
114 |
mkdir browser_info |
|
10082 | 115 |
else |
116 |
./build -b -m HOL-Real HOL |
|
117 |
./build -b ZF |
|
12827 | 118 |
[ -n "$DO_LIBRARY" ] && ./build -bait |
10082 | 119 |
rm -f "heaps/$COMPILER/Pure" "heaps/$COMPILER/FOL" |
120 |
fi |
|
121 |
||
122 |
||
123 |
# prepare result |
|
124 |
||
125 |
cd "$TMP" |
|
126 |
||
127 |
chmod -R g=o "$TMP" |
|
128 |
chgrp -R isabelle "$TMP" |
|
129 |
||
130 |
for IMG in HOL HOL-Real ZF |
|
131 |
do |
|
10113 | 132 |
"$TAR" cf "${IMG}_$PLATFORM.tar" \ |
133 |
"$ISABELLE_NAME/heaps/$COMPILER/$IMG" \ |
|
134 |
"$ISABELLE_NAME/heaps/$COMPILER/log/$IMG.gz" |
|
12827 | 135 |
gzip -f "${IMG}_$PLATFORM.tar" |
10087 | 136 |
cp -f "${IMG}_$PLATFORM.tar.gz" "$ARCHIVE_DIR" |
12827 | 137 |
|
138 |
if [ -n "$DO_LIBRARY" ]; then |
|
139 |
"$TAR" cf "${ISABELLE_NAME}_library.tar" $ISABELLE_NAME/browser_info && \ |
|
140 |
gzip -f "${ISABELLE_NAME}_library.tar" |
|
12830 | 141 |
cp -f "${ISABELLE_NAME}_library.tar.gz" "$ARCHIVE_DIR" |
12827 | 142 |
fi |
10082 | 143 |
done |
144 |
||
145 |
||
146 |
# clean up |
|
147 |
cd /tmp |
|
148 |
rm -rf "$TMP" |