10082
|
1 |
#!/bin/bash
|
|
2 |
#
|
|
3 |
# $Id$
|
|
4 |
#
|
|
5 |
# makebin -- make Isabelle logic images for current platform.
|
|
6 |
|
|
7 |
|
|
8 |
## global settings
|
|
9 |
|
10090
|
10 |
FAKE_BUILD=""
|
10082
|
11 |
DISTBASE=~/tmp/isadist
|
|
12 |
TMP="/tmp/isabelle-makebin$$"
|
|
13 |
|
|
14 |
TAR=tar
|
|
15 |
type -path gtar >/dev/null && TAR=gtar
|
|
16 |
|
10097
|
17 |
export THIS_IS_ISABELLE_BUILD=true
|
|
18 |
|
10082
|
19 |
|
|
20 |
## diagnostics
|
|
21 |
|
|
22 |
PRG=$(basename "$0")
|
|
23 |
|
|
24 |
function usage()
|
|
25 |
{
|
|
26 |
echo
|
|
27 |
echo "Usage: $PRG ARCHIVE"
|
|
28 |
echo
|
|
29 |
echo " Make Isabelle logic images for current platform."
|
|
30 |
echo
|
|
31 |
exit 1
|
|
32 |
}
|
|
33 |
|
|
34 |
function fail()
|
|
35 |
{
|
|
36 |
echo "$1" >&2
|
|
37 |
exit 2
|
|
38 |
}
|
|
39 |
|
|
40 |
|
|
41 |
## process command line
|
|
42 |
|
|
43 |
[ "$#" -gt 1 ] && usage
|
|
44 |
|
|
45 |
ARCHIVE="$1"; shift
|
|
46 |
|
|
47 |
|
|
48 |
## main
|
|
49 |
|
|
50 |
[ ! -f "$ARCHIVE" ] && fail "Bad archive file $ARCHIVE"
|
|
51 |
ARCHIVE_BASE=$(basename "$ARCHIVE")
|
|
52 |
ARCHIVE_DIR=$(cd $(dirname "$ARCHIVE"); echo "$PWD")
|
|
53 |
ARCHIVE_FULL="$ARCHIVE_DIR/$ARCHIVE_BASE"
|
|
54 |
|
|
55 |
ISABELLE_NAME=$(basename "$ARCHIVE_BASE" .tar.gz)
|
|
56 |
ISABELLE_HOME="$TMP/$ISABELLE_NAME"
|
|
57 |
|
|
58 |
|
|
59 |
# build logics
|
|
60 |
|
|
61 |
mkdir "$TMP" || fail "Cannot create directory $TMP"
|
|
62 |
|
|
63 |
cd "$TMP"
|
10087
|
64 |
"$TAR" xzf "$ARCHIVE_FULL"
|
10082
|
65 |
cd "$ISABELLE_NAME"
|
|
66 |
|
|
67 |
ISABELLE_HOME_USER=$(./bin/isatool getenv -b ISABELLE_HOME_USER)
|
|
68 |
[ -f "$ISABELLE_HOME_USER/etc/settings" ] && \
|
|
69 |
echo "### WARNING! Personal Isabelle settings present. " >&2
|
|
70 |
|
|
71 |
COMPILER=$(./bin/isatool getenv -b ML_IDENTIFIER)
|
|
72 |
PLATFORM=$(./bin/isatool getenv -b ML_PLATFORM)
|
|
73 |
|
|
74 |
if [ -n "$FAKE_BUILD" ]; then
|
|
75 |
mkdir -p "heaps/$COMPILER"
|
|
76 |
touch "heaps/$COMPILER/HOL"
|
|
77 |
touch "heaps/$COMPILER/HOL-Real"
|
|
78 |
touch "heaps/$COMPILER/ZF"
|
|
79 |
else
|
10101
|
80 |
./build -b -m Pure-copied Pure
|
10082
|
81 |
./build -b -m HOL-Real HOL
|
|
82 |
./build -b ZF
|
|
83 |
rm -f "heaps/$COMPILER/Pure" "heaps/$COMPILER/FOL"
|
|
84 |
fi
|
|
85 |
|
|
86 |
|
|
87 |
# prepare result
|
|
88 |
|
|
89 |
cd "$TMP"
|
|
90 |
|
|
91 |
chmod -R g=o "$TMP"
|
|
92 |
chgrp -R isabelle "$TMP"
|
|
93 |
|
|
94 |
for IMG in HOL HOL-Real ZF
|
|
95 |
do
|
10113
|
96 |
"$TAR" cf "${IMG}_$PLATFORM.tar" \
|
|
97 |
"$ISABELLE_NAME/heaps/$COMPILER/$IMG" \
|
|
98 |
"$ISABELLE_NAME/heaps/$COMPILER/log/$IMG.gz"
|
10082
|
99 |
gzip "${IMG}_$PLATFORM.tar"
|
10087
|
100 |
cp -f "${IMG}_$PLATFORM.tar.gz" "$ARCHIVE_DIR"
|
10082
|
101 |
done
|
|
102 |
|
|
103 |
|
|
104 |
# clean up
|
|
105 |
cd /tmp
|
|
106 |
rm -rf "$TMP"
|