Admin/makebin
author wenzelm
Tue, 26 Sep 2000 18:09:38 +0200
changeset 10087 4dc7edfb0b5f
parent 10082 7c2021b7c664
child 10090 36d1218b58f4
permissions -rwxr-xr-x
tuned;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10082
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
     1
#!/bin/bash
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
     2
#
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
     3
# $Id$
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
     4
#
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
     5
# makebin -- make Isabelle logic images for current platform.
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
     6
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
     7
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
     8
## global settings
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
     9
10087
wenzelm
parents: 10082
diff changeset
    10
FAKE_BUILD="true"
10082
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    11
DISTBASE=~/tmp/isadist
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    12
TMP="/tmp/isabelle-makebin$$"
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    13
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    14
TAR=tar
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    15
type -path gtar >/dev/null && TAR=gtar
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    16
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    17
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    18
## diagnostics
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    19
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    20
PRG=$(basename "$0")
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    21
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    22
function usage()
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    23
{
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    24
  echo
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    25
  echo "Usage: $PRG ARCHIVE"
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    26
  echo
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    27
  echo "  Make Isabelle logic images for current platform."
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    28
  echo
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    29
  exit 1
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    30
}
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    31
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    32
function fail()
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    33
{
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    34
  echo "$1" >&2
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    35
  exit 2
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    36
}
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    37
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    38
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    39
## process command line
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    40
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    41
[ "$#" -gt 1 ] && usage
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    42
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    43
ARCHIVE="$1"; shift
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    44
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    45
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    46
## main
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    47
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    48
[ ! -f "$ARCHIVE" ] && fail "Bad archive file $ARCHIVE"
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    49
ARCHIVE_BASE=$(basename "$ARCHIVE")
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    50
ARCHIVE_DIR=$(cd $(dirname "$ARCHIVE"); echo "$PWD")
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    51
ARCHIVE_FULL="$ARCHIVE_DIR/$ARCHIVE_BASE"
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    52
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    53
ISABELLE_NAME=$(basename "$ARCHIVE_BASE" .tar.gz)
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    54
ISABELLE_HOME="$TMP/$ISABELLE_NAME"
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    55
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    56
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    57
# build logics
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    58
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    59
mkdir "$TMP" || fail "Cannot create directory $TMP"
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    60
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    61
cd "$TMP"
10087
wenzelm
parents: 10082
diff changeset
    62
"$TAR" xzf "$ARCHIVE_FULL"
10082
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    63
cd "$ISABELLE_NAME"
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    64
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    65
ISABELLE_HOME_USER=$(./bin/isatool getenv -b ISABELLE_HOME_USER)
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    66
[ -f "$ISABELLE_HOME_USER/etc/settings" ] && \
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    67
  echo "### WARNING!  Personal Isabelle settings present. " >&2
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    68
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    69
COMPILER=$(./bin/isatool getenv -b ML_IDENTIFIER)
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    70
PLATFORM=$(./bin/isatool getenv -b ML_PLATFORM)
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    71
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    72
if [ -n "$FAKE_BUILD" ]; then
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    73
  mkdir -p "heaps/$COMPILER"
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    74
  touch "heaps/$COMPILER/HOL"
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    75
  touch "heaps/$COMPILER/HOL-Real"
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    76
  touch "heaps/$COMPILER/ZF"
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    77
else
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    78
  ./build -b -m HOL-Real HOL
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    79
  ./build -b ZF
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    80
  rm -f "heaps/$COMPILER/Pure" "heaps/$COMPILER/FOL"
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    81
fi
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    82
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    83
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    84
# prepare result
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    85
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    86
cd "$TMP"
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    87
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    88
chmod -R g=o "$TMP"
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    89
chgrp -R isabelle "$TMP"
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    90
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    91
for IMG in HOL HOL-Real ZF
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    92
do
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    93
  "$TAR" cf "${IMG}_$PLATFORM.tar" "$ISABELLE_NAME/heaps/$COMPILER/$IMG"
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    94
  gzip "${IMG}_$PLATFORM.tar"
10087
wenzelm
parents: 10082
diff changeset
    95
  cp -f "${IMG}_$PLATFORM.tar.gz" "$ARCHIVE_DIR"
10082
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    96
done
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    97
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    98
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
    99
# clean up
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
   100
cd /tmp
7c2021b7c664 make Isabelle logic images for current platform;
wenzelm
parents:
diff changeset
   101
rm -rf "$TMP"