Admin/makebundle
author wenzelm
Wed, 19 Jan 2011 21:00:16 +0100
changeset 41614 b7cd80330a16
parent 41611 f23ce44fbaec
child 41627 0040e0ea02e7
permissions -rwxr-xr-x
added librarypath: shared library convenience in bash, keeping LD_LIBRARY_PATH and DYLD_LIBRARY_PATH separate;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
#
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
     3
# makebundle -- re-package with add-on components
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
37315
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    12
  echo "Usage: $PRG ARCHIVE PLATFORM"
33907
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    13
  echo
37315
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    14
  echo "  Re-package Isabelle source distribution with add-on components"
37343
c333da19fe67 single heaps archive;
wenzelm
parents: 37315
diff changeset
    15
  echo "  and heap images"
33907
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    16
  echo
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    17
  exit 1
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    18
}
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    19
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    20
function fail()
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
  echo "$1" >&2
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    23
  exit 2
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    24
}
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    25
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    26
37315
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    27
## implicit and explicit arguments
33907
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    28
37315
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    29
TMP="/var/tmp/isabelle-makebundle$$"
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    30
mkdir "$TMP" || fail "Cannot create directory $TMP"
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    31
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    32
[ "$#" -ne 2 ] && usage
33907
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    33
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    34
ARCHIVE="$1"; shift
37315
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    35
PLATFORM="$1"; shift
33907
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    36
37315
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    37
[ -f "$ARCHIVE" ] || fail "Bad source archive: $ARCHIVE"
33907
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    38
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    39
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    40
## main
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    41
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    42
ARCHIVE_DIR="$(cd $(dirname "$ARCHIVE"); echo "$PWD")"
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    43
ISABELLE_NAME="$(basename "$ARCHIVE" .tar.gz)"
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    44
ISABELLE_HOME="$TMP/$ISABELLE_NAME"
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    45
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    46
tar -C "$TMP" -x -z -f "$ARCHIVE"
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    47
37315
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    48
33907
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    49
echo "#bundled components" >> "$ISABELLE_HOME/etc/components"
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    50
37315
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    51
for CONTRIB in "$ARCHIVE_DIR"/contrib/*.tar.gz
33907
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    52
do
37315
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    53
  tar -C "$ISABELLE_HOME/contrib" -x -z -f "$CONTRIB"
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    54
  NAME="$(basename "$CONTRIB" .tar.gz)"
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    55
  [ -d "$ISABELLE_HOME/contrib/$NAME" ] || fail "Bad archive content $CONTRIB"
33907
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    56
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    57
  if [ -e "$ISABELLE_HOME/contrib/$NAME/etc/settings" ]; then
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    58
    echo "component $NAME"
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    59
    echo "contrib/$NAME" >> "$ISABELLE_HOME/etc/components"
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    60
  else
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    61
    echo "package $NAME"
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    62
  fi
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    63
done
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    64
37315
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    65
37343
c333da19fe67 single heaps archive;
wenzelm
parents: 37315
diff changeset
    66
HEAPS_ARCHIVE="$ARCHIVE_DIR/${ISABELLE_NAME}_heaps_${PLATFORM}.tar.gz"
c333da19fe67 single heaps archive;
wenzelm
parents: 37315
diff changeset
    67
[ -f "$HEAPS_ARCHIVE" ] || fail "Bad heaps archive: $HEAPS_ARCHIVE"
c333da19fe67 single heaps archive;
wenzelm
parents: 37315
diff changeset
    68
echo "heaps"
37357
b7a55231065a proper target directory;
wenzelm
parents: 37343
diff changeset
    69
tar -C "$TMP" -x -z -f "$HEAPS_ARCHIVE"
37315
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    70
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    71
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
    72
if [ "$PLATFORM" = x86-cygwin ]; then
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
    73
  rm "$TMP/$ISABELLE_NAME/contrib/ProofGeneral"
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
    74
  ln -s ProofGeneral-3.7.1.1 "$TMP/$ISABELLE_NAME/contrib/ProofGeneral"
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
    75
fi
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
    76
37315
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    77
BUNDLE_ARCHIVE="${ARCHIVE_DIR}/${ISABELLE_NAME}_bundle_${PLATFORM}.tar.gz"
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    78
af2adf0ae97d one all-inclusive bundle for each platform;
wenzelm
parents: 33907
diff changeset
    79
echo "$(basename "$BUNDLE_ARCHIVE")"
41555
178fdd4cca46 updated for release;
wenzelm
parents: 37357
diff changeset
    80
tar -C "$TMP" -c -z -f "$BUNDLE_ARCHIVE" "$ISABELLE_NAME"
33907
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    81
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    82
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    83
# clean up
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    84
cd /tmp
473f859e1c29 re-package Isabelle distribution with add-on components;
wenzelm
parents:
diff changeset
    85
rm -rf "$TMP"