50806
|
1 |
#!/usr/bin/env bash
|
|
2 |
#
|
|
3 |
# DESCRIPTION: produce pre-canned Cygwin distribution for Isabelle
|
|
4 |
|
|
5 |
## diagnostics
|
|
6 |
|
|
7 |
PRG=$(basename "$0")
|
|
8 |
|
|
9 |
function usage()
|
|
10 |
{
|
|
11 |
echo
|
|
12 |
echo "Usage: isabelle $PRG"
|
|
13 |
echo
|
|
14 |
echo " Produce pre-canned Cygwin distribution for Isabelle."
|
|
15 |
echo
|
|
16 |
exit 1
|
|
17 |
}
|
|
18 |
|
|
19 |
function fail()
|
|
20 |
{
|
|
21 |
echo "$1" >&2
|
|
22 |
exit 2
|
|
23 |
}
|
|
24 |
|
|
25 |
|
|
26 |
## arguments
|
|
27 |
|
|
28 |
[ "$#" -ne 0 ] && usage
|
|
29 |
|
|
30 |
|
|
31 |
## main
|
|
32 |
|
|
33 |
TARGET="$PWD/cygwin"
|
|
34 |
|
|
35 |
|
|
36 |
# download
|
|
37 |
|
|
38 |
[ ! -e "$TARGET" ] || fail "Target already exists: \"$TARGET\""
|
|
39 |
mkdir -p "$TARGET/isabelle" || fail "Failed to create target directory: \"$TARGET\""
|
|
40 |
|
|
41 |
perl -MLWP::Simple -e "getprint 'http://cygwin.com/setup.exe';" > "$TARGET/isabelle/cygwin.exe"
|
|
42 |
chmod +x "$TARGET/isabelle/cygwin.exe"
|
|
43 |
|
|
44 |
"$TARGET/isabelle/cygwin.exe" -h </dev/null >/dev/null || exit 2
|
|
45 |
|
|
46 |
|
|
47 |
# install
|
|
48 |
|
|
49 |
"$TARGET/isabelle/cygwin.exe" \
|
|
50 |
--local-package-dir "$(cygpath -w "$TMP/cygwin")" \
|
|
51 |
--root "$(cygpath -w "$TARGET")" \
|
|
52 |
--packages libgmp3,perl,python,rlwrap \
|
|
53 |
--no-shortcuts --no-startmenu --no-desktop --quiet-mode
|
|
54 |
|
|
55 |
[ "$?" = 0 -a -e "$TARGET/etc" ] || exit 2
|
|
56 |
|
|
57 |
|
|
58 |
# patches
|
|
59 |
|
|
60 |
for NAME in hosts protocols services networks
|
|
61 |
do
|
|
62 |
rm "$TARGET/etc/$NAME"
|
|
63 |
done
|
|
64 |
|
|
65 |
ln -s cygperl5_14.dll "$TARGET/bin/cygperl5_14_2.dll"
|
|
66 |
|
|
67 |
rm "$TARGET/Cygwin.bat"
|
|
68 |
|
50807
|
69 |
cp -a "$ISABELLE_HOME/Admin/Windows/Cygwin/isabelle/." "$TARGET/isabelle/."
|
|
70 |
|