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;

#!/usr/bin/env bash
#
# DESCRIPTION: produce pre-canned Cygwin distribution for Isabelle

## global parameters

CYGWIN_MIRROR="http://isabelle.in.tum.de/cygwin_2013"


## diagnostics

PRG=$(basename "$0")

function usage()
{
  echo
  echo "Usage: isabelle $PRG"
  echo
  echo "  Produce pre-canned Cygwin distribution for Isabelle."
  echo
  exit 1
}

function fail()
{
  echo "$1" >&2
  exit 2
}


## arguments

[ "$#" -ne 0 ] && usage


## main

TARGET="$PWD/cygwin"


# download

[ ! -e "$TARGET" ] || fail "Target already exists: \"$TARGET\""
mkdir -p "$TARGET/isabelle" || fail "Failed to create target directory: \"$TARGET\""

perl -MLWP::Simple -e "getprint '$CYGWIN_MIRROR/setup.exe';" > "$TARGET/isabelle/cygwin.exe"
chmod +x "$TARGET/isabelle/cygwin.exe"

"$TARGET/isabelle/cygwin.exe" -h </dev/null >/dev/null || exit 2


# install

"$TARGET/isabelle/cygwin.exe" \
  --site "$CYGWIN_MIRROR" --no-verify \
  --local-package-dir 'C:\temp' \
  --root "$(cygpath -w "$TARGET")" \
  --packages libgmp3,make,perl,python,rlwrap,vim \
  --no-shortcuts --no-startmenu --no-desktop --quiet-mode

[ "$?" = 0 -a -e "$TARGET/etc" ] || exit 2


# patches

for NAME in hosts protocols services networks
do
  rm "$TARGET/etc/$NAME"
done

ln -s cygperl5_14.dll "$TARGET/bin/cygperl5_14_2.dll"

rm "$TARGET/Cygwin.bat"

cp -a "$ISABELLE_HOME/Admin/Windows/Cygwin/isabelle/." "$TARGET/isabelle/."


# archive

DATE=$(date +%Y%m%d)
tar -C "$TARGET/.." -cz -f "cygwin-${DATE}.tar.gz" cygwin