author | wenzelm |
Sun, 28 Nov 2010 13:55:19 +0100 | |
changeset 40779 | 24851517ef15 |
parent 37340 | f3492868bbfd |
child 41556 | f55d564e0521 |
permissions | -rwxr-xr-x |
12721 | 1 |
#!/usr/bin/env bash |
10082 | 2 |
# |
30862 | 3 |
# makebin -- make Isabelle logic images for current platform |
10082 | 4 |
|
5 |
||
6 |
## global settings |
|
7 |
||
12427
37cfec8dfe8e
use /var/tmp (which happens to be more spacious on atbroy37);
wenzelm
parents:
11576
diff
changeset
|
8 |
TMP="/var/tmp/isabelle-makebin$$" |
10082 | 9 |
|
27030 | 10 |
export THIS_IS_ISABELLE_MAKEBIN=true |
11 |
||
10082 | 12 |
|
13 |
## diagnostics |
|
14 |
||
15 |
PRG=$(basename "$0") |
|
16 |
||
17 |
function usage() |
|
18 |
{ |
|
19 |
echo |
|
12827 | 20 |
echo "Usage: $PRG [OPTIONS] ARCHIVE" |
10082 | 21 |
echo |
12827 | 22 |
echo " Options are:" |
13001 | 23 |
echo " -l produce library" |
12827 | 24 |
echo |
25 |
echo " Precompile Isabelle for the current platform." |
|
10082 | 26 |
echo |
27 |
exit 1 |
|
28 |
} |
|
29 |
||
30 |
function fail() |
|
31 |
{ |
|
32 |
echo "$1" >&2 |
|
33 |
exit 2 |
|
34 |
} |
|
35 |
||
36 |
||
37 |
## process command line |
|
38 |
||
12827 | 39 |
# options |
40 |
||
41 |
DO_LIBRARY="" |
|
42 |
||
13001 | 43 |
while getopts "ln" OPT |
12827 | 44 |
do |
45 |
case "$OPT" in |
|
46 |
l) |
|
47 |
DO_LIBRARY=true |
|
48 |
;; |
|
49 |
\?) |
|
50 |
usage |
|
51 |
;; |
|
52 |
esac |
|
53 |
done |
|
54 |
||
55 |
shift $(($OPTIND - 1)) |
|
56 |
||
57 |
||
58 |
# args |
|
59 |
||
10082 | 60 |
[ "$#" -gt 1 ] && usage |
61 |
||
62 |
ARCHIVE="$1"; shift |
|
63 |
||
64 |
||
65 |
## main |
|
66 |
||
67 |
[ ! -f "$ARCHIVE" ] && fail "Bad archive file $ARCHIVE" |
|
30862 | 68 |
ARCHIVE_BASE="$(basename "$ARCHIVE")" |
69 |
ARCHIVE_DIR="$(cd $(dirname "$ARCHIVE"); echo "$PWD")" |
|
10082 | 70 |
ARCHIVE_FULL="$ARCHIVE_DIR/$ARCHIVE_BASE" |
71 |
||
30862 | 72 |
ISABELLE_NAME="$(basename "$ARCHIVE_BASE" .tar.gz)" |
10082 | 73 |
ISABELLE_HOME="$TMP/$ISABELLE_NAME" |
74 |
||
75 |
||
76 |
# build logics |
|
77 |
||
78 |
mkdir "$TMP" || fail "Cannot create directory $TMP" |
|
79 |
||
80 |
cd "$TMP" |
|
30862 | 81 |
tar xzf "$ARCHIVE_FULL" |
10082 | 82 |
cd "$ISABELLE_NAME" |
83 |
||
17575 | 84 |
perl -pi \ |
37286 | 85 |
-e 's:^ISABELLE_USEDIR_OPTIONS=.*$:ISABELLE_USEDIR_OPTIONS="-M 1":;' \ |
17575 | 86 |
etc/settings |
87 |
||
13001 | 88 |
if [ -n "$DO_LIBRARY" ]; then |
37286 | 89 |
perl -pi -e 's:^ISABELLE_USEDIR_OPTIONS=.*$:ISABELLE_USEDIR_OPTIONS="-M 1 -i true -d pdf -V outline=/proof,/ML":;' \ |
13001 | 90 |
etc/settings |
91 |
fi |
|
11576
c418146c4763
activate default ISABELLE_USEDIR_OPTIONS for precompiled distribution;
wenzelm
parents:
10307
diff
changeset
|
92 |
|
28504
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents:
27588
diff
changeset
|
93 |
ISABELLE_HOME_USER=$(./bin/isabelle getenv -b ISABELLE_HOME_USER) |
10082 | 94 |
[ -f "$ISABELLE_HOME_USER/etc/settings" ] && \ |
95 |
echo "### WARNING! Personal Isabelle settings present. " >&2 |
|
96 |
||
28504
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents:
27588
diff
changeset
|
97 |
COMPILER=$(./bin/isabelle getenv -b ML_IDENTIFIER) |
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents:
27588
diff
changeset
|
98 |
PLATFORM=$(./bin/isabelle getenv -b ML_PLATFORM) |
10082 | 99 |
|
37340 | 100 |
if [ -n "$DO_LIBRARY" ]; then |
13001 | 101 |
./build -bait |
10082 | 102 |
else |
27587 | 103 |
./build -b -m HOL-Nominal HOL |
40779
24851517ef15
follow-up to HOLCF move (cf. 0437dbc127b3, 04d44a20fccf);
wenzelm
parents:
37340
diff
changeset
|
104 |
./build -b -m HOLCF HOL |
10082 | 105 |
./build -b ZF |
106 |
fi |
|
107 |
||
108 |
||
109 |
# prepare result |
|
110 |
||
111 |
cd "$TMP" |
|
112 |
||
113 |
chmod -R g=o "$TMP" |
|
114 |
chgrp -R isabelle "$TMP" |
|
115 |
||
13001 | 116 |
if [ -n "$DO_LIBRARY" ]; then |
37340 | 117 |
tar -c -z -f "$ARCHIVE_DIR/${ISABELLE_NAME}_library.tar.gz" "$ISABELLE_NAME/browser_info" |
13001 | 118 |
else |
37340 | 119 |
tar -c -z -f "$ARCHIVE_DIR/${ISABELLE_NAME}_heaps_${PLATFORM}.tar.gz" "$ISABELLE_NAME/heaps" |
13001 | 120 |
fi |
10082 | 121 |
|
122 |
||
123 |
# clean up |
|
124 |
cd /tmp |
|
125 |
rm -rf "$TMP" |