author | blanchet |
Wed, 31 Oct 2012 11:23:21 +0100 | |
changeset 49984 | 9f655a6bffd8 |
parent 48190 | 76b6207eb000 |
permissions | -rwxr-xr-x |
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
1 |
#!/usr/bin/env bash |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
2 |
# |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
3 |
# makebundle -- re-package with add-on components |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
4 |
|
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
5 |
## diagnostics |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
6 |
|
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
7 |
PRG=$(basename "$0") |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
8 |
|
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
9 |
function usage() |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
10 |
{ |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
11 |
echo |
37315 | 12 |
echo "Usage: $PRG ARCHIVE PLATFORM" |
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
13 |
echo |
37315 | 14 |
echo " Re-package Isabelle source distribution with add-on components" |
37343 | 15 |
echo " and heap images" |
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
16 |
echo |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
17 |
exit 1 |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
18 |
} |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
19 |
|
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
20 |
function fail() |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
21 |
{ |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
22 |
echo "$1" >&2 |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
23 |
exit 2 |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
24 |
} |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
25 |
|
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
26 |
|
37315 | 27 |
## implicit and explicit arguments |
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
28 |
|
37315 | 29 |
TMP="/var/tmp/isabelle-makebundle$$" |
30 |
mkdir "$TMP" || fail "Cannot create directory $TMP" |
|
31 |
||
32 |
[ "$#" -ne 2 ] && usage |
|
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
33 |
|
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
34 |
ARCHIVE="$1"; shift |
37315 | 35 |
PLATFORM="$1"; shift |
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
36 |
|
37315 | 37 |
[ -f "$ARCHIVE" ] || fail "Bad source archive: $ARCHIVE" |
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
38 |
|
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
39 |
|
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
40 |
## main |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
41 |
|
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
42 |
ARCHIVE_DIR="$(cd $(dirname "$ARCHIVE"); echo "$PWD")" |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
43 |
ISABELLE_NAME="$(basename "$ARCHIVE" .tar.gz)" |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
44 |
ISABELLE_HOME="$TMP/$ISABELLE_NAME" |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
45 |
|
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
46 |
tar -C "$TMP" -x -z -f "$ARCHIVE" |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
47 |
|
37315 | 48 |
|
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
49 |
echo "#bundled components" >> "$ISABELLE_HOME/etc/components" |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
50 |
|
44951
3aa3aeb4980f
specific bundle for x86_64-linux, which is especially important for JRE due to its extra library dependencies;
wenzelm
parents:
44807
diff
changeset
|
51 |
for CONTRIB in "$ARCHIVE_DIR/contrib/"*.tar.gz "$ARCHIVE_DIR/contrib/$PLATFORM"/*.tar.gz |
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
52 |
do |
44951
3aa3aeb4980f
specific bundle for x86_64-linux, which is especially important for JRE due to its extra library dependencies;
wenzelm
parents:
44807
diff
changeset
|
53 |
if [ -f "$CONTRIB" ]; then |
3aa3aeb4980f
specific bundle for x86_64-linux, which is especially important for JRE due to its extra library dependencies;
wenzelm
parents:
44807
diff
changeset
|
54 |
tar -C "$ISABELLE_HOME/contrib" -x -z -f "$CONTRIB" |
3aa3aeb4980f
specific bundle for x86_64-linux, which is especially important for JRE due to its extra library dependencies;
wenzelm
parents:
44807
diff
changeset
|
55 |
NAME="$(basename "$CONTRIB" .tar.gz)" |
3aa3aeb4980f
specific bundle for x86_64-linux, which is especially important for JRE due to its extra library dependencies;
wenzelm
parents:
44807
diff
changeset
|
56 |
[ -d "$ISABELLE_HOME/contrib/$NAME" ] || fail "Bad archive content $CONTRIB" |
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
57 |
|
44951
3aa3aeb4980f
specific bundle for x86_64-linux, which is especially important for JRE due to its extra library dependencies;
wenzelm
parents:
44807
diff
changeset
|
58 |
if [ -e "$ISABELLE_HOME/contrib/$NAME/etc/settings" ]; then |
3aa3aeb4980f
specific bundle for x86_64-linux, which is especially important for JRE due to its extra library dependencies;
wenzelm
parents:
44807
diff
changeset
|
59 |
echo "component $NAME" |
47522
f74da4658bd1
accomodate ProofGeneral as Isabelle component, with adhoc version switch for Cygwin as before;
wenzelm
parents:
44964
diff
changeset
|
60 |
if [ "$PLATFORM" != x86-cygwin -a "$NAME" = ProofGeneral-3.7.1.1 ]; then |
f74da4658bd1
accomodate ProofGeneral as Isabelle component, with adhoc version switch for Cygwin as before;
wenzelm
parents:
44964
diff
changeset
|
61 |
echo "#contrib/$NAME" >> "$ISABELLE_HOME/etc/components" |
f74da4658bd1
accomodate ProofGeneral as Isabelle component, with adhoc version switch for Cygwin as before;
wenzelm
parents:
44964
diff
changeset
|
62 |
elif [ "$PLATFORM" = x86-cygwin -a "$NAME" = ProofGeneral-4.1 ]; then |
f74da4658bd1
accomodate ProofGeneral as Isabelle component, with adhoc version switch for Cygwin as before;
wenzelm
parents:
44964
diff
changeset
|
63 |
echo "#contrib/$NAME" >> "$ISABELLE_HOME/etc/components" |
f74da4658bd1
accomodate ProofGeneral as Isabelle component, with adhoc version switch for Cygwin as before;
wenzelm
parents:
44964
diff
changeset
|
64 |
else |
f74da4658bd1
accomodate ProofGeneral as Isabelle component, with adhoc version switch for Cygwin as before;
wenzelm
parents:
44964
diff
changeset
|
65 |
echo "contrib/$NAME" >> "$ISABELLE_HOME/etc/components" |
f74da4658bd1
accomodate ProofGeneral as Isabelle component, with adhoc version switch for Cygwin as before;
wenzelm
parents:
44964
diff
changeset
|
66 |
fi |
44951
3aa3aeb4980f
specific bundle for x86_64-linux, which is especially important for JRE due to its extra library dependencies;
wenzelm
parents:
44807
diff
changeset
|
67 |
else |
3aa3aeb4980f
specific bundle for x86_64-linux, which is especially important for JRE due to its extra library dependencies;
wenzelm
parents:
44807
diff
changeset
|
68 |
echo "package $NAME" |
3aa3aeb4980f
specific bundle for x86_64-linux, which is especially important for JRE due to its extra library dependencies;
wenzelm
parents:
44807
diff
changeset
|
69 |
fi |
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
70 |
fi |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
71 |
done |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
72 |
|
47685 | 73 |
if [ "$PLATFORM" = x86-cygwin ]; then |
47723
f43b8873743d
augment Isabelle home directory more systematically;
wenzelm
parents:
47709
diff
changeset
|
74 |
TAR="$ARCHIVE_DIR/contrib/x86-cygwin/Isabelle.tar" |
f43b8873743d
augment Isabelle home directory more systematically;
wenzelm
parents:
47709
diff
changeset
|
75 |
[ -e "$TAR" ] || fail "Missing $TAR" |
47709 | 76 |
rm -f "$ISABELLE_HOME/Isabelle" |
47723
f43b8873743d
augment Isabelle home directory more systematically;
wenzelm
parents:
47709
diff
changeset
|
77 |
tar -C "$ISABELLE_HOME" -xv -f "$TAR" |
47742
316c67657fd3
move polyml within Cygwin /usr/local to simplify its rebasing;
wenzelm
parents:
47723
diff
changeset
|
78 |
|
47857
ec58b1fbe7b7
save 90MB by removing foreign binaries -- multi-platform installations are unlikely on Windows;
wenzelm
parents:
47833
diff
changeset
|
79 |
( |
ec58b1fbe7b7
save 90MB by removing foreign binaries -- multi-platform installations are unlikely on Windows;
wenzelm
parents:
47833
diff
changeset
|
80 |
cd "$ISABELLE_HOME" |
ec58b1fbe7b7
save 90MB by removing foreign binaries -- multi-platform installations are unlikely on Windows;
wenzelm
parents:
47833
diff
changeset
|
81 |
for DIR in $(find contrib -name x86-linux -o -name x86_64-linux -o -name x86-darwin -o -name x86_64-darwin | sort) |
ec58b1fbe7b7
save 90MB by removing foreign binaries -- multi-platform installations are unlikely on Windows;
wenzelm
parents:
47833
diff
changeset
|
82 |
do |
ec58b1fbe7b7
save 90MB by removing foreign binaries -- multi-platform installations are unlikely on Windows;
wenzelm
parents:
47833
diff
changeset
|
83 |
echo "removing $DIR" |
ec58b1fbe7b7
save 90MB by removing foreign binaries -- multi-platform installations are unlikely on Windows;
wenzelm
parents:
47833
diff
changeset
|
84 |
rm -rf "$DIR" |
ec58b1fbe7b7
save 90MB by removing foreign binaries -- multi-platform installations are unlikely on Windows;
wenzelm
parents:
47833
diff
changeset
|
85 |
done |
ec58b1fbe7b7
save 90MB by removing foreign binaries -- multi-platform installations are unlikely on Windows;
wenzelm
parents:
47833
diff
changeset
|
86 |
) |
ec58b1fbe7b7
save 90MB by removing foreign binaries -- multi-platform installations are unlikely on Windows;
wenzelm
parents:
47833
diff
changeset
|
87 |
|
47742
316c67657fd3
move polyml within Cygwin /usr/local to simplify its rebasing;
wenzelm
parents:
47723
diff
changeset
|
88 |
mv "$ISABELLE_HOME/contrib"/polyml* "$ISABELLE_HOME/contrib/cygwin-1.7.9/usr/local/" |
47760
b9840d8fca43
register polyml executables so that Cygwin rebaseall will see them;
wenzelm
parents:
47742
diff
changeset
|
89 |
( |
b9840d8fca43
register polyml executables so that Cygwin rebaseall will see them;
wenzelm
parents:
47742
diff
changeset
|
90 |
cd "$ISABELLE_HOME/contrib/cygwin-1.7.9" |
b9840d8fca43
register polyml executables so that Cygwin rebaseall will see them;
wenzelm
parents:
47742
diff
changeset
|
91 |
find usr/local/polyml-*/x86-cygwin | gzip > etc/setup/polyml.lst.gz |
b9840d8fca43
register polyml executables so that Cygwin rebaseall will see them;
wenzelm
parents:
47742
diff
changeset
|
92 |
) |
47833
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
93 |
|
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
94 |
for NAME in ANNOUNCE README NEWS COPYRIGHT CONTRIBUTORS contrib/README |
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
95 |
do |
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
96 |
FILE="$ISABELLE_HOME/$NAME" |
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
97 |
{ |
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
98 |
echo '<?xml version="1.0" encoding="utf-8" ?>' |
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
99 |
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' |
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
100 |
echo '<html xmlns="http://www.w3.org/1999/xhtml">' |
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
101 |
echo '<head>' |
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
102 |
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>' |
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
103 |
echo "<title>${NAME}</title>" |
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
104 |
echo '</head>' |
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
105 |
echo '<body>' |
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
106 |
echo '<pre>' |
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
107 |
perl -w -p -e "s/&/&/g; s/</</g; s/>/>/g; s/'/'/g; s/\"/"/g;" "$FILE" |
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
108 |
echo '</pre>' |
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
109 |
echo '</body>' |
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
110 |
} > "${FILE}.html" |
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
111 |
done |
47685 | 112 |
fi |
113 |
||
37315 | 114 |
|
37343 | 115 |
HEAPS_ARCHIVE="$ARCHIVE_DIR/${ISABELLE_NAME}_heaps_${PLATFORM}.tar.gz" |
116 |
[ -f "$HEAPS_ARCHIVE" ] || fail "Bad heaps archive: $HEAPS_ARCHIVE" |
|
117 |
echo "heaps" |
|
37357 | 118 |
tar -C "$TMP" -x -z -f "$HEAPS_ARCHIVE" |
37315 | 119 |
|
41627
0040e0ea02e7
delete compiled .elc files to improve portability on Linux, notably for GNU Emacs 23.1.x instead of 23.2.x;
wenzelm
parents:
41611
diff
changeset
|
120 |
case "$PLATFORM" in |
44951
3aa3aeb4980f
specific bundle for x86_64-linux, which is especially important for JRE due to its extra library dependencies;
wenzelm
parents:
44807
diff
changeset
|
121 |
x86_64-linux) |
3aa3aeb4980f
specific bundle for x86_64-linux, which is especially important for JRE due to its extra library dependencies;
wenzelm
parents:
44807
diff
changeset
|
122 |
perl -pi -e 's,^ML_PLATFORM=.*$,ML_PLATFORM="\$ISABELLE_PLATFORM64",g;' "$TMP/$ISABELLE_NAME/etc/settings" |
3aa3aeb4980f
specific bundle for x86_64-linux, which is especially important for JRE due to its extra library dependencies;
wenzelm
parents:
44807
diff
changeset
|
123 |
perl -pi -e "s,^ML_OPTIONS=.*$,ML_OPTIONS=\"-H 400\",g;" "$TMP/$ISABELLE_NAME/etc/settings" |
3aa3aeb4980f
specific bundle for x86_64-linux, which is especially important for JRE due to its extra library dependencies;
wenzelm
parents:
44807
diff
changeset
|
124 |
;; |
44807 | 125 |
*-darwin) |
126 |
perl -pi -e "s,lookAndFeel=.*,lookAndFeel=com.apple.laf.AquaLookAndFeel,g;" \ |
|
44964 | 127 |
-e "s,delete-line.shortcut=.*,delete-line.shortcut=C+d,g;" \ |
128 |
-e "s,delete.shortcut2=.*,delete.shortcut2=A+d,g;" \ |
|
44807 | 129 |
"$TMP/$ISABELLE_NAME/src/Tools/jEdit/dist/properties/jEdit.props" |
130 |
;; |
|
131 |
*-cygwin) |
|
132 |
perl -pi -e "s,lookAndFeel=.*,lookAndFeel=com.sun.java.swing.plaf.windows.WindowsLookAndFeel,g;" \ |
|
133 |
"$TMP/$ISABELLE_NAME/src/Tools/jEdit/dist/properties/jEdit.props" |
|
41627
0040e0ea02e7
delete compiled .elc files to improve portability on Linux, notably for GNU Emacs 23.1.x instead of 23.2.x;
wenzelm
parents:
41611
diff
changeset
|
134 |
;; |
0040e0ea02e7
delete compiled .elc files to improve portability on Linux, notably for GNU Emacs 23.1.x instead of 23.2.x;
wenzelm
parents:
41611
diff
changeset
|
135 |
*) |
0040e0ea02e7
delete compiled .elc files to improve portability on Linux, notably for GNU Emacs 23.1.x instead of 23.2.x;
wenzelm
parents:
41611
diff
changeset
|
136 |
;; |
0040e0ea02e7
delete compiled .elc files to improve portability on Linux, notably for GNU Emacs 23.1.x instead of 23.2.x;
wenzelm
parents:
41611
diff
changeset
|
137 |
esac |
41611
f23ce44fbaec
Cygwin: back to ProofGeneral-3.7.1.1 with XEmacs, since PG 4.x with GNU Emacs 23 is painfully slow;
wenzelm
parents:
41555
diff
changeset
|
138 |
|
37315 | 139 |
BUNDLE_ARCHIVE="${ARCHIVE_DIR}/${ISABELLE_NAME}_bundle_${PLATFORM}.tar.gz" |
140 |
||
141 |
echo "$(basename "$BUNDLE_ARCHIVE")" |
|
41555 | 142 |
tar -C "$TMP" -c -z -f "$BUNDLE_ARCHIVE" "$ISABELLE_NAME" |
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
143 |
|
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
144 |
|
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
145 |
# clean up |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
146 |
cd /tmp |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
147 |
rm -rf "$TMP" |