Admin/makebin
author wenzelm
Thu, 28 Sep 2000 14:35:42 +0200
changeset 10101 746263fbcbfd
parent 10097 1db5bd97f6a3
child 10113 a1f8d7d4084b
permissions -rwxr-xr-x
./build -b -m Pure-copied Pure;
     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   ./build -b -m Pure-copied Pure
    81   ./build -b -m HOL-Real HOL
    82   ./build -b ZF
    83   rm -f "heaps/$COMPILER/Pure" "heaps/$COMPILER/FOL"
    84 fi
    85 
    86 
    87 # prepare result
    88 
    89 cd "$TMP"
    90 
    91 chmod -R g=o "$TMP"
    92 chgrp -R isabelle "$TMP"
    93 
    94 for IMG in HOL HOL-Real ZF
    95 do
    96   "$TAR" cf "${IMG}_$PLATFORM.tar" "$ISABELLE_NAME/heaps/$COMPILER/$IMG"
    97   gzip "${IMG}_$PLATFORM.tar"
    98   cp -f "${IMG}_$PLATFORM.tar.gz" "$ARCHIVE_DIR"
    99 done
   100 
   101 
   102 # clean up
   103 cd /tmp
   104 rm -rf "$TMP"