author | haftmann |
Tue, 17 Jul 2012 23:11:24 +0200 | |
changeset 48282 | 39bfb2844b9e |
parent 48190 | 76b6207eb000 |
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 |
|
10 |
||
11 |
## diagnostics |
|
12 |
||
13 |
PRG=$(basename "$0") |
|
14 |
||
15 |
function usage() |
|
16 |
{ |
|
17 |
echo |
|
12827 | 18 |
echo "Usage: $PRG [OPTIONS] ARCHIVE" |
10082 | 19 |
echo |
12827 | 20 |
echo " Options are:" |
13001 | 21 |
echo " -l produce library" |
12827 | 22 |
echo |
23 |
echo " Precompile Isabelle for the current platform." |
|
10082 | 24 |
echo |
25 |
exit 1 |
|
26 |
} |
|
27 |
||
28 |
function fail() |
|
29 |
{ |
|
30 |
echo "$1" >&2 |
|
31 |
exit 2 |
|
32 |
} |
|
33 |
||
34 |
||
35 |
## process command line |
|
36 |
||
12827 | 37 |
# options |
38 |
||
39 |
DO_LIBRARY="" |
|
40 |
||
44877
a4761fc03ee7
misc tuning and clarification (NB: settings are already local for named snapshots/releases);
wenzelm
parents:
41556
diff
changeset
|
41 |
while getopts "l" OPT |
12827 | 42 |
do |
43 |
case "$OPT" in |
|
44 |
l) |
|
45 |
DO_LIBRARY=true |
|
46 |
;; |
|
47 |
\?) |
|
48 |
usage |
|
49 |
;; |
|
50 |
esac |
|
51 |
done |
|
52 |
||
53 |
shift $(($OPTIND - 1)) |
|
54 |
||
55 |
||
56 |
# args |
|
57 |
||
10082 | 58 |
[ "$#" -gt 1 ] && usage |
59 |
||
60 |
ARCHIVE="$1"; shift |
|
61 |
||
62 |
||
63 |
## main |
|
64 |
||
65 |
[ ! -f "$ARCHIVE" ] && fail "Bad archive file $ARCHIVE" |
|
30862 | 66 |
ARCHIVE_BASE="$(basename "$ARCHIVE")" |
67 |
ARCHIVE_DIR="$(cd $(dirname "$ARCHIVE"); echo "$PWD")" |
|
10082 | 68 |
ARCHIVE_FULL="$ARCHIVE_DIR/$ARCHIVE_BASE" |
69 |
||
30862 | 70 |
ISABELLE_NAME="$(basename "$ARCHIVE_BASE" .tar.gz)" |
10082 | 71 |
ISABELLE_HOME="$TMP/$ISABELLE_NAME" |
72 |
||
73 |
||
74 |
# build logics |
|
75 |
||
76 |
mkdir "$TMP" || fail "Cannot create directory $TMP" |
|
77 |
||
78 |
cd "$TMP" |
|
30862 | 79 |
tar xzf "$ARCHIVE_FULL" |
10082 | 80 |
cd "$ISABELLE_NAME" |
81 |
||
17575 | 82 |
perl -pi \ |
37286 | 83 |
-e 's:^ISABELLE_USEDIR_OPTIONS=.*$:ISABELLE_USEDIR_OPTIONS="-M 1":;' \ |
17575 | 84 |
etc/settings |
85 |
||
13001 | 86 |
if [ -n "$DO_LIBRARY" ]; then |
37286 | 87 |
perl -pi -e 's:^ISABELLE_USEDIR_OPTIONS=.*$:ISABELLE_USEDIR_OPTIONS="-M 1 -i true -d pdf -V outline=/proof,/ML":;' \ |
13001 | 88 |
etc/settings |
89 |
fi |
|
11576
c418146c4763
activate default ISABELLE_USEDIR_OPTIONS for precompiled distribution;
wenzelm
parents:
10307
diff
changeset
|
90 |
|
28504
7ad7d7d6df47
simplified main Isabelle executables: removed Isabelle and isabelle (replaced by isabelle-process), renamed isatool to isabelle;
wenzelm
parents:
27588
diff
changeset
|
91 |
ISABELLE_HOME_USER=$(./bin/isabelle getenv -b ISABELLE_HOME_USER) |
10082 | 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 |
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
|
94 |
PLATFORM=$(./bin/isabelle getenv -b ML_PLATFORM) |
10082 | 95 |
|
37340 | 96 |
if [ -n "$DO_LIBRARY" ]; then |
45126
fc3bb3a42369
include no-smlnj targets into library (cf. e54a985daa61);
wenzelm
parents:
44877
diff
changeset
|
97 |
./build -bait -m all |
10082 | 98 |
else |
41556
f55d564e0521
bundle main HOL image only, to save about 300 MB disk space;
wenzelm
parents:
40779
diff
changeset
|
99 |
./build -b HOL |
10082 | 100 |
fi |
101 |
||
102 |
||
103 |
# prepare result |
|
104 |
||
105 |
cd "$TMP" |
|
106 |
||
107 |
chmod -R g=o "$TMP" |
|
108 |
chgrp -R isabelle "$TMP" |
|
109 |
||
13001 | 110 |
if [ -n "$DO_LIBRARY" ]; then |
37340 | 111 |
tar -c -z -f "$ARCHIVE_DIR/${ISABELLE_NAME}_library.tar.gz" "$ISABELLE_NAME/browser_info" |
13001 | 112 |
else |
37340 | 113 |
tar -c -z -f "$ARCHIVE_DIR/${ISABELLE_NAME}_heaps_${PLATFORM}.tar.gz" "$ISABELLE_NAME/heaps" |
13001 | 114 |
fi |
10082 | 115 |
|
116 |
||
117 |
# clean up |
|
118 |
rm -rf "$TMP" |