author | wenzelm |
Tue, 15 Jan 2013 12:30:23 +0100 | |
changeset 50899 | 506ff6abfde0 |
parent 50892 | 9a7d81d66d09 |
child 50961 | d64bc889f7d6 |
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 |
# |
50790 | 3 |
# DESCRIPTION: re-package Isabelle distribution with add-on components |
33907
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 |
50790 | 12 |
echo "Usage: isabelle $PRG ARCHIVE" |
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" |
50790 | 15 |
echo " and post-hoc patches for platform families linux, macos, windows." |
16 |
echo |
|
17 |
echo " Add-on components are that of the running Isabelle version!" |
|
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
18 |
echo |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
19 |
exit 1 |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
20 |
} |
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 |
function fail() |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
23 |
{ |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
24 |
echo "$1" >&2 |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
25 |
exit 2 |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
26 |
} |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
27 |
|
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
28 |
|
50790 | 29 |
## arguments |
30 |
||
31 |
[ "$#" -ne 1 ] && usage |
|
32 |
||
33 |
ARCHIVE="$1"; shift |
|
34 |
||
35 |
[ -f "$ARCHIVE" ] || fail "Bad source archive: $ARCHIVE" |
|
36 |
||
37 |
ARCHIVE_DIR="$(cd $(dirname "$ARCHIVE"); echo "$PWD")" |
|
38 |
ISABELLE_NAME="$(basename "$ARCHIVE" .tar.gz)" |
|
39 |
||
40 |
||
41 |
## main |
|
42 |
||
50863 | 43 |
export COPYFILE_DISABLE=true |
44 |
||
50790 | 45 |
for PLATFORM_FAMILY in linux macos windows |
46 |
do |
|
47 |
||
48 |
echo |
|
49 |
echo "*** $PLATFORM_FAMILY ***" |
|
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
50 |
|
50794 | 51 |
TMP="/var/tmp/isabelle-makedist$$" |
37315 | 52 |
mkdir "$TMP" || fail "Cannot create directory $TMP" |
53 |
||
50790 | 54 |
ISABELLE_TARGET="$TMP/$ISABELLE_NAME" |
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
55 |
|
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
56 |
tar -C "$TMP" -x -z -f "$ARCHIVE" |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
57 |
|
37315 | 58 |
|
50790 | 59 |
# bundled components |
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
60 |
|
50790 | 61 |
mkdir -p "$ARCHIVE_DIR/contrib" |
62 |
||
63 |
echo "#bundled components" >> "$ISABELLE_TARGET/etc/components" |
|
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
64 |
|
50812 | 65 |
for CATALOG in main "$PLATFORM_FAMILY" bundled "bundled-$PLATFORM_FAMILY" |
50790 | 66 |
do |
67 |
CATALOG_FILE="$ISABELLE_HOME/Admin/components/$CATALOG" |
|
68 |
if [ -f "$CATALOG_FILE" ] |
|
69 |
then |
|
70 |
echo "catalog ${CATALOG}" |
|
71 |
{ |
|
72 |
while { unset REPLY; read -r; test "$?" = 0 -o -n "$REPLY"; } |
|
73 |
do |
|
74 |
case "$REPLY" in |
|
75 |
\#* | "") ;; |
|
76 |
*) |
|
77 |
COMPONENT="$REPLY" |
|
50891
d1a0335b4231
do not register quasi-components, notably cygwin;
wenzelm
parents:
50863
diff
changeset
|
78 |
COMPONENT_DIR="$ISABELLE_TARGET/contrib/$COMPONENT" |
50790 | 79 |
case "$COMPONENT" in |
80 |
jedit_build*) ;; |
|
81 |
*) |
|
82 |
echo " component $COMPONENT" |
|
83 |
CONTRIB="$ARCHIVE_DIR/contrib/${COMPONENT}.tar.gz" |
|
84 |
if [ ! -f "$CONTRIB" ]; then |
|
85 |
REMOTE="$ISABELLE_COMPONENT_REPOSITORY/${COMPONENT}.tar.gz" |
|
86 |
echo " download $REMOTE" |
|
87 |
perl -MLWP::Simple -e "getprint '$REMOTE';" > "$CONTRIB" |
|
88 |
perl -e "exit((stat('${CONTRIB}'))[7] == 0 ? 0 : 1);" && exit 2 |
|
89 |
fi |
|
90 |
||
91 |
tar -C "$ISABELLE_TARGET/contrib" -x -z -f "$CONTRIB" |
|
50891
d1a0335b4231
do not register quasi-components, notably cygwin;
wenzelm
parents:
50863
diff
changeset
|
92 |
if [ -f "$COMPONENT_DIR/etc/settings" -o -f "$COMPONENT_DIR/etc/components" ] |
d1a0335b4231
do not register quasi-components, notably cygwin;
wenzelm
parents:
50863
diff
changeset
|
93 |
then |
d1a0335b4231
do not register quasi-components, notably cygwin;
wenzelm
parents:
50863
diff
changeset
|
94 |
echo "contrib/$COMPONENT" >> "$ISABELLE_TARGET/etc/components" |
d1a0335b4231
do not register quasi-components, notably cygwin;
wenzelm
parents:
50863
diff
changeset
|
95 |
fi |
50790 | 96 |
;; |
97 |
esac |
|
98 |
;; |
|
99 |
esac |
|
100 |
done |
|
101 |
} < "$CATALOG_FILE" |
|
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
102 |
fi |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
103 |
done |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
104 |
|
47742
316c67657fd3
move polyml within Cygwin /usr/local to simplify its rebasing;
wenzelm
parents:
47723
diff
changeset
|
105 |
|
50798 | 106 |
# platform-specific patches |
47833
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
107 |
|
50790 | 108 |
case "$PLATFORM_FAMILY" in |
109 |
linux) |
|
50798 | 110 |
OTHER_PLATFORMS='-name "x86*-darwin" -o -name "x86*-cygwin" -o -name "x86*-windows"' |
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
|
111 |
;; |
50790 | 112 |
macos) |
50798 | 113 |
OTHER_PLATFORMS='-name "x86*-linux" -o -name "x86*-cygwin" -o -name "x86*-windows"' |
114 |
||
44807 | 115 |
perl -pi -e "s,lookAndFeel=.*,lookAndFeel=com.apple.laf.AquaLookAndFeel,g;" \ |
44964 | 116 |
-e "s,delete-line.shortcut=.*,delete-line.shortcut=C+d,g;" \ |
117 |
-e "s,delete.shortcut2=.*,delete.shortcut2=A+d,g;" \ |
|
44807 | 118 |
"$TMP/$ISABELLE_NAME/src/Tools/jEdit/dist/properties/jEdit.props" |
119 |
;; |
|
50790 | 120 |
windows) |
50798 | 121 |
OTHER_PLATFORMS='-name "x86*-linux" -o -name "x86*-darwin"' |
50790 | 122 |
|
44807 | 123 |
perl -pi -e "s,lookAndFeel=.*,lookAndFeel=com.sun.java.swing.plaf.windows.WindowsLookAndFeel,g;" \ |
124 |
"$TMP/$ISABELLE_NAME/src/Tools/jEdit/dist/properties/jEdit.props" |
|
50790 | 125 |
|
50810
76967aa4fe84
outermost directory structure for Windows/Cygwin;
wenzelm
parents:
50798
diff
changeset
|
126 |
cp "$ISABELLE_HOME/Admin/Windows/launch4j/Isabelle.exe" "$ISABELLE_TARGET/Isabelle2013.exe" |
76967aa4fe84
outermost directory structure for Windows/Cygwin;
wenzelm
parents:
50798
diff
changeset
|
127 |
cp "$ISABELLE_HOME/Admin/Windows/Cygwin/Cygwin-Setup.bat" \ |
76967aa4fe84
outermost directory structure for Windows/Cygwin;
wenzelm
parents:
50798
diff
changeset
|
128 |
"$ISABELLE_HOME/Admin/Windows/Cygwin/Cygwin-Terminal.bat" "$ISABELLE_TARGET" |
50790 | 129 |
|
50892
9a7d81d66d09
include /isabelle/rebaseall in autorebaseall, which is run after installation of further packages;
wenzelm
parents:
50891
diff
changeset
|
130 |
for NAME in init.bat postinstall rebaseall |
9a7d81d66d09
include /isabelle/rebaseall in autorebaseall, which is run after installation of further packages;
wenzelm
parents:
50891
diff
changeset
|
131 |
do |
9a7d81d66d09
include /isabelle/rebaseall in autorebaseall, which is run after installation of further packages;
wenzelm
parents:
50891
diff
changeset
|
132 |
cp -a "$ISABELLE_HOME/Admin/Windows/Cygwin/isabelle/$NAME" \ |
9a7d81d66d09
include /isabelle/rebaseall in autorebaseall, which is run after installation of further packages;
wenzelm
parents:
50891
diff
changeset
|
133 |
"$ISABELLE_TARGET/contrib/cygwin/isabelle/." |
9a7d81d66d09
include /isabelle/rebaseall in autorebaseall, which is run after installation of further packages;
wenzelm
parents:
50891
diff
changeset
|
134 |
done |
9a7d81d66d09
include /isabelle/rebaseall in autorebaseall, which is run after installation of further packages;
wenzelm
parents:
50891
diff
changeset
|
135 |
|
9a7d81d66d09
include /isabelle/rebaseall in autorebaseall, which is run after installation of further packages;
wenzelm
parents:
50891
diff
changeset
|
136 |
perl -pi -e "s,/bin/rebaseall.*,/isabelle/rebaseall,g;" \ |
9a7d81d66d09
include /isabelle/rebaseall in autorebaseall, which is run after installation of further packages;
wenzelm
parents:
50891
diff
changeset
|
137 |
"$ISABELLE_TARGET/contrib/cygwin/etc/postinstall/autorebase.bat.done" |
9a7d81d66d09
include /isabelle/rebaseall in autorebaseall, which is run after installation of further packages;
wenzelm
parents:
50891
diff
changeset
|
138 |
|
50790 | 139 |
for NAME in ANNOUNCE README NEWS COPYRIGHT CONTRIBUTORS contrib/README |
140 |
do |
|
141 |
FILE="$ISABELLE_TARGET/$NAME" |
|
142 |
{ |
|
143 |
echo '<?xml version="1.0" encoding="utf-8" ?>' |
|
144 |
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' |
|
145 |
echo '<html xmlns="http://www.w3.org/1999/xhtml">' |
|
146 |
echo '<head>' |
|
147 |
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>' |
|
148 |
echo "<title>${NAME}</title>" |
|
149 |
echo '</head>' |
|
150 |
echo '<body>' |
|
151 |
echo '<pre>' |
|
152 |
perl -w -p -e "s/&/&/g; s/</</g; s/>/>/g; s/'/'/g; s/\"/"/g;" "$FILE" |
|
153 |
echo '</pre>' |
|
154 |
echo '</body>' |
|
155 |
} > "${FILE}.html" |
|
156 |
done |
|
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
|
157 |
;; |
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
|
158 |
*) |
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
|
159 |
;; |
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
|
160 |
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
|
161 |
|
50798 | 162 |
|
163 |
# purge other platforms |
|
164 |
||
165 |
( |
|
166 |
cd "$ISABELLE_TARGET" |
|
167 |
for DIR in $(eval find contrib $OTHER_PLATFORMS | sort) |
|
168 |
do |
|
169 |
echo "removing $DIR" |
|
170 |
rm -rf "$DIR" |
|
171 |
done |
|
172 |
) |
|
173 |
||
174 |
||
175 |
# archive |
|
176 |
||
177 |
BUNDLE_ARCHIVE="${ARCHIVE_DIR}/${ISABELLE_NAME}_${PLATFORM_FAMILY}.tar.gz" |
|
37315 | 178 |
|
50790 | 179 |
echo "packaging $(basename "$BUNDLE_ARCHIVE")" |
50899
506ff6abfde0
grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
50892
diff
changeset
|
180 |
tar -C "$TMP" -c -z -f "$BUNDLE_ARCHIVE" "$ISABELLE_NAME" || exit 2 |
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
181 |
|
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
182 |
|
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
183 |
# clean up |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
184 |
rm -rf "$TMP" |
50790 | 185 |
|
186 |
done |
|
187 |