author | wenzelm |
Tue, 16 Jul 2013 20:23:05 +0200 | |
changeset 52678 | 9bc073ea478a |
parent 52677 | 2b446d507296 |
child 53418 | d47a7cebe6b2 |
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 |
51064
9c425ed4a52c
separate makedist_bundle for each platform family, which is more useful for manual use;
wenzelm
parents:
50961
diff
changeset
|
12 |
echo "Usage: isabelle $PRG ARCHIVE PLATFORM_FAMILY" |
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" |
51064
9c425ed4a52c
separate makedist_bundle for each platform family, which is more useful for manual use;
wenzelm
parents:
50961
diff
changeset
|
15 |
echo " and post-hoc patches for platform family linux, macos, windows." |
50790 | 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 |
||
51064
9c425ed4a52c
separate makedist_bundle for each platform family, which is more useful for manual use;
wenzelm
parents:
50961
diff
changeset
|
31 |
[ "$#" -ne 2 ] && usage |
50790 | 32 |
|
33 |
ARCHIVE="$1"; shift |
|
51064
9c425ed4a52c
separate makedist_bundle for each platform family, which is more useful for manual use;
wenzelm
parents:
50961
diff
changeset
|
34 |
PLATFORM_FAMILY="$1"; shift |
50790 | 35 |
|
36 |
[ -f "$ARCHIVE" ] || fail "Bad source archive: $ARCHIVE" |
|
37 |
||
38 |
ARCHIVE_DIR="$(cd $(dirname "$ARCHIVE"); echo "$PWD")" |
|
39 |
ISABELLE_NAME="$(basename "$ARCHIVE" .tar.gz)" |
|
40 |
||
41 |
||
42 |
## main |
|
43 |
||
50863 | 44 |
export COPYFILE_DISABLE=true |
45 |
||
50794 | 46 |
TMP="/var/tmp/isabelle-makedist$$" |
37315 | 47 |
mkdir "$TMP" || fail "Cannot create directory $TMP" |
48 |
||
50790 | 49 |
ISABELLE_TARGET="$TMP/$ISABELLE_NAME" |
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
50 |
|
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
51 |
tar -C "$TMP" -x -z -f "$ARCHIVE" |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
52 |
|
37315 | 53 |
|
50790 | 54 |
# bundled components |
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
55 |
|
50790 | 56 |
mkdir -p "$ARCHIVE_DIR/contrib" |
57 |
||
58 |
echo "#bundled components" >> "$ISABELLE_TARGET/etc/components" |
|
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
59 |
|
50812 | 60 |
for CATALOG in main "$PLATFORM_FAMILY" bundled "bundled-$PLATFORM_FAMILY" |
50790 | 61 |
do |
62 |
CATALOG_FILE="$ISABELLE_HOME/Admin/components/$CATALOG" |
|
63 |
if [ -f "$CATALOG_FILE" ] |
|
64 |
then |
|
65 |
echo "catalog ${CATALOG}" |
|
66 |
{ |
|
67 |
while { unset REPLY; read -r; test "$?" = 0 -o -n "$REPLY"; } |
|
68 |
do |
|
69 |
case "$REPLY" in |
|
70 |
\#* | "") ;; |
|
71 |
*) |
|
72 |
COMPONENT="$REPLY" |
|
50891
d1a0335b4231
do not register quasi-components, notably cygwin;
wenzelm
parents:
50863
diff
changeset
|
73 |
COMPONENT_DIR="$ISABELLE_TARGET/contrib/$COMPONENT" |
50790 | 74 |
case "$COMPONENT" in |
75 |
jedit_build*) ;; |
|
76 |
*) |
|
77 |
echo " component $COMPONENT" |
|
78 |
CONTRIB="$ARCHIVE_DIR/contrib/${COMPONENT}.tar.gz" |
|
79 |
if [ ! -f "$CONTRIB" ]; then |
|
80 |
REMOTE="$ISABELLE_COMPONENT_REPOSITORY/${COMPONENT}.tar.gz" |
|
81 |
echo " download $REMOTE" |
|
82 |
perl -MLWP::Simple -e "getprint '$REMOTE';" > "$CONTRIB" |
|
83 |
perl -e "exit((stat('${CONTRIB}'))[7] == 0 ? 0 : 1);" && exit 2 |
|
84 |
fi |
|
85 |
||
86 |
tar -C "$ISABELLE_TARGET/contrib" -x -z -f "$CONTRIB" |
|
50891
d1a0335b4231
do not register quasi-components, notably cygwin;
wenzelm
parents:
50863
diff
changeset
|
87 |
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
|
88 |
then |
d1a0335b4231
do not register quasi-components, notably cygwin;
wenzelm
parents:
50863
diff
changeset
|
89 |
echo "contrib/$COMPONENT" >> "$ISABELLE_TARGET/etc/components" |
d1a0335b4231
do not register quasi-components, notably cygwin;
wenzelm
parents:
50863
diff
changeset
|
90 |
fi |
50790 | 91 |
;; |
92 |
esac |
|
93 |
;; |
|
94 |
esac |
|
95 |
done |
|
96 |
} < "$CATALOG_FILE" |
|
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
97 |
fi |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
98 |
done |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
99 |
|
47742
316c67657fd3
move polyml within Cygwin /usr/local to simplify its rebasing;
wenzelm
parents:
47723
diff
changeset
|
100 |
|
52501 | 101 |
# purge other platforms |
102 |
||
103 |
function purge_contrib |
|
104 |
{ |
|
105 |
( |
|
106 |
cd "$ISABELLE_TARGET" |
|
107 |
for DIR in $(eval find contrib "$@" | sort) |
|
108 |
do |
|
109 |
echo "removing $DIR" |
|
110 |
rm -rf "$DIR" |
|
111 |
done |
|
112 |
) |
|
113 |
} |
|
114 |
||
115 |
||
50798 | 116 |
# platform-specific patches |
47833
12cb7b5d4b77
more windows-friendly presentation of main text files;
wenzelm
parents:
47760
diff
changeset
|
117 |
|
50790 | 118 |
case "$PLATFORM_FAMILY" in |
119 |
linux) |
|
52501 | 120 |
purge_contrib '-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
|
121 |
;; |
50790 | 122 |
macos) |
52501 | 123 |
purge_contrib '-name "x86*-linux" -o -name "x86*-cygwin" -o -name "x86*-windows"' |
52677 | 124 |
mv "$ISABELLE_TARGET/contrib/macos_app" "$TMP/." |
50798 | 125 |
|
44807 | 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 |
;; |
|
50790 | 131 |
windows) |
52501 | 132 |
purge_contrib '-name "x86*-linux" -o -name "x86*-darwin"' |
52677 | 133 |
mv "$ISABELLE_TARGET/contrib/windows_app" "$TMP/." |
50790 | 134 |
|
44807 | 135 |
perl -pi -e "s,lookAndFeel=.*,lookAndFeel=com.sun.java.swing.plaf.windows.WindowsLookAndFeel,g;" \ |
136 |
"$TMP/$ISABELLE_NAME/src/Tools/jEdit/dist/properties/jEdit.props" |
|
50790 | 137 |
|
52670
57a00f274130
build Windows application on the spot, using Unix tools;
wenzelm
parents:
52668
diff
changeset
|
138 |
cp "$TMP/windows_app/Isabelle.exe" "$ISABELLE_TARGET/${ISABELLE_NAME}.exe" |
50810
76967aa4fe84
outermost directory structure for Windows/Cygwin;
wenzelm
parents:
50798
diff
changeset
|
139 |
cp "$ISABELLE_HOME/Admin/Windows/Cygwin/Cygwin-Setup.bat" \ |
50961 | 140 |
"$ISABELLE_HOME/Admin/Windows/Cygwin/Cygwin-Latex-Setup.bat" \ |
50810
76967aa4fe84
outermost directory structure for Windows/Cygwin;
wenzelm
parents:
50798
diff
changeset
|
141 |
"$ISABELLE_HOME/Admin/Windows/Cygwin/Cygwin-Terminal.bat" "$ISABELLE_TARGET" |
50790 | 142 |
|
52501 | 143 |
( |
144 |
cd "$ISABELLE_TARGET" |
|
145 |
||
52670
57a00f274130
build Windows application on the spot, using Unix tools;
wenzelm
parents:
52668
diff
changeset
|
146 |
for NAME in postinstall rebaseall |
52501 | 147 |
do |
148 |
cp -a "$ISABELLE_HOME/Admin/Windows/Cygwin/isabelle/$NAME" \ |
|
149 |
"contrib/cygwin/isabelle/." |
|
150 |
done |
|
151 |
||
52561 | 152 |
find . -type f -not -name '*.exe' -not -name '*.dll' -perm +100 \ |
153 |
-print0 > "contrib/cygwin/isabelle/executables" |
|
52501 | 154 |
|
52668
a467a6b4376c
produce 7z archive for windows and preserve symlinks separately;
wenzelm
parents:
52561
diff
changeset
|
155 |
find . -type l -exec echo "{}" ";" -exec readlink "{}" ";" \ |
a467a6b4376c
produce 7z archive for windows and preserve symlinks separately;
wenzelm
parents:
52561
diff
changeset
|
156 |
> "contrib/cygwin/isabelle/symlinks" |
52501 | 157 |
) |
50892
9a7d81d66d09
include /isabelle/rebaseall in autorebaseall, which is run after installation of further packages;
wenzelm
parents:
50891
diff
changeset
|
158 |
|
9a7d81d66d09
include /isabelle/rebaseall in autorebaseall, which is run after installation of further packages;
wenzelm
parents:
50891
diff
changeset
|
159 |
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
|
160 |
"$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
|
161 |
|
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
|
162 |
;; |
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
|
163 |
*) |
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
|
164 |
;; |
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
|
165 |
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
|
166 |
|
50798 | 167 |
|
168 |
# archive |
|
169 |
||
170 |
BUNDLE_ARCHIVE="${ARCHIVE_DIR}/${ISABELLE_NAME}_${PLATFORM_FAMILY}.tar.gz" |
|
37315 | 171 |
|
50790 | 172 |
echo "packaging $(basename "$BUNDLE_ARCHIVE")" |
50899
506ff6abfde0
grand-unified Admin/Release/build script (excluding .app and .exe);
wenzelm
parents:
50892
diff
changeset
|
173 |
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
|
174 |
|
52670
57a00f274130
build Windows application on the spot, using Unix tools;
wenzelm
parents:
52668
diff
changeset
|
175 |
|
57a00f274130
build Windows application on the spot, using Unix tools;
wenzelm
parents:
52668
diff
changeset
|
176 |
# application |
57a00f274130
build Windows application on the spot, using Unix tools;
wenzelm
parents:
52668
diff
changeset
|
177 |
|
52677 | 178 |
if [ "$ISABELLE_PLATFORM_FAMILY" = linux -a "$PLATFORM_FAMILY" != macos -o "$ISABELLE_PLATFORM_FAMILY" = macos ] |
52668
a467a6b4376c
produce 7z archive for windows and preserve symlinks separately;
wenzelm
parents:
52561
diff
changeset
|
179 |
then |
52677 | 180 |
case "$PLATFORM_FAMILY" in |
181 |
macos) |
|
52670
57a00f274130
build Windows application on the spot, using Unix tools;
wenzelm
parents:
52668
diff
changeset
|
182 |
echo "application for $PLATFORM_FAMILY" |
57a00f274130
build Windows application on the spot, using Unix tools;
wenzelm
parents:
52668
diff
changeset
|
183 |
( |
52677 | 184 |
cd "$TMP" |
185 |
||
186 |
APP_TEMPLATE="$ISABELLE_HOME/Admin/MacOS/App3" |
|
187 |
APP="${ISABELLE_NAME}.app" |
|
188 |
||
189 |
for NAME in Java MacOS PlugIns Resources |
|
190 |
do |
|
191 |
mkdir -p "$APP/Contents/$NAME" |
|
192 |
done |
|
193 |
||
194 |
cat "$APP_TEMPLATE/Info.plist" | \ |
|
195 |
perl -p -e "s,{ISABELLE_NAME},${ISABELLE_NAME},g;" > "$APP/Contents/Info.plist" |
|
196 |
||
197 |
for NAME in Pure.jar scala-library.jar scala-swing.jar |
|
198 |
do |
|
199 |
ln -sf "../Resources/${ISABELLE_NAME}/lib/classes/ext/$NAME" "$APP/Contents/Java" |
|
200 |
done |
|
201 |
||
202 |
cp -R "$APP_TEMPLATE/Resources/." "$APP/Contents/Resources/." |
|
203 |
cp "$APP_TEMPLATE/../isabelle.icns" "$APP/Contents/Resources/." |
|
204 |
||
205 |
ln -sf "../Resources/${ISABELLE_NAME}/contrib/jdk-7u21/x86_64-darwin/jdk1.7.0_21.jdk" \ |
|
206 |
"$APP/Contents/PlugIns/jdk" |
|
207 |
||
208 |
cp macos_app/JavaAppLauncher "$APP/Contents/MacOS/." && \ |
|
209 |
chmod +x "$APP/Contents/MacOS/JavaAppLauncher" |
|
210 |
||
211 |
mv "$ISABELLE_NAME" "$APP/Contents/Resources/." |
|
212 |
ln -sf "Contents/Resources/$ISABELLE_NAME" "$APP/Isabelle" |
|
213 |
||
52678 | 214 |
rm -f "${ARCHIVE_DIR}/${ISABELLE_NAME}.dmg" |
52677 | 215 |
hdiutil create -srcfolder "$APP" "${ARCHIVE_DIR}/${ISABELLE_NAME}.dmg" |
216 |
) |
|
217 |
;; |
|
218 |
windows) |
|
219 |
( |
|
220 |
cd "$TMP" |
|
221 |
rm -f "${ARCHIVE_DIR}/${ISABELLE_NAME}.7z" |
|
222 |
7z -y -bd a "$TMP/${ISABELLE_NAME}.7z" "$ISABELLE_NAME" || exit 2 |
|
223 |
||
224 |
echo "application for $PLATFORM_FAMILY" |
|
225 |
( |
|
226 |
cat "windows_app/7zsd_All.sfx" |
|
227 |
cat "$ISABELLE_HOME/Admin/Windows/Installer/sfx.txt" | \ |
|
228 |
perl -p -e "s,{ISABELLE_NAME},${ISABELLE_NAME},g;" |
|
229 |
cat "$TMP/${ISABELLE_NAME}.7z" |
|
230 |
) > "${ARCHIVE_DIR}/${ISABELLE_NAME}.exe" |
|
231 |
chmod +x "${ARCHIVE_DIR}/${ISABELLE_NAME}.exe" |
|
232 |
) |
|
233 |
;; |
|
234 |
*) |
|
235 |
;; |
|
236 |
esac |
|
237 |
else |
|
238 |
echo "### Cannot build application for $PLATFORM_FAMILY on $ISABELLE_PLATFORM_FAMILY" |
|
52668
a467a6b4376c
produce 7z archive for windows and preserve symlinks separately;
wenzelm
parents:
52561
diff
changeset
|
239 |
fi |
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
240 |
|
52677 | 241 |
|
33907
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
242 |
# clean up |
473f859e1c29
re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff
changeset
|
243 |
rm -rf "$TMP" |