Admin/lib/Tools/makedist_cygwin
author wenzelm
Fri, 11 Jan 2013 22:38:12 +0100
changeset 50839 9cc70b273e90
parent 50838 ad959a8b951e
child 50887 1cadc8a8b377
permissions -rw-r--r--
prefer MS-DOS-style temp;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50806
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
     1
#!/usr/bin/env bash
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
     2
#
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
     3
# DESCRIPTION: produce pre-canned Cygwin distribution for Isabelle
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
     4
50834
506342881c33 refer to cygwin mirror with static copy of setup.ini;
wenzelm
parents: 50811
diff changeset
     5
## global parameters
506342881c33 refer to cygwin mirror with static copy of setup.ini;
wenzelm
parents: 50811
diff changeset
     6
506342881c33 refer to cygwin mirror with static copy of setup.ini;
wenzelm
parents: 50811
diff changeset
     7
CYGWIN_MIRROR="http://isabelle.in.tum.de/cygwin_2013"
506342881c33 refer to cygwin mirror with static copy of setup.ini;
wenzelm
parents: 50811
diff changeset
     8
506342881c33 refer to cygwin mirror with static copy of setup.ini;
wenzelm
parents: 50811
diff changeset
     9
50806
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    10
## diagnostics
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    11
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    12
PRG=$(basename "$0")
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    13
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    14
function usage()
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    15
{
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    16
  echo
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    17
  echo "Usage: isabelle $PRG"
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    18
  echo
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    19
  echo "  Produce pre-canned Cygwin distribution for Isabelle."
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    20
  echo
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    21
  exit 1
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    22
}
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    23
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    24
function fail()
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    25
{
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    26
  echo "$1" >&2
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    27
  exit 2
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    28
}
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    29
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    30
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    31
## arguments
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    32
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    33
[ "$#" -ne 0 ] && usage
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    34
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    35
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    36
## main
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    37
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    38
TARGET="$PWD/cygwin"
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    39
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    40
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    41
# download
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    42
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    43
[ ! -e "$TARGET" ] || fail "Target already exists: \"$TARGET\""
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    44
mkdir -p "$TARGET/isabelle" || fail "Failed to create target directory: \"$TARGET\""
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    45
50834
506342881c33 refer to cygwin mirror with static copy of setup.ini;
wenzelm
parents: 50811
diff changeset
    46
perl -MLWP::Simple -e "getprint '$CYGWIN_MIRROR/setup.exe';" > "$TARGET/isabelle/cygwin.exe"
50806
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    47
chmod +x "$TARGET/isabelle/cygwin.exe"
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    48
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    49
"$TARGET/isabelle/cygwin.exe" -h </dev/null >/dev/null || exit 2
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    50
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    51
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    52
# install
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    53
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    54
"$TARGET/isabelle/cygwin.exe" \
50834
506342881c33 refer to cygwin mirror with static copy of setup.ini;
wenzelm
parents: 50811
diff changeset
    55
  --site "$CYGWIN_MIRROR" --no-verify \
50839
9cc70b273e90 prefer MS-DOS-style temp;
wenzelm
parents: 50838
diff changeset
    56
  --local-package-dir 'C:\temp' \
50806
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    57
  --root "$(cygpath -w "$TARGET")" \
50838
ad959a8b951e more Cygwin packages to help out in a pitch -- NB: make is still needed for legacy usedir;
wenzelm
parents: 50834
diff changeset
    58
  --packages libgmp3,make,perl,python,rlwrap,vim \
50806
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    59
  --no-shortcuts --no-startmenu --no-desktop --quiet-mode
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    60
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    61
[ "$?" = 0 -a -e "$TARGET/etc" ] || exit 2
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    62
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    63
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    64
# patches
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    65
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    66
for NAME in hosts protocols services networks
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    67
do
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    68
  rm "$TARGET/etc/$NAME"
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    69
done
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    70
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    71
ln -s cygperl5_14.dll "$TARGET/bin/cygperl5_14_2.dll"
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    72
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    73
rm "$TARGET/Cygwin.bat"
c19dba2d7ffe more systematic makedist_cygwin;
wenzelm
parents:
diff changeset
    74
50807
c065f3d14197 clarified cygwin/isabelle scripts;
wenzelm
parents: 50806
diff changeset
    75
cp -a "$ISABELLE_HOME/Admin/Windows/Cygwin/isabelle/." "$TARGET/isabelle/."
c065f3d14197 clarified cygwin/isabelle scripts;
wenzelm
parents: 50806
diff changeset
    76
50811
wenzelm
parents: 50807
diff changeset
    77
wenzelm
parents: 50807
diff changeset
    78
# archive
wenzelm
parents: 50807
diff changeset
    79
50834
506342881c33 refer to cygwin mirror with static copy of setup.ini;
wenzelm
parents: 50811
diff changeset
    80
DATE=$(date +%Y%m%d)
506342881c33 refer to cygwin mirror with static copy of setup.ini;
wenzelm
parents: 50811
diff changeset
    81
tar -C "$TARGET/.." -cz -f "cygwin-${DATE}.tar.gz" cygwin