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