author | wenzelm |
Mon, 21 Jan 2002 16:28:22 +0100 | |
changeset 12830 | c037ff3e5ddf |
parent 12827 | 05c13f5a515d |
child 12985 | 9db054a40247 |
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:" |
29 |
echo " -l include library" |
|
30 |
echo " -t test run -- no build phase" |
|
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="" |
|
49 |
TEST_RUN="" |
|
50 |
||
51 |
while getopts "lt" OPT |
|
52 |
do |
|
53 |
case "$OPT" in |
|
54 |
l) |
|
55 |
DO_LIBRARY=true |
|
56 |
;; |
|
57 |
t) |
|
58 |
TEST_RUN=true |
|
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 |
||
11576
c418146c4763
activate default ISABELLE_USEDIR_OPTIONS for precompiled distribution;
wenzelm
parents:
10307
diff
changeset
|
95 |
#activate default for precompiled distribution ... |
c418146c4763
activate default ISABELLE_USEDIR_OPTIONS for precompiled distribution;
wenzelm
parents:
10307
diff
changeset
|
96 |
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
|
97 |
|
10082 | 98 |
ISABELLE_HOME_USER=$(./bin/isatool getenv -b ISABELLE_HOME_USER) |
99 |
[ -f "$ISABELLE_HOME_USER/etc/settings" ] && \ |
|
100 |
echo "### WARNING! Personal Isabelle settings present. " >&2 |
|
101 |
||
102 |
COMPILER=$(./bin/isatool getenv -b ML_IDENTIFIER) |
|
103 |
PLATFORM=$(./bin/isatool getenv -b ML_PLATFORM) |
|
104 |
||
12827 | 105 |
if [ -n "$TEST_RUN" ]; then |
106 |
mkdir -p "heaps/$COMPILER/log" |
|
10082 | 107 |
touch "heaps/$COMPILER/HOL" |
12827 | 108 |
touch "heaps/$COMPILER/log/HOL.gz" |
10082 | 109 |
touch "heaps/$COMPILER/HOL-Real" |
12827 | 110 |
touch "heaps/$COMPILER/log/HOL-Real.gz" |
10082 | 111 |
touch "heaps/$COMPILER/ZF" |
12827 | 112 |
touch "heaps/$COMPILER/log/ZF.gz" |
113 |
mkdir browser_info |
|
10082 | 114 |
else |
115 |
./build -b -m HOL-Real HOL |
|
116 |
./build -b ZF |
|
12827 | 117 |
[ -n "$DO_LIBRARY" ] && ./build -bait |
10082 | 118 |
rm -f "heaps/$COMPILER/Pure" "heaps/$COMPILER/FOL" |
119 |
fi |
|
120 |
||
121 |
||
122 |
# prepare result |
|
123 |
||
124 |
cd "$TMP" |
|
125 |
||
126 |
chmod -R g=o "$TMP" |
|
127 |
chgrp -R isabelle "$TMP" |
|
128 |
||
129 |
for IMG in HOL HOL-Real ZF |
|
130 |
do |
|
10113 | 131 |
"$TAR" cf "${IMG}_$PLATFORM.tar" \ |
132 |
"$ISABELLE_NAME/heaps/$COMPILER/$IMG" \ |
|
133 |
"$ISABELLE_NAME/heaps/$COMPILER/log/$IMG.gz" |
|
12827 | 134 |
gzip -f "${IMG}_$PLATFORM.tar" |
10087 | 135 |
cp -f "${IMG}_$PLATFORM.tar.gz" "$ARCHIVE_DIR" |
12827 | 136 |
|
137 |
if [ -n "$DO_LIBRARY" ]; then |
|
138 |
"$TAR" cf "${ISABELLE_NAME}_library.tar" $ISABELLE_NAME/browser_info && \ |
|
139 |
gzip -f "${ISABELLE_NAME}_library.tar" |
|
12830 | 140 |
cp -f "${ISABELLE_NAME}_library.tar.gz" "$ARCHIVE_DIR" |
12827 | 141 |
fi |
10082 | 142 |
done |
143 |
||
144 |
||
145 |
# clean up |
|
146 |
cd /tmp |
|
147 |
rm -rf "$TMP" |